/* ---------- Demo modal ---------- */
.dm { position: fixed; inset: 0; z-index: 100; display: none; }
.dm.is-open { display: block; }
.dm-backdrop { position: absolute; inset: 0; background: #f4f7f5f2; backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s var(--ease); }
.dm.is-shown .dm-backdrop { opacity: 1; }
.dm-dialog { position: relative; height: 100%; overflow-y: auto; padding: clamp(12px, 3vw, 32px) var(--pad);
  opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .35s var(--ease), transform .45s var(--ease); }
.dm.is-shown .dm-dialog { opacity: 1; transform: none; }
.dm-inner { max-width: 1080px; margin: 0 auto; }
.dm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dm-top h3 { font-size: clamp(22px, 3vw, 30px); }
.dm-top p { color: var(--tx-2); margin-top: 6px; max-width: 640px; }
.dm-close { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-d2); background: #fff; color: var(--ink); cursor: pointer; font-size: 22px; line-height: 1; }
.dm-close:hover { border-color: #17211d4d; }
.dm-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 14px; }
.dm-note { color: var(--tx-3); font-size: 13px; padding-bottom: 24px; }

/* ---------- Device + app ---------- */
.dv-screen { background: linear-gradient(#1c2622, #0b100e); border-radius: 22px; padding: 10px; container: screen / inline-size;
  box-shadow: inset 0 0 0 1px #ffffff1f, 0 60px 120px -50px #000000e6, 0 0 160px -60px #3f7d68a6; }
.app { height: 520px; color: var(--ink); background: var(--paper); border-radius: 14px; display: grid; grid-template-rows: 52px minmax(0, 1fr);
  grid-template-columns: 172px minmax(0, 1fr); font: 400 13px/1.4 var(--font); overflow: hidden; text-align: left; }
.app-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); }
.app-brand { display: flex; align-items: center; gap: 9px; font: 750 14px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-mark { flex: none; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 7px; background: var(--green); color: #fff; display: grid; place-items: center; font: 800 10.5px/1 var(--display); }
.app-search { flex: 1; max-width: 300px; background: #f1f4f2; color: var(--muted); border-radius: 9px; padding: 8px 12px; font-size: 12.5px; }
.app-chip { margin-left: auto; white-space: nowrap; background: #fdf0dc; color: #6f470b; border-radius: 999px; padding: 6px 10px; font: 700 11px/1 var(--display); }
.app-nav { background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; display: grid; align-content: start; gap: 4px; }
.app-nav em { font-style: normal; }
.app-nav span { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); font: 620 13.5px/1 var(--display); transition: background-color .2s, color .2s; }
.app-nav span.on { background: var(--tint); color: var(--green); }
.app-nav svg { flex: none; }
.app-main { position: relative; overflow: hidden; }
.v { position: absolute; inset: 0; padding: 18px; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .22s var(--ease), transform .3s var(--ease), visibility 0s linear .22s; }
.v.on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.a { opacity: 0; }
.v.on .a { animation: pop .32s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.v-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.v-h b { font: 750 16px/1.2 var(--display); }
.v-h span { color: var(--muted); font-size: 12px; }
.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; animation: live 1.6s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }

/* chat */
.chat { height: 100%; background: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; box-shadow: 0 1px 3px #17211d14; max-width: 760px; }
.chat-head { display: flex; align-items: center; gap: 10px; }
.ava { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--tint); color: var(--green); display: grid; place-items: center; font: 750 12px/1 var(--display); }
.who { display: grid; gap: 1px; min-width: 0; color: var(--muted); font-size: 12px; }
.who b { font: 700 14px/1.2 var(--display); color: var(--ink); }
.pill { margin-left: auto; white-space: nowrap; background: #e7f5ee; color: #1f7a52; border-radius: 999px; padding: 5px 10px; font: 700 11px/1 var(--display); }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 30px; margin: 14px 0; }
.wave i { width: 3px; height: 100%; border-radius: 2px; background: var(--live); transform: scaleY(.25); animation: eq 1.1s ease-in-out infinite alternate; }
.wave i:nth-child(3n) { animation-duration: .9s; animation-delay: -.35s; }
.wave i:nth-child(3n+1) { animation-duration: 1.3s; animation-delay: -.7s; }
.wave i:nth-child(4n) { animation-delay: -.2s; }
@keyframes eq { from { transform: scaleY(.18); } to { transform: scaleY(.95); } }
.chat-sep { height: 1px; background: var(--line); margin: 12px 0 4px; }
.lines { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 4px 2px 8px; display: grid; align-content: start; gap: 8px;
  scrollbar-width: none; -webkit-mask-image: linear-gradient(transparent, #000 24px); mask-image: linear-gradient(transparent, #000 24px); }
.lines::-webkit-scrollbar { display: none; }
.lines li { display: none; border-radius: 14px; max-width: 80%; padding: 9px 12px; font-size: 13px; }
.lines li.shown { display: block; animation: pop .25s var(--ease) both; }
.lines .them { justify-self: start; background: #f1f4f2; border-bottom-left-radius: 4px; }
.lines .us { justify-self: end; background: var(--tint); color: #134437; border-bottom-right-radius: 4px; }
.lines .sys { justify-self: center; max-width: none; background: none; color: var(--muted); font: 650 11.5px/1.3 var(--display); letter-spacing: .02em; padding: 4px 0; }
.lines .sys::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d4553f; margin-right: 7px; vertical-align: 0; }
.tag { display: flex; align-items: center; gap: 6px; margin-top: 7px; padding-top: 7px; border-top: 1px solid #1f7a5226; color: #1f7a52; font: 700 10.5px/1.25 var(--display); letter-spacing: .02em; }
.tag::before { content: ""; flex: none; width: 9px; height: 5px; margin-top: -2px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); }

/* pipeline */
.pl { display: grid; grid-template-columns: minmax(0, 1fr) 220px; grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; height: 100%; }
.pl .v-h { grid-column: 1 / -1; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: start; }
.col { background: #e9eeeb; border-radius: 12px; padding: 8px; display: grid; gap: 7px; }
.st { display: inline-block; white-space: nowrap; border-radius: 999px; padding: 4px 8px; font: 700 10.5px/1.2 var(--display); letter-spacing: 0; text-transform: none; margin-bottom: 2px; }
.st-new { background: #e6eefc; color: #2b4f9a; } .st-walk { background: #fdf0dc; color: #7a4f0d; }
.st-prop { background: #efe7fb; color: #5b3a96; } .st-won { background: var(--tint); color: var(--green); }
.card { background: #fff; border-radius: 10px; padding: 9px 10px; display: grid; gap: 2px; color: var(--muted); font-size: 11.5px; box-shadow: 0 1px 2px #17211d12; }
.card b { font: 660 12.5px/1.3 var(--display); color: var(--ink); }
.card.hero { --d: .1s; outline: 2px solid var(--mint-2); box-shadow: 0 0 0 5px #8fe3c04d; }
.detail { --d: .4s; align-self: start; background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px #17211d14; }
.dh { font: 700 13px/1.3 var(--display); margin-bottom: 8px; }
.detail dl { margin: 0; display: grid; gap: 7px; }
.detail dl div { display: grid; gap: 1px; }
.detail dt { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.detail dd { margin: 0; font-weight: 560; }
.detail .next { color: var(--green); font-weight: 700; }

/* timeline */
.tl { display: grid; grid-template-columns: minmax(0, 1fr) 236px; grid-template-rows: auto minmax(0, 1fr); column-gap: 18px; align-items: start; height: 100%; }
.tl .v-h { grid-column: 1 / -1; }
.tl.solo { grid-template-columns: minmax(0, 1fr); }
.time { position: relative; list-style: none; margin: 6px 0 0; padding: 0 0 0 26px; display: grid; gap: 11px; max-width: 600px; }
.time::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: #dfe6e2; }
.time li { position: relative; display: grid; gap: 6px; }
.time li::before { content: ""; position: absolute; left: -24px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #b7c4bd; }
.time .done::before { background: var(--live); border-color: var(--live); }
.time .done > span:last-child { color: #1f7a52; font-weight: 650; }
.when { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.bubble { border-radius: 14px; max-width: 90%; padding: 9px 12px; font-size: 13px; }
.bubble.us { justify-self: end; background: var(--tint); color: #134437; border-bottom-right-radius: 4px; }
.bubble.them { justify-self: start; background: #fff; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px #17211d14; }
.plan { --d: .3s; background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px #17211d14; }
.plan ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 0 8px; background: var(--paper); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.plan b { font: 700 12px/1.3 var(--display); }
.plan em { grid-column: 2; font-style: normal; font-size: 11px; font-weight: 650; color: var(--muted); }
.plan .ok em { color: #1f7a52; }
.plan .note { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

/* calendar */
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; height: calc(100% - 44px); }
.day { background: #fff; border-radius: 12px; display: flex; flex-direction: column; min-height: 0; box-shadow: 0 1px 2px #17211d0f; }
.day-h { display: flex; align-items: baseline; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.day-h b { font: 750 15px/1 var(--display); color: var(--ink); }
.day.hl .day-h b { color: var(--green); }
.slots { position: relative; flex: 1; margin: 6px; background: repeating-linear-gradient(transparent 0 calc(20% - 1px), #edf1ef calc(20% - 1px) 20%); }
.ev { position: absolute; left: 0; right: 0; display: grid; gap: 1px; align-content: start; padding: 6px 8px; border-radius: 8px; background: #eef2f0;
  border-left: 3px solid #b7c4bd; color: var(--muted); font-size: 11px; }
.ev b { font: 650 11.5px/1.25 var(--display); color: var(--ink); }
.ev.new { --d: .2s; background: var(--tint); border-left-color: var(--live); box-shadow: 0 0 0 4px #8fe3c059; }
.ev.new b { color: var(--green); }
.toast { --d: .7s; position: absolute; right: 18px; bottom: 18px; max-width: 360px; background: #11241d; color: #e8f4ee; border-radius: 12px; padding: 11px 14px; font-size: 12.5px; box-shadow: 0 16px 40px -14px #00000080; }
.toast .live { background: #8fe3c0; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px #17211d14; }
.kpi span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.kpi b { display: block; font: 800 24px/1.1 var(--display); margin-top: 8px; color: var(--ink); letter-spacing: -.02em; }
.kpi em { font-style: normal; font-size: 11.5px; color: #1f7a52; font-weight: 650; }
.dlist { margin-top: 12px; background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px #17211d14; }
.dlist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dlist li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--paper); border-radius: 10px; padding: 9px 12px; }
.dlist li b { font: 650 12.5px/1.3 var(--display); }
.dlist li span { color: var(--muted); font-size: 12px; }

/* table */
.tbl { background: #fff; border-radius: 14px; box-shadow: 0 1px 3px #17211d14; overflow: hidden; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font: 700 11px/1.2 var(--display); letter-spacing: 0; text-transform: none; color: var(--muted); background: #f7f9f8; padding: 10px 12px; }
.tbl td { padding: 10px 12px; border-top: 1px solid var(--line); }
.tbl td b { font-family: var(--display); font-weight: 650; }
.tbl .ok { color: #1f7a52; font-weight: 650; }
.tbl-note { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

/* ---------- Player controls ---------- */
.chapters { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 10px; }
.chapters.one { display: none; }
.chap { position: relative; overflow: hidden; width: 100%; height: 100%; text-align: left; cursor: pointer; display: grid; gap: 4px;
  border: 1px solid var(--line-d2); border-radius: 16px; background: #fff; color: var(--tx); padding: 14px 16px 16px; transition: border-color .3s, background-color .3s; }
.chap:hover { border-color: #087f5766; }
.chap[aria-pressed=true] { border-color: #087f57b3; background: #087f5710; }
.chap-n { font: 760 12px/1 var(--display); color: var(--mint); }
.chap-name { font: 760 17px/1.2 var(--display); color: var(--ink); letter-spacing: -.02em; }
.chap-line { font-size: 13.5px; color: var(--tx-3); }
.chap-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--mint); transform: scaleX(0); transform-origin: 0; }
.playing .chap[aria-pressed=true] .chap-bar { animation: bar var(--dur, 6s) linear forwards; }
.paused .chap-bar { animation-play-state: paused !important; }
.stopped .chap-bar { opacity: 0; }
@keyframes bar { to { transform: scaleX(1); } }
.ctrl { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-d2);
  background: none; color: var(--tx-2); font: 600 14px/1 var(--display); cursor: pointer; }
.ctrl:hover { color: var(--ink); border-color: #17211d4d; }

/* ---------- Container queries ---------- */
@container screen (width <= 900px) {
  .app { grid-template-columns: 60px minmax(0, 1fr); }
  .app-nav span { justify-content: center; padding: 0; }
  .app-nav span em { display: none; }
  .pl { grid-template-columns: 1fr; grid-template-rows: auto auto auto; row-gap: 12px; }
  .detail dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tl { grid-template-columns: 1fr; }
  .plan { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container screen (width <= 600px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); height: 560px; font-size: 12.5px; }
  .app-top { gap: 10px; padding: 0 12px; }
  .app-brand { font-size: 12.5px; }
  .app-chip { padding: 5px 8px; font-size: 10px; }
  .v-h { flex-wrap: wrap; gap: 2px 10px; }
  .app-nav { display: none; }
  .app-search { display: none; }
  .app-chip .long { display: none; }
  .v, .chat { padding: 12px; }
  .lines li, .bubble { max-width: 88%; font-size: 12.5px; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col .card + .card:not(.hero) { display: none; }
  .detail dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail dl div.opt { display: none; }
  .week { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .day:nth-child(-n+2) { display: none; }
  .toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .tbl .hide-sm { display: none; }
  .dlist li { grid-template-columns: minmax(0, 1fr) auto; }
  .dlist li span.mid { display: none; }
}
@media (max-width: 720px) {
  .chapters { grid-template-columns: repeat(min(var(--n, 3), 2), minmax(0, 1fr)); }
  .chap-line { display: none; }
  .chap { padding: 12px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .v.on .a { animation-delay: 0s !important; }
  .live, .wave i { animation: none !important; }
}
