/* ==========================================================================
   Panels (patient + admin) — calm dashboard with soft depth
   ========================================================================== */
body.panel-body { background: var(--bg); min-height: 100vh; }
body.panel-body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--g-aurora); pointer-events: none; opacity: .8; }
.shell { display: grid; grid-template-columns: 286px minmax(0, 1fr); min-height: 100vh; }

/* ---- Sidebar ---- */
.side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 6px;
    background: var(--g-deep); color: rgba(232, 243, 242, .82); scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; z-index: 60;
}
.side::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(400px 300px at 100% 0%, rgba(142,124,240,.25), transparent 60%), radial-gradient(300px 300px at 0% 100%, rgba(242,155,116,.12), transparent 60%); }
.side > * { position: relative; }
.side .brand { padding: 6px 8px 18px; }
.side .brand-text b { color: #fff; } .side .brand-text small { color: rgba(255,255,255,.55); }
.side-user { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.side-user b { color: #fff; display: block; font-size: .92rem; line-height: 1.5; }
.side-user small { font-size: .75rem; color: rgba(255,255,255,.55); }
.side-group { font-size: .7rem; font-weight: 800; letter-spacing: .06em; color: rgba(255,255,255,.4); padding: 14px 12px 4px; }
.side-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; font-weight: 600; font-size: .91rem;
    transition: background .25s, color .25s, transform .25s; position: relative;
}
.side-link .icon { width: 19px; height: 19px; opacity: .8; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(-3px); }
.side-link.is-active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.side-link.is-active::before { content: ''; position: absolute; right: -16px; top: 22%; bottom: 22%; width: 4px; border-radius: 4px 0 0 4px; background: var(--g-warm); }
.side-link.is-active .icon { opacity: 1; color: var(--gold-2); }
.side-link .count { margin-right: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center; background: var(--g-warm); color: #fff; font-size: .72rem; font-weight: 800; }
.side-cta { margin-top: auto; padding: 18px; border-radius: 22px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); text-align: center; }
.side-cta b { color: #fff; display: block; margin-bottom: 4px; }
.side-cta p { font-size: .8rem; color: rgba(255,255,255,.6); margin-bottom: 12px; }

/* ---- Main ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 14px 30px; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); }
.topbar .t-search { flex: 1; max-width: 460px; }
.topbar .t-search .input { min-height: 44px; border-radius: 999px; background: var(--surface); }
.topbar .t-actions { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.t-btn { position: relative; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; transition: .25s; }
.t-btn:hover { color: var(--primary); border-color: var(--line-2); transform: translateY(-2px); }
.t-btn .pip { position: absolute; top: 9px; left: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--peach); box-shadow: 0 0 0 2px var(--surface); }
.side-toggle { display: none; }
.content { padding: 28px 30px 60px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); margin: 0; display: flex; align-items: center; gap: 12px; }
.page-head h1 .ph-ico { width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; background: var(--g-primary); color: #fff; box-shadow: var(--shadow-glow); flex: none; }
.page-head .sub { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }
.page-head .crumbs-p { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.page-head .crumbs-p a:hover { color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-foot { padding: 18px 30px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 1100px) {
    .shell { grid-template-columns: 1fr; }
    .side { position: fixed; top: 0; right: 0; bottom: 0; width: 290px; transform: translateX(105%); transition: transform .45s var(--ease); box-shadow: var(--shadow-lg); }
    .shell.side-open .side { transform: none; }
    .shell.side-open::after { content: ''; position: fixed; inset: 0; background: rgba(8,26,31,.45); z-index: 55; backdrop-filter: blur(3px); }
    .side-toggle { display: grid; }
    .content { padding: 22px 16px 50px; }
    .topbar { padding: 12px 16px; }
    .topbar .t-search { display: none; }
}

/* ---- Welcome hero ---- */
.welcome { position: relative; overflow: hidden; isolation: isolate; border-radius: 32px; padding: 30px 34px; color: #fff; margin-bottom: 26px; min-height: 180px;
    background: radial-gradient(500px 260px at 0% 0%, rgba(183,171,247,.45), transparent 60%), radial-gradient(400px 260px at 100% 100%, rgba(242,155,116,.35), transparent 60%), var(--g-deep); box-shadow: var(--shadow-lg); }
.welcome h1, .welcome h2 { color: #fff; margin-bottom: 6px; }
.welcome p { color: rgba(255,255,255,.78); max-width: 560px; margin-bottom: 18px; }
.welcome .orb { opacity: .8; }
.welcome-art { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); width: 170px; height: 170px; z-index: -1; }
@media (max-width: 700px) { .welcome-art { opacity: .35; left: -30px; } .welcome { padding: 24px; } }

/* ---- KPI tiles (3D) ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 26px; }
.kpi { position: relative; padding: 20px 22px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; transition: .45s var(--ease); display: block; }
a.kpi:hover, .kpi:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.kpi::after { content: ''; position: absolute; width: 130px; height: 130px; border-radius: 50%; left: -40px; bottom: -60px; background: var(--tone-soft, var(--primary-soft)); z-index: 0; }
.kpi > * { position: relative; z-index: 1; }
.kpi .k-ico { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: var(--tone-grad, var(--g-primary)); box-shadow: inset 0 -5px 10px rgba(0,0,0,.14), inset 0 4px 8px rgba(255,255,255,.4), 0 12px 22px -10px var(--tone, var(--primary)); margin-bottom: 14px; }
.kpi .k-val { font-size: 1.75rem; font-weight: 900; line-height: 1.3; color: var(--ink); }
.kpi .k-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.kpi .k-foot { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.kpi .k-trend { font-size: .76rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.kpi .k-trend.up { background: var(--ok-soft); color: var(--ok); } .kpi .k-trend.down { background: var(--bad-soft); color: var(--bad); }

/* ---- Lists ---- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line); transition: background .2s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: color-mix(in srgb, var(--primary-soft) 50%, transparent); }
.li-ico { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; font-weight: 700; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-main small { color: var(--muted); font-size: .8rem; }
.date-box { width: 58px; flex: none; text-align: center; padding: 6px 0; border-radius: 16px; background: var(--surface-2); line-height: 1.35; }
.date-box b { display: block; font-size: 1.3rem; font-weight: 900; color: var(--primary); }
.date-box small { font-size: .7rem; font-weight: 700; color: var(--muted); }

/* ---- Toolbar / filters ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .input, .toolbar .select { min-height: 42px; width: auto; min-width: 160px; border-radius: 13px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; }
.tabs-line a, .tabs-line button { padding: 11px 16px; font-weight: 700; font-size: .9rem; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs-line a:hover, .tabs-line button:hover { color: var(--ink); }
.tabs-line .is-active { color: var(--primary); border-bottom-color: var(--primary-2); }
.pills { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.pills a, .pills button { padding: 7px 15px; border-radius: 12px; font-weight: 700; font-size: .84rem; color: var(--muted); border: 0; background: none; cursor: pointer; }
.pills .is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---- Calendar (admin month view) ---- */
.cal { border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); }
.cal-head div { padding: 10px; text-align: center; font-weight: 800; font-size: .8rem; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 118px; padding: 8px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); position: relative; }
.cal-day:nth-child(7n) { border-left: 0; }
.cal-day .d-num { font-weight: 800; font-size: .85rem; color: var(--muted); }
.cal-day.is-today { background: color-mix(in srgb, var(--primary-soft) 60%, transparent); }
.cal-day.is-today .d-num { color: var(--primary); }
.cal-day.is-out { background: var(--surface-2); opacity: .6; }
.appt-pill { display: block; margin-top: 4px; padding: 3px 8px; border-radius: 9px; font-size: .72rem; font-weight: 700; line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--primary-soft); color: var(--primary); }
.appt-pill.st-pending_payment, .appt-pill.st-pending_approval { background: var(--warn-soft); color: var(--warn); }
.appt-pill.st-completed { background: var(--ok-soft); color: var(--ok); }
.appt-pill.st-cancelled, .appt-pill.st-rejected, .appt-pill.st-no_show { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }
.free-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.free-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-2); opacity: .5; }
@media (max-width: 760px) { .cal-day { min-height: 70px; padding: 4px; } .appt-pill { font-size: 0; height: 6px; padding: 0; } }

