/* =========================================================================
   VDT — app styling (intranet + auth)
   Minimalist, matching the public site's cinematic design language:
   indigo brand, thin type, uppercase micro-labels, soft surfaces.
   Light + dark themes via [data-theme] on <html>.
   ========================================================================= */

:root {
  --brand: #4152af;
  --brand-2: #4b5bd6;
  --brand-dark: #34418c;
  --brand-light: #eceefb;
  --accent: #6b7cf0;
  --ink: #12151c;
  --muted: #6b7280;
  --line: #e5e8ef;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --success: #1a7f37;
  --danger: #b42318;
  --danger-solid: #d92d20;
  --success-bg: #e7f5ec;
  --success-line: #b7e1c4;
  --danger-bg: #fdecea;
  --danger-line: #f5c2c0;
  --warn-bg: #fff4e5;
  --warn: #b45309;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(18, 21, 28, 0.06);
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand: #5b6cf0;
  --brand-2: #6f7ef5;
  --brand-dark: #3a49b8;
  --brand-light: #232327;
  --accent: #93a2ff;
  --ink: #ecedee;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.09);
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --success: #4ade80;
  --danger: #f87171;
  --danger-solid: #e5484d;
  --success-bg: rgba(74, 222, 128, 0.12);
  --success-line: rgba(74, 222, 128, 0.3);
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-line: rgba(248, 113, 113, 0.32);
  --warn-bg: rgba(251, 191, 36, 0.12);
  --warn: #fbbf24;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Native <select> option popups are rendered by the OS/browser and do not
   inherit the select's themed background, so theme them explicitly. */
select { color-scheme: inherit; }
option { background-color: var(--surface); color: var(--ink); }

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3 { font-weight: 300; letter-spacing: -.01em; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); transform: translateY(-1px); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.danger:hover { opacity: .88; transform: translateY(-1px); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.disabled { opacity: .4; pointer-events: none; }
.btn.ghost-light { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .6); color: #fff; }
.btn.ghost-light:hover { background: rgba(255, 255, 255, .22); }
.btn .icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.small .icon { width: 14px; height: 14px; }

/* ---------- Public site (legacy layout, kept token-aware) ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand img { height: 54px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; font-size: 14px; }
.site-nav > a { color: var(--ink); }
.site-nav > a.active { color: var(--brand); }
.site-nav .call { display: inline-flex; align-items: center; gap: 7px; background: var(--brand-2); color: #fff; padding: 9px 16px; border-radius: 999px; }
.site-nav .call:hover { background: var(--brand); text-decoration: none; }
.icon-phone { flex: none; vertical-align: -2px; }

.lang-switch {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
}

.hours-menu { position: relative; }
.hours-menu summary { cursor: pointer; list-style: none; font-weight: 600; }
.hours-menu summary::-webkit-details-marker { display: none; }
.hours-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  min-width: 260px;
}
.hours-panel ul { list-style: none; margin: 8px 0 0; padding: 0; }
.hours-panel li { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; font-size: 13.5px; }
.hours-note { margin: 0; font-weight: 600; color: var(--brand); font-size: 13px; }

.mobile-menu { display: none; position: relative; }
.mobile-menu summary { font-size: 26px; cursor: pointer; list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu div {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 190px;
}

/* Sections */
.section { padding: clamp(40px, 7vw, 80px) clamp(20px, 5vw, 70px); max-width: 1180px; margin: 0 auto; width: 100%; }
.section h2 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 24px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.service-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.service-card h3 { margin: 0 0 10px; color: var(--brand); font-size: 18px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.hours-card, .location-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.hours-list { list-style: none; margin: 12px 0 0; padding: 0; }
.hours-list li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.hours-list li:last-child { border-bottom: none; }
.map { width: 100%; height: 220px; border: 0; border-radius: 10px; margin: 12px 0; }

.page-title { font-size: clamp(26px, 4vw, 40px); margin: 0 0 26px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.team-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.team-card img { width: 100%; height: 280px; object-fit: cover; }
.team-info { padding: 18px 20px 22px; }
.team-info h3 { margin: 0 0 4px; }
.team-info p { margin: 6px 0; font-size: 14px; }

/* Public footer styles live in footer.css (shared with the cinematic site). */

/* Auth */
.auth-section { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; background: var(--bg); }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px; width: min(430px, 100%);
}
.auth-logo { height: 56px; margin: 0 auto 14px; }
.auth-card h1 { margin: 0 0 20px; font-size: 24px; text-align: center; font-weight: 300; }
.auth-card .flash { margin: 0 0 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Intranet ---------- */
.intranet { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; transition: grid-template-columns .22s ease; }
.sidenav {
  background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line);
  transition: background-color .3s ease, border-color .3s ease;
}
.sidenav-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; font-weight: 600; letter-spacing: .04em; color: var(--ink); }
.sidenav-brand img { height: 36px; }
.sidenav-brand-name { display: flex; flex-direction: column; line-height: 1.2; }
.sidenav-brand-name strong { font-size: 15px; font-weight: 700; letter-spacing: .2em; color: var(--brand); }
.sidenav-brand span { font-size: 12px; text-transform: uppercase; letter-spacing: .22em; color: var(--muted); }
.user-card {
  display: flex; align-items: center; gap: 11px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 20px; line-height: 1.2;
}
.user-card strong { font-size: 14px; font-weight: 600; }
.user-card .muted { font-size: 12px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; display: grid; place-items: center; font-weight: 700; flex: none;
}
.sidenav-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 600;
  letter-spacing: .02em; transition: background .18s ease, color .18s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item.active { background: var(--brand-light); color: var(--brand); }
html[data-theme="dark"] .nav-item.active { background: #232327; color: var(--accent); }
.nav-item .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidenav-footer { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.version { font-size: 11px; color: var(--muted); padding: 6px 12px; letter-spacing: .08em; }
.logout-form { margin: 0; }
.logout-form button.nav-item { width: 100%; background: none; border: 0; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; }

/* Theme toggle */
.theme-toggle { background: none; border: 0; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; width: 100%; color: var(--muted); }
.theme-toggle .theme-ico { display: inline-flex; align-items: center; }
.theme-toggle .theme-ico-dark, .theme-toggle .theme-label-dark { display: none; }
html[data-theme="dark"] .theme-toggle .theme-ico-light, html[data-theme="dark"] .theme-toggle .theme-label-light { display: none; }
html[data-theme="dark"] .theme-toggle .theme-ico-dark { display: inline-flex; }
html[data-theme="dark"] .theme-toggle .theme-label-dark { display: inline; }

.intranet-main { min-width: 0; background: var(--bg); }
.appbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 18px clamp(18px, 3vw, 34px);
  position: sticky; top: 0; z-index: 10;
}
.appbar h1 { margin: 0; font-size: 20px; font-weight: 300; letter-spacing: .01em; }

/* Sidebar collapse toggle */
.sidenav-toggle {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.sidenav-toggle:hover { background: var(--brand-light); color: var(--brand); border-color: var(--brand-light); }
.sidenav-toggle .icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .22s ease; }
html[data-sidebar="collapsed"] .sidenav-toggle .icon { transform: rotate(180deg); }
.content { padding: clamp(18px, 3vw, 34px); max-width: 1440px; margin-inline: auto; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px clamp(18px,3vw,34px) 0; font-size: 14px; font-weight: 600; }
.card-body .flash { margin: 0 0 16px; }
.flash.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-line); }
.flash.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }

