/* Fonts: Vazirmatn (OFL) for all regular text; Morabba (brand, Fontiran licence next to the files) only for headings */
@font-face { font-family: Morabba; src: url("/static/fonts/Morabba-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: Morabba; src: url("/static/fonts/Morabba-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: Morabba; src: url("/static/fonts/Morabba-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: Morabba; src: url("/static/fonts/Morabba-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: Morabba; src: url("/static/fonts/Morabba-ExtraBold.woff") format("woff"); font-weight: 800; font-display: swap; }
@font-face { font-family: Vazirmatn; src: url("/static/fonts/Vazirmatn.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

/* Brand tokens (Brand Book p.59). The old names stay so the scripts keep working: --surface = panels and cards,
   --surface-2 = tiles and hovers, --accent = intelligence and links (blue), --action = the one orange action */
:root {
  --bg: #F8FAFC;            /* Arctic White */
  --surface: #FFFFFF;
  --surface-2: #E2E8F0;     /* Ice Gray */
  --border: #CBD5E1;        /* Frost Border */
  --text: #09090B;          /* Near Black */
  --muted: #64748B;         /* Slate Gray */
  --placeholder: #94A3B8;   /* Mist Gray */
  --action: #EA580C;        /* Burning Orange */
  --action-hover: #C2410C;
  --action-text: #FFFFFF;
  --accent: #3B82F6;        /* Electric Blue: AI, analysis, links */
  --link: #2563EB;
  --accent-tint: #EFF6FF;
  --user-bg: #E2E8F0;
  --success: #047857;
  --error: #BE123C;
  --focus: rgb(59 130 246 / 25%);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: Vazirmatn, Tahoma, sans-serif;
  --font-heading: Morabba, Vazirmatn, Tahoma, sans-serif;
  color-scheme: light;
}

/* Dark mode keeps the black family (Brand Book p.28) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090B;
    --surface: #18181B;
    --surface-2: #27272A;
    --border: #3F3F46;
    --text: #FAFAFA;
    --muted: #A1A1AA;
    --placeholder: #71717A;
    --action-hover: #F97316;
    --accent: #60A5FA;
    --link: #60A5FA;
    --accent-tint: #172554;
    --user-bg: #27272A;
    --success: #10B981;
    --error: #F43F5E;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.8 var(--font);
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
::placeholder { color: var(--placeholder); }
h1, h2, h3, .welcome { font-family: var(--font-heading); font-weight: 800; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px auto;
  max-width: 820px;
}

.login { max-width: 380px; margin-top: 12vh; }
.login h1 { margin-top: 0; }
.login label { display: block; margin-bottom: 14px; }
.login input, .login textarea, .login select { display: block; width: 100%; margin-top: 4px; }
.login-links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.step-title { font-family: var(--font-heading); font-weight: 800; font-size: 1.15em; margin: 0 0 12px; }
.hint { font-size: 0.85em; margin: -8px 0 12px; }
.choices { border: 0; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.choices legend { padding: 0; margin-bottom: 6px; }
.choice { display: inline-flex !important; margin: 0 !important; }
.choice input { position: absolute; opacity: 0; width: 1px !important; }
.choice span { border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.choice input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); }
.team-added { margin: 8px 0 12px; padding-inline-start: 20px; }
#team-add { width: 100%; margin-bottom: 4px; }
.login form > button { width: 100%; }
button.link { background: none; border: none; color: var(--link); min-height: 0; padding: 0; font-weight: 500;
  font-size: inherit; text-decoration: none; cursor: pointer; }
button.link:hover:not(:disabled) { background: none; border: none; color: var(--link); text-decoration: underline; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

/* Buttons (Brand Book p.56): orange = the action, outlined black = everything else */
button {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  min-height: 40px;
  border: 1px solid var(--action);
  border-radius: var(--radius-md);
  padding: 0 18px;
  background: var(--action);
  color: var(--action-text);
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--text); }
button.secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text); }
button:disabled { opacity: 0.6; cursor: wait; }

.muted { color: var(--muted); font-weight: normal; }
.error { color: var(--error); min-height: 1.5em; margin: 8px 0 0; }

.business { font-weight: 700; }
.brand-logo { display: block; height: 20px; width: auto; }
.login h1 { text-align: center; }
.login-logo { height: 30px; margin: 8px auto 16px; }

/* App shell: sidebar at the start side (right in Persian), conversation in the main column */
.app-shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border-inline-end: 1px solid var(--surface-2);
}
.app-shell.sidebar-closed .sidebar { display: none; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 1.15em; }
.icon-button { background: transparent; color: var(--text); border-color: transparent; padding: 4px 10px; font-size: 1.1em; min-height: 36px; }
.icon-button:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: transparent;
  color: var(--text); border-color: transparent; font-weight: 400; font-size: 14px; min-height: 36px; padding: 0 10px; }
