@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --surface: #ffffff;
  --surface-subtle: #f5f6f4;
  --surface-hover: #f4f7f5;
  --surface-glass: rgba(255,255,255,.88);
  --ink: #182324;
  --muted: #7a8685;
  --line: #e9ece8;
  --field-line: #dfe4df;
  --primary: #176d78;
  --primary-deep: #0e5962;
  --primary-soft: #e3f0f1;
  --coral: #ef725d;
  --coral-soft: #fff0ec;
  --green: #2f9269;
  --green-soft: #e8f5ee;
  --violet: #7b6cb1;
  --violet-soft: #efecf8;
  --warning: #a96a10;
  --warning-soft: #fff5dc;
  --neutral-soft: #f0f1ef;
  --sidebar: 248px;
  --shadow: 0 12px 38px rgba(30, 53, 52, .055);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1718;
  --surface: #152123;
  --surface-subtle: #1b292b;
  --surface-hover: #1c2d2f;
  --surface-glass: rgba(21,33,35,.9);
  --ink: #edf4f2;
  --muted: #98a7a5;
  --line: #293a3c;
  --field-line: #34484a;
  --primary: #55aeb8;
  --primary-deep: #78c7cf;
  --primary-soft: #17383c;
  --coral: #ff8b77;
  --coral-soft: #3b2523;
  --green: #69c99b;
  --green-soft: #18362b;
  --violet: #b1a4df;
  --violet-soft: #2d2942;
  --warning: #e8b768;
  --warning-soft: #3a2d18;
  --neutral-soft: #273133;
  --shadow: 0 14px 42px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "DM Sans", Arial, sans-serif; font-size: 14px; }
