/* ---------- Font (bundled, works offline) ---------- */
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/public-sans-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/public-sans-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #eef1f5;          /* page */
  --card: #ffffff;        /* surfaces */
  --field: #ffffff;
  --text: #172033;        /* ink */
  --muted: #5d6779;
  --line: #d8dee8;
  --line-soft: #e8ecf2;
  --ink: #172033;         /* dark bars and dossier head */
  --ink-text: #f2f4f8;
  --ink-muted: #a8b2c4;
  --accent: #3d4ed8;      /* Majorelle blue: actions, selection */
  --accent-soft: #eceffe;
  --accent-ink: #ffffff;
  --good: #1d7a4e;
  --warn: #a35d00;
  --bad: #b42318;
  --good-bg: #e6f4ec;
  --warn-bg: #fdf1df;
  --bad-bg: #fdeceb;
  --radius: 8px;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141d;
    --card: #171d29;
    --field: #111722;
    --text: #e8ecf3;
    --muted: #97a1b3;
    --line: #2a3242;
    --line-soft: #222a38;
    --ink: #0b1018;
    --ink-text: #eef1f6;
    --ink-muted: #8f9ab0;
    --accent: #8d98ff;
    --accent-soft: #232a4d;
    --accent-ink: #0f141d;
    --good: #5cc98f;
    --warn: #f0b25c;
    --bad: #f28b82;
    --good-bg: #16301f;
    --warn-bg: #33270f;
    --bad-bg: #3a1a18;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); overflow-x: clip; font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
small { color: var(--muted); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Controls ---------- */
label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 550; color: var(--text); }
label small { font-size: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); color: var(--text);
  font: 400 15px/1.3 var(--font);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=file] { padding: 7px; min-height: 0; }
