:root {
  color-scheme: light;
  --base: #f5f5f5;
  --surface: #fff;
  --subtle: #ededed;
  --ink: #151515;
  --muted: #545454;
  --line: #dedede;
  --accent: #202020;
  --accent-soft: #eaeaea;
  --button: #181818;
  --button-text: #fff;
  --hero: #181818;
  --hero-alt: #343434;
  --hero-ink: #fff;
  --hero-muted: #dedede;
  --hero-line: #ffffff40;
  --phone: #191919;
  --phone-soft: #eaeaea;
  --focus: #333;
  --shadow: 0 14px 40px #00000018;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --base: #121212;
  --surface: #1e1e1e;
  --subtle: #2b2b2b;
  --ink: #f5f5f5;
  --muted: #c5c5c5;
  --line: #454545;
  --accent: #f2f2f2;
  --accent-soft: #333;
  --button: #f2f2f2;
  --button-text: #141414;
  --hero: #292929;
  --hero-alt: #3d3d3d;
  --hero-ink: #fff;
  --hero-muted: #e1e1e1;
  --hero-line: #ffffff42;
  --phone: #f5f5f5;
  --phone-soft: #333;
  --focus: #eee;
  --shadow: 0 14px 40px #00000072;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--base); color: var(--ink); font: 16px/1.5 "Segoe UI", system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button, summary { cursor: pointer; color: inherit; }
button { background: none; border: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
svg { display: block; width: 22px; height: 22px; flex: none; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.top { position: sticky; z-index: 3; top: 0; padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner, .workspace-content { max-width: 1220px; margin-inline: auto; padding-inline: 32px; }
.top-inner { min-height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.brand { font-size: 1.9rem; line-height: 1; letter-spacing: -.07em; }
.brand strong span { color: var(--accent); }
.app-tabs, #filters { display: flex; gap: 3px; padding: 4px; border-radius: 100px; background: var(--subtle); }
.app-tabs button, #filters button { min-height: 40px; padding: 0 17px; border-radius: 100px; color: var(--muted); font-weight: 650; font-size: .875rem; white-space: nowrap; }
.app-tabs [aria-current], #filters [aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.top-actions { justify-self: end; display: flex; gap: 7px; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.icon-button:hover { background: var(--subtle); }
.theme-toggle { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.theme-toggle svg { animation: theme-swap .24s ease-out; }
@keyframes theme-swap { from { transform: rotate(-20deg) scale(.82); opacity: .5; } to { transform: none; opacity: 1; } }
.tools-menu { position: relative; }
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-items { position: absolute; z-index: 5; right: 0; top: calc(100% + 8px); min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.tools-items button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; border-radius: 10px; text-align: left; padding: 8px; font-size: .9rem; }
.tools-items button:hover { background: var(--subtle); }
.tools-items svg { width: 17px; height: 17px; }
.workspace-content { padding-block: 38px max(52px, env(safe-area-inset-bottom)); }
.page-heading { margin-bottom: 24px; }
.today-date { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 4px; color: var(--muted); font-size: .9rem; font-weight: 650; }
h1 { font-size: clamp(2rem, 4.6vw, 3.8rem); line-height: 1.05; letter-spacing: -.065em; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) repeat(2,minmax(0,1fr)); gap: 14px; }
.home-grid.personal { grid-template-columns: minmax(0, 1fr); }
.today-card, .number-card, .inbox, .detail, .agenda-panel { min-width: 0; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); }
.today-card { padding: 20px 22px; background: linear-gradient(120deg,var(--hero),var(--hero-alt)); color: var(--hero-ink); border-color: transparent; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-header h2 { display: flex; align-items: center; gap: 9px; font-size: 1.1rem; }
.card-header button { min-height: 44px; padding-inline: 13px; border: 1px solid var(--hero-line); border-radius: 100px; font-weight: 650; white-space: nowrap; font-size: .875rem; }
.card-header button:hover { background: var(--hero-line); }
.card-header button:focus-visible { outline-color: var(--hero-ink); }
.today-count { margin: 5px 0; color: var(--hero-muted); font-size: .85rem; }
.today-slot { display: grid; grid-template-columns: 6.2rem 1fr; align-items: center; gap: 10px; padding-block: 8px; border-top: 1px solid var(--hero-line); }
.today-slot time { font-size: .83rem; font-variant-numeric: tabular-nums; }
.today-slot strong, .today-slot small { display: block; }
.today-slot strong { font-size: .94rem; }
.today-slot small { color: var(--hero-muted); font-size: .78rem; }
.number-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 20px; min-height: 154px; }
.number-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); margin-bottom: 13px; }
.number-icon svg { width: 20px; height: 20px; }
.number-card h2 { color: var(--muted); font-size: .84rem; letter-spacing: 0; }
.number-card strong { margin-block: 4px; font-size: clamp(1.7rem, 4.2vw, 3.2rem); line-height: 1.05; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.number-card small { color: var(--muted); font-size: .78rem; }
.cost-card { background: var(--subtle); }
.board { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr); align-items: start; gap: 14px; margin-top: 26px; }
.inbox, .detail, .agenda-panel { padding: 22px; }
.inbox-heading, .detail-header { display: flex; align-items: center; gap: 11px; }
.inbox-heading { justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.call-list { display: grid; gap: 6px; }
.call { min-height: 72px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 14px; text-align: left; }
.call:hover, .call.selected { border-color: var(--line); background: var(--subtle); }
.call-name, .call-meta { display: block; overflow-wrap: anywhere; }
.call-name { font-weight: 700; }
.call-meta, .time, .detail-subtitle, .empty, .muted { color: var(--muted); font-size: .875rem; }
.time { white-space: nowrap; font-size: .75rem; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750; font-size: .78rem; }
.detail-header { flex-wrap: wrap; }
.badge { margin-left: auto; border-radius: 100px; padding: 4px 9px; background: var(--subtle); color: var(--muted); font-size: .75rem; font-weight: 650; }
.badge.done { color: var(--accent); background: var(--accent-soft); }
.phone { display: inline-flex; min-height: 44px; margin-top: 14px; align-items: center; gap: 8px; padding-inline: 13px; border-radius: 100px; color: var(--phone); background: var(--phone-soft); font-weight: 700; text-decoration: none; }
.phone:hover { text-decoration: underline; }
.phone svg, .button svg { width: 18px; height: 18px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 17px 0; }
.field { padding: 9px 0; border-top: 1px solid var(--line); }
.field dt { color: var(--muted); font-size: .76rem; }
.field dd { margin: 2px 0 0; font-weight: 650; font-size: .9rem; }
.section p { color: var(--muted); margin: 5px 0 0; font-size: .91rem; }
.actions, .agenda-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); font-size: .875rem; font-weight: 650; }
.button:hover { background: var(--subtle); }
.button.primary { background: var(--button); color: var(--button-text); border-color: transparent; }
.button.primary:hover { filter: brightness(.93); }
.mobile-back { display: none; }
.agenda-account { margin-bottom: 14px; }
.agenda-account .agenda-controls { margin-top: 0; }
.agenda-panel h2 + p { margin-top: 6px; }
.agenda-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; align-items: start; }
.hours-layout { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
.hours-editor textarea { min-height: 108px; }
.manual-hours { margin-top: 14px; border-top: 1px solid var(--line); }
.manual-hours summary { color: var(--accent); padding-block: 12px; font-size: .88rem; font-weight: 650; }
.week-hours { margin: 12px 0; }
.week-hours div { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.week-hours dd { margin: 0; color: var(--muted); font-size: .88rem; }
.agenda-empty { color: var(--muted); margin-top: 12px; font-size: .9rem; }
.agenda-controls, .agenda-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.agenda-date { grid-column: 1 / -1; }
label { display: block; font-size: .86rem; font-weight: 650; }
textarea, select, input { display: block; width: 100%; max-width: 100%; min-width: 0; min-height: 44px; padding: 9px; margin-top: 4px; border-radius: 9px; border: 1px solid var(--line); color: var(--ink); background: var(--base); }
textarea { min-height: 76px; resize: vertical; }
.agenda-panel > label { margin-top: 16px; }
.agenda-list { list-style: none; padding: 0; margin-block: 10px 17px; }
.agenda-list li { border-bottom: 1px solid var(--line); padding-block: 10px; }
.agenda-list small { display: block; color: var(--muted); }
.agenda-message { margin-top: 10px; color: var(--accent); }
dialog { width: min(470px,calc(100% - 30px)); padding: 22px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 19px; box-shadow: var(--shadow); }
dialog::backdrop { background: #0008; }
dialog .close { margin: 0 0 10px auto; }
#dialog-content p { margin-top: 10px; }
#toast { position: fixed; z-index: 9; right: 16px; bottom: 16px; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: var(--button); color: var(--button-text); box-shadow: var(--shadow); }
@media (max-width: 760px) {
  .top-inner, .workspace-content { padding-inline: 16px; }
  .workspace-content { padding-top: 24px; }
  .home-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .today-card { grid-column: 1 / -1; }
  .number-card, .today-card, .inbox, .detail, .agenda-panel { padding: 15px; border-radius: 17px; }
  .board, .agenda-layout { grid-template-columns: minmax(0,1fr); }
  .board { margin-top: 18px; }
  .board .detail, .board.show-detail .inbox { display: none; }
  .board.show-detail .detail { display: block; }
  .mobile-back { display: inline-flex; margin-bottom: 12px; }
  .call.selected { background: transparent; border-color: transparent; }
}
@media (max-width: 460px) {
  .top-inner { min-height: 114px; grid-template-columns: 1fr 1fr; gap: 5px; padding-block: 8px; }
  .app-tabs { grid-row: 2; grid-column: 1 / -1; }
  .app-tabs button { flex: 1; min-height: 44px; padding-inline: 8px; }
  .top-actions { grid-row: 1; grid-column: 2; }
  .inbox-heading { align-items: flex-start; }
  .agenda-controls { grid-template-columns: minmax(0,1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle svg { animation: none; }
}

.demo-switch { display: grid; gap: 8px; margin-top: 6px; padding: 10px 8px 6px; border-top: 1px solid var(--line); }
.demo-switch p { color: var(--muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.demo-switch label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.demo-switch select { min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }

body[data-auth="out"] .top, body[data-auth="out"] .workspace-content { display: none; }
body[data-auth="in"] #login { display: none; }
#login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
#login form { width: min(380px, 100%); display: grid; gap: 10px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
#login h1 { font-size: 1.8rem; margin-bottom: 6px; }
#login label { font-size: .85rem; color: var(--muted); font-weight: 650; }
#login input { min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--base); color: var(--ink); }
.login-error { min-height: 1.3em; color: var(--ink); font-size: .9rem; font-weight: 650; }
.account-name { padding: 8px; color: var(--muted); font-size: .8rem; font-weight: 650; }


#invite-form { width: min(380px, 100%); display: grid; gap: 10px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
#invite-form h1 { font-size: 1.8rem; margin-bottom: 6px; }
#invite-form label, #dialog-content label { font-size: .85rem; color: var(--muted); font-weight: 650; display: block; margin-top: 10px; }
#invite-form input, #dialog-content input, #dialog-content select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--base); color: var(--ink); }
.phone-link { display: inline-block; margin-top: 4px; font-weight: 650; }
.inline-add { display: flex; gap: 8px; }
#team-result { margin-top: 12px; display: grid; gap: 8px; font-size: .9rem; }
.agenda-list .button { margin-top: 8px; margin-right: 8px; }


.outcome { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 100px; font-size: .75rem; font-weight: 700; border: 1px solid var(--line); background: var(--subtle); color: var(--muted); }
.outcome.booked { background: var(--button); color: var(--button-text); border-color: transparent; }
.call-meta { display: block; }
#dialog-content textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--base); color: var(--ink); font: inherit; }
.push-actions { display: grid; gap: 8px; margin-top: 10px; }


.link-button { background: none; border: 0; padding: 10px 0 0; color: var(--muted); font: inherit; font-size: .875rem; text-decoration: underline; cursor: pointer; justify-self: center; }
.link-button:hover { color: var(--ink); }
#forgot-note { min-height: 1.2em; }

