/* Portail Starcolor. Phone first: bottom tab bar; from 900px a sidebar. Light and dark follow the device. */
:root {
  --bg: #F2F3F5; --surface: #FFFFFF; --surface-2: #F5F6F8; --line: #E3E5E9; --line-soft: #EEF0F2;
  --ink: #14171C; --soft: #3F4654; --muted: #5B6270;
  --accent: #2340D8; --on-accent: #FFFFFF; --accent-soft: #E8ECFB; --accent-ink: #2340D8;
  --ok: #1E6B4B; --ok-bg: #E4F3EC; --warn: #8A5300; --warn-bg: #FDF0DC; --bad: #B42318; --bad-bg: #FDE8E6;
  --neutral: #3F4654; --neutral-bg: #EEF0F4;
  --nav-bg: #101418; --nav-ink: #B8BEC8;
  --display: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1115; --surface: #171B21; --surface-2: #1E232A; --line: #2A3038; --line-soft: #232830;
    --ink: #EEF0F3; --soft: #C2C8D0; --muted: #9AA2AE;
    --accent: #7A8FFF; --on-accent: #0E1115; --accent-soft: #1E2647; --accent-ink: #B4C2FF;
    --ok: #6FD3A0; --ok-bg: #13301F; --warn: #F0B45E; --warn-bg: #3A2A10; --bad: #FF8A80; --bad-bg: #3B1714;
    --neutral: #C2C8D0; --neutral-bg: #232830; --nav-bg: #0A0C10;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1, h2, p { margin: 0; }
h1 { font-family: var(--display); font-size: 28px; font-weight: 650; line-height: 1.15; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.main { max-width: 760px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }

/* Navigation: bottom bar on phones */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav .brand { display: none; }
.nav-link { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; }
.nav-link[aria-current="page"] { color: var(--accent); font-weight: 650; }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #FFFFFF; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

@media (min-width: 900px) {
  .nav { top: 0; right: auto; width: 232px; display: flex; flex-direction: column; gap: 2px; padding: 24px 14px; background: var(--nav-bg); border: 0; }
  .nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; color: #FFFFFF; text-decoration: none; font-weight: 700; letter-spacing: 0.06em; }
  .nav .brand small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--nav-ink); }
  .nav-link { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: 8px; color: var(--nav-ink); font-size: 14px; }
  .nav-link:hover { background: #1C222A; color: #FFFFFF; }
  .nav-link[aria-current="page"] { background: #F2F3F5; color: #14171C; }
  .badge { position: static; margin-left: auto; }
  .main { margin-left: 232px; margin-right: 0; padding: 32px 40px 56px; max-width: 900px; }
}

.logo { width: 30px; height: 30px; border-radius: 8px; background: #2340D8; color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.logo.big { width: 52px; height: 52px; border-radius: 14px; font-size: 24px; }

.page-head { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.eyebrow, .label { font-size: 13px; color: var(--muted); }
.back { font-size: 14px; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.accent { color: var(--accent-ink); }
.section { font-family: var(--display); font-size: 18px; font-weight: 650; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.count { font: 600 12px var(--body); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 1px 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.tight { padding: 14px; gap: 6px; }
.card.flush { padding: 2px 16px; gap: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big { font-family: var(--display); font-size: 36px; font-weight: 650; line-height: 1.05; font-variant-numeric: tabular-nums; }
.mid { font-family: var(--display); font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.up { color: var(--ok); } .down { color: var(--bad); }
.meter { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.item { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 0; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.card.flush > .item:first-child { border-top: 0; }
.item.report { flex-direction: column; align-items: stretch; gap: 6px; }
.item.report ul { margin: 0; padding-left: 18px; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item-sub.late { color: var(--bad); font-weight: 600; }
.lead { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--surface-2); color: var(--soft); }
.lead.warn { background: var(--warn-bg); color: var(--warn); }
.empty { padding: 14px 0; color: var(--muted); }
.card.empty { padding: 14px 16px; }

.pill { display: inline-flex; align-items: center; white-space: nowrap; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.neutral { background: var(--neutral-bg); color: var(--neutral); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { display: contents; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--soft); min-width: 0; }
.field input, .field select, .field textarea, .search input { min-height: 48px; width: 100%; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.field textarea { padding: 12px; min-height: 120px; resize: vertical; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 14px; background: var(--line-soft); }
.seg button { flex: 1 1 auto; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--soft); font: inherit; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.callout { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.callout.ok { background: var(--ok-bg); color: var(--ok); }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.bad { background: var(--bad-bg); color: var(--bad); }

.fu { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fu.warn { border-left-color: var(--warn); } .fu.bad { border-left-color: var(--bad); } .fu.ok { border-left-color: var(--ok); }
.fu .actions { margin-top: 6px; }
details.card summary { min-height: 32px; font-weight: 650; cursor: pointer; }
.rules { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.result dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.result dt { color: var(--muted); font-size: 13px; margin-top: 8px; }
.result dd { margin: 0; min-width: 0; }
@media (min-width: 600px) { .result dl { grid-template-columns: minmax(0, 8em) minmax(0, 1fr); gap: 10px 12px; } .result dt { margin-top: 8px; } }
.result textarea, .result input { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 15px; }
.result select { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; }
.result .act-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 10px; }
@media (min-width: 600px) { .result .act-row { grid-template-columns: minmax(0, 1fr) 170px; } }

.login { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; }
.login-card .callout, .login-card .btn, .dev-login { width: 100%; text-align: left; }
.dev-login { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 30; max-width: min(440px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; }
@media (prefers-reduced-motion: no-preference) { .card, .fu { transition: border-color 0.15s; } }

/* Navigation: extra pages are in the sidebar on a computer, under "Plus" on the phone. */
.nav-link.desk { display: none; }
@media (min-width: 900px) { .nav-link.desk { display: flex; } .nav-link.phone { display: none; } }
.chev { width: 18px; height: 18px; color: var(--muted); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--soft); font-size: 14px; text-decoration: none; white-space: nowrap; }
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

.calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 600px) { form.calc:not([method="post"]) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; } }
.fam-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }

.doc-link { color: var(--ink); text-decoration: none; }
.item form { display: contents; }

.kv { margin: 4px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12px; margin-top: 6px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 600px) { .kv { grid-template-columns: minmax(0, 11em) minmax(0, 1fr); } .kv dt { margin-top: 4px; } .kv dd { margin-top: 4px; } }
.fu details summary { cursor: pointer; color: var(--muted); }
.answer { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.answer textarea { min-height: 64px; }
input[type="file"] { padding: 10px 12px; }

/* Administration */
.user-row .item-main { gap: 2px; }
.user-row details { margin-top: 6px; }
.user-row summary { cursor: pointer; color: var(--accent); min-height: 32px; display: flex; align-items: center; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; }
.objectives { display: flex; flex-direction: column; gap: 14px; }
.months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.months input { text-align: right; padding: 0 10px; }
ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.pilot { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13px; text-align: center; }

/* Home dashboard: one column on the phone, two on a computer. */
:root { --under: #C96F12; }
@media (prefers-color-scheme: dark) { :root { --under: #F0A44E; } }
.main:has(.dash) { max-width: 1120px; }
.dash { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "month" "kpis" "quick" "today" "todo" "chart" "watch" "recent"; }
.dash > * { min-width: 0; }
.block { display: flex; flex-direction: column; gap: 10px; }
.block .section { margin-top: 4px; }
@media (min-width: 1000px) {
  .dash { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start;
    grid-template-areas: "month chart" "kpis chart" "quick today" "todo today" "todo watch" "recent watch"; }
}
.card.hero { gap: 8px; }
.hero .big { font-size: 40px; }
.quick4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.qa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.qa .ic { width: 24px; height: 24px; color: var(--accent); }
.qa.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qa.primary .ic { color: var(--on-accent); }
.lead.bad { background: var(--bad-bg); color: var(--bad); }
.lead.info { background: var(--accent-soft); color: var(--accent-ink); }
.item .chev { margin-left: auto; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar.ok { fill: var(--accent); }
.chart .bar.under { fill: var(--under); }
.chart .bar.current { opacity: 0.55; }
.chart .goal { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 2; opacity: 0.55; }
.chart .axis { font-size: 10px; fill: var(--muted); font-family: var(--body); }
.chart .axis.now { fill: var(--ink); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.ok { background: var(--accent); } .sw.under { background: var(--under); }
.sw.goal { height: 0; border-top: 2px dashed var(--ink); opacity: 0.55; width: 14px; border-radius: 0; }
.viewing { margin: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.linkish { background: none; border: 0; padding: 0; min-height: 32px; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.user-row form { display: block; }

/* Import */
.import-result { display: flex; flex-direction: column; gap: 8px; }
.import-result:empty { display: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
table.sample { border-collapse: collapse; width: 100%; font-size: 13px; }
table.sample th, table.sample td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.sample th { color: var(--muted); font-weight: 600; background: var(--surface-2); }

/* Agenda */
.ag-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ag-bar .btn.primary { margin-left: auto; }
.ag-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.ag-day > .ag-item:first-child { border-top: 0; }
.ag-time { flex: none; width: 52px; font-size: 13px; line-height: 1.35; padding-left: 10px; border-left: 3px solid var(--accent); }
.ag-item.call .ag-time { border-left-color: var(--ok); }
.ag-item.google .ag-time { border-left-color: var(--line); color: var(--muted); }
.ag-item .item-main { gap: 2px; }
.ag-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ag-actions .btn .ic { width: 16px; height: 16px; }
.select-like { flex: 1; min-height: 48px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.card.connect { border-color: var(--accent); }
.disconnect { display: flex; gap: 6px; align-items: center; }

/* Map and tours */
.map { height: min(58vh, 520px); border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
button.chip { cursor: pointer; font: inherit; font-size: 14px; gap: 6px; }
button.chip:not(.on) { opacity: 0.45; text-decoration: line-through; }
button.chip.on { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 500; }
.tour-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.tour-list:empty { display: none; }
.tour-list li { display: flex; align-items: center; gap: 8px; }
.tour-list li::marker { font-weight: 700; color: var(--accent); }
.tour-plan { display: flex; flex-direction: column; gap: 10px; }
.info { font: 14px/1.4 var(--body); color: #14171C; max-width: 240px; }
.info .actions { margin-top: 8px; }