/* ---- Week schedule board ---- */
.week-board { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 12px; overflow-x: auto; }
.week-col { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px; min-height: 160px; }
.week-col h4 { font-size: .88rem; text-align: center; margin-bottom: 10px; }
.slot-chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 10px; border-radius: 11px; font-size: .8rem; font-weight: 700; margin-bottom: 6px; background: var(--primary-soft); color: var(--primary); }
.slot-chip.st-booked, .slot-chip.st-held { background: var(--peach-soft); color: #c86a43; }
.slot-chip.st-blocked { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.slot-chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0; display: grid; place-items: center; opacity: .7; }
.slot-chip button:hover { opacity: 1; }

/* ---- Builder rows ---- */
.builder-row { display: grid; gap: 10px; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 12px; position: relative; }
.builder-row .drag { cursor: grab; color: var(--muted); }
.opt-row { display: grid; grid-template-columns: 1fr 90px 36px; gap: 8px; align-items: center; }

/* ---- Chat / ticket ---- */
.thread { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.bubble { max-width: min(640px, 88%); padding: 14px 18px; border-radius: 22px 22px 22px 6px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.95; }
.bubble.mine { align-self: flex-start; border-radius: 22px 22px 6px 22px; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary-2) 25%, transparent); }
.bubble.staff { align-self: flex-end; background: var(--lav-soft); border-color: color-mix(in srgb, var(--lav) 25%, transparent); }
.bubble .b-meta { font-size: .74rem; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; }

