/* Kochy UI — design language adapted from ProtokolOnline/design.md.
   Light "application" mode only (no marketing surface).
   All custom properties are tokens; no Tailwind, no bundler.
   CSP-strict: no inline styles, no fonts loaded from third parties. */

:root {
  /* Slate scale — text, surfaces, borders */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Emerald — primary brand & "vyhovuje" / "hotovo" */
  --emerald-50:  #ecfdf5;
  --emerald-200: #a7f3d0;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;

  /* Blue — secondary action */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-300: #93c5fd;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  /* Amber — blíží se termín */
  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-500: #f59e0b;
  --amber-700: #b45309;
  --amber-800: #92400e;

  /* Red — chyba, po termínu */
  --red-50:  #fef2f2;
  --red-200: #fecaca;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  /* Tokens */
  --bg:           var(--slate-50);
  --surface:      #ffffff;
  --text:         var(--slate-900);
  --text-muted:   var(--slate-600);
  --text-hint:    var(--slate-500);
  --border:       var(--slate-200);
  --border-strong: var(--slate-300);
  --accent:       var(--emerald-700);
  --accent-soft:  var(--emerald-50);
  --link:         var(--blue-600);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 6px rgba(15, 23, 42, 0.05);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
               Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --tap: 44px; /* min touch target */
}

/* ------------- reset ------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
.mobile-menu-lock { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.3; }
p  { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }

::selection { background: var(--emerald-200); color: var(--slate-900); }

/* ------------- layout ------------- */

.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.sidebar-brand-sub {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-height: var(--tap);
}
.sidebar-nav a:hover { background: var(--slate-100); text-decoration: none; }
.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--emerald-800);
}
.sidebar-nav a .icon { color: var(--text-hint); }
.sidebar-nav a.active .icon { color: var(--emerald-700); }
.sidebar-foot {
  padding: var(--space-3);
  border-top: 1px solid var(--border);
}
.sidebar-foot .user {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px var(--space-2);
}
.sidebar-foot button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap);
}
.sidebar-foot button:hover { background: var(--slate-100); }

main.content {
  padding: var(--space-8) var(--space-8) var(--space-12);
  max-width: 1120px;
  width: 100%;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.page-head .title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.page-head .crumb {
  font-size: 13px;
  color: var(--text-hint);
}
.page-head .crumb a { color: var(--text-muted); }

/* mobile */
.menu-button {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
}
.sidebar-overlay { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  main.content { padding: 64px var(--space-4) var(--space-10); }
  .menu-button { display: flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    z-index: 70;
    box-shadow: var(--shadow-lg);
  }
  .app.menu-open .sidebar { transform: translateX(0); }
  .app.menu-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 65;
  }
}

/* ------------- cards ------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
.card-head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.card-head h2 { font-size: 16px; }
.card-body { padding: var(--space-5); }

.equipment-details {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.equipment-detail-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.36fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--border);
}
.equipment-detail-row:last-child { border-bottom: 0; }
.equipment-detail-row dt,
.equipment-detail-row dd {
  min-width: 0;
  padding: 11px 14px;
  overflow-wrap: anywhere;
}
.equipment-detail-row dt {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.equipment-detail-row dd {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.equipment-empty { border: 1px dashed var(--border-strong); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kpi .label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.kpi .value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ------------- forms ------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.field .hint { font-size: 12px; color: var(--text-hint); }
.field .err {
  font-size: 13px;
  color: var(--red-700);
  background: var(--red-50);
  border: 1px solid var(--red-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: var(--tap);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: var(--emerald-600);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
input::placeholder, textarea::placeholder { color: var(--text-hint); }

.file-picker {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-3);
}
.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.file-picker-input:focus-visible + .btn,
.file-picker:focus-within > .btn {
  outline: 3px solid rgba(16, 185, 129, 0.22);
  outline-offset: 2px;
}
.file-picker-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------- buttons ------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
  transition: background 0.12s, border-color 0.12s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--emerald-700);
  color: #fff;
}
.btn-primary:hover { background: var(--emerald-800); text-decoration: none; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--slate-50); text-decoration: none; }
.btn-danger {
  background: var(--surface);
  color: var(--red-700);
  border-color: var(--red-200);
}
.btn-danger:hover { background: var(--red-50); text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  height: 36px;
  padding: 0 var(--space-3);
}
.btn-ghost:hover { background: var(--slate-100); text-decoration: none; }
.btn-block { width: 100%; }

/* ------------- tables ------------- */

.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--slate-50);
}
table.table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--slate-100);
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: var(--slate-50); }
table.table .num { font-variant-numeric: tabular-nums; }

.customer-protocol-table { table-layout: fixed; }
.customer-protocol-table th:nth-child(1) { width: 14%; }
.customer-protocol-table th:nth-child(2) { width: 9%; }
.customer-protocol-table th:nth-child(3) { width: 8%; }
.customer-protocol-table th:nth-child(4) { width: 14%; }
.customer-protocol-table th:nth-child(5) { width: 12%; }
.customer-protocol-table th:nth-child(6) { width: 43%; }
.customer-protocol-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.customer-protocol-actions .btn {
  justify-content: center;
  min-width: 0;
  width: 100%;
  line-height: 1.25;
  white-space: normal;
}

.users-table { table-layout: fixed; }
.users-table th:nth-child(1) { width: 15%; }
.users-table th:nth-child(2) { width: 20%; }
.users-table th:nth-child(3) { width: 14%; }
.users-table th:nth-child(4) { width: 10%; }
.users-table th:nth-child(5) { width: 12%; }
.users-table th:nth-child(6) { width: 12%; }
.users-table th:nth-child(7) { width: 17%; }
.users-table td:nth-child(2) { overflow-wrap: anywhere; }
.users-table-actions {
  display: grid;
  gap: 6px;
  width: 100%;
}
.users-table-actions .btn {
  justify-content: center;
  min-width: 0;
  width: 100%;
  white-space: normal;
}