input[readonly] { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; min-height: 64px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); font: 600 14px/1.2 var(--font); cursor: pointer; white-space: nowrap;
}
button:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
button.secondary:hover { border-color: var(--muted); background: var(--card); }
button.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--card); }
button.danger:hover { background: var(--bad-bg); }
button.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { background: none; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.msg { min-height: 1.2em; margin: 8px 0 0; font-size: 13px; }
.msg:empty { min-height: 0; margin: 0; }
.msg.error { color: var(--bad); }
.private { font-size: 13px; color: var(--muted); }
.unsynced { color: var(--warn); }
.count { font-weight: 500; color: var(--muted); font-size: .9em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.banner { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 13px; border: 1px solid var(--line); }

/* Tier pills */
.tier { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tier.Trusted { color: var(--good); background: var(--good-bg); }
.tier.Normal { color: var(--accent); background: var(--accent-soft); }
.tier.Caution { color: var(--warn); background: var(--warn-bg); }
.tier.Blocked { color: var(--bad); background: var(--bad-bg); }

/* ---------- Top bar (agency app and admin) ---------- */
header, .topbar {
  display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: var(--ink); color: var(--ink-text); position: sticky; top: 0; z-index: 5;
}
header h1 { font-size: 17px; font-weight: 700; }
header small { color: var(--ink-muted); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-sub { font-size: 12px; color: var(--ink-muted); }
.status { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; }
.net { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.net::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.net.on::before { background: #4ade80; }
.net.off::before { background: #f87171; }
.pending { color: #fbbf24; font-weight: 600; }
.last-sync { color: var(--ink-muted); }
.toggle { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-muted); font-weight: 500; }
.toggle input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
header button, button.on-dark { background: transparent; border-color: color-mix(in srgb, var(--ink-text) 35%, transparent); color: var(--ink-text); min-height: 34px; padding: 6px 12px; }
header button:hover, button.on-dark:hover { background: color-mix(in srgb, var(--ink-text) 12%, transparent); }
.link-on-dark { background: none !important; border: 0 !important; padding: 0 !important; min-height: 0 !important; color: var(--ink-muted) !important; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.link-on-dark:hover { color: var(--ink-text) !important; }

/* ---------- Workspace layout ---------- */
.workspace { display: grid; gap: 20px; padding: 20px; max-width: 1480px; margin: 0 auto; grid-template-columns: 1fr; align-items: start; }
.col-main { display: grid; gap: 20px; min-width: 0; }
@media (min-width: 1080px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(420px, 500px); }
  .dossier { position: sticky; top: 76px; }
}

/* Search: the main action */
.searchbar { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.searchbar h2 { margin-bottom: 12px; }
.search-form { display: grid; grid-template-columns: 150px 140px minmax(0, 1fr) auto; gap: 8px; }
.search-form label { margin: 0; }
.search-form input, .search-form select { margin-top: 0; min-height: 44px; }
.search-form .f-query input { font-size: 16px; }
.search-form .f-go { min-height: 44px; padding: 0 22px; }
@media (max-width: 640px) {
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form .f-query, .search-form .f-go { grid-column: 1 / -1; }
}
#lookupResult:not(:empty) { margin-top: 14px; }
.lookup-hit { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lookup-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--bg); font-size: 13px; color: var(--muted); }

/* Client rows */
.client-list { display: grid; }
.client-row {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) 112px 112px; gap: 14px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent;
}
.client-list .client-row + .client-row { margin-top: 2px; }
.client-row:hover { background: var(--bg); }
.client-row.selected { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.cr-photo { position: relative; z-index: 1; }
.cr-main { min-width: 0; }
.cr-name { all: unset; display: block; font-weight: 650; font-size: 15px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-name::after { content: ''; position: absolute; inset: 0; border-radius: 10px; }
.cr-name:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.cr-sub { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 13px; color: var(--muted); }
.cr-id { letter-spacing: .02em; }
.client-row > .tier { justify-self: start; }
.cr-meta { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.client-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 520px) {
  .client-row { grid-template-columns: 40px minmax(0, 1fr) 104px; }
  .cr-meta { display: none; }
}

.photo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--line-soft); display: block; }
.photo-btn { all: unset; cursor: zoom-in; border-radius: 8px; display: block; }
.photo-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zoomable:hover .photo { outline: 2px solid var(--accent); outline-offset: 1px; }

/* New client card */
.new-client { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ---------- Dossier (client profile) ---------- */
.dossier { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.dossier-empty { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 56px 32px; color: var(--muted); }
.dossier-empty svg { color: var(--line); margin-bottom: 8px; }
.dossier-empty p { margin: 0; max-width: 34ch; font-size: 14px; }
.dossier-empty strong { color: var(--text); font-size: 15px; }

.dossier-head { position: relative; background: var(--ink); color: var(--ink-text); padding: 20px 20px 0; }
.close-x { position: absolute; top: 10px; right: 10px; min-height: 32px; width: 32px; padding: 0; background: transparent; border: 0; color: var(--ink-muted); }
.close-x:hover { background: color-mix(in srgb, var(--ink-text) 12%, transparent); color: var(--ink-text); }
.id-block { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding-right: 28px; }
.id-block .photo { width: 84px; height: 100px; border-radius: 8px; background: color-mix(in srgb, var(--ink-text) 10%, transparent); }
.id-name { font-size: 21px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.id-lines { display: grid; gap: 1px; margin-top: 4px; font-size: 13px; color: var(--ink-muted); }
.id-code { color: var(--ink-text); letter-spacing: .04em; font-weight: 600; }
.id-pending { color: #fbbf24; }

.id-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.fact { display: grid; gap: 1px; align-content: start; min-width: 0; padding: 8px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--ink-text) 7%, transparent); border: 1px solid color-mix(in srgb, var(--ink-text) 10%, transparent); }
.fact.wide { grid-column: 1 / -1; }
.fact-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); }
.fact-val { font-size: 15px; font-weight: 600; color: var(--ink-text); letter-spacing: .02em; overflow-wrap: anywhere; }
.fact.wide .fact-val { font-size: 13px; font-weight: 400; letter-spacing: 0; white-space: pre-wrap; }
.fact-val a { color: inherit; text-decoration: none; }
.fact-val a:hover { text-decoration: underline; }
.fact-sub { font-size: 12px; color: var(--ink-muted); }
.fact-sub .doc-flag { margin-left: 6px; }
.fact-empty { color: var(--ink-muted); font-weight: 400; }
.facts-note { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 11.5px; color: var(--ink-muted); }
.facts-note svg { flex: none; }
@media (max-width: 330px) { .id-facts { grid-template-columns: minmax(0, 1fr); } }
/* Score seal: the one strong element */
.seal { display: grid; justify-items: center; align-content: center; width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid currentColor; text-align: center; line-height: 1; }
.seal b { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.seal span { font-size: 11px; font-weight: 700; margin-top: 4px; }
.seal.Trusted { color: #4ade80; } .seal.Normal { color: #a5b0ff; } .seal.Caution { color: #fbbf24; } .seal.Blocked { color: #f87171; }
.seal.none { color: var(--ink-muted); }
.seal.none b { font-size: 15px; font-weight: 600; }
.tier-strip { margin: 16px -20px 0; padding: 9px 20px; font-size: 13px; font-weight: 600; }
.tier-strip.Trusted { background: var(--good-bg); color: var(--good); }
.tier-strip.Normal { background: var(--accent-soft); color: var(--accent); }
.tier-strip.Caution { background: var(--warn-bg); color: var(--warn); }
.tier-strip.Blocked { background: var(--bad-bg); color: var(--bad); }
.tier-strip.none { background: var(--bg); color: var(--muted); }
@media (max-width: 440px) {
  .fact { padding: 7px 10px; }
  .fact-val { font-size: 14px; }
  .id-block { grid-template-columns: 64px minmax(0, 1fr); padding-right: 24px; }
  .id-block .photo { width: 64px; height: 76px; }
  .seal { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; width: auto; height: auto;
    border-radius: 999px; border-width: 2px; padding: 6px 16px; justify-self: start; }
  .seal b { font-size: 24px; }
  .seal span { margin: 0; font-size: 13px; }
  .stats span { font-size: 16px; }
}
#profileExternal:not(:empty) { padding: 16px 20px 0; }
#profileExternal .banner { margin: 0; }

.tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (max-width: 480px) { .tabs { padding: 0 14px; } .tabs button { margin-right: 10px; } }
.tabs button { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 12px 4px 10px; margin-right: 16px; min-height: 0; font-weight: 600; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { padding: 16px 20px 20px; }
.panel-note { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
#newRentalBtn { margin-top: 14px; }
#rentalFormWrap { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
#rentalFormWrap h3 { margin-bottom: 12px; }

/* Rental history */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.stats div { padding: 10px 14px; font-size: 12px; color: var(--muted); }
.stats div + div { border-left: 1px solid var(--line); }
.stats span { display: block; font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.3; }
.stats em { font-style: normal; color: var(--bad); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; border-bottom-color: var(--line); }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td:first-child { white-space: normal; min-width: 84px; font-weight: 600; }
td small { color: var(--muted); font-weight: 400; }
td.num, th.num { text-align: right; }
td.act { text-align: right; }
td.act button { min-height: 28px; padding: 3px 9px; font-size: 12px; }
tr.flagged td:not(.act) { text-decoration: line-through; color: var(--muted); }
tr.flag-note td, tr.flag-form-row td { white-space: normal; font-size: 12px; padding: 8px 10px; background: var(--bad-bg); }
.flag-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--bad); color: #fff; font-weight: 600; margin-right: 6px; }
.flag-form { display: grid; gap: 6px; }
.flag-form label { margin: 0; }
.flag-form .row { gap: 8px; }
.flag-form .row > * { flex: 0 0 auto; }

/* Rental form */
.date-field { position: relative; display: flex; gap: 6px; margin-top: 5px; }
.date-field input[name=startDate] { margin-top: 0; }
.cal-btn { flex: none; padding: 0 11px; }
.date-picker { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; min-height: 0; }
.total-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); font-size: 14px; }
#rentalTotal { font-size: 20px; margin-left: 8px; color: var(--text); }

/* Reviews and events */
.reviews h3 { margin-bottom: 10px; }
.review-list { list-style: none; margin: 0 0 16px; padding: 0; font-size: 13px; }
.review-list li { padding: 10px 0 10px 14px; border-left: 3px solid var(--line); margin-bottom: 8px; }
.review-list li.ev-bad { border-left-color: var(--bad); }
.review-list li.ev-warn { border-left-color: var(--warn); }
.review-list li.ev-good { border-left-color: var(--good); }
.review-list .ev-head { display: flex; flex-wrap: wrap; gap: 0 10px; align-items: baseline; }
.review-list .ev-head span { color: var(--muted); }
.note { margin-top: 3px; white-space: pre-wrap; }
.review-form { border-top: 1px solid var(--line); padding-top: 14px; }
.review-form h4 { margin: 0 0 10px; font-size: 14px; }

/* ---------- Photo enlarge, toast ---------- */
.photo-dialog { width: auto; max-width: min(92vw, 760px); padding: 12px; text-align: center; cursor: zoom-out; background: var(--card); color: var(--text); border: 0; border-radius: 12px; }
.photo-dialog img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; object-fit: contain; }
.photo-dialog p { margin: 10px 0 2px; font-weight: 600; }
.photo-dialog::backdrop { background: rgba(10, 14, 22, .78); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; max-width: min(92vw, 520px);
  background: var(--ink); color: var(--ink-text); padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(10, 14, 22, .25); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .18s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
}

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.login-card { width: min(380px, 100%); display: grid; gap: 2px; padding: 28px; }
.login-card h1 { font-size: 22px; margin: 10px 0 2px; }
.login-card .private { margin: 0 0 14px; }
.login-card button { margin-top: 4px; min-height: 44px; }

.client-row.selected .tier { background: var(--card); }
td.num small { white-space: nowrap; }

.table-wrap { position: relative; }
/* Narrow space (side panel, phones): each rental becomes a small stacked block instead of a wide table */
#rentalHistory { container-type: inline-size; container-name: hist; }
@container hist (max-width: 640px) {
  .table-wrap thead { display: none; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap tbody tr:not(.flag-note):not(.flag-form-row) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft);
  }
  .table-wrap tbody tr:not(.flag-note):not(.flag-form-row) td { display: block; border: 0; padding: 0; white-space: normal; }
  .table-wrap td:nth-child(1) { grid-column: 1; }
  .table-wrap td:nth-child(2) { grid-column: 1; font-size: 13px; }
  .table-wrap td:nth-child(3) { grid-column: 2; grid-row: 1 / span 2; text-align: right; max-width: 230px; }
  .table-wrap td:nth-child(3) small { white-space: normal; }
  .table-wrap td.act { grid-column: 1 / -1; text-align: left; margin-top: 6px; }
  .table-wrap tr.flag-note, .table-wrap tr.flag-form-row { display: block; }
  .table-wrap tr.flag-note td, .table-wrap tr.flag-form-row td { display: block; }
}

header button.secondary { background: transparent; border-color: color-mix(in srgb, var(--ink-text) 35%, transparent); color: var(--ink-text); }
header button.secondary:hover { background: color-mix(in srgb, var(--ink-text) 12%, transparent); }
.card > h2 { margin-bottom: 14px; }
.stats span { white-space: nowrap; }
@media (max-width: 440px) { .stats div { padding: 8px 10px; } .stats span { font-size: 15px; } }

.head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .clients .card-head { flex-wrap: wrap; } .head-actions { width: 100%; justify-content: stretch; } .head-actions button { flex: 1 1 auto; } }

.foot-actions, .banner-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.banner-actions { margin-top: 10px; }
.banner-actions { display: flex; }

/* ---------- Sections: Clients / Flotte et planning ---------- */
.viewnav { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.viewnav button { background: transparent; border: 0; color: var(--ink-muted); min-height: 34px; padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.viewnav button:hover { color: var(--ink-text); background: color-mix(in srgb, var(--ink-text) 10%, transparent); }
.viewnav button[aria-current=true] { color: var(--ink-text); background: color-mix(in srgb, var(--ink-text) 16%, transparent); }
@media (max-width: 700px) { .viewnav { order: 3; width: 100%; margin: 0; } .viewnav button { flex: 1; } }

.fleet-view { display: grid; gap: 20px; padding: 20px; max-width: 1480px; margin: 0 auto; }
.fleet-head .card-head { margin-bottom: 10px; }
.fleet-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 40%), 1fr)); gap: 10px; }
.fleet-stats:empty { display: none; }
.fleet-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; border-left-width: 4px; }
.fleet-stats b { display: block; font-size: 24px; line-height: 1.1; }
.fleet-stats span { font-size: 13px; color: var(--muted); }
.fleet-stats .st-free { border-left-color: var(--good); }
.fleet-stats .st-rented { border-left-color: var(--accent); }
.fleet-stats .st-maint { border-left-color: var(--warn); }
.alerts { margin-top: 14px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-bg); border-radius: 10px; padding: 12px 14px; }
.alerts h3 { font-size: 14px; margin-bottom: 6px; color: var(--warn); }
.alerts ul { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.alerts li.bad { color: var(--bad); }

/* Segmented buttons */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { background: var(--card); color: var(--text); border: 0; border-radius: 0; min-height: 34px; padding: 6px 12px; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--bg); }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
.seg.wide { display: flex; margin-bottom: 14px; }
.seg.wide button { flex: 1; }
.plan-toolbar { flex-wrap: wrap; }
.plan-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12px; color: var(--muted); margin: -4px 0 10px; }
.plan-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plan-legend .hint { margin-left: auto; }
.lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.rent { background: var(--accent); }
.lg.maint { background: repeating-linear-gradient(45deg, var(--muted) 0 3px, color-mix(in srgb, var(--muted) 55%, transparent) 3px 6px); }
.lg.pending { border: 2px dashed var(--warn); }