/* ---- Mood ---- */
.mood-scale { display: flex; gap: 10px; flex-wrap: wrap; }
.mood-scale label { position: relative; cursor: pointer; }
.mood-scale input { position: absolute; opacity: 0; }
.mood-scale span { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; padding: 12px 6px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); font-size: .76rem; font-weight: 700; transition: .3s var(--ease-spring); }
.mood-scale span em { font-style: normal; font-size: 2rem; line-height: 1.2; filter: grayscale(.6); transition: .3s; }
.mood-scale input:checked + span { border-color: var(--primary-2); background: var(--primary-soft); transform: translateY(-4px) scale(1.05); box-shadow: var(--shadow); }
.mood-scale input:checked + span em { filter: none; transform: scale(1.15); }
.chart-box { position: relative; height: var(--h, 280px); }

/* ---- Course player ---- */
.player-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.player { border-radius: 24px; overflow: hidden; background: #0a1a1f; aspect-ratio: 16/9; box-shadow: var(--shadow-lg); }
.player video, .player iframe { width: 100%; height: 100%; border: 0; }
.player audio { width: 100%; margin-top: 40%; }
.lesson-list a { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.lesson-list a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.lesson-list a .done { color: var(--ok); margin-right: auto; }
@media (max-width: 1024px) { .player-wrap { grid-template-columns: 1fr; } }

/* ---- Receipt card ---- */
.bank-card { position: relative; border-radius: 26px; padding: 26px; color: #fff; aspect-ratio: 1.6; max-width: 400px; overflow: hidden; background: var(--g-deep); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; justify-content: space-between; }
.bank-card::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; left: -80px; top: -120px; background: radial-gradient(circle, rgba(183,171,247,.5), transparent 70%); }
.bank-card .num { font-size: 1.45rem; font-weight: 800; letter-spacing: .12em; direction: ltr; text-align: left; position: relative; z-index: 1; }
.bank-card .chip-ic { width: 46px; height: 34px; border-radius: 8px; background: var(--g-gold); }

/* ---- Editor (Quill) ---- */
.editor-holder { background: var(--surface); border-radius: 0 0 14px 14px; min-height: 220px; font-family: var(--font) !important; font-size: 1rem; }
.ql-toolbar.ql-snow { border-radius: 14px 14px 0 0; border-color: var(--line-2) !important; background: var(--surface-2); direction: ltr; }
.ql-container.ql-snow { border-color: var(--line-2) !important; }
.ql-editor { min-height: 220px; text-align: right; line-height: 2; }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--ink-2); } [data-theme="dark"] .ql-snow .ql-fill { fill: var(--ink-2); } [data-theme="dark"] .ql-snow .ql-picker { color: var(--ink-2); }

/* ---- Image field ---- */
.img-field { display: flex; gap: 14px; align-items: center; }
.img-field img { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex: none; }

/* ---- Auth ---- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; overflow: hidden; isolation: isolate; color: #fff; padding: 50px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(600px 400px at 20% 10%, rgba(183,171,247,.45), transparent 60%), radial-gradient(500px 400px at 90% 90%, rgba(242,155,116,.3), transparent 60%), var(--g-deep); }
.auth-art img.auth-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; z-index: -2; opacity: .55; mix-blend-mode: luminosity; }
.auth-art::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(13,59,69,.35), rgba(13,59,69,.92)); }
.auth-art h2 { color: #fff; font-size: 2rem; }
.auth-art .brand-text b { color: #fff; } .auth-art .brand-text small { color: rgba(255,255,255,.7); }
.auth-main { display: grid; place-items: center; padding: 40px 20px; }
.auth-card { width: min(450px, 100%); }
.auth-card h1 { font-size: 1.7rem; }
.otp-inputs { display: flex; gap: 8px; direction: ltr; justify-content: center; }
.otp-inputs input { width: 52px; height: 60px; text-align: center; font-size: 1.5rem; font-weight: 800; border-radius: 16px; border: 1.5px solid var(--line-2); background: var(--surface); }
.otp-inputs input:focus { border-color: var(--primary-2); outline: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-2) 18%, transparent); }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---- Print ---- */
@media print {
    .side, .topbar, .page-actions, .no-print, .panel-foot { display: none !important; }
    .shell { display: block; } .content { padding: 0; } body::before { display: none; }
    .card { box-shadow: none; border-color: #ccc; }
}