/* Voided-invoice notice atop the form view. */
.void-alert {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line);
  font-size: 14px; font-weight: 600;
}
.void-alert .icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden;
  transition: background-color .3s ease, border-color .3s ease;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: 20px; }

/* Forms */
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; background: var(--surface); color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .3s ease;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-light); }
.field-hint { font-size: 12px; color: var(--muted); }

/* Client picker (invoice form) */
.client-picker { position: relative; }
.client-option-name { font-weight: 500; }
.client-option-meta { font-size: 12px; color: var(--muted); }

/* Client detail card (invoice form) */
.client-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); padding: 16px 18px; }
.client-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.client-card-head .client-card-name { margin: 0; }
.client-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.client-card [hidden] { display: none; }
.client-card-name { margin: 0; font-size: 16px; }
.client-card-name.is-empty { color: var(--muted); font-weight: 400; }
.client-card-contact { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-top: 12px; }
.client-card-contact-row { display: flex; gap: 8px; }
.client-card-contact-label { color: var(--muted); min-width: 84px; flex-shrink: 0; }
.client-card-contact-value { color: var(--ink); word-break: break-word; }

/* Client browse dialog */
.client-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.client-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.client-dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.client-dialog-head h3 { margin: 0; }
.client-dialog-search { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.client-dialog-search-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 14px;
}
.client-dialog-search-input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-light); }
.client-dialog-body {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px;
  padding: 20px; overflow-y: auto;
}
.client-dialog-body:has(.client-dialog-detail:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.client-dialog-results { display: flex; flex-direction: column; gap: 6px; height: 420px; overflow-y: auto; }
.client-dialog-result {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  cursor: pointer; font: inherit; font-size: 14px;
}
.client-dialog-result:hover,
.client-dialog-result.active { background: var(--brand-light); border-color: var(--brand); color: var(--brand); }
html[data-theme="dark"] .client-dialog-result:hover,
html[data-theme="dark"] .client-dialog-result.active { background: #232327; border-color: var(--accent); color: var(--accent); }
.client-dialog-empty { color: var(--muted); padding: 12px 0; text-align: center; font-size: 13px; }
.client-dialog-detail { border-left: 1px solid var(--line); padding-left: 20px; }
.client-dialog-detail h4 { margin: 0 0 12px; }
.client-dialog-contact { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; font-size: 13px; }
.client-dialog-contact-row { display: flex; gap: 8px; }
.client-dialog-contact-label { color: var(--muted); min-width: 64px; flex-shrink: 0; }
.client-dialog-contact-value { color: var(--ink); word-break: break-word; }
.client-dialog-travelers { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.client-dialog-traveler { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.client-dialog-detail .btn { width: 100%; }
@media (max-width: 640px) {
  .client-dialog-body { grid-template-columns: 1fr; }
  .client-dialog-detail { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
}
/* Client invoices dialog (clients list) */
.invoices-cell .btn { gap: 6px; }
.invoices-dialog .client-dialog-body { align-content: start; max-height: calc(100vh - 220px); }
.invoices-dialog .table-wrap { overflow-x: auto; }
/* Client summary dialog (clients list) */
.summary-dialog .client-dialog-body { align-content: start; max-height: calc(100vh - 220px); }
.summary-dialog .summary-line { margin-bottom: 18px; }
.summary-dialog .client-dialog-contact { margin-bottom: 18px; }
.summary-dialog h4 { margin: 0 0 10px; }
.summary-dialog .client-dialog-travelers { margin-bottom: 0; }
.notes-field { gap: 8px; }
.notes-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.notes-tab { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; transition: background .18s ease, color .18s ease; }
.notes-tab + .notes-tab { border-left: 1px solid var(--line); }
.notes-tab:hover { background: var(--surface-2); }
.notes-tab.active { background: var(--brand); color: #fff; }
.notes-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface-2); }
.notes-tool { font: inherit; font-size: 13px; font-weight: 600; min-width: 30px; padding: 4px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.notes-tool:hover { background: var(--line); }
.notes-tool .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notes-select { font: inherit; font-size: 12px; font-weight: 600; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
.notes-toolbar .notes-select { width: auto; min-width: 0; padding: 4px 6px; border-radius: 6px; font-size: 12px; }
.notes-color { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.notes-color-label { font-weight: 700; line-height: 1; }
.notes-color-highlight { background: #fde68a; color: #111827; border-radius: 3px; padding: 1px 2px; }
.notes-color input[type="color"] { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.notes-tool-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.notes-editor { min-height: 160px; max-height: 420px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--surface); color: var(--ink); font-family: Calibri, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; font-size: 12px; overflow-wrap: anywhere; }
.notes-editor:focus { outline: none; box-shadow: inset 0 0 0 2px var(--brand-light); }
.notes-editor table { border-collapse: collapse; }
.notes-editor td, .notes-editor th { border: 1px solid var(--line); padding: 4px 8px; }
.notes-field textarea[hidden], .notes-toolbar[hidden], .notes-editor[hidden] { display: none; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.checkbox-strict {
  align-self: flex-start;
  width: fit-content;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: background .18s ease, border-color .18s ease;
}
.grid-2 + .checkbox-strict { margin-top: 14px; }
.checkbox-strict:hover { background: var(--surface-2); }
.checkbox-strict input { width: 16px; height: 16px; cursor: pointer; }
.checkbox-strict:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.subhead { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.repeat { display: flex; flex-direction: column; gap: 8px; }
.repeat + [data-add-row] { margin-top: 8px; }
.repeat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: center; }
.traveler-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.payment-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.repeat-row input, .repeat-row select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); }
.repeat-row .row-remove { justify-self: start; align-self: stretch; padding-top: 0; padding-bottom: 0; color: var(--muted); }
.repeat-row .row-remove:hover { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
.summary-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.summary-stat { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 14px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.summary-stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.summary-stat.total::before { background: var(--brand); }
.summary-stat.paid::before { background: var(--success); }
.summary-stat.balance::before { background: var(--muted); }
.summary-stat.balance.owed::before { background: var(--danger); }
.summary-stat.balance.settled::before { background: var(--success); }
.summary-stat.balance.owed { background: var(--danger-bg); border-color: var(--danger-line); }
.summary-stat.balance.settled { background: var(--success-bg); border-color: var(--success-line); }
.summary-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.summary-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.summary-stat.balance.owed .summary-value { color: var(--danger); }
.summary-stat.balance.settled .summary-value { color: var(--success); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.form-actions .btn.danger { order: -1; margin-right: auto; }
.print-lang { display: flex; align-items: center; gap: 8px; }
.print-lang .field-label { margin: 0; }
.print-lang select { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); cursor: pointer; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar input[type="search"], .toolbar select { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); }
.toolbar input[type="search"] { flex: 1 1 280px; min-width: 0; }
.toolbar .btn.primary { margin-left: auto; }

/* Live search swaps the results in place; dim them while a fetch is pending. */
[data-live-results].is-loading { opacity: .55; transition: opacity .12s ease; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap-top { overflow-x: auto; overflow-y: hidden; }
.table-wrap-top[hidden] { display: none; }
.table-wrap-top-inner { height: 1px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--surface-2); padding: 11px 12px; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .empty { text-align: center; color: var(--muted); }
.data-table .actions { text-align: right; }
.data-table .actions form { display: inline; }
.data-table .actions .btn.danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.data-table .actions .btn.danger:hover { background: var(--danger-bg); opacity: 1; }

/* Row action menu: one "⋯" toggle that reveals the row's actions in a
   dropdown, positioned with fixed coordinates (see app.js) so it is not
   clipped by the horizontally scrollable .table-wrap. */
.actions-menu { position: relative; display: inline-block; vertical-align: middle; }
.actions-menu > summary { list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; }
.actions-menu > summary::-webkit-details-marker { display: none; }
.actions-menu[open] > summary { background: var(--surface-2); }
.actions-menu-list {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  visibility: hidden;
}
.actions-menu.menu-positioned .actions-menu-list { visibility: visible; }
.actions-menu-list form { display: block; }
.actions-menu-list .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  border-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.actions-menu-list .btn:hover { background: var(--surface-2); }
.actions-menu-list .btn.danger { color: var(--danger); }
.actions-menu-list .btn.danger:hover { background: var(--danger-bg); }

/* Freeze the action column to the right edge of the scrolling table on
   desktop, so row actions stay reachable without scrolling sideways. On
   mobile it scrolls like every other column. */
@media (min-width: 861px) {
  .data-table th.actions,
  .data-table td.actions {
    position: sticky;
    right: 0;
    z-index: 1;
    box-shadow: -10px 0 12px -12px rgba(18, 21, 28, 0.28);
  }
  .data-table th.actions { background: var(--surface-2); z-index: 2; }
  .data-table td.actions { background: var(--surface-2); }
  .data-table tbody tr:hover td.actions { background: color-mix(in srgb, var(--ink) 7%, var(--surface-2)); }
  .data-table td.actions.menu-open-cell { z-index: 5; }
}

/* Void-row cells are dimmed with opacity, so each cell is its own stacking
   context. Lift the row that owns an open menu so its dropdown paints above
   the dimmed cells of the rows that follow it. */
.data-table tbody tr:has(.actions-menu[open]) { position: relative; z-index: 6; }

/* Dim the cells rather than the row: opacity on <tr> also fades the action
   dropdown and turns the open menu translucent. */
.row-void > td { opacity: .6; }
.row-void > td.actions { opacity: 1; }
.row-total { font-weight: 700; }
.row-total td { border-top: 2px solid var(--line); background: var(--surface-2); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.4; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; vertical-align: middle; }
.badge.paid { background: var(--success-bg); color: var(--success); }
.badge.void { background: var(--danger-bg); color: var(--danger); }
.badge.open { background: var(--warn-bg); color: var(--warn); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.pager-links { display: flex; gap: 6px; }

/* Stats */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 14px; }
.filter-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-bar .filter-presets { margin-bottom: 0; }
.year-filter { max-width: 200px; margin-bottom: 16px; }
.filter-bar .year-filter { max-width: none; margin-bottom: 0; }
.filter-bar .year-filter .field { flex-direction: row; align-items: center; gap: 8px; }
.filter-bar .year-filter .field-label { white-space: nowrap; }
.filter-bar .year-filter .field select { width: auto; min-width: 110px; padding: 7px 10px; font-size: 13px; }
.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.filter-dates { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 14px 16px; flex: 1 1 360px; }
.filter-actions { padding-top: 0; flex: 0 0 auto; }
.card-actions .period-note { margin: 0; text-align: right; }
@media (max-width: 620px) {
  .filter-dates { grid-template-columns: 1fr; }
  .filter-actions { flex: 1 1 100%; justify-content: flex-start; }
}
.preset {
  display: inline-flex; align-items: center; padding: 6px 13px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--surface); transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.preset:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.preset.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.period-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.period-note strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand-2); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-card.warn { border-left-color: var(--warn); }
.stat-card.success { border-left-color: var(--success); }
.stat-card .stat-ico { position: absolute; top: 14px; right: 14px; color: var(--brand-2); opacity: .7; }
.stat-card .stat-ico .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stat-card.warn .stat-ico { color: var(--warn); }
.stat-card.success .stat-ico { color: var(--success); }
.stat-label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 26px; font-weight: 300; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.stat-bar { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

.data-table th.num, .data-table td.num { text-align: right; }
.data-table th .th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; font: inherit; }
.data-table th .th-sort:hover { color: var(--brand); text-decoration: none; }
.data-table th .th-sort.active { color: var(--brand); }

.interval-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.interval-filter .preset { padding: 4px 10px; font-size: 11.5px; }
.graph-filters { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.column-chart { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 18px 2px 4px; }
.column { flex: 1 0 auto; min-width: 26px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.column-track { position: relative; width: 100%; height: 160px; display: flex; align-items: flex-end; }
.column-fill { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--brand-2), var(--brand)); transition: filter .18s ease; }
.column-fill.max { background: linear-gradient(180deg, var(--accent), var(--brand-dark)); }
.column:hover .column-fill { filter: brightness(1.12); }
.column-value { position: absolute; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.column-label { font-size: 10.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.client-cell { min-width: 170px; }
.client-name { display: block; font-weight: 600; }
.share-track { display: block; margin-top: 6px; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.share-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.cell-sub { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* ---------- Navigation loading skeleton ----------
   Shown inside .content while a slow page (e.g. statistics) is fetched, so the
   appbar stays visible and the skeleton matches the real content's width. It
   lives in the outgoing document, replaced when the new page paints. */
.content.is-loading > *:not(.nav-skeleton) { display: none; }
.nav-skeleton { min-height: 60vh; }


.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 8px; }
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: sk-shimmer 1.4s infinite;
}
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }

.sk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 22px;
}
.sk-line { height: 12px; margin: 0 0 12px; }
.sk-line:last-child { margin-bottom: 0; }
.sk-line.w-30 { width: 30%; }
.sk-line.w-50 { width: 50%; }
.sk-line.w-70 { width: 70%; }
.sk-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sk-pill { width: 92px; height: 28px; border-radius: 999px; }

.sk-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 16px; margin-bottom: 22px; }
.sk-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.sk-stat .sk-line { margin-bottom: 14px; }
.sk-value { height: 24px; width: 55%; }
.sk-rows .sk-line { margin-bottom: 18px; }

/* ---------- 404 ---------- */
.not-found {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 22px;
  background:
    radial-gradient(900px 460px at 50% -12%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 68%),
    var(--bg);
}
.not-found-brand { display: inline-block; margin-bottom: 26px; }
.not-found-brand img { height: 52px; width: auto; opacity: .95; }
.not-found-code {
  margin: 0;
  font-size: clamp(92px, 20vw, 190px);
  line-height: .88;
  font-weight: 300;
  letter-spacing: -.05em;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.not-found-title { margin: 8px 0 0; font-size: clamp(21px, 3vw, 30px); font-weight: 300; }
.not-found-hint { margin: 12px 0 0; max-width: 44ch; font-size: 15px; color: var(--muted); }
.not-found-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.not-found-actions .btn { padding: 11px 22px; font-size: 14px; }

/* Collapsed sidebar (icons only). Desktop only — the mobile layout stacks
   the sidebar on top, where collapsing makes no sense. */
@media (min-width: 861px) {
  html[data-sidebar="collapsed"] .intranet { grid-template-columns: 78px 1fr; }
  html[data-sidebar="collapsed"] .sidenav { padding-left: 12px; padding-right: 12px; }
  html[data-sidebar="collapsed"] .sidenav-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html[data-sidebar="collapsed"] .sidenav-brand-name,
  html[data-sidebar="collapsed"] .user-card > div:not(.user-avatar),
  html[data-sidebar="collapsed"] .nav-item span,
  html[data-sidebar="collapsed"] .theme-toggle .theme-label,
  html[data-sidebar="collapsed"] .version { display: none; }
  html[data-sidebar="collapsed"] .user-card { justify-content: center; padding: 8px; margin-bottom: 14px; }
  html[data-sidebar="collapsed"] .nav-item { justify-content: center; padding-left: 8px; padding-right: 8px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .site-nav { display: none; }
  .mobile-menu { display: block; }
  .intranet { grid-template-columns: 1fr; }
  .sidenav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav-nav { flex-direction: row; flex-wrap: wrap; }
  .sidenav-footer { margin-top: 12px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .sidenav-footer .theme-toggle,
  .sidenav-footer .logout-form button.nav-item { width: auto; }
  .sidenav-footer .version { width: 100%; }
}

/* =========================================================================
   Invoice edit — Form / Paper view tabs + editable invoice paper.
   The paper is a physical-sheet simulation, so it stays light even in dark
   mode. Only the active view's controls are enabled (see app.js), and Print
   outputs just the paper sheet via the browser's native Save-as-PDF.
   ========================================================================= */
.view-tabs {
  display: inline-flex; gap: 4px; padding: 4px; align-self: flex-start;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.view-tab {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px;
  font-weight: 600; padding: 7px 14px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.view-tab:hover { color: var(--ink); }
.view-tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.view-tab .icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-invoice-view][hidden] { display: none !important; }
.invoice-view { display: flex; flex-direction: column; gap: 16px; }

/* The invoice paper targets A4 (210 x 297mm). Force the print page size so the
   sheet, its page-break guides and the printed output all agree, regardless of
   the printer's default (Letter in North America). The sheet supplies its own
   9mm padding, so the page margin is zero. */
@page { size: A4; margin: 0; }

.paper {
  position: relative;
  width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; padding: 9mm;
  background: #fff; color: #12151c; border: 1px solid #e5e8ef; border-radius: 4px;
  box-shadow: var(--shadow);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
.paper .doc { width: 100%; border-collapse: collapse; table-layout: fixed; }
.paper .doc td { vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
.paper .brand-lockup { display: flex; align-items: center; gap: 16px; }
.paper .brand img { width: 92px; height: 92px; object-fit: contain; flex: none; }
.paper .brand-text { display: flex; flex-direction: column; gap: 2px; }
.paper .brand-text strong { font-size: 19px; font-weight: 600; letter-spacing: .02em; color: #4152af; }
.paper .brand-text span { font-size: 11.5px; color: #6b7280; }
.paper .head-right { padding-left: 32px; }
.paper .h1 { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #4152af; }
.paper .facts { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13.5px; }
.paper .facts li { padding: 2px 0; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.paper .facts input.paper-inline { field-sizing: content; width: auto; min-width: 5.5em; text-align: right; }

/* Paper date fields: read-only month-word text over a real date input (the
   text box opens the native picker; the date input carries/saves the value). */
.paper .paper-date-field { position: relative; display: inline-block; max-width: 100%; }
.paper .paper-date-text {
  font: inherit; font-size: inherit; color: inherit; background: transparent;
  border: 1px solid transparent; border-radius: 4px; padding: 1px 4px;
  width: auto; field-sizing: content; min-width: 6em; max-width: 100%; cursor: pointer;
}
.paper .paper-date-text:hover { border-color: #e5e8ef; background: #f3f5fb; }
.paper .paper-date-text:focus { outline: none; border-color: #4152af; background: #eceefb; }
.paper .paper-date-text::placeholder { color: #9aa3af; }
.paper .paper-date-text:placeholder-shown { border-bottom: 1px dashed #cbd5e1; border-radius: 0; }
.paper .paper-date-input {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0;
  border: 0; padding: 0; pointer-events: none;
}
.paper .repeat-row .paper-date-field { flex: none; }
.paper .col { padding: 18px 8px 0; }
.paper .title { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; }
.paper .title-bar { width: 34px; height: 0; border-top: 2px solid #4152af; margin: 6px 0 8px; }
.paper .col p { margin: 0 0 2px; font-size: 14px; }
.paper .paper-recipient { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.paper .paper-recipient-main { flex: 1 1 auto; min-width: 0; }
.paper .paper-recipient-contact { flex: 0 1 auto; min-width: 0; max-width: 55%; text-align: right; }
.paper .paper-recipient p { margin: 0 0 2px; font-size: 14px; }
.paper .paper-recipient-email { white-space: nowrap; font-size: 10px; }
.paper .info { font-size: 13px; line-height: 1.5; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.paper .info p { margin: 0 0 6px; }
.paper .info ul, .paper .info ol { margin: 4px 0 6px; padding-left: 20px; }
.paper .info a { color: #4152af; }
.paper .info img { max-width: 100%; height: auto; }
.paper .info table { border-collapse: collapse; font-size: 13px; width: 100%; max-width: 100%; table-layout: fixed; }
.paper .info th, .paper .info td { border: 1px solid #e5e8ef; padding: 0; text-align: left; }
.paper .info h1, .paper .info h2, .paper .info h3, .paper .info h4, .paper .info h5, .paper .info h6 { margin: 6px 0 4px; font-size: 14px; font-weight: 600; }
.paper .sig { margin-top: 26px; }
.paper .sig-line { width: 175px; height: 1px; border-top: 1px solid #e5e8ef; }
.paper .sig span { font-size: 11px; color: #6b7280; }
.paper .amount { width: 100%; border-collapse: collapse; font-size: 14px; }
.paper .amount caption { text-align: left; caption-side: top; padding: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; }
.paper .amount td { padding: 7px 10px; border-bottom: 1px solid #e5e8ef; }
.paper .amount td:first-child { color: #6b7280; }
.paper .amount td:last-child { font-variant-numeric: tabular-nums; text-align: right; }
.paper .amount tr.final td { border-bottom: 0; border-top: 2px solid #4152af; background: #eceefb; color: #4152af; font-weight: 700; }
.paper .thanks { display: inline-block; margin-top: 24px; font-size: 14px; font-weight: 600; color: #4152af; }
.paper ul.notes { margin: 6px 0 0; padding: 8px 0 0 18px; list-style: disc; font-size: 11.5px; color: #6b7280; border-top: 1px solid #e5e8ef; }
.paper ul.notes li { padding: 2px 0; }
.paper ul.notes li::marker { color: #4152af; }

/* Void watermark: a big angled, translucent red "VOID" over the sheet content.
   app.js places one mark centered in each page band (screen and print) so every
   page carries it. It sits on the topmost layer but stays see-through so the
   content below remains readable. */
.paper .paper-void-mark {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-size: 240px; font-weight: 800; letter-spacing: .06em; line-height: 1;
  color: rgba(217, 45, 32, .18); white-space: nowrap;
  pointer-events: none; user-select: none; z-index: 5;
}

/* Inline paper fields read as printed text until hovered/focused. */
.paper input.paper-inline, .paper select.paper-inline {
  font: inherit; font-size: inherit; color: inherit; background: transparent;
  border: 1px solid transparent; border-radius: 4px; padding: 1px 4px;
  max-width: 100%; min-width: 0;
}
.paper input.paper-inline:hover, .paper select.paper-inline:hover { border-color: #e5e8ef; background: #f3f5fb; }
.paper input.paper-inline:focus, .paper select.paper-inline:focus { outline: none; border-color: #4152af; background: #eceefb; box-shadow: none; }
.paper input[type="date"].paper-inline { width: auto; }
.paper .paper-money { width: 6.5em; max-width: 34%; text-align: right; font-variant-numeric: tabular-nums; }
.paper-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.paper-check input { width: 15px; height: 15px; }
.paper .repeat { display: flex; flex-direction: column; gap: 5px; }
.paper .repeat-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 5px; }
.paper .repeat-row > * { min-width: 0; }
.paper .traveler-row input[type="text"] { flex: 1 1 auto; }
.paper .traveler-row input[type="date"],
.paper .payment-row input[type="date"] { flex: 0 0 auto; max-width: 9.5em; }
.paper .payment-row select { flex: 0 1 auto; min-width: 9.5em; max-width: 10.5em; }
.paper .paper-pay-type { display: none; }
.paper .pay-lead { color: #6b7280; white-space: nowrap; flex: none; }
.paper .repeat-row .row-remove { padding: 1px 5px; flex: none; }
.paper .paper-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px;
  border: 1px solid #e5e8ef; border-radius: 999px; background: #f1f3f9; color: #4152af; cursor: pointer;
  text-decoration: none;
}
.paper .paper-client-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.paper .paper-client-actions .paper-btn { margin-top: 6px; }
.paper .paper-btn[hidden] { display: none; }
.paper .paper-btn:hover { background: #eceefb; }
.paper .paper-btn .icon { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.paper .notes-field { gap: 0; }
.paper-info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.paper .notes-toolbar { background: #f1f3f9; border-color: #e5e8ef; }
.paper .notes-tool { color: #12151c; }
.paper .notes-tool:hover { background: #e5e8ef; }
.paper .notes-select { background: #fff; color: #12151c; border-color: #e5e8ef; }
.paper .notes-tool-sep { background: #e5e8ef; }
.paper .notes-switch { border-color: #e5e8ef; }
.paper .notes-tab { background: #fff; color: #6b7280; }
.paper .notes-tab + .notes-tab { border-left-color: #e5e8ef; }
.paper .notes-tab.active { background: #4152af; color: #fff; }
.paper .notes-editor {
  border-color: #e5e8ef; border-radius: 0 0 6px 6px; max-height: none;
  background: #fff; color: #12151c; font-family: inherit; font-size: 13px;
}
.paper .notes-editor:focus { box-shadow: inset 0 0 0 2px #eceefb; }
.paper .notes-field textarea {
  width: 100%; min-height: 120px; padding: 8px 10px; border: 1px solid #e5e8ef;
  border-radius: 0 0 6px 6px; font: inherit; font-size: 12px; color: #12151c; background: #fff;
}

/* Screen-only page-break guides (A4). Inserted by app.js at each 297mm line. */
.paper-guides { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.paper-guide { position: absolute; left: 0; right: 0; border-top: 2px dashed #d92d20; }
.paper-guide-label {
  position: absolute; right: 4px; top: -1.4em;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #d92d20; background: #fff; padding: 0 6px; border-radius: 999px;
}

/* Off-screen host for the print-layout clone app.js measures page breaks with.
   Fixed so it never affects the page's own layout or scrollbars. */
.paper-measure-host {
  position: fixed; left: -20000px; top: 0; width: 210mm; pointer-events: none;
}

@media print {
  html, body { background: #fff !important; }
  .intranet { display: block !important; }
  .sidenav, .appbar, .flash, .view-tabs, .form-actions, .no-print,
  .notes-toolbar, .notes-switch, .paper-guides, .paper-measure-host,
  [data-invoice-view="form"] { display: none !important; }
  .intranet-main { background: #fff !important; }
  .content { padding: 0 !important; max-width: none !important; margin: 0 !important; }
  .form-grid { display: block !important; gap: 0 !important; }
  .paper[data-invoice-view] {
    display: block !important; width: auto !important; min-height: auto !important;
    margin: 0 !important; padding: 9mm !important; border: 0 !important;
    border-radius: 0 !important; box-shadow: none !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  /* Print flows naturally: no forced breaks and no keep-together, so a section
     may split across pages. The on-screen red guide is only an indicator of
     where the natural A4 break falls. */
  /* Every paper form control prints as its plain-text value, not as a widget. */
  .paper input, .paper select, .paper textarea {
    -webkit-appearance: none !important; appearance: none !important;
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    color: #12151c !important; -webkit-text-fill-color: #12151c !important;
    field-sizing: content !important; width: auto !important; min-width: 0 !important; max-width: none !important;
    padding: 0 !important; margin: 0 !important;
  }
  .paper input[type="number"]::-webkit-outer-spin-button,
  .paper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }
  /* Controls with no useful text rendering are hidden; their text mirror prints
     instead (payment type label, date text, insurance "Accepté/Refusé"). */
  .paper .payment-row select,
  .paper .paper-date-input,
  .paper-check input { display: none !important; }
  .paper .paper-pay-type { display: inline !important; }
  /* The notes surface prints as plain content, without its editor box. */
  .paper .notes-editor,
  .paper .notes-field textarea {
    border: 0 !important; border-radius: 0 !important; background: transparent !important;
    padding: 0 !important; margin: 0 !important; min-height: 0 !important; max-height: none !important; overflow: visible !important;
  }
  .paper-check input { display: none !important; }
  .paper .paper-btn { display: none !important; }
}