@media (max-width: 720px) {
  table.table thead { display: none; }
  table.table, table.table tbody, table.table tr, table.table td { display: block; width: 100%; }
  table.table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    background: var(--surface);
  }
  table.table tbody td {
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
  }
  table.table tbody td::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: center;
  }
  .customer-protocol-actions { flex: 1 1 100%; }
}

/* ------------- badges & pills ------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-emerald { background: var(--emerald-50); color: var(--emerald-800); border-color: var(--emerald-200); }
.badge-amber   { background: var(--amber-50);   color: var(--amber-700);   border-color: var(--amber-200); }
.badge-red     { background: var(--red-50);     color: var(--red-700);     border-color: var(--red-200); }
.badge-blue    { background: var(--blue-50);    color: var(--blue-700);    border-color: var(--blue-100); }
.badge-slate   { background: var(--slate-100);  color: var(--slate-700);   border-color: var(--border); }

/* ------------- tabs ------------- */

.tabs {
  display: flex;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}
.tab {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  padding: 12px var(--space-4);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  min-height: var(--tap);
  white-space: nowrap;
}
.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--emerald-700);
}
.tab:hover { color: var(--text); }

/* ------------- toast ------------- */

.toast-host {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}
.toast {
  background: var(--slate-900);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: auto;
  max-width: 320px;
}
.toast.error { background: var(--red-700); }
.toast.success { background: var(--emerald-800); }

/* ------------- auth surface (login.html) ------------- */

.auth-shell {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-8);
  width: 100%;
  max-width: 420px;
}
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card .lede {
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  font-size: 14px;
}
.auth-card .brand {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--emerald-700);
  margin-bottom: var(--space-3);
}
.auth-context {
  margin: calc(-1 * var(--space-2)) 0 var(--space-6);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.partner-auth-shell {
  background:
    radial-gradient(circle at 18% 12%, rgba(21, 128, 61, 0.12), transparent 32rem),
    radial-gradient(circle at 88% 86%, rgba(15, 23, 42, 0.08), transparent 28rem),
    var(--bg);
}
.partner-auth-shell .auth-card {
  border-top: 4px solid var(--emerald-700);
}
.auth-card .switch {
  margin-top: var(--space-5);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
#turnstile-host {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* sticky form header (PLAN §10.2) */
.sticky-protocol-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  font-size: 14px;
}
.sticky-protocol-head .head-group { display: flex; gap: var(--space-3); align-items: center; }
.sticky-protocol-head .ev-placeholder {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--text-hint);
  font-size: 13px;
}