/* ---------- Planning (one row per car, one column per day) ---------- */
.plan-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.plan { --car: 210px; --col: 40px; min-width: calc(var(--car) + var(--days) * var(--col)); }
.plan-row { display: grid; grid-template-columns: var(--car) 1fr; border-bottom: 1px solid var(--line-soft); }
.plan-row:last-child { border-bottom: 0; }
.plan-car { position: sticky; left: 0; z-index: 3; background: var(--card); border-right: 1px solid var(--line); padding: 8px 12px;
  display: flex; align-items: center; gap: 10px; min-width: 0; }
.plan-car b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-car small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-car > div { min-width: 0; }
.plan-head .plan-car { font-size: 12px; font-weight: 600; color: var(--muted); }
.plan-track { display: grid; grid-template-columns: repeat(var(--days), minmax(var(--col), 1fr)); grid-template-rows: 52px; }
.plan-head .plan-track { grid-template-rows: auto; }
.pd { grid-row: 1; text-align: center; padding: 6px 0; font-size: 11px; color: var(--muted); border-left: 1px solid var(--line-soft); position: relative; }
.pd b { display: block; font-size: 15px; color: var(--text); }
.pd em { position: absolute; top: -1px; left: 3px; font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent); text-transform: lowercase; }
.pd.we { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.pd.today { background: var(--accent); color: #fff; }
.pd.today b { color: #fff; }
.pc { grid-row: 1; min-height: 0; padding: 0; border: 0; border-left: 1px solid var(--line-soft); border-radius: 0; background: transparent; }
.pc.we { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.pc.today { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.pc:hover:not(:disabled) { background: var(--accent-soft); cursor: copy; }
.pc:disabled { cursor: not-allowed; }
.plan-row.out .plan-track { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--line-soft) 8px 10px); }
.bar { grid-row: 1; z-index: 2; margin: 9px 2px; min-height: 0; padding: 0 8px; border-radius: 7px; justify-content: flex-start;
  font-size: 12px; font-weight: 600; overflow: hidden; white-space: nowrap; border: 0; }
.bar span { overflow: hidden; text-overflow: ellipsis; }
.bar.rent { background: var(--accent); color: #fff; }
.bar.rent:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.bar.maint { background: repeating-linear-gradient(45deg, var(--muted) 0 6px, color-mix(in srgb, var(--muted) 80%, #000) 6px 12px); color: #fff; }
.bar.pending { outline: 2px dashed var(--warn); outline-offset: -2px; opacity: .85; }
.bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dot.free { background: var(--good); }
.dot.rented { background: var(--accent); }
.dot.maint, .dot.out { background: var(--warn); }
@media (max-width: 640px) { .plan { --car: 130px; --col: 38px; } .plan-legend .hint { margin-left: 0; width: 100%; } }

/* ---------- Car list ---------- */
.fleet-table-wrap { overflow-x: auto; }
.fleet-table td { vertical-align: top; white-space: normal; }
.fleet-table td:first-child { min-width: 170px; }
.fleet-table td.act { white-space: nowrap; }
.fleet-table td.act button + button { margin-left: 6px; }
.fleet-table tr.retired td { color: var(--muted); }
.state { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.state.free { background: var(--good-bg); color: var(--good); }
.state.rented { background: var(--accent-soft); color: var(--accent); }
.state.maint, .state.out { background: var(--warn-bg); color: var(--warn); }
.state.retired { background: var(--bg); color: var(--muted); }
.due { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; margin: 0 4px 4px 0; background: var(--bg); color: var(--muted); white-space: nowrap; }
.due.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.due.bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
@media (max-width: 640px) {
  .fleet-table thead { display: none; }
  .fleet-table, .fleet-table tbody { display: block; }
  .fleet-table tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .fleet-table td { display: block; border: 0; padding: 0; }
  .fleet-table td:nth-child(2), .fleet-table td:nth-child(3), .fleet-table td.act { grid-column: 1 / -1; }
  .fleet-table td.num { grid-column: 2; grid-row: 1; }
}

/* ---------- Dialogs ---------- */
.form-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; border-radius: 14px; padding: 22px; background: var(--card); color: var(--text); }
.form-dialog::backdrop { background: rgba(10, 14, 22, .6); }
.form-dialog h2 { margin-bottom: 16px; }
.form-dialog fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 0; margin: 4px 0 12px; }
.form-dialog legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.form-dialog .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.form-dialog .kv dt { color: var(--muted); }
.form-dialog .kv dd { margin: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.dialog-actions .spacer { flex: 1; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
#planClient { height: auto; min-height: 120px; padding: 4px; }
#planClient option { padding: 6px 8px; border-radius: 6px; }
#planClientSearch { margin-bottom: 6px; }
.avail { margin: 0 0 12px; font-size: 13px; font-weight: 600; min-height: 1.2em; }
.avail:empty { margin: 0; }
.avail.free { color: var(--good); }
.avail.busy { color: var(--bad); }
.refused { color: var(--bad); font-weight: 600; }
.refused-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.refused-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 6px; }
.pending.has-refused { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; color: #fca5a5; }
.cancel-reason { margin-top: 4px; }

/* ---------- Import of an agency's history ---------- */
.import-dialog { width: min(720px, calc(100vw - 32px)); }
.import-dialog #importFor { margin: -8px 0 14px; }
.import-steps { margin: 0 0 14px; padding-left: 20px; font-size: 14px; display: grid; gap: 6px; }
.import-steps a { color: var(--accent); font-weight: 600; }
.file-drop { display: flex; align-items: center; justify-content: center; min-height: 84px; border: 2px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; font-weight: 600; color: var(--accent); }
.file-drop:hover, .file-drop:focus-within { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop span { overflow-wrap: anywhere; }
.import-head { font-size: 14px; margin-bottom: 10px; overflow-wrap: anywhere; }
.import-head.ok { color: var(--good); font-weight: 600; }
.form-dialog .import-kv { font-size: 14px; }
.import-count { font-size: 13px; margin: 6px 0 8px; }
.import-count.good { color: var(--good); }
.import-count .bad { color: var(--bad); }
.import-count .warn { color: var(--warn); }
.import-issues { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-issues table { font-size: 13px; }
.import-issues th { position: sticky; top: 0; background: var(--card); text-align: left; }
.import-issues th, .import-issues td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.import-issues td:nth-child(2) { text-align: right; white-space: nowrap; }
.import-issues tr.error td:last-child { color: var(--bad); }
.import-issues tr.warning td:last-child { color: var(--warn); }
.priv-note { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.rent-note { color: var(--muted); }
.import-issues table { table-layout: auto; min-width: 0; }
.import-issues td { white-space: normal; overflow-wrap: anywhere; }
.import-issues td:first-child { white-space: nowrap; }

/* ---------- Edit / delete a client ---------- */
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.profile-actions button { min-height: 32px; min-width: 92px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1; }
.profile-actions .info-btn { margin-left: auto; }
.info-section { margin: 0 0 16px; }
.info-section h3 { margin: 0 0 8px; font-size: 14px; font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.info-section h3 small { font-weight: 400; color: var(--muted); }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.info-grid dt { font-size: 12px; color: var(--muted); }
.info-grid dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.info-grid .muted { color: var(--muted); font-weight: 400; }
.info-note { margin: 0; font-size: 14px; white-space: pre-wrap; }
.id-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
@media (max-width: 480px) { .info-grid { grid-template-columns: minmax(0, 1fr); } }
.edit-group legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.edit-group legend small { font-weight: 400; color: var(--ink-muted); }
.edit-group .private { margin: 0 0 8px; }
.edit-group textarea { width: 100%; }
.remove-list { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }

/* ---------- Sales dashboard ---------- */
.sales-toolbar { flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi .fee-cats { display: grid; gap: 1px; }
.kpi .fee-cats span { display: flex; justify-content: space-between; gap: 8px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.kpi > span { font-size: 13px; color: var(--muted); }
.kpi > b { font-size: 24px; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi.main { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.kpi.main > b { font-size: 28px; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi small b { color: var(--text); }
.delta { font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }
.sales-chart { position: relative; }
.empty-chart { color: var(--muted); padding: 30px 0; text-align: center; }
.bars { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; height: 240px; margin: 8px 0 0 44px; padding-bottom: 22px; }
.bars .grid { position: absolute; inset: 0 0 22px 0; pointer-events: none; }
.bars .tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.bars .tick span { position: absolute; right: calc(100% + 6px); top: -8px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars .col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; padding: 0; min-height: 0; border: 0; border-radius: 0; background: transparent; color: inherit; cursor: default; }
.bars .col[data-month], .bars .col[data-year] { cursor: pointer; }
.bars .col:hover, .bars .col:focus-visible { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.bars .sbar { position: relative; width: min(70%, 44px); background: var(--accent); border-radius: 4px 4px 0 0; margin-bottom: 0; min-height: 0; }
.bars.dense .sbar { width: 72%; border-radius: 2px 2px 0 0; }
.bars .sbar em { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; }
.bars .x { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars.dense .x.minor { visibility: hidden; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--ink); color: var(--ink-text); border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.4; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 2; }
.chart-tip small { color: var(--ink-muted); }
.sales-table { margin-top: 18px; font-size: 13px; }
.sales-table summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.sales-table table, .sales-list table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sales-table table { margin-top: 8px; max-width: 520px; }
.sales-table th, .sales-table td, .sales-list th, .sales-list td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.sales-list th, .sales-table th { font-weight: 600; color: var(--muted); font-size: 12px; }
.sales-view .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sales-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 20px; }
.sales-list { overflow-x: auto; }
.share { display: inline-block; width: 44px; height: 6px; border-radius: 3px; background: var(--line-soft); margin-right: 6px; vertical-align: middle; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.sales-note { margin: -6px 4px 0; }
.muted { color: var(--muted); }
.small-note { font-size: 12px; margin-top: 6px; }
@media (max-width: 600px) {
  .bars { height: 200px; margin-left: 38px; }
  .bars:not(.dense) .x { font-size: 10px; transform: rotate(-40deg); transform-origin: top center; bottom: -22px; }
  .bars:not(.dense) { padding-bottom: 30px; }
  .bars:not(.dense) .grid { bottom: 30px; }
  .sales-list .share { display: none; }
}
.sales-list .car-cell small { display: block; font-size: 12px; }
@media (max-width: 600px) { .sales-list .opt { display: none; } .sales-list th, .sales-list td { padding: 7px 5px; } }
.login-card h1 small { display: block; font-size: 15px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* Tiqaloc logo */
.login-logo img { display: block; width: 196px; height: auto; margin-bottom: 6px; }
.brand-mark { display: block; width: 36px; height: auto; flex-shrink: 0; }

/* Document dates and driving licence */
.license-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 4px; margin: 4px 0 10px; display: grid; gap: 8px; }
.license-block legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.license-block legend small { font-weight: 400; color: var(--muted); }
.doc-line { display: block; font-size: 13px; margin-top: 2px; }
.doc-flag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }
.doc-flag.bad { color: var(--bad); background: var(--bad-bg); }
.doc-flag.warn { color: var(--warn); background: var(--warn-bg); }

/* Costs of a rental */
.exp-block { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.exp-block > summary { cursor: pointer; padding: 10px 12px; font-size: 14px; font-weight: 600; list-style-position: inside; }
.exp-block > summary small { font-weight: 400; color: var(--muted); }
.exp-sum { font-weight: 700; color: var(--accent); }
.exp-block .exp-editor { padding: 0 12px 12px; }
.exp-editor { container-type: inline-size; }
.exp-rows { display: grid; gap: 8px; }
.exp-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, 1.2fr) 36px; gap: 8px; align-items: center; }
.exp-row select, .exp-row input { width: 100%; min-width: 0; }
.icon-btn { min-height: 36px; width: 36px; padding: 0; font-size: 18px; line-height: 1; }
.exp-add { margin-top: 8px; }
.exp-margin { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.exp-margin b { color: var(--good); }
.exp-margin b.neg { color: var(--bad); }
.exp-line { color: var(--muted); }
.exp-line b { color: var(--text); }
.exp-summary { margin: -4px 0 12px; font-size: 13px; color: var(--muted); }
.exp-summary b { color: var(--text); }
td.act button + button { margin-left: 4px; }
@container (max-width: 520px) {
  .exp-rows { gap: 14px; }
  .exp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
  .exp-row [name=cat] { grid-column: 1 / 3; }
  .exp-row [data-exp-del] { grid-column: 3; grid-row: 1; }
  .exp-row [name=amount] { grid-column: 1; grid-row: 2; }
  .exp-row [name=label] { grid-column: 2 / 4; grid-row: 2; }
}
.bars .sbar .fee { position: absolute; top: 0; left: 0; right: 0; border-radius: inherit; background: color-mix(in srgb, #f59e0b 70%, var(--card)); }
.bars .sbar .fee + em, .bars .sbar em { z-index: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0 44px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-margin { background: var(--accent); }
.lg-fee { background: color-mix(in srgb, #f59e0b 70%, var(--card)); }
.kpi.margin > b { color: var(--good); }
.kpi > b.neg { color: var(--bad); }
.kv-fees { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13px; color: var(--muted); max-width: 360px; }
.kv-fees li { display: flex; justify-content: space-between; gap: 12px; }
.kv b.pos { color: var(--good); }
.kv b.neg { color: var(--bad); }
.kv-btn { display: block; margin-top: 6px; }

/* Attached files */
.btn-like { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  font: 600 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; position: relative; }
.btn-like:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-like.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-like.secondary:hover { border-color: var(--muted); background: var(--card); }
.btn-like:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-like[hidden] { display: none; }
.attach-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 6px; }
.attach-add select, .attach-add .btn-like { height: 42px; min-height: 42px; box-sizing: border-box; }
.attach-cat small { font-weight: 400; color: var(--muted); }
.attach-empty { grid-column: 1 / -1; margin: 4px 0 0; }
.tabs .clip-ico { vertical-align: -3px; margin-right: 4px; }
.tab-short { display: none; }
@media (max-width: 480px) { .tabs .tab-long { display: none; } .tabs .tab-short { display: inline; } }
.attach-cat { flex: 1 1 180px; margin: 0; }
.attach-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.only-desk { display: inline; } .only-touch { display: none; }
.attach-camera { display: none; }
@media (pointer: coarse) {
  .attach-camera { display: inline-flex; }
  .attach-btns { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .attach-btns .btn-like { padding: 8px 10px; white-space: normal; text-align: center; height: auto; min-height: 46px; }
  .only-desk { display: none; } .only-touch { display: inline; }
}
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.attach-item { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-content: start; grid-template-rows: auto auto; align-items: start; justify-items: stretch; gap: 0; min-height: 0; padding: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; overflow: hidden; text-align: left; white-space: normal; font-weight: 400; }
.attach-item:hover { background: var(--card); border-color: var(--accent); }
.attach-item.failed { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.attach-thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; background: var(--bg); color: var(--muted); overflow: hidden; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb.pdf b { font-size: 18px; letter-spacing: .06em; color: var(--bad); border: 2px solid currentColor; border-radius: 6px; padding: 6px 8px; }
.attach-cap { display: grid; gap: 1px; padding: 7px 9px 9px; font-size: 13px; }
.attach-cap small { font-size: 11.5px; color: var(--muted); }
.attach-cap .unsynced { color: var(--warn); }
.attach-viewer { width: min(860px, calc(100vw - 24px)); }
.attach-view-body { display: grid; place-items: center; background: var(--bg); border-radius: 10px; min-height: 160px; margin-bottom: 12px; overflow: hidden; }
.attach-view-body img { max-width: 100%; max-height: 68vh; object-fit: contain; display: block; }
.attach-pdf { display: grid; justify-items: center; gap: 8px; padding: 28px 16px; text-align: center; }
.attach-pdf > b { font-size: 22px; color: var(--bad); border: 2px solid currentColor; border-radius: 8px; padding: 8px 12px; }
.attach-pdf p { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.files-btn { min-width: 0 !important; gap: 5px; }
.files-btn span { font-variant-numeric: tabular-nums; }
.tabs [role=tab] { scroll-margin-top: 80px; }
@media (max-width: 440px) { .profile-actions { gap: 6px; } .profile-actions button { min-width: 0; padding: 4px 10px; } }
.km-line { color: var(--muted); }
.km-line b { color: var(--text); font-weight: 600; }
.km-todo { color: var(--warn); }
.km-badge { display: inline-block; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--muted); }
.km-done { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--good); min-height: 1em; }
.km-done.bad { color: var(--bad); }