.nav-item:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.nav-icon { font-size: 1.1em; }
.conversation-list { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-heading { margin: 6px 4px; font-size: 0.85em; color: var(--muted); }
#conversation-list { list-style: none; margin: 0; padding: 0; }
#conversation-list li { display: flex; align-items: center; border-radius: var(--radius-md); }
#conversation-list li:hover, #conversation-list li.active { background: var(--surface-2); }
#conversation-list li.active { font-weight: 600; }
.conversation-open {
  flex: 1; min-width: 0; text-align: start; background: transparent; color: var(--text); border-color: transparent;
  font-weight: 400; min-height: 36px;
  padding: 7px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conversation-delete { background: transparent; color: var(--muted); border-color: transparent; padding: 4px 8px; min-height: 36px; visibility: hidden; }
.conversation-open:hover:not(:disabled), .conversation-delete:hover:not(:disabled) { background: transparent; border-color: transparent; }
#conversation-list li:hover .conversation-delete, .conversation-delete:focus { visibility: visible; }
.sidebar-bottom { position: relative; border-top: 1px solid var(--surface-2); padding-top: 8px; }
.account-button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: transparent;
  color: var(--text); border-color: transparent; font-weight: 400; padding: 6px 8px; min-height: 48px; }
.account-button:hover:not(:disabled), .account-button[aria-expanded="true"] { background: var(--surface-2); border-color: transparent; }
.avatar { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px; }
.account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.account-text #user-label { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text #role-label { font-size: 12px; }
.chevron { color: var(--muted); font-size: 14px; }
.account-menu { position: absolute; bottom: calc(100% + 6px); inset-inline: 0; z-index: 30; display: flex; flex-direction: column;
  gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgb(9 9 11 / 14%); }
.account-menu[hidden] { display: none; }
.account-menu hr { border: 0; border-top: 1px solid var(--surface-2); margin: 4px 0; width: 100%; }
.account-email { margin: 4px 10px 0; font-size: 13px; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
.account-business { margin: 0 10px 4px; font-size: 12px; color: var(--muted); }
.menu-icon { flex-shrink: 0; color: var(--muted); }
.sidebar-bottom #user-label { font-size: 0.85em; overflow-wrap: anywhere; }
.sidebar-backdrop { display: none; }

.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.main-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 48px; }
.app-shell:not(.sidebar-closed) #sidebar-open { visibility: hidden; }
/* The header keeps no title: a conversation's name is its first message, which is noise next to the page (the browser tab
   and the sidebar already name it) */
.conversation-title { display: none; }
/* Trial notice: quiet grey, orange in the last days; the read-only panel replaces the message box */
.plan-notice { margin: 0 auto 0 0; font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 999px;
  padding: 4px 12px; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.plan-notice.urgent { color: var(--action-hover); background: #FFF7ED; }
.plan-notice a { color: inherit; font-weight: 600; }
/* Credits */
.credit-meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.credit-meter span { display: block; height: 100%; background: var(--text); border-radius: 999px; }
.credit-meter span.low { background: var(--action); }
.credit-left { font-weight: 700; margin: 4px 0; }
.credit-table { border-collapse: collapse; width: 100%; font-size: 0.9em; margin: 12px 0; }
.credit-table th, .credit-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: start; }
.credit-history { padding-inline-start: 18px; font-size: 0.9em; color: var(--muted); }
.plan-lock { border: 1px solid var(--border); border-radius: 20px; padding: 18px 20px; background: var(--bg); text-align: center; }
.plan-lock p { color: var(--muted); margin: 6px 0 12px; }
@media (max-width: 600px) { .plan-notice { min-width: 0; overflow: hidden; text-overflow: ellipsis; } }
/* Conversation scrolls; the input stays pinned at the bottom once the chat has started */
#chat { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; overflow-y: auto;
  padding: 0 max(16px, calc((100% - 820px) / 2)); scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
/* Chat convention regardless of language: you on the right, the assistant on the left.
   Each bubble keeps its own text direction, so Persian text inside still reads right-to-left. */
#messages { flex: 1 0 auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 2px 16px; direction: ltr; }
.composer { position: sticky; bottom: 0; padding: 8px 0 12px; background: var(--surface); }
/* "Go to the latest message": a small round button that floats above the message box while the chat is scrolled up */
.to-latest { position: absolute; top: -44px; left: 50%; transform: translateX(-50%); width: 36px; min-height: 36px; padding: 0;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); box-shadow: 0 2px 8px rgb(9 9 11 / 10%); }
.to-latest:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.to-latest[hidden] { display: none; }
.welcome { display: none; align-items: center; justify-content: center; gap: 12px; font-size: 2em; margin: 0 0 24px; }
.welcome-mark { height: 0.9em; width: auto; }
#chat.empty { justify-content: center; }
#chat.empty #messages { display: none; }
#chat.empty .welcome { display: flex; }
/* First minutes: the welcome line, starter buttons, the sample-data banner, the product tour */
.welcome-sub { display: none; text-align: center; color: var(--muted); margin: -12px auto 24px; max-width: 34em; line-height: 1.8; }
#chat.empty .welcome-sub { display: block; }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 0; }
.starter { font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.starter:hover { background: var(--surface-2); }
#chat:not(.empty) .starters { display: none; }
#settings-view { flex: 1; min-height: 0; overflow-y: auto; }

.message {
  overflow-wrap: anywhere;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  max-width: 85%;
  border: 1px solid var(--border);
  background: var(--surface);
}
.message.user { align-self: flex-end; background: var(--user-bg); border-color: transparent; border-radius: 18px; white-space: pre-wrap; }
.message.pending { color: var(--muted); font-style: italic; }

.chat-box { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 2px 8px rgb(9 9 11 / 6%); }
.chat-box:focus-within { border-color: var(--placeholder); }
.chat-box textarea { width: 100%; resize: none; border: 0; background: transparent; padding: 4px 2px; max-height: 40vh;
  overflow-y: auto; line-height: 1.8; }
.chat-box textarea:focus { box-shadow: none; }
.chat-tools { display: flex; align-items: center; justify-content: space-between; }
.tool-button { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; background: transparent; border-color: transparent;
  color: var(--muted); font-size: 22px; font-weight: 400; line-height: 1; }
.tool-button:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; color: var(--text); }
.tool-button.small { width: 24px; min-height: 24px; font-size: 16px; }
.send-button { width: 36px; min-height: 36px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; }
.send-button:disabled { opacity: 0.4; }
.attach-chip { display: inline-flex; align-self: flex-start; align-items: center; gap: 6px; margin: 0; padding: 2px 4px 2px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); font-size: 13px; }
.attach-chip[hidden] { display: none; }