.protocol-structure-editor {
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}
.protocol-structure-editor summary {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 700;
}
.protocol-structure-body { padding: 0 var(--space-4) var(--space-4); }
.protocol-editor-row {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(180px, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}
.protocol-row-toggle { display: inline-flex; align-items: center; gap: var(--space-2); }

@media (max-width: 640px) {
  .protocol-editor-row { grid-template-columns: 1fr auto; }
  .protocol-editor-row > .protocol-row-toggle { grid-column: 1 / -1; }
}

/* small utilities */
.row { display: flex; gap: var(--space-3); align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.muted { color: var(--text-muted); }
.hint  { color: var(--text-hint); font-size: 13px; }
.mono  { font-family: var(--font-mono); font-size: 13px; }
.right { text-align: right; }
.empty {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  color: var(--text-muted);
  font-size: 14px;
}
.empty .small { font-size: 13px; color: var(--text-hint); margin-top: 6px; }

/* recovery code list */
.recovery-codes {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  letter-spacing: 0.04em;
}

/* spinner */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--slate-300);
  border-top-color: var(--emerald-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOTP enrollment QR — server-rendered SVG injected into #enroll-qr. */
.qr-host {
  display: inline-block;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 0;
}
.qr-host svg {
  display: block;
  width: 220px;
  height: 220px;
}

/* Inline-style replacements (CSP style-src 'self' forbids `style="…"`). */
.field-center {
  text-align: center;
}
.secret-block {
  display: block;
  word-break: break-all;
  padding: 10px 12px;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ============================================================
   Utility classes — added 2026-05-25 to replace inline style="…"
   attributes (CSP style-src 'self' compliance, removes the need
   for 'unsafe-inline'). Names intentionally short + composable.
   ============================================================ */

.text-bold       { font-weight: 600; }
.title-sm        { font-weight: 600; font-size: 14px; }
.text-xs         { font-size: 12px; }
.text-2xs        { font-size: 11px; }
.min-w-0         { min-width: 0; }
.break-all       { word-break: break-all; }
.pre-wrap        { margin: 0; white-space: pre-wrap; }
.mb-sm           { margin-bottom: 8px; }
.mr-sm           { margin-right: 8px; }
.gap-xs          { gap: 6px; }
.gap-sm          { gap: 8px; }
.row-actions     { gap: 6px; justify-content: flex-end; }
.cursor-pointer  { cursor: pointer; }

/* Truncate a single line inside a fixed-width table cell. */
.truncate-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-detail-value {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Repeating "card row" pattern used by archive-detail, customer attachments,
   customers list, dashboard recent-customers. */
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.list-row--padded   { padding: 14px; }
.list-row--link     { text-decoration: none; color: inherit; }
.list-row--wrap     { gap: 12px; flex-wrap: wrap; }

/* Sidebar role badge under the user name. */
.user-role-badge {
  font-size: 11px;
  color: var(--text-hint);
  padding: 0 0 8px 0;
}

/* Preset / recent-customer card button on /new.html. */
.preset-btn {
  justify-content: flex-start;
  text-align: left;
  height: auto;
  padding: 10px 12px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

/* HTML-side utility classes for the inline-style refactor.
   Names favor shorthand: mw = min-width, m = margin, mt/mb/my = margin-top/bottom/y,
   items-end = align-items:flex-end. CSS variables `--space-*` are kept in places
   that already use them; literal-pixel utilities for the rest. */
.mw-120 { min-width: 120px; }
.mw-140 { min-width: 140px; }
.mw-160 { min-width: 160px; }
.mw-200 { min-width: 200px; }
.mw-220 { min-width: 220px; }
.object-evidence-value {
  min-height: 24px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
#customer-object-evidence-number { width: 86px; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.m-0   { margin: 0; }
.mt-xs { margin-top: 6px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.my-xs { margin: 6px 0; }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.items-end { align-items: flex-end; }

/* Composite reused on archive-detail.html iframe — see frame-src 'self' in CSP. */
.pdf-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Invitation result card on /users.html. */
.invite-success {
  margin-top: var(--space-4);
  background: var(--accent-soft);
  border-color: var(--emerald-200);
}

/* Additional utilities for round-2 HTML refactor. */
.gap-8       { gap: 8px; }
.gap-12-wrap { gap: 12px; flex-wrap: wrap; }
.row-between { gap: var(--space-3); justify-content: space-between; }

.file-picker {
  position: relative;
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  clip-path: inset(50%);
}
.file-picker-button { flex: 0 0 auto; }
.file-picker-input:focus-visible + .file-picker-button {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}
.file-picker-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-filter-bar { min-width: 0; }
.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
}
.attachment-actions select {
  flex: 1 1 180px;
  width: auto;
  min-width: 0;
  max-width: 220px;
}
.fakturoid-note {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.fakturoid-note--narrow {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.mw-240 { min-width: 240px; }

/* ------------- sales-rep portal & commission ledger ------------- */

.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-500);
  color: var(--slate-950);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ledger-kicker {
  color: var(--emerald-700);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.rep-surface {
  background: #f4f6f3;
}

.rep-surface .sidebar-brand-name::after {
  content: " / PROVIZE";
  color: var(--emerald-700);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.ledger-kpi {
  position: relative;
  overflow: hidden;
  min-height: 128px;
  padding: 20px;
  background: var(--slate-900);
  border: 1px solid var(--slate-800);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.ledger-kpi .label {
  display: block;
  margin-bottom: 18px;
  color: var(--slate-300);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ledger-kpi strong {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(21px, 3vw, 30px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.ledger-rule {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
}
.ledger-rule-amber { background: var(--amber-500); }
.ledger-rule-blue  { background: var(--blue-600); }
.ledger-rule-green { background: var(--emerald-500); }

.referral-panel {
  margin-bottom: var(--space-4);
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 1px var(--emerald-200);
}
.referral-panel .card-head { flex-wrap: wrap; }
.referral-panel .card-head > div { min-width: 0; flex: 1 1 280px; }

.ledger-list {
  display: flex;
  flex-direction: column;
}

.ledger-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
}
.ledger-line:first-child { padding-top: 2px; }
.ledger-line:last-child { padding-bottom: 2px; border-bottom: 0; }
.ledger-line-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.ledger-line-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-amount {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ledger-table tbody td { vertical-align: top; }

.commission-tabs {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg);
  padding-top: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: end;
}
.form-span-2 { grid-column: 1 / -1; }

.case-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.case-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--slate-300);
  padding: 16px;
  background: var(--surface);
}
.case-card-new { border-left-color: var(--amber-500); }
.case-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
}
.case-private {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr);
  gap: var(--space-4);
  padding: 12px;
  background: var(--slate-50);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  white-space: pre-wrap;
}
.case-label {
  display: block;
  margin-bottom: 3px;
  color: var(--text-hint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.case-actions { padding-top: var(--space-3); }

.compact-control {
  width: auto;
  min-width: 135px;
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px;
}
.payout-reason { max-width: 190px; }
.generator-table-wrap { max-height: 520px; overflow-y: auto; }

.commission-dialog-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top, 0px)) 16px
    max(20px, env(safe-area-inset-bottom, 0px));
  place-items: center;
  background: rgb(15 23 42 / 0.58);
  backdrop-filter: blur(4px);
}
.commission-dialog-backdrop[hidden] { display: none; }
.commission-dialog-card {
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--border);
  border-top: 4px solid var(--emerald-600);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 28px 80px rgb(15 23 42 / 0.28);
}
.commission-dialog-card h2 { margin: 5px 0 6px; }
.commission-dialog-card .field { margin: 0; }
.commission-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-2);
}
body.commission-dialog-open { overflow: hidden; }

@media (max-width: 760px) {
  .ledger-summary { grid-template-columns: 1fr; }
  .ledger-kpi { min-height: 108px; }
  .ledger-kpi .label { margin-bottom: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: auto; }
  .case-head { flex-direction: column; }
  .case-private { grid-template-columns: 1fr; }
  .case-actions { align-items: stretch; }
  .case-actions .compact-control,
  .case-actions .btn { width: 100%; }
  .commission-tabs {
    overflow-x: auto;
    top: 56px;
  }
  .commission-dialog-backdrop {
    padding-right: 10px;
    padding-left: 10px;
    align-items: end;
  }
  .commission-dialog-card {
    max-height: calc(100dvh - 20px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .commission-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .commission-dialog-actions .btn { width: 100%; }
}

/* Customer service history — an operational log, intentionally closer to a
   workshop job card than a generic dashboard feed. */
.service-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.35fr);
  gap: var(--space-5);
  align-items: start;
}
.service-entry-card {
  position: sticky;
  top: var(--space-4);
  overflow: hidden;
  border-top: 4px solid var(--blue-600);
}
.service-entry-card .card-head {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue-50) 82%, white), var(--surface));
}
.eyebrow {
  margin-bottom: 4px;
  color: var(--blue-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.compact-field {
  display: grid;
  grid-template-columns: auto minmax(112px, 1fr);
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.compact-field select,
.compact-field input { min-height: 36px; }
.attachment-captured-field { min-width: 236px; }
.service-timeline {
  position: relative;
  display: grid;
  gap: 0;
}
.service-timeline::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 116px;
  width: 1px;
  background: var(--border);
  content: "";
}
.service-event {
  position: relative;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 34px;
  padding: 0 0 28px;
}
.service-event:last-child { padding-bottom: 0; }
.service-event::before {
  position: absolute;
  top: 7px;
  left: 111px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-300);
  content: "";
}
.service-event-date {
  display: grid;
  gap: 3px;
  padding-top: 2px;
  text-align: right;
}
.service-event-date strong {
  color: var(--text);
  font-size: 13px;
}
.service-event-date span {
  color: var(--text-hint);
  font-size: 11px;
}
.service-event-body {
  min-width: 0;
  padding: 0 0 2px;
}
.service-event-work {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.55;
}
.component-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.component-chip {
  padding: 5px 8px;
  border: 1px solid var(--slate-200);
  border-radius: 5px;
  background: var(--slate-50);
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 11px;
}
.service-event-created {
  display: block;
  margin-top: 11px;
}
.service-file-field {
  display: grid;
  gap: 8px;
}
.service-file-field > strong {
  font-size: 13px;
  font-weight: 500;
}
.service-event-attachments {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
.service-event-attachments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.service-event-attachments-head > strong { font-size: 12px; }
.service-event-attachment-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}
.service-attachment-date-field {
  display: grid;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
}
.service-attachment-date-field input {
  width: 142px;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 12px;
}
.service-add-file {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12px;
}
.service-attachment-list {
  display: grid;
  gap: 6px;
}
.service-attachment-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  color: var(--text);
}
.service-attachment-link:hover {
  border-color: var(--blue-300);
  background: var(--blue-50);
  text-decoration: none;
}
.service-attachment-type {
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.service-attachment-name {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .service-workspace { grid-template-columns: 1fr; }
  .service-entry-card { position: static; }
}

@media (max-width: 560px) {
  .service-timeline::before { left: 7px; }
  .service-event {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-left: 28px;
  }
  .service-event::before { left: 2px; }
  .service-event-date { text-align: left; }
  .service-history-card .card-head { align-items: flex-start; }
  .compact-field {
    width: 100%;
    grid-template-columns: auto 1fr;
  }
  .file-picker {
    align-items: stretch;
    flex-direction: column;
  }
  .file-picker > .btn { width: 100%; }
  .file-picker-name { white-space: normal; }
  .service-event-attachments-head {
    align-items: stretch;
    flex-direction: column;
  }
  .service-event-attachment-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .service-attachment-date-field input { width: 100%; }
  .service-add-file { width: 100%; }
  .service-attachment-link {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .service-attachment-link > .hint { grid-column: 2; }
}

/* Shared, append-only GDPR camera-recording access log. */
.gdpr-log-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(520px, 1.38fr);
  gap: var(--space-5);
  align-items: start;
}
.gdpr-log-form {
  position: sticky;
  top: var(--space-4);
  border-top: 4px solid var(--emerald-600);
}
.gdpr-log-integrity-note {
  padding: 11px 13px;
  border-left: 3px solid var(--emerald-500);
  background: var(--emerald-50);
  color: var(--emerald-800);
  font-size: 11px;
  line-height: 1.5;
}
.gdpr-log-list {
  display: grid;
  gap: 12px;
}
.gdpr-log-entry {
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 4px solid var(--emerald-500);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.gdpr-log-entry > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--slate-50);
}
.gdpr-log-entry > header > div {
  display: grid;
  gap: 3px;
}
.gdpr-log-entry > header span:not(.badge) {
  color: var(--text-muted);
  font-size: 11px;
}
.gdpr-log-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
}
.gdpr-log-detail {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
}
.gdpr-log-detail:first-child { grid-column: 1 / -1; }
.gdpr-log-detail > span {
  color: var(--text-hint);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gdpr-log-detail > strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
}
.gdpr-log-entry > footer {
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-hint);
  font-size: 10px;
}
.note-visibility-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--amber-300);
  border-radius: var(--radius-sm);
  background: var(--amber-50);
  color: var(--amber-800);
  font-weight: 650;
  white-space: nowrap;
}
.note-visibility-toggle input { width: auto; min-height: 0; }

