/* Cender customer dashboard. Builds on ../styles.css variables (ink, violet, lavender, mist). */
.app-body { --deep: #24135F; --side-w: 252px; margin: 0; background: var(--mist); color: var(--ink); font-family: var(--font-body); min-height: 100vh; }
.app-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app-side { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #24135F 0%, #1b0f4a 100%); color: #fff; display: flex; flex-direction: column; padding: 22px 16px; box-sizing: border-box; }
.app-side .wordmark { height: 26px; width: auto; display: block; margin: 4px 10px 26px; }
.app-nav { display: flex; flex-direction: column; gap: 4px; }
.app-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: rgba(255,255,255,.78); text-decoration: none; font-weight: 600; font-size: 15px; transition: background .15s ease, color .15s ease; }
.app-nav a svg { width: 20px; height: 20px; flex: none; }
.app-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav a[aria-current="page"] { background: rgba(182,156,255,.22); color: #fff; box-shadow: inset 0 0 0 1px rgba(182,156,255,.35); }
.app-nav .nav-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--lavender); margin-left: auto; }
.app-side-foot { margin-top: auto; font-size: 13px; color: rgba(255,255,255,.7); padding: 14px; border-radius: 16px; background: rgba(255,255,255,.06); line-height: 1.5; }
.app-side-foot strong { color: #fff; display: block; font-size: 14px; margin-bottom: 2px; }
.app-side-foot a { color: #fff; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-demo-bar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 9px 16px; background: #fff4d6; color: #6a4b00; font-size: 14px; border-bottom: 1px solid #f1dfa6; text-align: center; }
.app-demo-bar b { background: #6a4b00; color: #fff4d6; padding: 2px 9px; border-radius: 999px; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
.app-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 36px 6px; }
.app-top-title p { margin: 0 0 2px; font-size: 14px; color: var(--muted); font-weight: 600; }
.app-top-title h1 { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: -0.03em; margin: 0; line-height: 1.15; }
.app-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.app-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--accent-line); font-size: 14px; font-weight: 600; white-space: nowrap; }
.app-chip i { width: 8px; height: 8px; border-radius: 999px; background: #22a35a; }
.app-chip.is-warn i { background: #e0a100; } .app-chip.is-bad i { background: #c0392b; } .app-chip.is-wait i { background: var(--violet); }
.app-user { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.app-user:hover { color: var(--ink); border-color: var(--line-strong); }
.app-content { padding: 18px 36px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1240px; width: 100%; box-sizing: border-box; }
.app-view[hidden] { display: none !important; }
.app-view { display: flex; flex-direction: column; gap: 20px; }

.a-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 24px; box-shadow: 0 1px 2px rgba(23,19,41,.03); min-width: 0; }
.a-card h2 { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; margin: 0 0 4px; }
.a-card .a-sub { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.a-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.a-card-head h2 { margin: 0; }
.a-link { font-size: 14px; font-weight: 600; color: var(--violet); text-decoration: none; white-space: nowrap; }
.a-link:hover { text-decoration: underline; }
.a-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.a-grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.a-grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.a-next { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 24px; border-radius: var(--r-xl); color: #fff; background: radial-gradient(600px 300px at 0% 0%, rgba(182,156,255,.45), transparent 60%), linear-gradient(120deg, #24135F, #3a1c93); }
.a-next h2 { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -0.02em; margin: 0 0 4px; color: #fff; }
.a-next p { margin: 0; color: rgba(255,255,255,.82); font-size: 15px; max-width: 640px; }
.a-next .btn { flex: none; }
.a-next.is-bad { background: linear-gradient(120deg, #7a1f17, #b03a2e); }
.a-next.is-ok { background: linear-gradient(120deg, #135c37, #1d7a45); }

.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-label svg { width: 18px; height: 18px; color: var(--violet); }
.kpi-value { font-family: var(--font-display); font-weight: 800; font-size: 32px; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.kpi-foot { font-size: 13px; color: var(--muted); }
.bar { height: 10px; border-radius: 999px; background: #eeebf6; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7C3AED, #a77bff); transition: width .4s ease; }
.bar.is-warn > span { background: linear-gradient(90deg, #d68a00, #f2b21b); }
.bar.is-over > span { background: linear-gradient(90deg, #b03a2e, #e0645a); }

.num-card .num { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.02em; margin: 2px 0 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eeebf6; color: #4b4566; white-space: nowrap; }
.pill.ok { background: #dcf3e5; color: #1d6a3e; } .pill.warn { background: #fff1cc; color: #7a5600; } .pill.bad { background: #fde3df; color: #a3291d; } .pill.violet { background: var(--accent-soft); color: #5b25c4; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.codes div { background: var(--mist); border-radius: 14px; padding: 12px 14px; font-size: 13.5px; }
.codes b { display: block; font-size: 14px; margin-bottom: 4px; }
.codes code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #fff; border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #f1eff7; font-size: 15px; }
.checklist li:last-child { border-bottom: 0; }
.checklist .ck { width: 26px; height: 26px; border-radius: 999px; flex: none; display: grid; place-items: center; border: 2px solid #d9d4e8; color: transparent; }
.checklist .ck svg { width: 14px; height: 14px; }
.checklist li.done .ck { background: #1d7a45; border-color: #1d7a45; color: #fff; }
.checklist li.now .ck { border-color: var(--violet); box-shadow: 0 0 0 4px var(--accent-soft); }
.checklist li.done span.t { color: var(--muted); }
.checklist li a { margin-left: auto; }

/* Calls */
.calls-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.calls-search { flex: 1 1 240px; min-width: 0; font: inherit; font-size: 15px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff; }
.calls-search:focus, .a-select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px var(--accent-soft); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: #fff; border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 7px 14px; min-height: 36px; border-radius: 999px; border: 0; background: none; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.a-select { font: inherit; font-size: 14px; font-weight: 600; height: 44px; padding: 0 36px 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6880' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; appearance: none; }
.calls-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.calls-table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.calls-table td { padding: 14px 12px; border-bottom: 1px solid #f1eff7; vertical-align: top; }
.calls-table tr.call-row { cursor: pointer; }
.calls-table tr.call-row:hover td { background: #fbfaff; }
.calls-table tr.call-row:focus-visible { outline: 2px solid var(--violet); outline-offset: -2px; }
.calls-table .c-who b { display: block; font-weight: 700; }
.calls-table .c-who span, .calls-table .c-when span { color: var(--muted); font-size: 13px; }
.calls-table .c-issue { max-width: 380px; }
.calls-table .c-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.calls-table .c-len { white-space: nowrap; color: var(--muted); }
.calls-table tr.call-detail td { background: #fbfaff; padding: 0 12px 18px; }
.call-detail-inner { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; padding-top: 4px; }
.call-detail-inner p { margin: 0 0 8px; line-height: 1.55; }
.call-detail-inner dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.call-detail-inner dt { color: var(--muted); }
.call-detail-inner dd { margin: 0; font-weight: 600; }
.call-detail-inner audio { width: 100%; margin-top: 8px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid #f1eff7; }
.recent-list li:last-child { border-bottom: 0; }
.recent-list .r-main { flex: 1; min-width: 0; }
.recent-list .r-main b { display: block; font-size: 15px; }
.recent-list .r-main span { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-list time { font-size: 13px; color: var(--muted); white-space: nowrap; }
.avatar-i { width: 38px; height: 38px; border-radius: 999px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--accent-soft); color: #5b25c4; }
.avatar-i.urgent { background: #fde3df; color: #a3291d; }

/* Forms (setup + settings) */
.a-form fieldset { border: 0; margin: 0 0 6px; padding: 0 0 18px; border-bottom: 1px solid #f1eff7; display: flex; flex-direction: column; gap: 6px; }
.a-form fieldset:last-of-type { border-bottom: 0; }
.a-form legend { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; padding: 0; margin: 10px 0 6px; }
.a-form label { font-size: 14px; font-weight: 600; margin-top: 8px; }
.a-form input[type=text], .a-form input[type=email], .a-form input[type=tel], .a-form select, .a-form textarea {
  font: inherit; font-size: 15.5px; width: 100%; box-sizing: border-box; padding: 11px 18px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink); }
.a-form select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6880' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px; padding-right: 40px; }
.a-form textarea { border-radius: 20px; resize: vertical; min-height: 84px; }
.a-form input:focus, .a-form select:focus, .a-form textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px var(--accent-soft); }
.a-form [aria-invalid="true"] { border-color: #c0392b !important; }
.a-form .hint { font-size: 13px; color: var(--muted); margin: 2px 0 0 4px; }
.a-form .ferr { font-size: 13px; color: #b03a2e; margin: 2px 0 0 4px; }
.a-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.a-form .row-2 > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.a-form .choice-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.a-form .choice { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 15px; font-weight: 500; margin: 0; cursor: pointer; }
.a-form .choice input { accent-color: var(--violet); width: 16px; height: 16px; margin: 0; }
.a-form .choice:has(input:checked) { border-color: var(--violet); background: var(--accent-soft); }
.a-form .plan-gate { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #5b25c4; background: var(--accent-soft); border-radius: 12px; padding: 8px 12px; margin-top: 6px; }
.a-form .plan-gate a { color: #5b25c4; font-weight: 700; }
.a-form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.a-form-msg { font-size: 14px; font-weight: 600; }
.a-form-msg.ok { color: #1d7a45; } .a-form-msg.err { color: #b03a2e; }
.oc-row { display: grid; grid-template-columns: 28px 1fr 1fr 40px; gap: 10px; align-items: center; }
.oc-row .oc-n { width: 28px; height: 28px; border-radius: 999px; background: var(--accent-soft); color: #5b25c4; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: #b03a2e; border-color: #f4cfc9; }
.icon-btn svg { width: 16px; height: 16px; }
.add-btn { align-self: flex-start; font: inherit; font-size: 14px; font-weight: 700; color: var(--violet); background: none; border: 1px dashed var(--accent-line); border-radius: 999px; padding: 9px 16px; cursor: pointer; margin-top: 6px; }
.add-btn:hover { background: var(--accent-soft); }
.add-btn[disabled] { color: #a3a0b3; border-color: var(--line); cursor: not-allowed; background: none; }
.count-tag { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--mist); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.chips .chip button { width: 26px; height: 26px; border-radius: 999px; border: 0; background: #fff; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.chips .chip button:hover { color: #b03a2e; }
.add-inline { display: flex; gap: 8px; margin-top: 8px; }
.add-inline input { flex: 1; }

/* Billing */
.plan-sum { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-sum .p-name { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.03em; margin: 0; }
.plan-sum .p-price { font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.plan-sum .p-price span { font-size: 15px; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.kv div { background: var(--mist); border-radius: 14px; padding: 12px 14px; }
.kv dt { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.kv dd { margin: 0; font-weight: 700; font-size: 15px; }
.tier-mini { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tier-mini > div { border: 1px solid var(--line); border-radius: 16px; padding: 14px; font-size: 13.5px; }
.tier-mini > div.current { border: 2px solid var(--violet); background: #fbfaff; }
.tier-mini b { display: block; font-family: var(--font-display); font-size: 17px; }
.tier-mini .tm-price { font-weight: 700; margin: 2px 0 6px; }
.tier-mini ul { margin: 0; padding-left: 16px; color: var(--muted); }

.app-loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); font-weight: 600; }
.toast-a { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop); z-index: 50; }

@media (max-width: 1100px) {
  .a-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tier-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app-side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: column; padding: 12px 12px 0; }
  .app-side .wordmark { margin: 2px 6px 10px; height: 22px; }
  .app-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 10px; scrollbar-width: none; }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav a { flex: none; min-width: max-content; padding: 8px 12px; font-size: 14px; white-space: nowrap; gap: 8px; }
  .app-nav a svg { width: 17px; height: 17px; }
  .app-nav .nav-dot { margin-left: 2px; }
  .app-side-foot { display: none; }
  .app-top { padding: 16px 16px 2px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .app-top-right { justify-content: flex-start; }
  .app-top-title h1 { font-size: 25px; }
  .app-content { padding: 12px 14px 40px; gap: 16px; }
  .a-grid-2, .a-grid-2.even { grid-template-columns: minmax(0, 1fr); }
  .a-card { padding: 18px; }
  .a-next { flex-direction: column; align-items: flex-start; padding: 18px; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .call-detail-inner { grid-template-columns: minmax(0, 1fr); }
  .calls-table thead { display: none; }
  .calls-table, .calls-table tbody, .calls-table tr, .calls-table td { display: block; width: 100%; box-sizing: border-box; }
  .calls-table tr.call-row { display: grid; grid-template-columns: 1fr auto; padding: 12px 4px; border-bottom: 1px solid #f1eff7; }
  .calls-table tr.call-row td { border: 0; padding: 2px 0; }
  .calls-table td.c-when { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; }
  .calls-table td.c-who { grid-column: 1; grid-row: 1; }
  .calls-table td.c-issue, .calls-table td.c-tags { grid-column: 1 / -1; }
  .calls-table td.c-len { display: none; }
  .calls-table tr.call-detail td { padding: 0 4px 14px; }
}
@media (max-width: 560px) {
  .a-grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi-value { font-size: 26px; }
  .a-form .row-2 { grid-template-columns: minmax(0, 1fr); }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .oc-row { grid-template-columns: 24px minmax(0, 1fr) 40px; }
  .oc-row .oc-phone { grid-column: 2; }
  .tier-mini { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .oc-row .oc-n { grid-column: 1; grid-row: 1; }
  .oc-row .oc-name { grid-column: 2; grid-row: 1; }
  .oc-row .oc-phone { grid-column: 2; grid-row: 2; }
  .oc-row .icon-btn { grid-column: 3; grid-row: 1; }
}
.app-shell { background: linear-gradient(to right, #1b0f4a var(--side-w), transparent var(--side-w)); }
@media (max-width: 900px) { .app-shell { background: none; } }
