:root {
  --bg: #e8eef5;
  --surface: #f7fafc;
  --border: #d3dde8;
  --text: #1a2433;
  --muted: #5b6b7c;
  --primary: #2f6fad;
  --primary-hover: #245a8e;
  --hover: #e7eef6;
  --selected: #d5e6f6;
  --selected-border: #4a86c1;
  --header-bg: #1c2b3d;
  --header-text: #eaf1f8;
  --shadow: 0 1px 2px rgba(28, 43, 61, 0.06), 0 6px 18px rgba(28, 43, 61, 0.06);
  --action-pos: #059669;
  --action-pos-hover: #047857;
  --action-neg: #b42318;
  --action-neg-hover: #991b1b;
  --action-mute: #1c2b3d;
  --action-mute-hover: #2a3d54;
  --ink: var(--text);
  --ink-soft: var(--muted);
  --paper: var(--bg);
  --paper-2: #e3ebf5;
  --cream: var(--surface);
  --accent: var(--primary);
  --accent-dark: var(--primary-hover);
  --accent-soft: var(--selected);
  --navy: var(--header-bg);
  --navy-2: #24364c;
  --copper: var(--primary);
  --copper-dark: var(--primary-hover);
  --sage: var(--action-pos);
  --rule: var(--border);
  --danger: var(--action-neg);
  --warn: #b45309;
  --ok: var(--action-pos);
  --sidebar: 260px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(47, 111, 173, 0.14), transparent 50%),
    var(--paper);
  line-height: 1.5;
}
h1, h2, h3, .brand strong, .login-card h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}
h1 { font-size: 1.85rem; margin: 0.1rem 0 0; }
h2 { font-size: 1.12rem; margin: 0; }
h3 { font-size: 1.02rem; margin: 0.4rem 0 0.25rem; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0; }
code, .hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.shell { display: flex; min-height: 100vh; max-width: 100%; }
.sidebar {
  width: var(--sidebar);
  background: var(--header-bg);
  color: var(--header-text);
  border-right: 3px solid var(--primary);
  padding: 1.35rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand em {
  display: block;
  font-style: normal;
  font-size: 0.76rem;
  opacity: 0.62;
  font-weight: 500;
}
.seal {
  width: 0.85rem;
  height: 1.7rem;
  border: 0;
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-size: 0;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(180deg, #7eb3e0, var(--primary));
  box-shadow: 0 0 0 3px rgba(47, 111, 173, 0.28);
}
.seal.large {
  width: 0.85rem;
  height: 2.2rem;
  font-size: 0;
  margin: 0 auto 0.8rem;
  border-radius: 2px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 0.2rem; }
.sidebar nav a {
  color: #b7c5d9;
  text-decoration: none;
  padding: 0.52rem 0.72rem;
  border-radius: 10px;
  font-weight: 500;
}
.sidebar nav a.is-active,
.sidebar nav a:hover {
  background: rgba(47, 111, 173, 0.28);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.is-active {
  background: var(--primary);
  box-shadow: none;
}
.sidebar-cta { text-align: center; }
.sidebar-views { display: flex; flex-direction: column; gap: 0.15rem; }
.sidebar-views p {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7f90a8;
  margin: 0 0.7rem 0.3rem;
  font-weight: 600;
}
.sidebar-views a {
  color: #b7c5d9;
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  font-size: 0.9rem;
}
.sidebar-views a.is-active,
.sidebar-views a:hover {
  background: rgba(47, 111, 173, 0.28);
  color: #fff;
  text-decoration: none;
}
.sidebar-user {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.86rem;
  color: #9db0c8;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user a { color: #93c5fd; }
.sidebar-user-links { display: flex; gap: 0.75rem; }
.sidebar-back {
  text-align: center;
  background: transparent;
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.28);
}
.sidebar-back:hover { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.settings-pill {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 1.2rem;
}
.settings-card {
  display: grid;
  gap: 0.35rem;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.settings-card:hover {
  text-decoration: none;
  border-color: var(--selected-border);
  transform: none;
  box-shadow: var(--shadow);
}
.settings-card p:not(.kicker) { color: var(--ink-soft); font-size: 0.92rem; }
.settings-card strong {
  margin-top: 0.45rem;
  color: var(--accent-dark);
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.6rem 0;
}
.quick-search {
  display: flex;
  gap: 0.4rem;
  flex: 1;
  max-width: 520px;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.22rem 0.22rem 0.22rem 1rem;
  box-shadow: var(--shadow);
}
.quick-search input {
  border: 0;
  background: transparent;
  flex: 1;
  font: inherit;
  outline: none;
  box-shadow: none;
}
.quick-search button,
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.45rem 0.95rem;
  background: var(--action-mute);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn:hover { text-decoration: none; background: var(--action-mute-hover); filter: none; }
.btn-copper { background: var(--action-pos); color: #fff; }
.btn-copper:hover { background: var(--action-pos-hover); filter: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--action-neg); color: #fff; }
.btn-danger:hover { background: var(--action-neg-hover); }
.btn-block { width: 100%; }
.topbar-meta { color: var(--ink-soft); font-size: 0.88rem; }
.content { padding: 1.2rem 1.6rem 1.5rem; min-width: 0; max-width: 100%; }
.app-footer {
  padding: 0.65rem 1.6rem 1.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.app-footer .footer-sep { margin: 0 0.35rem; opacity: 0.55; }

.page-head, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--accent-dark);
  font-weight: 700;
}
.muted { color: var(--ink-soft); margin: 0 0 1rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.flashes { padding: 0.8rem 1.6rem 0; display: grid; gap: 0.4rem; }
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #1e3a8a;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info { background: #dbeafe; color: #1e40af; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.stat, .panel, .doc-card, .folder-row, .empty {
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { padding: 1rem 1.1rem; }
.stat p { color: var(--ink-soft); font-size: 0.85rem; }
.stat strong { font-size: 1.7rem; display: block; letter-spacing: -0.03em; }
.status-row { display: flex; gap: 0.5rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--paper-2);
}
.status-brouillon { background: #e0e7ff; color: #3730a3; }
.status-valide { background: #d1fae5; color: var(--sage); }
.status-archive { background: #e2e8f0; color: var(--ink-soft); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: 1.4rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.split > * { min-width: 0; max-width: 100%; }
.split.detail { grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr); align-items: start; }
.split.deposit { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: start; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.2rem;
}
.steps li {
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: var(--paper-2);
  font-size: 0.88rem;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 500;
}
.steps li.is-current {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.steps li.is-done { background: #dbeafe; color: var(--accent-dark); }
.deposit-preview { min-height: 240px; max-height: min(62vh, 640px); }
.sheet-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.7rem 0;
  background: #f1f6fc;
  border-bottom: 1px solid var(--rule);
}
.sheet-tabs a {
  padding: 0.28rem 0.65rem;
  border-radius: 8px 8px 0 0;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.82rem;
  background: transparent;
}
.sheet-tabs a.is-active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
}
.sheet {
  border-collapse: collapse;
  font-size: 0.8rem;
  width: max-content;
}
.sheet th, .sheet td {
  border: 1px solid #e4edf7;
  padding: 0.28rem 0.5rem;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet thead th {
  background: #f4f8fd;
  font-weight: 600;
  text-align: center;
}
.sheet .row-head {
  background: #f4f8fd;
  text-align: center;
  color: var(--ink-soft);
  min-width: 2.2rem;
}
.sheet-meta {
  padding: 0.45rem 0.7rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  background: #f8fbfe;
}
.ocr-panel { margin-top: 1rem; }
.ocr-panel h2 { margin-bottom: 0.35rem; }
.ocr-text {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0.4rem 0 0;
  padding: 0.7rem 0.8rem;
  background: #f8fbfe;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
}
.ocr-empty { margin-top: 0.8rem; }
.ocr-run { margin: 0.35rem 0 0.15rem; }
.model-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  padding: 0.2rem 0 0.4rem;
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  margin: 0;
}
.check-item input { width: auto; margin: 0; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.8rem;
}
.doc-card { padding: 1rem; transition: border-color 0.15s ease, transform 0.15s ease; }
.doc-card:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
}
.doc-card-top { display: flex; justify-content: space-between; align-items: center; }
.doc-card h3 a { color: inherit; }
.doc-meta { color: var(--ink-soft); font-size: 0.84rem; }
.kind {
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.45rem;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
}
.kind-pdf { background: #2563eb; }
.kind-image { background: #0ea5e9; }
.kind-texte { background: #1d4ed8; }
.kind-tableur { background: #0f766e; }
.kind-presentation { background: #7c3aed; }
.kind-archive { background: #475569; }
.kind.big { font-size: 1rem; padding: 0.4rem 0.7rem; }
.tags { list-style: none; display: flex; gap: 0.35rem; flex-wrap: wrap; padding: 0; margin: 0.6rem 0 0; }
.tags a, .tags span {
  background: #f1f6fc;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-decoration: none;
}
.model-name { font-weight: 600; }
.model-lock { margin: 0; color: var(--ink-soft); }
.name-preview {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #f5f9ff;
  border: 1px solid var(--rule);
}
.name-preview .hint { display: block; margin-top: 0.25rem; }
.attr-block {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1rem 1rem 0.4rem;
  background: #f7faff;
}
.attr-block legend {
  font-weight: 700;
  padding: 0 0.35rem;
}
.attr-block legend strong { margin-left: 0.35rem; }
.prop-type {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 0.3rem;
}
.attr-list {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.35rem 0 0.1rem;
  margin-bottom: 0.4rem;
}
.property-row { align-items: center; flex-wrap: wrap; gap: 0.45rem; }
.property-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}
.property-edit input[name="name"] { width: 11rem; }
.property-edit select[name="prop_type"] { width: auto; }
.property-edit select[name="nomenclature_id"] { min-width: 11rem; }
.property-edit .options-inline { flex: 1 1 100%; }
.property-edit .options-inline textarea { min-height: 70px; }
.col-edit input[name="name"] { width: 11rem; }
.nom-wrap { overflow-x: auto; padding: 0.4rem 0.6rem 0.8rem; }
.nom-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.nom-table th, .nom-table td {
  border-bottom: 1px solid var(--rule);
  padding: 0.35rem 0.4rem;
  text-align: left;
  vertical-align: middle;
}
.nom-table th {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.nom-table input[type="text"],
.nom-table input[type="email"],
.nom-table input[type="tel"],
.nom-table input[type="date"],
.nom-table select { width: 100%; min-width: 6.5rem; }
.nom-table input[type="checkbox"] { width: auto; min-width: 0; }
.nom-table td { vertical-align: top; }
.nom-ref-cell { display: grid; gap: 0.2rem; min-width: 8rem; }
.nom-ref-preview {
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.3;
}
.nom-table input[type="date"] { min-width: 9.5rem; }
.col-edit input[name="value_pattern"] { width: 12rem; }
.nom-table .nom-actions {
  white-space: nowrap;
  width: 1%;
}
.nom-table .nom-actions form { display: inline; }
.col-edit select[name="ref_nomenclature_id"] { min-width: 10rem; }
.nom-related { margin-top: 0.7rem; }
.nom-related h3 { margin-bottom: 0.45rem; }
.nom-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}
.nom-related-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
}
.nom-related-list span { color: var(--ink-soft); }
.user-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}
.user-edit input[name="username"] { width: 8rem; }
.user-edit input[name="display_name"] { width: 11rem; }
.user-edit input[name="email"] { width: 14rem; }
.user-edit input[name="password"] { width: 11rem; }
.recipient-picks { display: grid; gap: 0.35rem; margin: 0.4rem 0 0.2rem; }
fieldset.span-2 {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin: 0;
  background: #f7faff;
}
fieldset.span-2 legend { padding: 0 0.35rem; font-size: 0.9rem; }
.icon-btn {
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--paper); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-danger { color: var(--danger); }
.help-sign {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.2rem;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: #fff;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.help-sign:hover { background: var(--accent-soft); }
.help-pop {
  position: fixed;
  z-index: 40;
  max-width: 280px;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: var(--navy);
  color: #e8eef8;
  font-size: 0.84rem;
  line-height: 1.4;
  box-shadow: 0 16px 40px rgba(11, 31, 58, 0.28);
}
h1 .help-sign, h2 .help-sign, legend .help-sign { vertical-align: middle; }
.login-help { display: flex; align-items: center; gap: 0.55rem; }
.login-help .btn { flex: 1; }
.inline-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}
.inline-check input { width: auto; }
.rule-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.2fr auto;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
  align-items: center;
}
.save-view {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
  align-items: center;
  flex-wrap: wrap;
}
.save-view input[type="text"] { min-width: 240px; }
.views-strip { margin-bottom: 1.6rem; }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.timeline li {
  padding: 0.85rem 0.95rem;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 14px;
  border-left: 4px solid var(--accent);
}
.timeline .when, .timeline .who { display: block; color: var(--ink-soft); font-size: 0.8rem; }
.timeline strong { text-transform: capitalize; }

.filters, .form-grid, .inline-form {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.filters {
  grid-template-columns: 1.2fr 0.9fr 0.9fr 0.7fr 0.7fr auto;
  align-items: end;
  background: var(--cream);
  border: 1px solid var(--rule);
  padding: 0.9rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
label { display: grid; gap: 0.35rem; font-size: 0.9rem; }
[hidden] { display: none !important; }
input, select, textarea {
  font: inherit;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--selected-border);
  box-shadow: 0 0 0 3px rgba(47, 111, 173, 0.16);
}
input[type="submit"].btn,
button.btn {
  display: inline-flex;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
}
input[type="submit"].btn-copper,
button.btn-copper {
  background: var(--accent);
  color: #fff;
}
textarea { resize: vertical; min-height: 110px; }
.panel { padding: 1.1rem; }
.form-grid { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.form-actions .inline-form {
  display: flex;
  gap: 0.6rem;
  margin: 0;
  align-items: center;
}
.page-save {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  justify-content: flex-end;
}
.field-error { color: var(--danger); font-size: 0.82rem; }
.hint { color: var(--ink-soft); font-size: 0.82rem; }
.dropzone {
  border: 1.5px dashed var(--selected-border);
  border-radius: 10px;
  padding: 1rem;
  background: var(--hover);
  cursor: pointer;
}
.dropzone.is-over { background: #dbeafe; }
.dropzone.is-busy {
  opacity: 0.72;
  pointer-events: none;
  background: #e8f0fe;
}
.file-input { width: 100%; cursor: pointer; }

.preview {
  min-height: 240px;
  max-width: 100%;
  overflow: visible;
  padding: 0;
  background: #fff;
}
.preview img, .preview iframe {
  width: 100%;
  height: 480px;
  border: 0;
  display: block;
  background: #fff;
}
.sheet-preview {
  display: block;
  max-width: 100%;
  background: #fff;
}
.sheet-scroll {
  display: block;
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  height: 480px;
  max-width: 100%;
  background: #fff;
}
.sheet {
  display: table;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.preview-empty { box-shadow: none; min-height: 320px; display: grid; place-items: center; text-align: center; gap: 0.8rem; }
.meta-panel { line-height: 1.25; }
.meta-panel p, .meta-panel .desc { display: grid; gap: 0.05rem; margin: 0 0 0.35rem; }
.meta-panel span { color: var(--ink-soft); font-size: 0.78rem; line-height: 1.2; }
.meta-panel strong { line-height: 1.25; }

.folder-list { display: grid; gap: 0.7rem; }
.folder-row {
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.folder-row p { color: var(--ink-soft); }
.folder-actions, .rename-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.empty { padding: 2rem; text-align: center; display: grid; gap: 0.8rem; justify-items: center; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1.2rem; }

.is-auth {
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(47, 111, 173, 0.14), transparent 50%),
    var(--bg);
  color: var(--ink);
}
.auth-wrap { width: min(440px, calc(100% - 2rem)); padding: 2rem 0; }
.login-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.6rem 1.6rem;
  box-shadow: var(--shadow);
}
.login-mark { text-align: center; margin-bottom: 1.4rem; }
.lede { color: var(--ink-soft); margin-top: 0.4rem; }
.stack { display: grid; gap: 0.9rem; }

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .stats, .split, .split.detail, .split.deposit, .filters, .form-grid, .rule-row, .settings-grid, .steps { grid-template-columns: 1fr; }
  .folder-row, .page-head { flex-direction: column; align-items: stretch; }
}