@media (max-width: 1080px) {
  .gdpr-log-workspace { grid-template-columns: 1fr; }
  .gdpr-log-form { position: static; }
}

@media (max-width: 600px) {
  .gdpr-log-entry > header { flex-direction: column; }
  .gdpr-log-entry-grid { grid-template-columns: 1fr; }
  .gdpr-log-detail:first-child { grid-column: auto; }
  .gdpr-log-history .card-head { align-items: stretch; }
  .gdpr-log-history .card-head > .row { width: 100%; }
  .gdpr-log-history .card-head .btn,
  .gdpr-log-history .compact-field { flex: 1 1 100%; width: 100%; }
}

/* Attendance — dense enough for payroll work, warm enough for daily use. */
.attendance-page-head { margin-bottom: var(--space-5); }
.attendance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  box-shadow: var(--shadow-sm);
}
.attendance-kpi {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 128px;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
}
.attendance-kpi::after {
  position: absolute;
  right: -20px;
  bottom: -35px;
  width: 92px;
  height: 92px;
  border: 18px solid var(--blue-50);
  border-radius: 50%;
  content: "";
}
.attendance-kpi-road::after {
  border-radius: 8px;
  transform: rotate(32deg);
}
.attendance-kpi-leave::after { border-color: var(--amber-100); }
.attendance-kpi .label {
  color: var(--text-hint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.attendance-kpi strong {
  position: relative;
  z-index: 1;
  font-size: clamp(24px, 2.5vw, 34px);
  letter-spacing: -0.04em;
}
.attendance-kpi > span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}
.attendance-filter-card { margin-bottom: var(--space-5); }
.attendance-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 0.7fr)) minmax(220px, 1.4fr) auto auto;
  gap: var(--space-3);
  align-items: end;
}
.attendance-place-filter { min-width: 0; }
.attendance-export-actions {
  display: flex;
  gap: 6px;
}
.attendance-export-actions .btn { white-space: nowrap; }
.attendance-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(480px, 1.35fr);
  gap: var(--space-5);
  align-items: start;
}
.attendance-layout > .card { min-width: 0; }
.attendance-editor {
  position: sticky;
  top: var(--space-4);
  border-top: 4px solid var(--blue-600);
}
.attendance-entry-stack {
  display: grid;
  gap: 8px;
}
.attendance-entry-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px 50px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--slate-50);
}
.attendance-entry-row label {
  min-width: 0;
  margin: 0;
}
.attendance-entry-row label > span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-hint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.attendance-entry-row input {
  min-width: 0;
  background: var(--surface);
}
.attendance-entry-row select { min-width: 0; }
.attendance-entry-row label:nth-of-type(1),
.attendance-entry-row label:nth-of-type(2),
.attendance-entry-row label:nth-of-type(5) {
  grid-column: 1 / -1;
}
.attendance-remove-entry {
  position: absolute;
  top: 30px;
  right: 8px;
  width: 36px;
  min-width: 36px;
  padding: 7px;
  color: var(--red-600);
  font-size: 18px;
}
.attendance-costs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.attendance-receipt-upload {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}
.attendance-receipt-upload > div:first-child {
  display: grid;
  gap: 3px;
}
.attendance-receipt-pickers {
  display: grid;
  gap: 8px;
}
.attendance-receipt-pickers .file-picker { min-width: 0; }
.attendance-receipt-links {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.attendance-receipt-links a { overflow-wrap: anywhere; }
.attendance-lock-note {
  padding: 10px 12px;
  border-left: 3px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.attendance-save { width: 100%; }
.attendance-day-stack {
  display: grid;
  gap: 12px;
}
.attendance-day-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue-500);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgb(15 23 42 / 0.02);
}
.attendance-day-card.is-locked { border-left-color: var(--slate-300); }
.attendance-day-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 13px 14px 10px;
}
.attendance-day-date {
  font-weight: 750;
  letter-spacing: -0.01em;
}
.attendance-day-total {
  color: var(--blue-700);
  font-size: 18px;
}
.attendance-history-entries {
  display: grid;
  gap: 1px;
  margin: 0 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--border);
}
.attendance-history-entry {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 72px minmax(120px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  background: var(--slate-50);
  font-size: 12px;
}
.attendance-history-place {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
}
.attendance-history-place strong { overflow-wrap: anywhere; }
.attendance-entry-hours {
  color: var(--blue-700);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}
.attendance-day-card > footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 11px 14px 13px;
  color: var(--text-muted);
  font-size: 11px;
}
.attendance-vacation-mark {
  margin: 0 14px 14px;
  padding: 18px;
  border: 1px dashed var(--amber-300);
  border-radius: 6px;
  background: var(--amber-50);
  color: var(--amber-800);
  text-align: center;
}