/* Phones: the sidebar slides over the conversation */
@media (max-width: 768px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 20; box-shadow: 0 0 24px rgb(0 0 0 / 25%); }
  .app-shell:not(.sidebar-closed) .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / 35%); }
  .app-shell:not(.sidebar-closed) #sidebar-open { visibility: visible; }
}

@media (max-width: 600px) {
  .message { max-width: 100%; }
}

/* Formatted assistant replies */
.message.assistant { align-self: flex-start; max-width: 95%; line-height: 1.8; background: transparent; border-color: transparent; padding-inline: 2px; }
.message > :first-child { margin-top: 0; }
.message > :last-child { margin-bottom: 0; }
.message p { margin: 0 0 8px; }
.message h3, .message h4, .message h5, .message h6 { margin: 12px 0 6px; line-height: 1.3; }
.message h3 { font-size: 1.1em; }
.message h4, .message h5, .message h6 { font-size: 1em; }
.message ul, .message ol { margin: 0 0 8px; padding-inline-start: 22px; }
.message blockquote { margin: 0 0 8px; padding-inline-start: 10px; border-inline-start: 3px solid var(--border); color: var(--muted); }
.message hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.message code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.message pre { margin: 0 0 8px; padding: 10px; background: var(--surface-2); border-radius: 6px; overflow-x: auto; direction: ltr; }
.message pre code { padding: 0; background: none; }
.message a { color: var(--link); text-decoration: underline; }
.table-wrap { overflow-x: auto; margin: 0 0 8px; }
.message table { border-collapse: collapse; font-size: 0.92em; min-width: 100%; }
.message th, .message td { border: 1px solid var(--border); padding: 5px 9px; text-align: start; vertical-align: top; }
.message th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }

