/* Ivory Lane — staff portal */
body.portal { background: var(--enamel); font-size: 15px; }
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font-family: var(--display); font-weight: 750; letter-spacing: -.03em; }
.brand svg { width: 24px; height: 24px; fill: var(--gum); }
.brand em { font-style: normal; font-weight: 500; }

/* Sidebar */
.side { background: var(--ink); color: #c9d3de; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 1.2rem .9rem; }
.side .brand { color: #fff; padding: .3rem .6rem 1.4rem; font-size: 1.1rem; }
.side .brand em { color: #91a0b2; }
.side nav { display: grid; gap: 2px; }
.side-label { font-size: .72rem; color: #6f8197; padding: 1.2rem .7rem .4rem; font-weight: 600; }
.side a.nav { display: flex; align-items: center; gap: .7rem; padding: .58rem .7rem; border-radius: 8px; text-decoration: none; font-weight: 500; font-size: .93rem; color: #c9d3de; }
.side a.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .85; }
.side a.nav:hover { background: #1d3150; color: #fff; }
.side a.nav.is-active { background: #fff; color: var(--ink); font-weight: 650; }
.side a.nav.is-active svg { opacity: 1; stroke: var(--gum); }
.side .badge { margin-left: auto; background: var(--gum); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: .05rem .45rem; }
.side-foot { margin-top: auto; border-top: 1px solid #2c3d56; padding: 1rem .5rem 0; display: flex; align-items: center; gap: .7rem; }
.side-foot .who { line-height: 1.25; min-width: 0; }
.side-foot .who strong { display: block; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: .78rem; color: #91a0b2; }
.side-foot form { margin-left: auto; }
.side-foot button { background: none; border: 0; color: #91a0b2; cursor: pointer; padding: .3rem; border-radius: 6px; }
.side-foot button:hover { color: #fff; background: #1d3150; }
.side-foot button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2c3d56; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }

/* Main */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .9rem 2rem; border-bottom: 1px solid var(--porcelain); background: var(--white); position: sticky; top: 0; z-index: 10; }
.topbar .today { font-weight: 600; color: var(--ink-soft); font-size: .9rem; }
.topbar .search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar .search input { padding-left: 2.2rem; border-radius: 999px; background: var(--enamel); }
.topbar .search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--steel); stroke-width: 2; }
.menu-btn { display: none; background: none; border: 1px solid var(--porcelain); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; }
.menu-btn svg { width: 20px; height: 20px; margin: auto; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.content { padding: 1.8rem 2rem 4rem; display: grid; gap: 1.5rem; align-content: start; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.9rem; letter-spacing: -.035em; }
.page-head p { color: var(--steel); margin-top: .25rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumb { font-size: .85rem; color: var(--steel); text-decoration: none; display: inline-block; margin-bottom: .35rem; }
.crumb:hover { color: var(--ink); }

.panel { background: var(--white); border: 1px solid var(--porcelain); border-radius: var(--r); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--porcelain-2); }
.panel-head h2 { font-size: 1.05rem; letter-spacing: -.015em; }
.panel-head a { font-size: .85rem; font-weight: 600; color: var(--gum); text-decoration: none; }
.panel-body { padding: 1.25rem; }
.panel-empty { padding: 2rem 1.25rem; text-align: center; color: var(--steel); }

.grid { display: grid; gap: 1.5rem; }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.2rem; }
.span-2 { grid-column: span 2; }

/* KPIs: a single strip, not a row of cards */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--white); border: 1px solid var(--porcelain); border-radius: var(--r); }
.kpi { padding: 1.1rem 1.3rem; border-left: 1px solid var(--porcelain-2); }
.kpi:first-child { border-left: 0; }
.kpi span { font-size: .82rem; color: var(--steel); font-weight: 500; }
.kpi strong { display: block; font-family: var(--display); font-size: 1.75rem; font-weight: 650; letter-spacing: -.03em; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi small { font-size: .8rem; color: var(--steel); }
.kpi.is-alert strong { color: var(--gum); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 600; color: var(--steel); font-size: .78rem; padding: .7rem 1rem; border-bottom: 1px solid var(--porcelain); white-space: nowrap; background: var(--porcelain-2); }
.t td { padding: .75rem 1rem; border-bottom: 1px solid var(--porcelain-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: #fafbfc; }
.t .r { text-align: right; }
.t a.row-link { text-decoration: none; font-weight: 600; }
.t a.row-link:hover { color: var(--gum); }
.t .sub { display: block; font-size: .8rem; color: var(--steel); font-weight: 400; }
.t .time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.alert-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: .35rem; vertical-align: middle; }
.dent { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.dent i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filters .input { width: auto; min-width: 150px; padding: .5rem .75rem; }
.filters .input[type=search] { min-width: 240px; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--porcelain); border-radius: 999px; padding: 3px; }
.seg a { padding: .35rem .85rem; border-radius: 999px; text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--steel); white-space: nowrap; }
.seg a.is-on { background: var(--ink); color: #fff; }
.tabs-status { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs-status a { text-decoration: none; font-size: .82rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--porcelain); background: var(--white); color: var(--ink-soft); font-weight: 600; }
.tabs-status a.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tabs-status b { font-weight: 700; color: var(--steel); margin-left: .25rem; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.25rem; border-top: 1px solid var(--porcelain-2); font-size: .85rem; color: var(--steel); }
.pager div { display: flex; gap: .4rem; }

/* Day list (dashboard) */
.queue { list-style: none; margin: 0; padding: 0; }
.queue li { display: grid; grid-template-columns: 74px 4px 1fr auto; gap: .9rem; align-items: center; padding: .8rem 1.25rem; border-bottom: 1px solid var(--porcelain-2); }
.queue li:last-child { border-bottom: 0; }
.queue li.is-past { opacity: .6; }
.queue li.is-now { background: linear-gradient(90deg, var(--gum-soft), transparent 60%); }
.queue .q-time { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; }
.queue .q-time small { display: block; font-weight: 500; color: var(--steel); font-size: .75rem; }
.queue .q-bar { align-self: stretch; border-radius: 2px; background: var(--c); }
.queue .q-who a { font-weight: 650; text-decoration: none; }
.queue .q-who a:hover { color: var(--gum); }
.queue .q-who span { display: block; font-size: .82rem; color: var(--steel); }
.queue .q-act { display: flex; gap: .4rem; align-items: center; }
.queue form { display: inline; }

.week { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 120px; padding: 0 1.25rem; }
.week .bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.week .bar i { display: block; background: var(--porcelain); border-radius: 3px 3px 0 0; min-height: 2px; }
.week .bar i.done { background: var(--sage); border-radius: 0; }
.week .bar.is-today i { background: var(--gum); }
.week .bar.is-future i { background: #c9d6e6; }
.week-labels { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; padding: .4rem 1.25rem 1rem; font-size: .68rem; color: var(--steel); text-align: center; }
.week-labels .is-today { color: var(--gum); font-weight: 700; }
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--steel); padding: 0 1.25rem .9rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }

.req { list-style: none; margin: 0; padding: 0; }
.req li { padding: .85rem 1.25rem; border-bottom: 1px solid var(--porcelain-2); display: grid; gap: .45rem; }
.req li:last-child { border-bottom: 0; }
.req .req-top { display: flex; justify-content: space-between; gap: .6rem; }
.req strong a { text-decoration: none; }
.req .req-meta { font-size: .82rem; color: var(--steel); }
.req .req-act { display: flex; gap: .4rem; }

/* Calendar */
.cal-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cal-bar h1 { font-size: 1.6rem; letter-spacing: -.03em; margin-right: .5rem; }
.cal-bar .input { width: auto; padding: .45rem .7rem; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--porcelain); background: var(--white); text-decoration: none; color: var(--ink); font-size: 1.1rem; }
.icon-btn:hover { border-color: var(--steel-2); }
.cal { background: var(--white); border: 1px solid var(--porcelain); border-radius: var(--r); overflow: auto; max-height: calc(100vh - 190px); }
.cal-grid { display: grid; grid-template-columns: 64px repeat(var(--cols), minmax(190px, 1fr)); position: relative; min-width: calc(64px + var(--cols) * 190px); }
.cal-head { position: sticky; top: 0; z-index: 4; background: var(--white); border-bottom: 1px solid var(--porcelain); padding: .7rem .8rem; display: flex; gap: .6rem; align-items: center; min-height: 60px; }
.cal-head.corner { position: sticky; left: 0; z-index: 5; }
.cal-head strong { display: block; font-size: .9rem; }
.cal-head span { font-size: .75rem; color: var(--steel); }
.cal-col { position: relative; border-left: 1px solid var(--porcelain-2); height: var(--h); }
.cal-times { position: sticky; left: 0; z-index: 3; background: var(--white); height: var(--h); }
.cal-times span { position: absolute; right: .5rem; font-size: .72rem; color: var(--steel); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--porcelain-2); }
.cal-line.half { border-top-style: dashed; border-color: #f1f4f6; }
.cal-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #f3f6f8 0 6px, #eaeff3 6px 12px); }
.cal-off span { position: absolute; top: .5rem; left: .6rem; font-size: .72rem; color: var(--steel); font-weight: 600; }
.cal-slot { position: absolute; left: 0; right: 0; display: block; text-decoration: none; }
.cal-slot:hover { background: var(--sage-soft); }
.cal-slot:hover::after { content: "+ Book " attr(data-t); position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); font-size: .72rem; font-weight: 700; color: var(--sage); }
.cal-ev { --c: var(--ink); position: absolute; left: 4px; right: 4px; border-radius: 7px; padding: .3rem .5rem; overflow: hidden; text-decoration: none; z-index: 2;
  background: color-mix(in srgb, var(--c) 12%, white); border-left: 3px solid var(--c); font-size: .78rem; line-height: 1.25; color: var(--ink); transition: box-shadow .15s; }
.cal-ev:hover { box-shadow: var(--shadow); z-index: 3; }
.cal-ev strong { display: block; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { display: block; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev .ev-st { position: absolute; top: .3rem; right: .35rem; width: 8px; height: 8px; border-radius: 50%; }
.cal-ev.st-requested { background: repeating-linear-gradient(135deg, #fffaf0 0 6px, #fbf1df 6px 12px); border-left-style: dashed; }
.cal-ev.st-requested .ev-st { background: var(--amber); }
.cal-ev.st-arrived .ev-st { background: #6a4bb0; }
.cal-ev.st-inchair { box-shadow: inset 0 0 0 2px var(--gum); }
.cal-ev.st-inchair .ev-st { background: var(--gum); }
.cal-ev.st-completed { opacity: .62; }
.cal-ev.st-completed .ev-st { background: var(--sage); }
.cal-ev.st-noshow { opacity: .55; text-decoration: line-through; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--gum); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--gum); }
.cal-closed { padding: 3rem; text-align: center; color: var(--steel); }
.cal-closed strong { display: block; font-family: var(--display); font-size: 1.4rem; color: var(--ink); margin-bottom: .4rem; }

/* Appointment detail */
.appt-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 1.4rem; align-items: center; padding: 1.4rem 1.5rem; }
.appt-date { text-align: center; background: var(--ink); color: #fff; border-radius: var(--r); padding: .7rem 1rem; min-width: 92px; }
.appt-date span { display: block; font-size: .75rem; color: #b8c4d1; font-weight: 600; }
.appt-date strong { display: block; font-family: var(--display); font-size: 2rem; line-height: 1.05; }
.appt-hero h1 { font-size: 1.5rem; letter-spacing: -.03em; }
.appt-hero .meta { color: var(--steel); margin-top: .3rem; display: flex; gap: .4rem 1rem; flex-wrap: wrap; font-size: .9rem; }
.flow { display: flex; gap: 0; padding: 0 1.5rem 1.4rem; }
.flow span { flex: 1; text-align: center; font-size: .75rem; font-weight: 600; color: var(--steel-2); position: relative; padding-top: 1.3rem; }
.flow span::before { content: ""; position: absolute; top: 4px; left: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--white); border: 2px solid var(--porcelain); transform: translateX(-50%); z-index: 1; }
.flow span::after { content: ""; position: absolute; top: 9px; left: -50%; right: 50%; height: 2px; background: var(--porcelain); }
.flow span:first-child::after { display: none; }
.flow span.done { color: var(--ink); }
.flow span.done::before { background: var(--sage); border-color: var(--sage); }
.flow span.done::after { background: var(--sage); }
.flow span.now { color: var(--gum); }
.flow span.now::before { background: var(--gum); border-color: var(--gum); box-shadow: 0 0 0 4px var(--gum-soft); }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.5rem; border-top: 1px solid var(--porcelain-2); background: #fbfcfd; border-radius: 0 0 var(--r) var(--r); }
.actions-row form { display: inline; }
.kv { display: grid; gap: 0; margin: 0; }
.kv div { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--porcelain-2); font-size: .9rem; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--steel); }
.kv dd { margin: 0; }
.alerts { border-radius: var(--r-sm); background: var(--red-soft); color: #8e2a20; padding: .75rem .9rem; font-size: .88rem; display: grid; gap: .25rem; }
.alerts strong { font-weight: 700; }
.note-box { background: var(--amber-soft); border-radius: var(--r-sm); padding: .7rem .9rem; font-size: .9rem; color: #6d4a12; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 82px 1fr auto; gap: .8rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--porcelain-2); font-size: .88rem; align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tl-date { color: var(--steel); font-variant-numeric: tabular-nums; }
.timeline a { text-decoration: none; font-weight: 600; }

/* Patient */
.p-head { display: flex; gap: 1.2rem; align-items: center; padding: 1.4rem 1.5rem; flex-wrap: wrap; }
.p-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--porcelain-2); display: grid; place-items: center; font-family: var(--display); font-weight: 750; font-size: 1.4rem; color: var(--ink-soft); }
.p-head h1 { font-size: 1.6rem; letter-spacing: -.03em; }
.p-head .meta { color: var(--steel); display: flex; gap: .3rem 1rem; flex-wrap: wrap; font-size: .9rem; margin-top: .25rem; }
.p-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.tabs { display: flex; gap: 1.4rem; padding: 0 1.5rem; border-top: 1px solid var(--porcelain-2); }
.tabs a { padding: .85rem 0; text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--steel); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-on { color: var(--ink); border-color: var(--gum); }
.tabs a b { font-weight: 600; color: var(--steel-2); margin-left: .2rem; }

/* Tooth chart */
.chart-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.5rem; align-items: start; }
.odonto { display: grid; gap: .3rem; overflow-x: auto; padding-bottom: .5rem; }
.odonto-row { display: grid; grid-template-columns: repeat(16, minmax(34px, 1fr)); gap: 4px; min-width: 600px; }
.odonto-mid { display: grid; grid-template-columns: 1fr 1fr; min-width: 600px; font-size: .72rem; color: var(--steel); font-weight: 600; padding: .4rem 0; border-top: 1px dashed var(--porcelain); margin-top: .3rem; }
.odonto-mid span:last-child { text-align: right; }
.tooth { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .35rem 0 .3rem; border: 1.5px solid transparent; border-radius: 8px; background: none; cursor: pointer; }
.tooth:hover { background: var(--porcelain-2); }
.tooth.is-sel { border-color: var(--ink); background: var(--porcelain-2); }
.tooth svg { width: 36px; height: 44px; }
.tooth .tb { fill: #fff; stroke: #b9c5d0; stroke-width: 1.5; }
.tooth .tm { fill: none; }
.tooth small { font-size: .68rem; color: var(--steel); font-weight: 600; font-variant-numeric: tabular-nums; }
.lower .tooth svg { transform: scaleY(-1); }
.c-caries .tb { fill: #fbe6e3; stroke: var(--red); } .c-caries .tm { fill: var(--red); }
.c-filled .tb { fill: #e5edf8; stroke: var(--blue); } .c-filled .tm { fill: var(--blue); }
.c-crown .tb { fill: #fbf1df; stroke: var(--amber); stroke-width: 2.5; }
.c-rootcanal .tb { fill: #efe8fb; stroke: #6a4bb0; } .c-rootcanal .tm { fill: none; stroke: #6a4bb0; stroke-width: 2; }
.c-missing .tb { fill: none; stroke: #cfd8e0; stroke-dasharray: 3 3; } .c-missing .tm { stroke: var(--steel-2); stroke-width: 2; }
.c-implant .tb { fill: #e3f2ec; stroke: var(--sage); } .c-implant .tm { stroke: var(--sage); stroke-width: 2; }
.c-bridge .tb { fill: #fbf1df; stroke: var(--amber); stroke-dasharray: 5 2; stroke-width: 2; }
.c-watch .tb { fill: #fff; stroke: var(--amber); stroke-width: 2; } .c-watch .tm { fill: var(--amber); }
.tooth-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .78rem; color: var(--steel); margin-top: 1rem; }
.tooth-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tooth-legend i { width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid; }
.tooth-form { position: sticky; top: 80px; }
.tooth-form h3 { font-size: 1.05rem; margin-bottom: .2rem; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: .8rem 0; }
.cond-grid label { position: relative; }
.cond-grid input { position: absolute; opacity: 0; }
.cond-grid span { display: block; padding: .45rem .6rem; border: 1.5px solid var(--porcelain); border-radius: 7px; font-size: .83rem; font-weight: 600; cursor: pointer; text-align: center; }
.cond-grid input:checked + span { border-color: var(--ink); background: var(--porcelain-2); }
.cond-grid input:focus-visible + span { box-shadow: var(--focus); }
.chart-notes { list-style: none; margin: 1.2rem 0 0; padding: 0; font-size: .85rem; display: grid; gap: .35rem; }
.chart-notes b { font-variant-numeric: tabular-nums; }

/* Invoice */
.inv-lines td { padding: .45rem .5rem; }
.inv-lines .input { padding: .5rem .6rem; }
.inv-lines input[name=Quantity] { width: 70px; }
.inv-lines input[name=UnitPrice] { width: 120px; }
.inv-lines input[name=Description] { min-width: 220px; }
.inv-lines .x { background: none; border: 0; color: var(--steel); cursor: pointer; font-size: 1.2rem; padding: .2rem .5rem; border-radius: 6px; }
.inv-lines .x:hover { color: var(--red); background: var(--red-soft); }
.totals { display: grid; gap: .45rem; font-size: .92rem; }
.totals div { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.totals .grand { font-family: var(--display); font-size: 1.4rem; font-weight: 650; border-top: 1px solid var(--porcelain); padding-top: .6rem; margin-top: .2rem; }
.totals .input { width: 130px; text-align: right; padding: .45rem .6rem; }
.invoice-doc { max-width: 820px; padding: 2.4rem; }
.invoice-doc header { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding-bottom: 1.5rem; border-bottom: 2px solid var(--ink); }
.invoice-doc h1 { font-size: 1.8rem; }
.invoice-doc .bill-to { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; padding: 1.4rem 0; font-size: .92rem; }
.invoice-doc .stamp { display: inline-block; border: 2px solid var(--sage); color: var(--sage); font-family: var(--display); font-weight: 750; padding: .2rem .7rem; border-radius: 6px; transform: rotate(-4deg); }
.invoice-doc .stamp.due { border-color: var(--gum); color: var(--gum); }

/* Misc */
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; padding-top: .5rem; flex-wrap: wrap; }
.slot-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.slot-pick button { padding: .5rem .3rem; border: 1.5px solid var(--porcelain); border-radius: 7px; background: var(--white); cursor: pointer; font-weight: 650; font-size: .88rem; font-variant-numeric: tabular-nums; }
.slot-pick button:hover { border-color: var(--sage); background: var(--sage-soft); }
.slot-pick button.is-sel { background: var(--sage); border-color: var(--sage); color: #fff; }
.slot-pick button small { display: block; font-size: .68rem; font-weight: 500; color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-pick button.is-sel small { color: #d9f1e9; }
.typeahead { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--porcelain); border-radius: var(--r-sm); box-shadow: var(--shadow); z-index: 20; list-style: none; margin: 0; padding: .3rem; max-height: 300px; overflow: auto; }
.ta-list li { padding: .55rem .7rem; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; }
.ta-list li:hover, .ta-list li.is-on { background: var(--porcelain-2); }
.ta-list li span { color: var(--steel); font-size: .8rem; }
.chosen { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border: 1.5px solid var(--ink); border-radius: var(--r-sm); background: var(--porcelain-2); }
.chosen strong { display: block; }
.chosen span { font-size: .82rem; color: var(--steel); }
.chosen button { margin-left: auto; }
.divider-or { display: flex; align-items: center; gap: .8rem; color: var(--steel); font-size: .8rem; margin: .4rem 0; }
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: var(--porcelain); }
.hours-edit { display: grid; gap: .4rem; }
.hours-edit div { display: grid; grid-template-columns: 120px 1fr 1fr; gap: .6rem; align-items: center; }
.hours-edit .input { padding: .45rem .6rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip-list label { position: relative; }
.chip-list input { position: absolute; opacity: 0; }
.chip-list span { display: inline-block; padding: .35rem .7rem; border: 1.5px solid var(--porcelain); border-radius: 999px; font-size: .83rem; cursor: pointer; font-weight: 500; }
.chip-list input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip-list input:focus-visible + span { box-shadow: var(--focus); }
.bar-h { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.bar-h .track { height: 8px; background: var(--porcelain-2); border-radius: 4px; overflow: hidden; }
.bar-h .fill { height: 100%; background: var(--c, var(--ink)); border-radius: 4px; }
.spark { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 150px; }
.spark div { background: var(--ink); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.spark div:hover { background: var(--gum); }
.spark-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: .7rem; color: var(--steel); text-align: center; margin-top: .4rem; }

/* Login */
body.login { background: var(--ink); min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { position: relative; overflow: hidden; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; color: #c9d3de; }
.login-art .brand { color: #fff; }
.login-art .brand em { color: #91a0b2; }
.login-art svg.arch { position: absolute; left: -10%; bottom: -12%; width: 120%; fill: none; stroke: #24364f; stroke-width: 2; }
.login-art h2 { color: #fff; font-size: clamp(2rem, 3.4vw, 3rem); letter-spacing: -.04em; max-width: 12em; position: relative; }
.login-art p { position: relative; max-width: 30em; }
.login-card { background: var(--enamel); display: grid; place-items: center; padding: 2rem 1rem; }
.login-card form { width: min(380px, 100%); display: grid; gap: 1rem; }
.login-card h1 { font-size: 1.8rem; letter-spacing: -.03em; }
.demo { font-size: .8rem; color: var(--steel); background: var(--white); border: 1px dashed var(--porcelain); border-radius: var(--r-sm); padding: .7rem .9rem; }
.demo code { font-size: .78rem; color: var(--ink); }

@media print {
  .side, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .panel { border: 0; }
  body.portal { background: #fff; }
}

@media (max-width: 1200px) {
  .grid-main { grid-template-columns: 1fr; }
  .chart-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 35, 59, .4); }
  .menu-btn { display: grid; }
  .topbar { padding: .7rem 16px; }
  .topbar .today { display: none; }
  .topbar .search { width: auto; flex: 1; }
  .content { padding: 1.2rem 16px 3rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--porcelain-2); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .appt-hero { grid-template-columns: auto 1fr; }
  .appt-hero > :last-child { grid-column: 1 / -1; }
  body.login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .queue li { grid-template-columns: 54px 4px 1fr; }
  .queue .q-act { grid-column: 3; }
  .week, .week-labels { grid-template-columns: repeat(14, 1fr); gap: 2px; padding-inline: .8rem; }
  .flow { overflow-x: auto; }
  .flow span { min-width: 72px; }
  .topbar .btn-new span { display: none; }
}