body.auth-checking .app-shell { visibility: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { min-height: 100vh; }

.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); padding: 27px 18px 18px; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.brand { height: 44px; display: flex; align-items: center; gap: 11px; padding: 0 10px; }
.brand-mark { position: relative; width: 29px; height: 29px; display: block; transform: rotate(-8deg); }
.brand-mark span { position: absolute; background: var(--primary); border-radius: 10px 10px 3px 10px; }
.brand-mark span:nth-child(1) { width: 13px; height: 20px; left: 2px; top: 7px; }
.brand-mark span:nth-child(2) { width: 11px; height: 16px; right: 1px; top: 2px; transform: rotate(52deg); background: var(--coral); }
.brand-mark span:nth-child(3) { width: 8px; height: 8px; right: 2px; bottom: 1px; border-radius: 50%; background: #f1b85a; }
.brand-name { font: 800 24px/1 "Manrope", sans-serif; letter-spacing: -1.4px; }
.brand-name span { color: var(--coral); }
.main-nav { margin-top: 32px; }
.nav-label { margin: 0 12px 9px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; }
.nav-label-space { margin-top: 29px; }
.nav-item { position: relative; height: 44px; margin: 2px 0; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 500; text-decoration: none; transition: .2s ease; }
.nav-item svg { width: 18px; }
.nav-item:hover { color: var(--primary); background: var(--surface-hover); }
.nav-item.active { color: var(--primary-deep); background: var(--primary-soft); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -18px; width: 3px; height: 24px; background: var(--primary); border-radius: 0 4px 4px 0; }
.nav-badge { margin-left: auto; min-width: 23px; padding: 3px 6px; border-radius: 12px; color: var(--coral); background: var(--coral-soft); font-size: 10px; text-align: center; }
.sidebar-bottom { position: relative; margin-top: auto; }
.upgrade-card { margin: 10px 1px 15px; padding: 16px; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 14px; }
.upgrade-icon { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: var(--primary); border-radius: 9px; }
.upgrade-icon svg { width: 16px; }
.upgrade-card h3 { margin: 12px 0 5px; font-size: 12px; }
.upgrade-card p { margin: 0 0 12px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.upgrade-card a { color: var(--primary); font-size: 10px; font-weight: 700; text-decoration: none; }
.upgrade-card a span { margin-left: 3px; }
.user-card { width: 100%; margin-top: 8px; padding: 12px 7px; display: flex; align-items: center; gap: 9px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.avatar { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #e59d84, #315f68); border-radius: 11px; font-size: 11px; font-weight: 700; }
.user-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.user-copy strong { font-size: 11px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.user-card > svg { width: 16px; color: var(--muted); }
.user-popover { position: absolute; z-index: 4; right: 2px; bottom: 62px; left: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.user-popover[hidden] { display: none; }
.user-popover button { width: 100%; height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 9px; color: #a0443a; background: transparent; border: 0; border-radius: 7px; font-size: 10px; font-weight: 600; cursor: pointer; }
.user-popover button:hover { background: var(--coral-soft); }
.user-popover svg { width: 16px; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { height: 76px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; background: var(--surface-glass); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.search-box { width: min(360px, 34vw); display: flex; align-items: center; gap: 9px; }
.search-box svg { width: 17px; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd { padding: 4px 7px; color: var(--muted); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 6px; font: 9px inherit; box-shadow: 0 1px 0 var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.icon-button:hover { background: var(--surface-hover); }
.theme-toggle { position: relative; color: var(--muted); }
.theme-toggle:hover { color: var(--primary); }
.theme-toggle:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.theme-icon { position: absolute; width: 17px; height: 17px; transition: opacity .18s ease, transform .18s ease; }
.theme-icon-sun { opacity: 0; transform: scale(.65) rotate(-25deg); }
:root[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: scale(.65) rotate(25deg); }
:root[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: scale(1) rotate(0); }
.notification-button { position: relative; border: 0; background: transparent; }
.notification-button span { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; background: var(--coral); border: 2px solid var(--surface); border-radius: 50%; }
.primary-button { height: 40px; padding: 0 17px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; border: 0; border-radius: 10px; background: var(--primary); font-size: 11px; font-weight: 700; box-shadow: 0 6px 15px rgba(23,109,120,.15); cursor: pointer; transition: .2s ease; }
.primary-button:hover { background: var(--primary-deep); transform: translateY(-1px); }
.primary-button svg { width: 16px; }
.menu-button { display: none; }

.dashboard-wrap { max-width: 1500px; margin: 0 auto; padding: 31px 34px 40px; }
.welcome-row { margin-bottom: 25px; display: flex; align-items: flex-end; justify-content: space-between; }
.eyebrow { margin: 0 0 7px !important; color: var(--coral) !important; font-size: 9px !important; font-weight: 700; letter-spacing: 1.15px; }
.welcome-row h1 { margin: 0; font: 700 24px/1.35 "Manrope", sans-serif; letter-spacing: -.7px; }
.welcome-row h1 span { display: inline-block; font-size: 21px; transform: rotate(-10deg); }
.welcome-row p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.date-filter { height: 38px; padding: 0 13px; display: flex; align-items: center; gap: 8px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 600; cursor: pointer; }
.date-filter svg { width: 15px; }
.date-filter .chevron { width: 13px; margin-left: 6px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.metric-card { min-height: 156px; padding: 17px 18px 15px; transition: transform .2s ease, box-shadow .2s ease; }
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 15px 40px rgba(30,53,52,.08); }
.metric-top { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; }
.metric-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; }
.metric-icon svg { width: 16px; }
.metric-icon.blue { color: var(--primary); background: var(--primary-soft); }
.metric-icon.orange { color: var(--coral); background: var(--coral-soft); }
.metric-icon.violet { color: var(--violet); background: var(--violet-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-top button, .panel-head button, .legend button { padding: 2px; display: grid; place-items: center; color: var(--muted); border: 0; background: transparent; cursor: pointer; }
.metric-top button svg, .panel-head button svg, .legend button svg { width: 16px; }
.metric-card > p { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.metric-value { font: 700 23px/1.2 "Manrope", sans-serif; letter-spacing: -.65px; }
.metric-value span, .balance span { font-size: .67em; }
.metric-foot { margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.metric-foot small { color: var(--muted); font-size: 8.5px; }
.trend { padding: 3px 5px; border-radius: 5px; font-size: 8px; font-weight: 700; }
.trend.positive { color: var(--green); background: var(--green-soft); }
.trend.negative { color: var(--coral); background: var(--coral-soft); }

.content-grid { margin-top: 17px; display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(270px, .75fr); gap: 16px; }
.panel { min-width: 0; padding: 19px 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.panel h2 { margin: 0; font: 700 13px/1.4 "Manrope", sans-serif; letter-spacing: -.25px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.legend { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 9px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.income { background: var(--primary); }
.dot.expense { background: var(--coral); }
.chart { height: 230px; margin-top: 15px; display: flex; }
.y-labels { width: 36px; padding: 3px 0 21px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 8px; text-align: right; }
.chart-area { position: relative; flex: 1; min-width: 0; margin-left: 10px; }
.grid-lines { position: absolute; inset: 5px 0 23px; display: flex; flex-direction: column; justify-content: space-between; }
.grid-lines i { display: block; border-top: 1px dashed var(--line); }
.area-chart { position: absolute; inset: 3px 0 23px; width: 100%; height: calc(100% - 26px); overflow: visible; }
.area-chart .line { fill: none; stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.income-line { stroke: var(--primary); }
.expense-line { stroke: var(--coral); }
.income-area { fill: url(#incomeFill); stroke: none; }
.expense-area { fill: url(#expenseFill); stroke: none; }
.x-labels { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.chart-tooltip { position: absolute; z-index: 3; top: 5px; right: 2%; padding: 7px 9px; display: flex; flex-direction: column; color: #fff; background: #173f43; border-radius: 7px; box-shadow: 0 6px 15px rgba(13,55,59,.2); }
.chart-tooltip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: #173f43; transform: rotate(45deg); }
.chart-tooltip small { opacity: .7; font-size: 7px; }
.chart-tooltip strong { font-size: 9px; }
.summary-panel { display: flex; flex-direction: column; }
.balance { margin-top: 15px; font: 700 24px/1.3 "Manrope", sans-serif; }
.summary-list { margin-top: 11px; border-top: 1px solid var(--line); }
.summary-list > div { padding: 13px 0; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.summary-icon { width: 28px; height: 28px; margin-right: 9px; display: grid; place-items: center; border-radius: 8px; }
.summary-icon svg { width: 14px; }
.summary-icon.green { color: var(--green); background: var(--green-soft); }
.summary-icon.coral { color: var(--coral); background: var(--coral-soft); }
.summary-list div > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; }
.summary-list small { color: var(--muted); font-size: 8px; }
.summary-list strong { margin-top: 2px; font-size: 10px; }
.summary-list em { padding: 3px 5px; color: var(--green); background: var(--green-soft); border-radius: 5px; font-size: 8px; font-style: normal; font-weight: 700; }
.summary-list em.danger { color: var(--coral); background: var(--coral-soft); }
.secondary-button { width: 100%; height: 37px; margin-top: auto; color: var(--primary); background: var(--surface); border: 1px solid var(--field-line); border-radius: 9px; font-size: 9px; font-weight: 700; cursor: pointer; }
.secondary-button:hover { background: var(--primary-soft); }
.secondary-button span { margin-left: 5px; }

.bottom-grid { grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr); }
.orders-panel { padding-bottom: 9px; }
.panel-head a { color: var(--primary); font-size: 9px; font-weight: 700; text-decoration: none; }
.panel-head a span { margin-left: 4px; }
.table-scroll { margin-top: 14px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 9px; white-space: nowrap; }
th { padding: 8px 8px; color: var(--muted); background: var(--surface-subtle); font-size: 7.5px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .45px; }
td { height: 45px; padding: 6px 8px; color: var(--muted); border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border: 0; }
td:nth-child(2) { display: flex; align-items: center; gap: 7px; }
td strong { color: var(--ink); font-size: 9px; }
.client-avatar { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 7px; font-size: 7px; font-weight: 700; }
.ca-blue { color: var(--primary); background: var(--primary-soft); }
.ca-coral { color: var(--coral); background: var(--coral-soft); }
.ca-violet { color: var(--violet); background: var(--violet-soft); }
.ca-green { color: var(--green); background: var(--green-soft); }
.status { padding: 4px 7px; border-radius: 12px; font-size: 7.5px; font-weight: 700; }
.status.paid { color: var(--green); background: var(--green-soft); }
.status.pending { color: var(--warning); background: var(--warning-soft); }
.status.canceled { color: var(--muted); background: var(--neutral-soft); }
.small-add { width: 29px; height: 29px; color: var(--primary) !important; background: var(--primary-soft) !important; border-radius: 8px !important; }
.appointment-list { margin-top: 15px; }
.appointment { min-height: 55px; display: grid; grid-template-columns: 37px 3px 1fr; gap: 10px; }
.appointment + .appointment { margin-top: 11px; }
.appointment time { padding-top: 2px; display: flex; flex-direction: column; }
.appointment time strong { font-size: 8.5px; }
.appointment time small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.appointment-line { height: 50px; border-radius: 4px; }
.blue-line { background: var(--primary); }
.coral-line { background: var(--coral); }
.violet-line { background: var(--violet); }
.appointment-type { color: var(--primary); font-size: 7px; font-weight: 700; }
.appointment-type.coral-text { color: var(--coral); }
.appointment-type.violet-text { color: var(--violet); }
.appointment h3 { margin: 2px 0 4px; font-size: 9px; }
.appointment p { margin: 0; display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 7.5px; }
.avatar-tiny { width: 19px; height: 19px; display: inline-grid; place-items: center; color: #fff; background: var(--primary); border: 2px solid var(--surface); border-radius: 50%; font-size: 6px; font-weight: 700; }
.coral-bg { background: var(--coral); }
.violet-bg { background: var(--violet); }

.toast { position: fixed; z-index: 60; right: 25px; bottom: 25px; min-width: 260px; padding: 13px 15px; display: flex; align-items: center; gap: 11px; color: #fff; background: #183f42; border-radius: 12px; box-shadow: 0 18px 50px rgba(20,53,55,.24); opacity: 0; transform: translateY(20px); pointer-events: none; transition: .3s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast > span { width: 27px; height: 27px; display: grid; place-items: center; color: #18483f; background: #9dd8bd; border-radius: 50%; font-weight: 800; }
.toast p { margin: 0; display: flex; flex-direction: column; }
.toast strong { font-size: 11px; }
.toast small { margin-top: 2px; opacity: .7; font-size: 9px; }
.action-modal { width: min(460px, calc(100% - 30px)); padding: 0; color: var(--ink); background: var(--surface); border: 0; border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.action-modal::backdrop { background: rgba(18,37,38,.38); backdrop-filter: blur(3px); }
.action-modal form { padding: 23px; }
.modal-head, .modal-head > div { display: flex; align-items: center; justify-content: space-between; gap: 11px; }
.modal-icon { width: 38px; height: 38px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 10px; }
.modal-head h2 { margin: 0; font: 700 16px "Manrope", sans-serif; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.modal-head > button { align-self: flex-start; border: 0; background: none; color: var(--muted); font-size: 24px; cursor: pointer; }
.type-switch { margin: 21px 0 16px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-subtle); border-radius: 9px; }
.type-switch button { height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.type-switch button.selected { color: var(--primary); background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.12); font-weight: 700; }
.action-modal label { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); font-size: 10px; font-weight: 600; }
.action-modal input, .action-modal select { width: 100%; height: 40px; padding: 0 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--field-line); border-radius: 8px; outline: none; font-size: 11px; }
.action-modal input:focus, .action-modal select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.cancel-button { height: 40px; padding: 0 16px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.sidebar-scrim { display: none; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .bottom-grid { grid-template-columns: 1fr; }
  .summary-panel .secondary-button { margin-top: 16px; }
}

@media (max-width: 800px) {
  :root { --sidebar: 260px; }
  .sidebar { transform: translateX(-101%); box-shadow: 15px 0 45px rgba(20,42,41,.16); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 25; inset: 0; display: block; background: rgba(18,37,38,.35); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .main-content { margin-left: 0; }
  .menu-button { display: grid; }
  .topbar { padding: 0 20px; gap: 14px; }
  .search-box { width: auto; flex: 1; }
  .search-box kbd { display: none; }
  .dashboard-wrap { padding: 26px 20px 36px; }
}

@media (max-width: 560px) {
  .topbar { height: 66px; padding: 0 14px; }
  .search-box { display: none; }
  .topbar-actions { margin-left: auto; }
  .primary-button { padding: 0 13px; }
  .topbar .primary-button { font-size: 0; }
  .topbar .primary-button svg { margin: 0; }
  .dashboard-wrap { padding: 22px 14px 30px; }
  .welcome-row { align-items: flex-start; gap: 16px; }
  .welcome-row h1 { font-size: 20px; }
  .date-filter { width: 39px; flex: 0 0 39px; padding: 0; justify-content: center; font-size: 0; }
  .date-filter .chevron { display: none; }
  .metric-grid { grid-template-columns: 1fr; gap: 11px; }
  .metric-card { min-height: 142px; }
  .panel { padding: 17px 15px; }
  .chart { height: 200px; }
  .legend { gap: 7px; }
  .legend button { display: none; }
  .bottom-grid { grid-template-columns: 1fr; }
  .orders-panel { padding-right: 0; }
  .orders-panel .panel-head { padding-right: 15px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .toast { right: 14px; bottom: 14px; left: 14px; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
