:root {
  --brand: #b92027;
  --brand-dark: #8e181e;
  --gold: #c4a469;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --desk: #e8e2d6;
  --sidebar: #0b0b0f;
  --paper: #fffdfb;
  --line: #d8d6d5;
  --font: "Roboto", "Segoe UI", sans-serif;
  --display: "Playfair Display", Georgia, serif;
  --font-display: "Playfair Display", Georgia, serif;
  --sidebar-text: #f2efec;
  --nav-w: 280px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--desk);
  max-width: 100%;
  overflow-x: clip;
}
img, svg, video { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; max-width: 100%; }
a { color: var(--brand); }
button, a, .btn, .btn-primary { touch-action: manipulation; }
body.nav-lock {
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  touch-action: none;
}

.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(120deg, rgba(11,11,15,.92), rgba(142,24,30,.75)),
    radial-gradient(circle at 20% 20%, rgba(196,164,105,.35), transparent 40%);
  display: flex;
  align-items: stretch;
}
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.login-brand {
  color: #fff;
  padding: 64px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.login-logo {
  display: block;
  width: min(280px, 78%);
  height: auto;
  margin: 0 0 22px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.28));
  background: transparent;
  padding: 0;
  object-fit: contain;
}
.login-logo-card {
  display: none;
  width: min(180px, 70%);
  height: auto;
  margin: 0 auto 14px;
  background: transparent;
  padding: 0;
  object-fit: contain;
}
.login-brand h1 { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 3.2rem); margin: 0 0 14px; }
.login-lead { max-width: 28rem; line-height: 1.5; color: #f2efec; }
.login-swatch { display: flex; gap: 8px; margin-top: 28px; }
.login-swatch span { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,.2); }
.sw-brand { background: var(--brand); }
.sw-gold { background: var(--gold); }
.sw-ink { background: #111; }
.login-card {
  margin: auto 24px;
  background: var(--paper);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  border-top: 4px solid var(--brand);
  width: auto;
  max-width: 28rem;
  min-width: 0;
}
.login-card h2 { font-family: var(--display); margin: 0 0 6px; }
.login-sub { color: var(--muted); margin: 0 0 22px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 1rem; color: var(--ink); }
.login-card input {
  width: 100%; margin-top: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 16px; min-height: var(--tap);
}
.btn-primary {
  width: 100%; border: 0; background: var(--brand); color: #fff; font-weight: 700;
  padding: 14px 16px; border-radius: 8px; cursor: pointer; margin-top: 8px; font-size: 1.1rem;
  min-height: var(--tap);
}
.btn-primary:hover { background: var(--brand-dark); }
.form-error { color: var(--brand); font-size: 1.05rem; }

.app-shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
}
.app-shell.nav-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}
.app-nav {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(185, 32, 39, 0.22), transparent 55%),
    radial-gradient(90% 50% at 100% 100%, rgba(196, 164, 105, 0.12), transparent 50%),
    linear-gradient(180deg, #121218 0%, var(--sidebar) 42%, #08080c 100%);
  color: #f2efec;
  padding: max(18px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
  transition: transform .28s ease, opacity .2s ease;
  box-shadow: inset -1px 0 0 rgba(196, 164, 105, 0.08);
}
.app-nav::before {
  content: "";
  display: block;
  height: 3px;
  margin: -18px -12px 10px;
  background: linear-gradient(90deg, #0b0b0f 0 18%, var(--brand) 18% 62%, var(--gold) 62% 100%);
}
.app-shell.nav-collapsed .app-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-12px);
  padding-left: 0;
  padding-right: 0;
}
.nav-backdrop {
  display: none;
}
.nav-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 0 4px 10px;
}
.nav-logo-link {
  display: block;
  flex: 0 0 auto;
  text-decoration: none;
  padding: 2px 0;
  transition: transform .25s ease, filter .25s ease;
}
.nav-logo-link:hover {
  transform: translateY(-1px) scale(1.02);
  filter: drop-shadow(0 6px 14px rgba(196, 164, 105, 0.22));
}
.nav-logo {
  display: block;
  width: 168px;
  max-width: 168px;
  height: auto;
  margin: 0;
  background: transparent;
  padding: 0;
  object-fit: contain;
}
.nav-product {
  margin: 0 8px 2px;
  font-family: var(--display);
  font-size: 1.05rem;
  color: #f7f3ee;
  letter-spacing: 0.01em;
}
.nav-product::after {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  margin-top: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.nav-brand-text { min-width: 0; flex: 1; padding-right: 2px; }
.app-nav h1 {
  font-family: var(--display);
  font-size: 1.02rem;
  margin: 0;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.nav-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: #d6d3d1;
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  font-size: .7rem;
  line-height: 1;
  white-space: nowrap;
  margin-top: 2px;
  min-height: var(--tap);
  min-width: var(--tap);
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.nav-toggle:hover { background: rgba(185,32,39,.28); color: #fff; border-color: transparent; transform: translateY(-1px); }
.nav-toggle-label { font-weight: 500; }
.nav-toggle-close { display: none; font-weight: 500; }
.app-nav .user {
  font-size: .8rem;
  color: #a8a29e;
  margin: 0 8px 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.nav-section { display: flex; flex-direction: column; gap: 5px; flex: 1; min-height: 0; }
.nav-footer { margin-top: auto; display: flex; flex-direction: column; gap: 5px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.app-nav button, .app-nav a.nav-link {
  appearance: none; border: 0; background: transparent; color: #d6d3d1; text-align: left;
  padding: 11px 12px; border-radius: 10px; cursor: pointer; text-decoration: none;
  display: flex; align-items: center; gap: 11px;
  width: 100%; font-size: 1.02rem; min-height: var(--tap);
  position: relative;
  overflow: hidden;
  transition:
    background .22s ease,
    color .22s ease,
    transform .22s ease,
    box-shadow .22s ease,
    padding-left .22s ease;
}
.app-nav button::before, .app-nav a.nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--gold));
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity .22s ease, transform .22s ease;
}
.nav-ico {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  text-align: center;
  font-size: .95rem;
  line-height: 1;
  color: var(--gold);
  opacity: .78;
  transition: opacity .2s ease, transform .2s ease, color .2s ease;
}
.nav-label { min-width: 0; }
.app-nav .nav-toggle {
  width: auto;
  flex: 0 0 auto;
  max-width: none;
  display: inline-flex;
  overflow: visible;
}
.app-nav .nav-toggle::before { display: none; }
.app-nav a.nav-link-back {
  color: #fff;
  background: linear-gradient(135deg, rgba(185, 32, 39, 0.34), rgba(196, 164, 105, 0.16));
  border: 1px solid rgba(196, 164, 105, 0.22);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
@media (hover: hover) and (pointer: fine) {
  .app-nav button:hover, .app-nav a.nav-link:hover {
    background: rgba(185,32,39,.22);
    color: #fff;
    transform: translateX(3px);
    box-shadow: inset 0 0 0 1px rgba(196, 164, 105, 0.12);
  }
  .app-nav button:hover::before, .app-nav a.nav-link:hover::before {
    opacity: 1;
    transform: scaleY(1);
  }
  .app-nav button:hover .nav-ico, .app-nav a.nav-link:hover .nav-ico {
    opacity: 1;
    transform: scale(1.08);
    color: #f0d9a4;
  }
  .app-nav a.nav-link-back:hover {
    background: linear-gradient(135deg, rgba(185, 32, 39, 0.48), rgba(196, 164, 105, 0.24));
  }
}
.app-nav button.active {
  background: linear-gradient(90deg, rgba(185,32,39,.38), rgba(185,32,39,.16));
  color: #fff;
  font-weight: 600;
  box-shadow:
    inset 0 0 0 1px rgba(196, 164, 105, 0.18),
    0 10px 22px rgba(0, 0, 0, 0.16);
}
.app-nav button.active::before {
  opacity: 1;
  transform: scaleY(1);
}
.app-nav button.active .nav-ico {
  opacity: 1;
  color: #f0d9a4;
}
.app-main {
  padding: 18px max(20px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  min-width: 0;
  max-width: 100%;
}
.view { max-width: 1400px; }
.view-head { margin: 0 0 16px; }
.view-title { font-family: var(--display); font-size: clamp(1.35rem, 3vw, 1.65rem); margin: 0 0 6px; }
.howto {
  background: #fff;
  border: 1px solid rgba(196,164,105,.45);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 16px;
  line-height: 1.5;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}
.next-steps-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.next-steps-actions .btn { flex: 1 1 12rem; }
.view-help { margin: 0; color: var(--muted); max-width: 42rem; line-height: 1.5; }
.empty-hint { margin: 0 0 14px; color: var(--muted); }
.create-box summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.4vw, 1.25rem);
  list-style: none;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.create-box summary::-webkit-details-marker { display: none; }
.create-box summary::before { content: "+ "; color: var(--brand); font-weight: 700; }
.create-box[open] summary::before { content: "– "; }
.create-box form { margin-top: 14px; }
.grid-2 > button,
.grid-2 > a.btn,
.grid-2 > .btn {
  grid-column: 1 / -1;
  justify-self: start;
}
.grid-2 > button.btn-lg,
.grid-2 > button.brand {
  width: 100%;
  justify-self: stretch;
}
.main-sticky {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--desk);
  padding: max(8px, env(safe-area-inset-top)) 0 10px;
  margin-bottom: 10px;
}
.topbar {
  display: flex; gap: 12px; align-items: center; margin-bottom: 0; flex-wrap: wrap;
}
.sidebar-open-btn[hidden] { display: none !important; }
.search-wrap { position: relative; flex: 1; min-width: min(100%, 220px); }
.search-wrap input {
  width: 100%; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-size: 16px; min-height: var(--tap);
}
.search-results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.12);
  max-height: min(320px, 60dvh); overflow: auto;
}
.search-results[hidden] { display: none; }
.search-item {
  display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 12px 12px; cursor: pointer;
  min-height: var(--tap);
}
.search-item:hover { background: #f7f3ef; }
.search-item small { display: block; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  background: #fff; border-radius: 12px; padding: 14px; border: 1px solid rgba(196,164,105,.35);
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
  min-width: 0;
}
.card .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card .value { font-family: var(--display); font-size: clamp(1.2rem, 3vw, 1.6rem); margin-top: 6px; overflow-wrap: anywhere; }
.card .value.money { font-size: clamp(1rem, 2.5vw, 1.15rem); }

.panel {
  background: #fff; border-radius: 12px; padding: 16px; border: 1px solid var(--line); margin-bottom: 16px;
  min-width: 0;
}
.panel:has(.table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel h2 { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 1.25rem); margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label.field { display: block; font-size: .95rem; color: var(--ink); margin-bottom: 12px; font-weight: 500; min-width: 0; }
label.field input, label.field select, label.field textarea {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 16px; min-height: var(--tap);
}
label.field textarea { min-height: 5.5rem; }
.field-hint { display: block; font-weight: 400; font-size: .88rem; color: var(--muted); margin: 4px 0 0; }
.check-field { display: flex !important; align-items: flex-start; gap: 10px; font-size: 1rem; min-height: var(--tap); padding: 6px 0; cursor: pointer; }
.check-field input { width: auto !important; margin-top: 2px; min-height: 1.35rem; min-width: 1.35rem; flex: 0 0 auto; }
.btn-lg { padding: 12px 18px; font-size: 1.05rem; min-height: var(--tap); }
.ficha-name { font-family: var(--display); font-size: clamp(1.35rem, 4vw, 1.7rem); margin: 12px 0 4px; overflow-wrap: anywhere; }
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.table th, .table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top;
  overflow-wrap: anywhere;
}
.table button.linkish { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; }
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
}
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.sidebar-open-btn {
  flex-shrink: 0;
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 9px 16px;
}
.btn.sidebar-open-btn:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn.ghost { background: transparent; }
a.btn { text-decoration: none; color: inherit; }
a.btn.brand { color: #fff; }
.muted { color: var(--muted); font-size: .85rem; }
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 10px;
}
.kanban-col { background: #f7f4ef; border-radius: 10px; padding: 10px; min-height: 180px; min-width: 0; }
.kanban-col h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.kanban-item { background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); font-size: .9rem; }
.kanban-item .btn { width: 100%; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0; border-bottom: 1px solid var(--line); }
.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 8px;
  cursor: pointer;
  border-radius: 8px;
  min-height: var(--tap);
}
.timeline-item:hover, .timeline-item:focus-visible {
  background: rgba(185,32,39,.06);
}
.timeline-open {
  color: var(--brand);
  font-weight: 600;
  font-size: .92rem;
}
.return-ficha-bar {
  margin: 10px 0 0;
}
.return-ficha-bar .btn { width: 100%; max-width: 36rem; }
tr.is-highlight, .timeline-item.is-highlight {
  background: rgba(185,32,39,.08);
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
tr.row-click { cursor: pointer; }
tr.row-click:hover { background: rgba(185,32,39,.05); }
.row-actions { white-space: normal; }
.row-actions .btn, .row-actions a.btn { margin: 2px; }
.ficha-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.ficha-toolbar .btn { flex: 1 1 auto; min-width: min(100%, 12rem); }
.item-open { border-left: 4px solid var(--brand); }
.item-open .btn, .item-open a.btn { flex-wrap: wrap; }
.doc-preview { margin: 12px 0 16px; min-width: 0; }
.doc-preview-frame {
  width: 100%;
  min-height: min(55dvh, 520px);
  height: min(70dvh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.doc-preview-img { max-width: 100%; max-height: min(60dvh, 640px); display: block; margin: 0 auto; }
.doc-preview-text {
  max-height: min(50dvh, 480px);
  overflow: auto;
  white-space: pre-wrap;
  background: #f7f4ef;
  padding: 12px;
  border-radius: 8px;
  font-size: .95rem;
}
.hidden { display: none !important; }
.toast {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: auto;
  background: #111; color: #fff;
  padding: 16px 18px; border-radius: 8px; z-index: 50; max-width: min(420px, calc(100% - 24px));
  font-size: 1.05rem; line-height: 1.4;
}

.notice-hero {
  background:
    linear-gradient(135deg, rgba(185,32,39,.08), rgba(196,164,105,.12)),
    #fffdfb;
  border-color: rgba(196,164,105,.45);
}
.notice-hero-logo {
  display: block;
  width: min(220px, 55%);
  height: auto;
  margin: 0 0 14px;
  background: #0b0b0f;
  padding: 10px 14px;
  border-radius: 12px;
  object-fit: contain;
}
.notice-kicker {
  margin: 0 0 6px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand);
}
.notice-hero h2 { margin-bottom: 8px; }
.notice-lead { margin: 0 0 16px; max-width: 42rem; color: var(--muted); line-height: 1.55; }
.notice-contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.notice-chip {
  display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px;
  border: 1px solid rgba(196,164,105,.45); background: #fff; color: var(--ink);
  text-decoration: none; font-size: .82rem; min-height: var(--tap);
}
.notice-chip:hover { border-color: var(--brand); color: var(--brand); }
.muted-chip { color: var(--muted); cursor: default; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notice-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mail-status {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: .86rem;
  line-height: 1.4;
}
.mail-ok { background: rgba(34,120,70,.1); color: #1d5c38; border: 1px solid rgba(34,120,70,.25); }
.mail-warn { background: rgba(185,32,39,.08); color: #8e181e; border: 1px solid rgba(185,32,39,.22); }
.notice-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px;
}
.notice-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 16px;
  background: linear-gradient(180deg, #fff, #faf7f2); display: flex; flex-direction: column; gap: 10px;
  min-height: 0; transition: border-color .2s ease, box-shadow .2s ease;
  min-width: 0;
}
@media (hover: hover) and (pointer: fine) {
  .notice-card:hover {
    border-color: rgba(185,32,39,.35);
    box-shadow: 0 10px 28px rgba(26,26,26,.06);
  }
}
.notice-card header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice-kind {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold);
  font-weight: 700;
}
.notice-badge {
  font-size: .68rem; padding: 2px 8px; border-radius: 999px; background: rgba(185,32,39,.12); color: var(--brand);
  font-weight: 700;
}
.notice-badge-create {
  background: rgba(196,164,105,.22); color: #7a5c28;
}
.notice-card h3 { font-family: var(--display); font-size: 1.05rem; margin: 0; line-height: 1.35; }
.notice-preview {
  flex: 1; margin: 0; padding: 12px; border-radius: 10px; background: #fff; border: 1px dashed rgba(196,164,105,.4);
  font-size: .78rem; line-height: 1.45; color: #3a3a3a; white-space: pre-wrap; max-height: 220px; overflow: auto;
  font-family: var(--font);
}
.notice-card .btn { align-self: stretch; }

.reports-hero {
  background:
    linear-gradient(135deg, rgba(11,11,15,.04), rgba(196,164,105,.14)),
    #fffdfb;
  border-color: rgba(196,164,105,.4);
  margin-bottom: 16px;
}
.reports-hero h2 { margin-bottom: 6px; }
.reports-hero p { margin: 0; color: var(--muted); max-width: 40rem; line-height: 1.5; }
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}
.report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  min-width: 0;
  transition: border-color .2s ease, box-shadow .2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .report-card:hover {
    border-color: rgba(185,32,39,.35);
    box-shadow: 0 12px 28px rgba(26,26,26,.06);
  }
}
.report-card .report-label {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.report-card h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  margin: 0;
}
.report-card p {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}
.report-card .btn { align-self: stretch; margin-top: auto; }

@media (max-width: 960px) {
  .app-shell,
  .app-shell.nav-collapsed {
    display: block;
    grid-template-columns: none;
  }
  .app-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(20rem, 88vw);
    z-index: 40;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    box-shadow: 8px 0 32px rgba(0,0,0,.35);
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .app-shell.nav-collapsed .app-nav {
    transform: translateX(-110%);
    opacity: 1;
    pointer-events: none;
    padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .nav-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 11, 15, .46);
    z-index: 35;
  }
  .nav-brand { width: auto; align-items: center; }
  .nav-logo { width: 148px; max-width: 148px; }
  .nav-product, .app-nav .user { width: auto; max-width: 100%; margin: 0 8px 8px; }
  .nav-section, .nav-footer { width: 100%; flex-direction: column; flex-wrap: nowrap; margin-top: 0; }
  .nav-footer { margin-top: auto; padding-top: 12px; }
  .nav-toggle-label { display: none; }
  .nav-toggle-close { display: inline; }
  .app-nav button, .app-nav a.nav-link { width: 100%; font-size: 1.02rem; padding: 12px 14px; }
  .app-main { padding: 12px max(12px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .topbar { gap: 8px; margin-bottom: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kanban {
    display: flex;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .kanban-col {
    min-height: 0;
    width: min(280px, 78vw);
    flex: 0 0 min(280px, 78vw);
    scroll-snap-align: start;
  }
  .login-shell { grid-template-columns: 1fr; min-height: 100dvh; align-content: center; }
  .login-brand { display: none; }
  .login-logo-card { display: block; }
  .login-card {
    margin: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    padding: 28px 22px;
    max-width: 28rem;
    width: min(28rem, calc(100% - 32px));
    justify-self: center;
  }
}

@media (max-width: 960px) and (orientation: landscape) and (min-width: 700px) {
  .login-brand { display: flex; padding: 24px; }
  .login-logo-card { display: none; }
  .login-shell { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-content: stretch; }
  .login-card { width: auto; margin: 16px 16px 16px 0; }
}

@media (max-width: 1400px) and (min-width: 961px) {
  .kanban {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  }
}

@media (max-width: 960px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td {
    display: block;
    width: 100%;
  }
  .table {
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0 10px;
  }
  .table tbody { display: flex; flex-direction: column; gap: 0; }
  .table tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0 0 10px;
  }
  .table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: 0;
    padding: 8px 0;
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    flex: 0 1 42%;
  }
  .table td:empty { display: none; }
  .table td[colspan] {
    display: block;
    text-align: left;
  }
  .table td[colspan]::before { content: none; }
  .table td.row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 6px;
    padding-top: 10px;
  }
  .table td.row-actions::before { display: none; }
  .table td.row-actions .btn,
  .table td.row-actions a.btn {
    flex: 1 1 7rem;
    margin: 0;
  }
  .panel:has(.table) { overflow-x: visible; }
  .item-open .btn,
  .item-open a.btn,
  .ficha-toolbar .btn {
    width: 100%;
  }
  .doc-preview-frame {
    min-height: min(45dvh, 360px);
    height: min(55dvh, 420px);
  }
  .return-ficha-bar .btn { max-width: none; }
}

@media (max-width: 560px) {
  .cards { gap: 8px; }
  .card { padding: 12px; }
  .panel { padding: 14px 12px; border-radius: 10px; }
  form .btn-lg, form .btn.brand, .notice-card-actions .btn, .report-card .btn {
    width: 100%;
  }
  .panel-actions .btn { width: auto; flex: 1 1 auto; }
  .login-swatch { margin-top: 18px; }
  .toast { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); max-width: none; }
  .howto { font-size: .98rem; }
  .next-steps-actions .btn { flex: 1 1 100%; }
  .cards { grid-template-columns: 1fr 1fr; }
  .kanban {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    scroll-snap-type: none;
  }
  .kanban-col { width: 100%; flex: none; }
  .table td {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 4px;
  }
  .table td::before { flex: none; }
}

@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
}

@media (min-width: 961px) and (max-width: 1200px) {
  :root { --nav-w: 240px; }
  .nav-logo { width: 148px; max-width: 148px; }
  .nav-toggle-label { display: none; }
}

@media (min-width: 1600px) {
  .app-main { padding-left: 32px; padding-right: 32px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .login-card { margin: 12px; padding: 18px 16px; }
  .app-nav { padding-top: max(10px, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .app-nav, .topbar, .main-sticky, .toast, .nav-backdrop, .sidebar-open-btn { display: none !important; }
  .app-shell, .app-shell.nav-collapsed { grid-template-columns: 1fr; }
  .app-main { padding: 0; max-width: none; }
  .panel { box-shadow: none; break-inside: avoid; }
  body { background: #fff; overflow: visible; }
}

.intake-q {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 10px;
  background: #fff;
}
.intake-q-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.intake-num {
  flex: 0 0 auto;
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  display: grid;
  place-items: center;
}
.intake-q textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.intake-progress { font-weight: 600; color: var(--ink); margin: 0 0 12px; }
.intake-suggest {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f7f3ef;
  border-radius: 10px;
}
.intake-suggest button { margin: 6px 8px 0 0; }