/* Settings page */
#settings-view { max-width: 1100px; width: 100%; min-width: 0; margin: 0 auto; padding: 16px; }
#settings-view .card, #settings-view .table-wrap { min-width: 0; max-width: 100%; }
#settings-view .card { max-width: none; margin: 0 0 16px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; min-width: 0; }
input, select, textarea { max-width: 100%; min-width: 0; }
@media (max-width: 600px) {
  #settings-view { padding: 12px; }
  #settings-view .card { padding: 16px; }
  .settings-head { flex-wrap: wrap; gap: 8px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form label, .inline-form input, .inline-form select { width: 100%; }
  #team-card .table-wrap { margin-inline: -16px; padding-inline: 16px; }
}
.status { min-height: 1.4em; margin: 8px 0 0; color: var(--muted); }
.status.error { color: var(--error); }
.chat-status { min-height: 0; text-align: center; font-size: 13px; }
#team-table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
#team-table th, #team-table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: start; vertical-align: middle; }
#team-table th { font-weight: 600; font-size: 0.85em; }
#team-table .center { text-align: center; }
#team-table .actions { white-space: nowrap; }
#team-table .actions button { margin-inline-start: 6px; padding: 4px 10px; }
.badge { display: inline-block; font-size: 0.8em; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--error); color: #fff; }

/* Confirmation cards for sensitive actions */
.message.action-card { border: 2px solid var(--action); background: var(--surface); padding: 12px 16px; }
.message.checklist { display: block; border-color: var(--border); background: var(--surface); padding: 12px 16px; }
.check-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.check-item label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check-item small { display: block; margin-inline-start: 26px; opacity: 0.75; }
.check-item.high > label span { font-weight: bold; }
.check-item.other { opacity: 0.7; }
.check-item.other > label { cursor: not-allowed; }
.check-item.done > label span { text-decoration: line-through; opacity: 0.6; }
.result-form { display: flex; gap: 6px; margin: 6px 0 0 26px; flex-wrap: wrap; }
.result-form input { flex: 1; min-width: 160px; }
.action-card p { margin: 6px 0; }
.action-buttons { display: flex; gap: 8px; margin-top: 8px; }

/* Big lists: a card in the chat, and the full-table page */
a.button { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; font-weight: 600; font-size: 14px;
  border-radius: var(--radius-md); padding: 0 18px; background: var(--action); color: var(--action-text); border: 1px solid var(--action); }
a.button:hover { background: var(--action-hover); border-color: var(--action-hover); }
a.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--text); }
a.button.secondary:hover { background: var(--surface-2); }
.message.list-card-chat { border: 1px solid var(--border); background: var(--surface); padding: 12px 16px; }
.list-card-chat p { margin: 6px 0; }
.list-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
body.list-page { margin: 0; padding: 16px; }
.list-card { max-width: none; }
.list-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.list-head h1 { font-size: 1.25rem; margin: 0 0 4px; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list-tools { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.list-tools input { flex: 1; max-width: 360px; }
.table-wrap { overflow-x: auto; }
#list-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
#list-table th, #list-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: right; white-space: nowrap; }
#list-table td.num { font-variant-numeric: tabular-nums; }
#list-table th button.sort { background: transparent; color: var(--text); border-color: transparent; padding: 0; min-height: 0; font-weight: bold; }
.list-pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.list-count { margin: 8px 0; }
.list-filters { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 6px 10px; margin-bottom: 8px; }
.list-filters summary { cursor: pointer; font-weight: bold; }
#filter-groups { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.filter-group { border: 0; padding: 0; margin: 0; min-width: 180px; }
.filter-group legend { font-size: 0.85rem; color: var(--muted); padding: 0; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; font-size: 0.85rem;
  font-weight: 400; min-height: 32px; }
.chip:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.range { display: flex; gap: 6px; }
.range input { width: 130px; }

/* Interactive report card */
.message.report-card { border: 1px solid var(--border); background: var(--surface); padding: 12px 16px; max-width: 100%; width: 100%; box-sizing: border-box; }
.report-head { margin-bottom: 6px; }
.report-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.report-chip { font-size: 0.8em; padding: 3px 8px; border-radius: 999px; min-height: 28px; font-weight: 400; }
.report-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.report-control { display: flex; flex-direction: column; font-size: 0.8em; color: var(--muted); gap: 2px; }
.report-control select { font: inherit; font-size: 1.1em; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px 6px; }
.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.report-tile { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.report-tile strong { font-size: 1.05em; }
.report-tile .up { color: var(--success); }
.report-tile .down { color: var(--error); }
.report-chart { position: relative; height: 320px; margin: 8px 0; }
/* What stands out: intelligence, so blue (Brand Book: blue marks insight only) */
.report-insights { margin: 8px 0; padding: 8px 12px 8px 12px; padding-inline-start: 28px; background: var(--accent-tint);
  border-inline-start: 3px solid var(--accent); border-radius: var(--radius-md); }
.report-insights li { margin: 2px 0; }
.report-table-wrap { overflow-x: auto; margin: 8px 0; }
.report-table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
.report-table th, .report-table td { border-bottom: 1px solid var(--border); padding: 5px 8px; text-align: right; }
.report-table tr.clickable { cursor: pointer; }
.report-table tr.clickable:hover { background: var(--surface-2); }
.report-table tr.total td { font-weight: bold; }
.report-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 0.9em; }
.report-range input { width: 7.5em; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px 6px; }
.report-range button { padding: 0 12px; min-height: 32px; }
.report-status { min-height: 1.2em; margin: 4px 0 0; font-size: 0.85em; }
@media (max-width: 600px) { .report-chart { height: 260px; } .report-control { flex: 1 1 45%; } }

.report-actions { align-items: center; }
.report-view { display: inline-flex; }
.report-view button { border-radius: 0; margin: 0; min-height: 36px; }
.report-view button:first-child { border-start-start-radius: var(--radius-md); border-end-start-radius: var(--radius-md); }
.report-view button:last-child { border-start-end-radius: var(--radius-md); border-end-end-radius: var(--radius-md); }
.report-view button + button { margin-inline-start: -1px; }
.report-view button.selected, .report-view button.selected:hover { background: var(--text); color: var(--bg); }
.report-download { position: relative; margin-inline-start: auto; }
.report-menu { position: absolute; bottom: 100%; inset-inline-end: 0; margin-bottom: 4px; min-width: 9em; z-index: 5;
  display: flex; flex-direction: column; gap: 2px; padding: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.report-menu[hidden] { display: none; }
.report-menu button { text-align: start; border: 0; font-weight: 400; }
.report-menu button:hover:not(:disabled), .report-menu button:focus-visible { background: var(--surface-2); }


/* ---------- Sign-in and sign-up: the form on one side, an illustration of kasbsi on the other */
.auth { display: flex; min-height: 100vh; min-height: 100dvh; background: var(--surface); }
.no-business { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 48px 16px; background: var(--surface); text-align: center; }
.no-business-inner { width: 100%; max-width: 420px; }
.no-business .auth-logo { margin: 0 auto 40px; }
.no-business h1 { font-size: 1.6rem; line-height: 1.5; margin: 0 0 8px; }
.auth-side { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-inner { width: 100%; max-width: 400px; }
.auth-logo { display: block; height: 28px; width: auto; margin: 0 0 40px; }
.auth-form h1 { font-size: 1.75rem; line-height: 1.5; margin: 0 0 6px; }
.auth-lead { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 28px; }
.auth-form label { display: block; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.auth-form input, .auth-form textarea, .auth-form select { display: block; width: 100%; margin-top: 6px; min-height: 44px; }
.auth-form textarea { min-height: 64px; resize: vertical; }
.auth-form .hint { font-size: 12px; color: var(--muted); margin: -10px 0 16px; }
.auth-primary { width: 100%; min-height: 46px; margin-top: 8px; font-size: 15px; }
.auth-primary.small { width: auto; min-width: 140px; margin-top: 0; }
.auth-foot { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--text); }
.auth-foot + .auth-foot { margin-top: 8px; }
.auth-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.auth .error { text-align: center; }
#team-add { width: 100%; }
.team-added { margin: 12px 0 0; padding-inline-start: 20px; font-size: 14px; }
.team-room { font-weight: 600; margin: 4px 0 12px; }
.team-full { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 8px 0; }
.business-switch { display: flex; flex-direction: column; margin: 4px 0; }
.invite-table { border-collapse: collapse; width: 100%; font-size: 0.9em; margin: 8px 0 16px; }
.invite-table th, .invite-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: start; vertical-align: top; }
.team-added li { margin: 4px 0; }

/* Main focus: cards to choose from */
.auth-form.wide { max-width: 560px; }
.auth-inner:has(.auth-form.wide:not([hidden])) { max-width: 560px; }
.focus-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.focus-card { margin: 0 !important; position: relative; }
.focus-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.focus-card span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer; background: var(--surface); }
.focus-card span:hover { border-color: var(--muted); }
.focus-card strong { font-size: 15px; }
.focus-card small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.focus-card input:checked + span { border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.focus-card input:focus-visible + span { outline: 3px solid var(--focus); }

/* The illustration (decorative): the brand's calm surfaces with one orange accent, no gradients */
.auth-visual { flex: 1 1 50%; padding: 24px; display: flex; }
.visual-stage { position: relative; flex: 1; border-radius: 28px; background: var(--bg); border: 1px solid var(--surface-2);
  overflow: hidden; min-height: 520px; }
.visual-card { position: absolute; background: var(--surface); border: 1px solid var(--surface-2); border-radius: 16px;
  box-shadow: 0 12px 32px rgb(9 9 11 / 8%); padding: 16px 18px; font-size: 13.5px; }
.visual-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.visual-chat { top: 16%; inset-inline: 12% 18%; }
.visual-bubble { margin: 0 0 12px auto; width: fit-content; max-width: 85%; background: var(--surface-2); border-radius: 14px;
  padding: 8px 12px; }
.visual-answer p { margin: 0 0 10px; }
.visual-bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; padding-top: 6px; border-bottom: 1px solid var(--surface-2); }
.visual-bars span { flex: 1; border-radius: 6px 6px 0 0; background: var(--accent); opacity: .35; }
.visual-bars span.now { background: var(--action); opacity: 1; }
.visual-bars .b1 { height: 38%; } .visual-bars .b2 { height: 52%; } .visual-bars .b3 { height: 45%; }
.visual-bars .b4 { height: 64%; } .visual-bars .b5 { height: 58%; } .visual-bars .b6 { height: 86%; }
.visual-doc { top: 56%; inset-inline-start: 26%; display: flex; align-items: center; gap: 12px; }
.visual-icon { font-size: 22px; }
.visual-done { margin-inline-start: 8px; background: #10B981; color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.visual-task { top: 74%; inset-inline-start: 8%; display: flex; align-items: center; gap: 12px; }
.visual-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--text); color: var(--bg); display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; }
.visual-mark { position: absolute; width: 64px; bottom: 7%; inset-inline-end: 8%; opacity: .9; }
@media (max-width: 900px) {
  .auth-visual { display: none; }
  .auth-side { padding: 32px 16px; align-items: flex-start; }
  .focus-grid { grid-template-columns: 1fr; }
}
.tour { position: fixed; inset: 0; z-index: 1000; }
.tour[hidden] { display: none; }
.tour-block { position: absolute; inset: 0; }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgb(9 9 11 / 55%); outline: 2px solid var(--action);
  pointer-events: none; transition: all .25s ease; }
