:root {
  --bg: #f6f6f6;
  --ink: #0c233f;
  --muted: #6d7b8c;
  --card: #ffffff;
  --line: #e5e5e5;
  --steel: #0c233f;
  --amber: #0078bf;
  --amber-soft: #e7f3fb;
  --gold: #faa21b;
  --good: #1f7a45;
  --bad: #9d342c;
  --shadow: 0 16px 40px rgba(12, 35, 63, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 100% -10%, rgba(0, 120, 191, 0.14), transparent 55%),
    var(--bg);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
a { color: var(--steel); }
h1, h2, h3 { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.05; margin: 0 0 0.4rem; }
h2 { margin: 0 0 0.35rem; font-size: 1.7rem; }
h3 { margin: 0; font-size: 1.15rem; }
p { margin: 0; }

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.auth-copy, .auth-card { padding: 48px 8vw; }
.auth-copy { background: var(--steel); color: #f7f1e6; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-copy p { max-width: 36rem; color: #d9e2e6; }
.auth-copy a { color: white; }
.kicker { letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.75rem; font-weight: 700; color: var(--amber); margin: 0 0 0.7rem; }
.auth-copy .kicker { color: var(--gold); }
.auth-logo { height: 52px; width: auto; margin-bottom: 22px; }
.auth-card { display: flex; align-items: center; }
.panel {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.shell { min-height: 100vh; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  position: sticky;
  top: 0;
  background: rgba(12, 35, 63, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand { text-decoration: none; color: white; font-weight: 800; letter-spacing: 0.04em; }
.brand img { height: 36px; width: auto; display: block; }
.top .nav a, .top .who, .top .text-btn { color: white; }
.top .nav a[aria-current="page"] { background: var(--amber); color: white; }
.nav, .tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.nav a, .tabs a, .btn, .text-btn {
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 14px;
  min-height: 44px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.nav a[aria-current="page"], .tabs a[aria-current="page"] { background: var(--steel); color: white; }
.who { color: var(--muted); font-size: 0.92rem; display: flex; gap: 10px; align-items: center; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 calc(64px + env(safe-area-inset-bottom)); }
.row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.stats, .grid { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.block { margin-top: 22px; }
.block h3 { margin-bottom: 8px; }
.note-card { margin-top: 12px; }
.note-card p { white-space: pre-wrap; margin-top: 8px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.85rem; }
.settings { display: grid; gap: 8px; margin-top: 12px; }
label.switch { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
label.switch strong { color: var(--ink); font-size: 1rem; }
label.switch input { width: 22px; min-height: 22px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.photos figure { margin: 0; }
.photos img { width: 100%; height: auto; max-height: 420px; object-fit: contain; border-radius: 12px; background: #f3efe6; display: block; }
.files { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.files li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.files a { font-weight: 700; }
.drop { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; background: #fff; }
.good-note { background: #e5f6ec; color: var(--good); }
.grid { grid-template-columns: 1.4fr 0.8fr; }
.card, .table-wrap, .composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card { padding: 16px; }
.stat strong { display: block; font-size: 1.45rem; margin-top: 4px; }
.stat span, .muted { color: var(--muted); }
.tabs { gap: 6px; margin: 14px -4px; padding: 2px 4px 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.95rem; }
th { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.composer { padding: 14px; margin-top: 12px; }
.fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
label { display: grid; gap: 4px; font-size: 0.82rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
.wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.btn { background: var(--amber); color: white; border-color: var(--amber); font-weight: 700; }
.btn.secondary { background: var(--steel); border-color: var(--steel); }
.btn.ghost, .text-btn { background: transparent; border-color: var(--line); color: var(--ink); }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; background: var(--amber-soft); color: #7a4b08; font-size: 0.78rem; font-weight: 700; }
.pill.good { background: #e5f6ec; color: var(--good); }
.pill.bad { background: #fdeceb; color: var(--bad); }
.notice { background: #fdeceb; color: var(--bad); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty { color: var(--muted); padding: 8px 0; }
@media (max-width: 900px) {
  .auth, .stats, .grid, .split, .fields { grid-template-columns: 1fr; }
  .auth-copy, .auth-card { padding: 28px 20px; }
  .auth-copy { min-height: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  h1 { font-size: 1.85rem; }
  .top { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .main { width: min(1180px, calc(100% - 20px)); padding-top: 18px; }
  label.switch { align-items: flex-start; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn, .actions .text-btn, .row .btn { width: 100%; }
  .photos { grid-template-columns: 1fr; }
  .files li { align-items: stretch; }
  .files .text-btn, .files .drop { width: 100%; }
  .table-wrap { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin: 0 0 10px; padding: 6px 12px; }
  td { display: block; border: 0; padding: 8px 0; }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  td[data-label=""]::before { content: none; }
  td .text-btn, td select { width: 100%; }
  tr:has(td.empty) { background: transparent; border: 0; padding: 0; }
}