@media (max-width: 1080px) {
  .attendance-summary { grid-template-columns: repeat(2, 1fr); }
  .attendance-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-filters .btn { width: 100%; }
  .attendance-export-actions { grid-column: 1 / -1; }
  .attendance-export-actions .btn { flex: 1; }
  .attendance-layout { grid-template-columns: 1fr; }
  .attendance-editor { position: static; }
}

@media (max-width: 680px) {
  .attendance-summary { grid-template-columns: 1fr; }
  .attendance-kpi { min-height: 105px; }
  .attendance-filters { grid-template-columns: 1fr; }
  .attendance-entry-row { padding-right: 46px; }
  .attendance-export-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .attendance-costs { grid-template-columns: 1fr; }
  .attendance-costs .form-span-2 { grid-column: auto; }
  .attendance-history-entry {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .attendance-history-entry > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .attendance-history-entry .hint { grid-column: 1 / -1; }
  .attendance-day-card > header { flex-direction: column; }
  .attendance-day-card > header .row {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 460px) {
  .attendance-entry-row { grid-template-columns: minmax(0, 1fr); }
  .attendance-entry-row label { grid-column: 1 / -1; }
  .attendance-export-actions { grid-template-columns: 1fr; }
}

/* Customer portal — quiet architectural archive: warm paper, ink, and the
   copper accent used on real technical folders. */
.customer-portal-surface {
  min-height: 100vh;
  background:
    linear-gradient(rgb(255 255 255 / 0.72), rgb(255 255 255 / 0.72)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgb(71 85 105 / 0.035) 31px 32px),
    #f5f3ee;
  color: #18201e;
}
.customer-portal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 12px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgb(24 32 30 / 0.12);
  background: rgb(250 249 246 / 0.92);
  backdrop-filter: blur(14px);
}
.customer-portal-brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: inherit;
}
.customer-portal-brand:hover { text-decoration: none; }
.customer-brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #1f4d42;
  border-radius: 50%;
  color: #1f4d42;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
}
.customer-portal-brand > span:last-child {
  display: grid;
  line-height: 1.15;
}
.customer-portal-brand strong {
  font-size: 14px;
  letter-spacing: 0.16em;
}
.customer-portal-brand small {
  margin-top: 3px;
  color: #66706c;
  font-size: 10px;
}
.customer-portal-account {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #66706c;
  font-size: 12px;
}
.customer-portal-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(48px, 8vw, 92px) 0 36px;
}
.customer-portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: clamp(32px, 8vw, 100px);
  align-items: center;
  margin-bottom: 52px;
}
.customer-kicker {
  margin-bottom: 10px;
  color: #a35f35;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.customer-portal-hero h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 70px);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -0.045em;
}
.customer-portal-hero p {
  max-width: 650px;
  color: #66706c;
  font-size: 16px;
}
.customer-document-seal {
  display: grid;
  width: 170px;
  height: 170px;
  place-content: center;
  border: 1px solid #a35f35;
  border-radius: 50%;
  color: #a35f35;
  text-align: center;
  transform: rotate(-5deg);
}
.customer-document-seal::before,
.customer-document-seal::after {
  display: block;
  width: 90px;
  height: 1px;
  margin: 6px auto;
  background: currentColor;
  content: "";
}
.customer-document-seal span,
.customer-document-seal small {
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.customer-document-seal strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  letter-spacing: 0.08em;
}
.customer-building-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}
.customer-building-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 14px;
  border: 1px solid rgb(24 32 30 / 0.14);
  background: rgb(255 255 255 / 0.74);
}
.customer-building-index {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #b8bfbb;
  border-radius: 50%;
  color: #66706c;
  font-family: var(--font-mono);
  font-size: 10px;
}
.customer-building-card > div { display: grid; gap: 3px; }
.customer-building-card strong { font-family: Georgia, "Times New Roman", serif; }
.customer-building-card span:not(.customer-building-index),
.customer-building-card small {
  color: #66706c;
  font-size: 11px;
}
.customer-portal-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 52px;
  border-top: 1px solid rgb(24 32 30 / 0.18);
  border-bottom: 1px solid rgb(24 32 30 / 0.18);
}
.customer-portal-metrics article {
  display: grid;
  gap: 7px;
  padding: 18px 20px;
  border-right: 1px solid rgb(24 32 30 / 0.12);
}
.customer-portal-metrics article:last-child { border-right: 0; }
.customer-portal-metrics span {
  color: #66706c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.customer-portal-metrics strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
}
.customer-library {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgb(24 32 30 / 0.15);
  background: rgb(255 255 255 / 0.82);
  box-shadow: 0 22px 60px rgb(24 32 30 / 0.06);
}
.customer-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.customer-library-head h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 400;
}
.customer-library-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgb(24 32 30 / 0.12);
  background: #f5f3ee;
}
.customer-library-tabs button {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  background: transparent;
  color: #66706c;
  font-size: 11px;
}
.customer-library-tabs button.active {
  background: #1f4d42;
  color: white;
}
.customer-document-grid {
  display: grid;
  gap: 1px;
  border-top: 1px solid rgb(24 32 30 / 0.12);
  background: rgb(24 32 30 / 0.12);
}
.customer-document-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 112px;
  padding: 18px 8px;
  background: white;
  color: inherit;
  transition: background 150ms ease, padding 150ms ease;
}
.customer-document-card:hover {
  padding-right: 14px;
  padding-left: 14px;
  background: #faf9f6;
  text-decoration: none;
}
.customer-document-icon {
  display: grid;
  width: 44px;
  height: 56px;
  place-items: end center;
  padding-bottom: 7px;
  border: 1px solid #b8bfbb;
  background:
    linear-gradient(135deg, transparent 0 10px, #f5f3ee 10px) top right / 13px 13px no-repeat,
    white;
}
.customer-document-icon span {
  color: #a35f35;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}
.customer-document-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.customer-document-copy > strong {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-document-copy > span,
.customer-document-copy p {
  color: #66706c;
  font-size: 11px;
}
.customer-doc-type {
  display: inline-flex;
  padding: 3px 6px;
  border: 1px solid #d1a78c;
  color: #8c4c27;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.customer-doc-type-protocol {
  border-color: #9fb9b2;
  color: #1f4d42;
}
.customer-document-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  color: #66706c;
  font-size: 11px;
}
.customer-download-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgb(24 32 30 / 0.15);
  border-radius: 50%;
  color: #1f4d42;
}
.customer-library-empty {
  display: grid;
  gap: 6px;
  padding: 54px 20px;
  color: #66706c;
  text-align: center;
}
.customer-library-empty strong {
  color: #18201e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
}
.customer-gdpr-journal {
  margin-top: 34px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgb(24 32 30 / 0.15);
  background: rgb(255 255 255 / 0.82);
  box-shadow: 0 22px 60px rgb(24 32 30 / 0.06);
}
.customer-gdpr-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.customer-gdpr-head h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 400;
}
.customer-gdpr-head p {
  max-width: 650px;
  color: #66706c;
  font-size: 12px;
}
.customer-gdpr-filters {
  display: flex;
  gap: 8px;
  align-items: end;
}
.customer-gdpr-filters label {
  display: grid;
  gap: 4px;
  min-width: 120px;
  color: #66706c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.customer-gdpr-filters select {
  min-height: 38px;
  border-color: rgb(24 32 30 / 0.2);
  border-radius: 0;
  background: white;
}
.customer-gdpr-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(420px, 1.2fr);
  gap: 20px;
  align-items: start;
}
.customer-gdpr-form {
  border: 1px solid rgb(24 32 30 / 0.16);
  background: #faf9f6;
}
.customer-gdpr-form-head {
  display: grid;
  gap: 3px;
  padding: 17px 18px;
  border-bottom: 1px solid rgb(24 32 30 / 0.12);
}
.customer-gdpr-form-head span {
  color: #a35f35;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.customer-gdpr-form-head strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 400;
}
.customer-gdpr-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 18px;
}
.customer-gdpr-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #66706c;
  font-size: 10px;
}
.customer-gdpr-fields input,
.customer-gdpr-fields textarea {
  min-width: 0;
  border-color: rgb(24 32 30 / 0.2);
  border-radius: 0;
  background: white;
}
.customer-gdpr-wide { grid-column: 1 / -1; }
.customer-gdpr-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 18px;
  border-top: 1px solid rgb(24 32 30 / 0.12);
}
.customer-gdpr-form-foot span { color: #66706c; font-size: 9px; }
.customer-gdpr-entry-list { display: grid; gap: 12px; }
.customer-gdpr-entry {
  overflow: hidden;
  border: 1px solid rgb(24 32 30 / 0.14);
  border-left: 3px solid #1f4d42;
  background: white;
}
.customer-gdpr-entry > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgb(24 32 30 / 0.1);
}
.customer-gdpr-entry > header > div { display: grid; gap: 3px; }
.customer-gdpr-entry > header span,
.customer-gdpr-entry > header small { color: #66706c; font-size: 9px; }
.customer-gdpr-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgb(24 32 30 / 0.1);
}
.customer-gdpr-detail {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  background: white;
}
.customer-gdpr-detail:first-child { grid-column: 1 / -1; }
.customer-gdpr-detail span {
  color: #66706c;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.customer-gdpr-detail strong {
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}
.customer-gdpr-entry > footer {
  padding: 8px 12px;
  border-top: 1px solid rgb(24 32 30 / 0.1);
  color: #66706c;
  font-size: 8px;
}
.customer-portal-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 0;
  color: #66706c;
  font-size: 10px;
}
.customer-portal-footer a { color: #1f4d42; }
.customer-auth-shell {
  background:
    radial-gradient(circle at 12% 18%, rgb(163 95 53 / 0.12), transparent 32%),
    linear-gradient(145deg, #f5f3ee, #e9eeeb);
}
.customer-auth-card {
  border-top: 4px solid #1f4d42;
  border-radius: 2px;
}
.customer-auth-card .brand {
  color: #1f4d42;
  font-family: Georgia, "Times New Roman", serif;
}

/* Contract/GDPR review workspace */
.contract-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(380px, 0.86fr);
  gap: 18px;
  align-items: start;
}
.contract-generator,
.contract-archive {
  overflow: hidden;
}
.review-gate {
  display: grid;
  gap: 4px;
  padding: 13px 18px;
  border-top: 1px solid var(--amber-300);
  border-bottom: 1px solid var(--amber-300);
  background: var(--amber-100);
  color: var(--amber-800);
  font-size: 12px;
}
.review-gate strong {
  font-size: 12px;
}
.contract-document-list {
  display: grid;
  gap: 10px;
}
.contract-document-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
}
.contract-document-mark {
  display: grid;
  width: 38px;
  height: 48px;
  place-items: end center;
  padding-bottom: 6px;
  border: 1px solid var(--slate-300);
  border-radius: 2px;
  color: var(--red-700);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.contract-document-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.contract-document-row > .row-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--slate-100);
}