.tour-bubble { position: fixed; background: var(--surface); color: var(--text); border-radius: 16px; padding: 16px 18px 12px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 22%); transition: top .25s ease, left .25s ease; }
.tour-bubble h2 { font-size: 1.05rem; margin: 2px 0 6px; }
.tour-bubble #tour-text { color: var(--muted); line-height: 1.8; margin: 0 0 12px; font-size: 14px; }
.tour-count { font-size: 12px; color: var(--muted); margin: 0; }
.tour-choices { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; }
.tour-choices[hidden] { display: none; }
.tour-nav { display: flex; align-items: center; gap: 8px; }
.tour-nav #tour-skip { margin-inline-end: auto; font-size: 13px; }
.tour-nav .small { padding: 6px 16px; font-size: 13px; min-width: 0; min-height: 36px; }
.tour-choices .auth-primary { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-bubble { transition: none; } }
/* Sample data is on: one calm line across the top, apart from the header's trial notice */
.sample-strip { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 16px; font-size: 13px;
  color: #92400E; background: #FEF3C7; border-bottom: 1px solid #FDE68A; }
.sample-strip[hidden] { display: none; }
.sample-strip .link { font-size: 13px; color: #92400E; font-weight: 600; text-decoration: underline; }
@media (prefers-color-scheme: dark) { .sample-strip { color: #FCD34D; background: #422006; border-bottom-color: #713F12; }
  .sample-strip .link { color: #FCD34D; } }
@media (max-width: 600px) { .sample-more { display: none; } }
/* One-time code: six boxes; the real input is invisible on top of them */
.otp { position: relative; display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.otp-box { width: 46px; height: 54px; display: grid; place-items: center; font-size: 22px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; }
.otp-box.filled { border-color: var(--text); }
.otp-box.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.auth-form .otp-input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0;
  cursor: text; font-size: 16px; }
@media (max-width: 400px) { .otp { gap: 6px; } .otp-box { width: 42px; height: 50px; } }

/* The upgrade page (a trial or plan has ended): what the business did, and the plan to continue */
.upgrade { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.upgrade-bar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.upgrade-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upgrade-actions .button, .upgrade-actions .secondary { min-height: 40px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; }
.upgrade-logo { height: 30px; display: block; }
.upgrade-business { color: var(--muted); font-weight: 600; margin-inline-end: auto; min-width: 0; overflow-wrap: anywhere; }
.upgrade-others { display: flex; gap: 12px; flex-wrap: wrap; }
.upgrade-inner { max-width: 760px; margin: 0 auto; padding: 40px 16px 64px; display: flex; flex-direction: column; gap: 16px; }
.upgrade-inner h1 { font-family: var(--font-heading); font-size: 2.2rem; line-height: 1.4; margin: 0; }
.upgrade-badge { align-self: flex-start; padding: 2px 14px; border-radius: 999px; background: #FFF1E8; color: var(--action-hover); font-weight: 700; font-size: 14px; }
.upgrade-stats { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.upgrade-stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; display: flex; flex-direction: column; }
.upgrade-stats strong { font-family: var(--font-heading); font-size: 2rem; color: var(--action); line-height: 1.3; }
.upgrade-pay { background: #09090B; color: #F8FAFC; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.upgrade-pay h2 { font-family: var(--font-heading); font-size: 1.6rem; margin: 0; }
.upgrade-pay .auth-sub { color: #CBD5E1; margin: 0; }
.upgrade-seg { display: flex; gap: 6px; padding: 6px; background: #18181B; border: 1px solid #3F3F46; border-radius: 14px; }
.upgrade-seg button { flex: 1; min-height: 46px; border: 0; border-radius: 10px; background: transparent; color: #E2E8F0; font: inherit; font-weight: 700; cursor: pointer; }
.upgrade-seg button[aria-pressed="true"] { background: var(--action); color: #09090B; }
.upgrade-people-row { display: flex; justify-content: flex-start; gap: 12px; align-items: baseline; font-weight: 600; }
.upgrade-people-row output { font-family: var(--font-heading); font-size: 2rem; color: #FB923C; }
.upgrade-pay input[type="range"] { width: 100%; accent-color: var(--action); height: 40px; }
.upgrade-total { background: #18181B; border: 1px solid #3F3F46; border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.upgrade-total > strong { font-family: var(--font-heading); font-size: 2rem; }
.upgrade-total > span { color: #FDBA74; font-weight: 600; }
.upgrade-total dl { margin: 8px 0 0; }
.upgrade-total dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #27272A; }
.upgrade-total dl div:last-child { border-bottom: 0; }
.upgrade-total dt { color: #CBD5E1; }
.upgrade-total dd { margin: 0; font-weight: 700; }
.upgrade-total small { color: #A1A1AA; }
.upgrade-pay .auth-primary { margin-top: 0; min-height: 54px; font-size: 1.05rem; }
@media (max-width: 600px) {
  .upgrade-bar { flex-wrap: wrap; padding: 12px 16px; row-gap: 12px; }
  .upgrade-logo { height: 26px; }
  .upgrade-business { font-size: 0.95rem; }
  .upgrade-actions { width: 100%; }
  .upgrade-actions .button, .upgrade-actions .secondary { flex: 1; min-height: 44px; }
  .upgrade-others { width: 100%; flex-direction: column; gap: 8px; }
  .upgrade-inner { padding: 24px 16px 40px; gap: 14px; }
  .upgrade-inner h1 { font-size: 1.7rem; }
  .upgrade-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .upgrade-stats li { padding: 14px; }
  .upgrade-stats strong { font-size: 1.6rem; }
  .upgrade-stats span { font-size: 0.9rem; }
  .upgrade-pay { padding: 20px 16px; }
  .upgrade-seg button { font-size: 0.85rem; padding: 0 6px; }
  .upgrade-total { padding: 16px; }
  .upgrade-total > strong { font-size: 1.6rem; }
}