@media (max-width: 720px) {
  .customer-portal-header { padding: 10px 18px; }
  .customer-portal-account > span { display: none; }
  .customer-portal-main { width: min(100% - 24px, 1180px); padding-top: 40px; }
  .customer-portal-hero { grid-template-columns: 1fr; margin-bottom: 34px; }
  .customer-document-seal { display: none; }
  .customer-portal-metrics { grid-template-columns: 1fr; }
  .customer-portal-metrics article {
    grid-template-columns: 1fr auto;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid rgb(24 32 30 / 0.12);
  }
  .customer-portal-metrics article:last-child { border-bottom: 0; }
  .customer-library-head { align-items: flex-start; flex-direction: column; }
  .customer-library-tabs { width: 100%; overflow-x: auto; }
  .customer-library-tabs button { flex: 1 0 auto; }
  .customer-document-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }
  .customer-document-meta {
    grid-column: 2;
    justify-content: space-between;
  }
  .customer-portal-footer { flex-direction: column; }
  .customer-gdpr-head,
  .customer-gdpr-form-foot { align-items: stretch; flex-direction: column; }
  .customer-gdpr-filters { align-items: stretch; flex-direction: column; width: 100%; }
  .customer-gdpr-filters label { width: 100%; }
  .customer-gdpr-layout { grid-template-columns: 1fr; }
  .customer-gdpr-fields { grid-template-columns: 1fr; padding: 14px; }
  .customer-gdpr-wide { grid-column: auto; }
  .customer-gdpr-form-foot .btn { width: 100%; }
  .customer-gdpr-entry > header { flex-direction: column; }
  .customer-gdpr-entry-grid { grid-template-columns: 1fr; }
  .customer-gdpr-detail:first-child { grid-column: auto; }
}

@media (max-width: 1080px) {
  .contract-workspace { grid-template-columns: 1fr; }
}

/* ------------- compact phone layout -------------
   The portal is often used by technicians on site. At phone widths controls
   become single-column work surfaces instead of compressed desktop rows. */
@media (max-width: 600px) {
  body { font-size: 15px; }
  button, input, select, textarea { font-size: 16px; }
  input:not([type]),
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="date"],
  select,
  select.compact-control,
  .compact-field select,
  textarea { font-size: 16px; }

  .app { grid-template-columns: minmax(0, 1fr); }
  .app::before {
    position: fixed;
    z-index: 40;
    inset: 0 0 auto;
    height: calc(56px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--border);
    background: rgb(255 255 255 / 0.94);
    box-shadow: 0 1px 10px rgb(15 23 42 / 0.04);
    backdrop-filter: blur(12px);
    pointer-events: none;
    content: "";
  }
  main.content {
    padding: calc(60px + env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      calc(32px + env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
  }
  .menu-button {
    top: max(10px, env(safe-area-inset-top, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
    width: var(--tap);
    height: var(--tap);
  }
  .sidebar { width: min(280px, calc(100vw - 32px)); }

  .page-head {
    align-items: stretch;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
  }
  .page-head > .btn { width: 100%; }
  .page-head > .row {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-head > .row .btn { flex: 1 1 auto; }
  .archive-detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .archive-detail-actions #regenerate-btn { grid-column: 1 / -1; }
  .page-head .title-block,
  .card,
  .card-head,
  .card-body,
  .field,
  .row,
  .stack { min-width: 0; max-width: 100%; }
  .card-head {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px var(--space-4);
  }
  .card-head > .row {
    width: 100%;
    flex-wrap: wrap;
  }
  .card-body { padding: var(--space-4); }
  .empty { padding: var(--space-6) var(--space-3); }
  .equipment-detail-row { grid-template-columns: minmax(0, 1fr); }
  .equipment-detail-row dt {
    padding-bottom: 5px;
    background: var(--surface-subtle);
  }
  .equipment-detail-row dd { padding-top: 7px; }

  .mw-120,
  .mw-140,
  .mw-160,
  .mw-200,
  .mw-220,
  .mw-240 { min-width: 0; }
  .row.wrap > .field {
    flex-basis: 100%;
    width: 100%;
  }
  .row-actions { flex-wrap: wrap; }
  .row-actions .btn { flex: 1 1 auto; }
  .btn {
    height: auto;
    min-height: var(--tap);
    padding-top: 8px;
    padding-bottom: 8px;
    white-space: normal;
  }
  input[type="file"] { min-width: 0; max-width: 100%; }
  .file-picker {
    width: 100%;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .file-picker-button { width: 100%; text-align: center; }
  .file-picker-name {
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .attachment-filter-bar { width: 100%; }
  .attachment-filter-bar .btn { flex: 1 1 120px; }
  .attachment-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .attachment-actions select {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }
  .attachment-actions .btn { width: 100%; }

  .sticky-protocol-head {
    position: static;
    display: grid;
    gap: 14px;
    padding: 14px;
  }
  .sticky-protocol-head .head-group {
    width: 100%;
    min-width: 0;
  }
  .sticky-protocol-head .protocol-kind-group {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
  }
  .sticky-protocol-head .protocol-module-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }
  .sticky-protocol-head .protocol-module-group > strong { grid-column: 1 / -1; }
  .sticky-protocol-head .protocol-template-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .protocol-template-group select,
  .protocol-template-group input,
  .protocol-template-group .btn { width: 100%; }
  .sticky-protocol-head .ev-placeholder {
    width: 100%;
    margin-left: 0;
    text-align: right;
  }
  #protocol-form .row-between {
    display: grid;
    grid-template-columns: 1fr;
  }
  #protocol-form .row-between .btn { width: 100%; }

  .tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 2px;
    padding-bottom: 4px;
  }
  .tab {
    flex: 1 1 auto;
    padding: 10px 12px;
  }

  .table-wrap { max-width: 100%; overflow-x: hidden; }
  table.table tbody td {
    min-width: 0;
    align-items: flex-start;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  table.table tbody td::before {
    flex: 0 0 min(42%, 120px);
    padding-top: 2px;
  }
  table.table .mono { overflow-wrap: anywhere; word-break: break-word; }
  table.table tbody td .row { flex-wrap: wrap; justify-content: flex-start; }
  .badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }

  .list-row {
    min-width: 0;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .list-row > * { min-width: 0; max-width: 100%; }
  .list-row > .right { width: 100%; text-align: left; }
  .truncate-cell {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .audit-detail-value {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
  }
  .mono, code, pre { overflow-wrap: anywhere; word-break: break-word; }

  .auth-shell { padding: var(--space-4); }
  .auth-card { padding: var(--space-6) var(--space-5); }
  .toast-host {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    left: max(12px, env(safe-area-inset-left, 0px));
  }
  .toast { max-width: none; }
  .recovery-codes { grid-template-columns: 1fr; }
  .pdf-frame { height: 68vh; }

  .customer-library-tabs { flex-wrap: wrap; overflow-x: visible; }
  .customer-library-tabs button { flex: 1 1 auto; }
  .customer-document-copy > strong {
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .customer-document-meta { flex-wrap: wrap; }
}
