:root {
  --bg: #f3f0ea;
  --bg-2: #ebe6de;
  --ink: #161311;
  --muted: #72685f;
  --card: rgba(255, 253, 250, 0.92);
  --line: rgba(28, 22, 16, 0.08);
  --brand: #8a5a2b;
  --brand-dark: #5e3b1d;
  --gold: #c4a15a;
  --gold-soft: #f4ead4;
  --ok: #1b6b45;
  --ok-bg: #e7f6ee;
  --bad: #9a3030;
  --bad-bg: #fdeeee;
  --side: #10100f;
  --side-2: #1a1816;
  --shadow: 0 1px 2px rgba(22, 16, 10, 0.04), 0 12px 32px rgba(22, 16, 10, 0.05);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
img, svg, video { max-width: 100%; height: auto; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI Variable Text", "Segoe UI", "Noto Naskh Arabic", "Nirmala UI", "Noto Sans Devanagari", Tahoma, sans-serif;
  background:
    radial-gradient(720px 280px at 100% -80px, rgba(196, 161, 90, 0.14), transparent 70%),
    var(--bg);
  line-height: 1.5;
  font-feature-settings: "ss01", "tnum";
}
a { color: var(--brand-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; }
h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 0 0 10px; font-size: 16px; }
button, input, textarea { font: inherit; color: inherit; }
select, option {
  font: inherit;
  color: #1b1714;
  background-color: #fff;
  color-scheme: light;
}
button, .btn, a.btn { transition: transform .15s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease; }
button:hover, .btn:hover { transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  color: #f4eee6;
  background: linear-gradient(180deg, #1c1a18 0%, var(--side) 28%);
  border-inline-end: 1px solid rgba(255,255,255,.06);
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand strong { display: block; font-size: 16px; }
.brand span { display: block; margin-top: 2px; color: #cbbba6; font-size: 12px; }
.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  color: #1b1714;
  font-style: normal;
  font-weight: 800;
  background: linear-gradient(160deg, #f3e2b8, var(--gold) 55%, #a87832);
  box-shadow: 0 8px 18px rgba(198, 161, 91, 0.28);
}
.side nav { margin-top: 14px; flex: 1; }
.group p {
  margin: 18px 10px 6px;
  color: #b5a792;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.side a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f6efe6;
  text-decoration: none;
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 10px;
  border: 1px solid transparent;
}
.nav-ico {
  width: 1.45em;
  text-align: center;
  font-size: 17px;
  flex: 0 0 auto;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}
.side-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 6px 10px; }
.fold { display: flex; justify-content: flex-start; margin: 0; }
.nav-check, .menu-btn, .menu-close, .nav-shade { display: none; }
.fold button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: #f3e2b8;
  border: 1px solid rgba(198,161,91,.35);
  box-shadow: none;
  font-size: 18px;
}
.fold button:hover { background: rgba(198,161,91,.22); }
.shell.collapsed { grid-template-columns: 86px minmax(0, 1fr); }
.shell.collapsed .brand div,
.shell.collapsed .group p,
.shell.collapsed .nav-label,
.shell.collapsed .side-foot { display: none; }
.shell.collapsed .side { padding-inline: 8px; }
.shell.collapsed .brand { justify-content: center; padding-inline: 0; }
.shell.collapsed .side a { justify-content: center; padding: 10px 0; }
.shell.collapsed .side-tools, .shell.collapsed .fold { justify-content: center; }
.side a:hover { background: rgba(255,255,255,.05); }
.side a.on {
  color: #fff8ea;
  background: rgba(255,255,255,.08);
  border-color: transparent;
  box-shadow: none;
}
.side-foot {
  margin-top: 12px;
  padding: 10px 12px;
  color: #cbbba6;
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.main { min-width: 0; }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  background: rgba(243, 240, 234, 0.78);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
}
.bell { position: relative; margin-inline-start: auto; }
.bell-check { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.bell-btn {
  position: relative;
  z-index: 22;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}
.bell-btn.has { border-color: #e7c2c2; background: #fff8f8; }
.bell-btn b {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #9a3030;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.bell-shade { display: none; }
.bell-check:checked ~ .bell-shade {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 18;
  background: transparent;
}
.bell-panel {
  display: none;
  position: absolute;
  z-index: 21;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(380px, 88vw);
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(22, 16, 10, 0.12);
}
.bell-check:checked ~ .bell-panel { display: grid; gap: 10px; }
.bell-head, .bell-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bell-head span, .note span { color: var(--muted); font-size: 12px; font-weight: 700; }
.bell-list { display: grid; gap: 8px; }
.note {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f5;
}
.note.unread { background: #fff; }
.note.sev-Danger { box-shadow: inset -3px 0 0 #9a3030; }
.note.sev-Warning { box-shadow: inset -3px 0 0 #c4a15a; }
.note div { display: flex; justify-content: space-between; gap: 8px; }
.note strong { font-size: 13px; }
.note p { margin: 0; color: #4d443c; font-size: 13px; }
.bell-panel form { margin: 0; }
.bell-panel button { min-height: 32px; width: auto; padding: 4px 10px; font-size: 12px; }
.langbar { position: relative; }
.lang-check { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.lang-btn {
  position: relative;
  z-index: 22;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.lang-code { letter-spacing: 0.03em; color: var(--muted); }
.lang-shade { display: none; }
.lang-check:checked ~ .lang-shade {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 18;
  background: transparent;
}
.lang-panel {
  display: none;
  position: absolute;
  z-index: 21;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  min-width: 160px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(22, 16, 10, 0.12);
}
.lang-check:checked ~ .lang-panel { display: grid; gap: 2px; }
.lang-panel a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.lang-panel a:hover { background: var(--gold-soft); }
.lang-panel a.on { background: var(--brand); color: #fff; }
.auth-lang { position: absolute; top: 18px; inset-inline-end: 18px; z-index: 3; }
.kicker {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.heading { min-width: 0; }
.top h1 { margin: 0; font-size: 22px; font-weight: 700; }
.who { display: flex; gap: 8px; align-items: center; }
.userchip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.content { padding: 22px 24px 56px; max-width: 1280px; }

.auth {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background: #1b1612;
}
.auth-stage { position: absolute; inset: 0; z-index: 0; }
.auth-stage span {
  position: absolute;
  inset: -6%;
  background-position: center;
  background-size: cover;
  opacity: 0;
  animation: authFade 32s ease-in-out infinite;
}
.auth-stage span:nth-child(1) { background-image: url("/assets/login-atelier.png"); }
.auth-stage span:nth-child(2) { background-image: url("/assets/login-fabric.png"); animation-delay: 8s; }
.auth-stage span:nth-child(3) { background-image: url("/assets/login-tailor.png"); animation-delay: 16s; }
.auth-stage span:nth-child(4) { background-image: url("/assets/login-mannequin.png"); animation-delay: 24s; }
.auth-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(680px 340px at 50% 0%, rgba(198, 161, 91, 0.22), transparent 70%),
    linear-gradient(180deg, rgba(18, 14, 11, 0.62), rgba(18, 14, 11, 0.42) 46%, rgba(18, 14, 11, 0.68));
}
.auth > :not(.auth-stage) { position: relative; z-index: 1; }
@keyframes authFade {
  0% { opacity: 1; transform: scale(1.04); }
  16% { opacity: 1; transform: scale(1.1); }
  25% { opacity: 0; transform: scale(1.12); }
  90% { opacity: 0; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1.04); }
}
.card, .panel, .stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel, .stat { padding: 16px; }
.login {
  width: min(440px, 100%);
  padding: 34px 30px 26px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 24px;
  background: rgba(255, 252, 248, 0.94);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(8, 6, 4, 0.38);
}
.login::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #8c5a2b, var(--gold), #f3e2b8);
}
.login .mark { margin-bottom: 16px; }
.login h1 { margin: 0 0 8px; font-size: 30px; }
.login p { margin: 0 0 8px; color: var(--muted); }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: #4d443c;
  font-size: 13px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #e6ddd2;
  border-radius: 12px;
  background: #fffcf9;
  padding: 9px 12px;
  font-weight: 500;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select option {
  color: #1b1714;
  background-color: #fff;
  font-weight: 600;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #c6a15b;
  box-shadow: 0 0 0 4px rgba(198, 161, 91, 0.18);
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--brand);
}
label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e6ddd2;
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
}
label:has(input[type="checkbox"]) input { width: 18px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: #171412;
  color: #fffaf3;
  text-decoration: none;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
button:hover, .btn:hover { background: #2a241f; }
button.ghost, .btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #e6ddd2;
  box-shadow: none;
}
button.ghost:hover, .btn.ghost:hover { background: #faf7f3; border-color: #d9cec0; }
button.danger {
  background: #9a3030;
  box-shadow: none;
}
button.danger:hover { background: #7e2626; }

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  margin: 0 0 16px;
  font-weight: 700;
  border: 1px solid transparent;
}
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #c9ead6; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #f4cfcf; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { min-height: 96px; }
.stat::before { display: none; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; font-size: 26px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.balance { margin-bottom: 16px; }
.balance .stats { margin-top: 12px; }
.stat.bal { background: #171412; color: #f6f1ea; }
.stat.bal span { color: #c6a15b; }
.stat.bal strong { color: #fff; }
.stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 108px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  text-decoration: none;
}
.stage-card .num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.stage-card.s1 .num { background: #0d4f3c; }
.stage-card.s2 .num { background: #1a7a5c; }
.stage-card.s3 .num { background: #2d8a6a; }
.stage-card.s4 .num { background: #c9a227; color: #062820; }
.stage-card.s5 .num { background: #062820; color: #e8d48b; }
.stage-card strong { font-size: 14px; }
.stage-card em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 700; }
.stage-card.on { border-color: #171412; box-shadow: 0 0 0 2px #171412; background: #faf7f3; }
.stage-banner {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(90deg, #171412, #3a332c);
  color: #fff;
}
.stage-banner h2 { margin: 0; font-size: 18px; }
.stage-banner p { margin: 4px 0 0; color: #d9cec0; font-size: 13px; }
.done-stage {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: #f4efe6;
  font-size: 13px;
  font-weight: 700;
}
.muted { color: var(--muted); font-size: 13px; }

.tabs, .row, .actions, .jumps { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.tabs:empty { display: none; }
.tabs {
  margin: 0 0 16px;
  padding: 5px;
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.tabs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #4d443c;
  font-size: 13px;
  font-weight: 700;
}
.tabs a:hover {
  background: #f6efe4;
  border-color: rgba(198, 161, 91, 0.35);
}
.tabs a.on {
  background: #171412;
  color: #fff8ea;
  box-shadow: none;
}
.tabs a.on::after { display: none; }
.filter-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}
.filter-line .tabs { margin: 0; flex: 1 1 280px; }
.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 14px;
  background: #171412;
  box-shadow: none;
}
.view-switch a.on {
  background: #fff;
  color: #171412;
}
.view-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 16px;
  border-radius: 12px;
  color: #f6efe6;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.jumps {
  margin: 0 0 14px;
  padding: 0;
  align-items: center;
}
.jumps a,
a.go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding-block: 5px;
  padding-inline: 12px 8px;
  border-radius: 999px;
  border: 1px solid #e6ddd2;
  background: #fff;
  color: #3d3228;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
.jumps a::after,
a.go::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: .75;
}
html[dir="ltr"] .jumps a::after,
html[dir="ltr"] a.go::after {
  transform: rotate(135deg);
}
.jumps a:hover,
a.go:hover {
  background: #171412;
  color: #fff8ea;
  border-color: #171412;
  transform: none;
}
.jumps a:hover::after,
a.go:hover::after { opacity: 1; }
a.go[href*="/print"] {
  border-style: dashed;
  background: #fff;
}
a.go[href*="/print"]::after { display: none; }
a.go[href*="/print"]::before {
  content: "";
  width: 14px;
  height: 16px;
  flex: 0 0 14px;
  border-radius: 2px 6px 2px 2px;
  background:
    linear-gradient(#6b4120, #6b4120) 3px 10px / 8px 1.5px no-repeat,
    linear-gradient(#6b4120, #6b4120) 3px 7px / 8px 1.5px no-repeat,
    linear-gradient(135deg, #fff 6px, #c6a15b 6px);
  box-shadow: inset 0 0 0 1.5px #6b4120;
}
a.go[href*="/print"]:hover {
  background: #1b1714;
  border-style: solid;
}
a.go[href*="/print"]:hover::before {
  background:
    linear-gradient(#fff8ea, #fff8ea) 3px 10px / 8px 1.5px no-repeat,
    linear-gradient(#fff8ea, #fff8ea) 3px 7px / 8px 1.5px no-repeat,
    linear-gradient(135deg, #1b1714 6px, #c6a15b 6px);
  box-shadow: inset 0 0 0 1.5px #fff8ea;
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
form.grid, form.panel.grid { padding: 18px; }
.span2 { grid-column: span 2; }
.mat-lines { display: grid; gap: 10px; grid-column: 1 / -1; }
.mat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mat-add {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.mat-lines .extra,
.mat-lines .add-line { display: none; }
.mat-lines > .add-line:first-of-type { display: inline-flex; width: max-content; }
#mat-add-2:checked ~ label[for="mat-add-2"] { display: none; }
#mat-add-2:checked ~ .n2 { display: grid; }
#mat-add-2:checked ~ label[for="mat-add-3"] { display: inline-flex; width: max-content; }
#mat-add-3:checked ~ label[for="mat-add-3"] { display: none; }
#mat-add-3:checked ~ .n3 { display: grid; }
#mat-add-3:checked ~ label[for="mat-add-4"] { display: inline-flex; width: max-content; }
#mat-add-4:checked ~ label[for="mat-add-4"] { display: none; }
#mat-add-4:checked ~ .n4 { display: grid; }
#mat-add-4:checked ~ label[for="mat-add-5"] { display: inline-flex; width: max-content; }
#mat-add-5:checked ~ label[for="mat-add-5"] { display: none; }
#mat-add-5:checked ~ .n5 { display: grid; }
#mat-add-5:checked ~ label[for="mat-add-6"] { display: inline-flex; width: max-content; }
#mat-add-6:checked ~ label[for="mat-add-6"] { display: none; }
#mat-add-6:checked ~ .n6 { display: grid; }
#mat-add-6:checked ~ label[for="mat-add-7"] { display: inline-flex; width: max-content; }
#mat-add-7:checked ~ label[for="mat-add-7"] { display: none; }
#mat-add-7:checked ~ .n7 { display: grid; }
#mat-add-7:checked ~ label[for="mat-add-8"] { display: inline-flex; width: max-content; }
#mat-add-8:checked ~ label[for="mat-add-8"] { display: none; }
#mat-add-8:checked ~ .n8 { display: grid; }
form.panel, form.card { display: grid; gap: 12px; }
form.row { align-items: end; margin-bottom: 14px; }
form.row label { min-width: 180px; }
form.row button { margin-bottom: 1px; }

fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--brand-dark); }
fieldset label { margin-top: 8px; }

.table-wrap {
  margin-top: 16px;
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: none;
}
table { width: 100%; border-collapse: collapse; margin: 0; background: transparent; }
.table-wrap table { min-width: 680px; }
th, td {
  padding: 11px 14px;
  text-align: right;
  vertical-align: middle;
  font-size: 13.5px;
  border-bottom: 1px solid #f1ebe4;
}
th {
  position: sticky;
  top: 0;
  color: #8a7d72;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #faf8f5;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #faf8f5; }
td:last-child, th:last-child { min-width: 180px; }

.to-stage, .to-tab { white-space: nowrap; }
.to-stage .send-cut, .to-tab .send-cut { display: inline-flex; }
.to-stage .send-cut button, .to-tab .send-cut button, a.to-side {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.to-stage .send-cut button { background: #fff; color: #171412; border: 1px solid #171412; }
.to-stage .send-cut button:hover { background: #faf7f3; }
a.to-side { background: #fff; color: #171412; border: 1px solid #171412; }
.inbox { margin: 0 0 16px; }
.inbox-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.inbox-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #faf8f5;
}
.inbox-card.on { border-color: #171412; background: #fff; }
.inbox-card span { color: var(--muted); font-size: 12px; }
.inbox-card .tools { margin-top: 6px; }
.tools form, .inline { display: inline-flex; }
.tools button, .tools .btn, .tools select, .tools input {
  min-height: 32px;
  padding: 4px 9px;
  border-radius: 9px;
  font-size: 12px;
  box-shadow: none;
}
.tools a.go { min-height: 30px; padding-block: 3px; font-size: 12px; font-weight: 700; }

details {
  margin-top: 8px;
  border: 1px solid #e6ddd2;
  border-radius: 12px;
  background: #fff;
  padding: 6px 10px;
}
summary { cursor: pointer; font-weight: 800; color: var(--brand-dark); }
details form, details .tools { margin-top: 8px; }

.chart {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 180px;
  margin-top: 8px;
  padding: 8px 4px 0;
}
.bars { flex: 1; display: flex; align-items: end; justify-content: center; gap: 4px; height: 130px; }
.bar {
  width: 10px;
  background: #171412;
  border-radius: 99px;
  min-height: 4px;
}
.bar.out { background: #1b6b45; }
.desk {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.roster-head, .form-head, .form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.roster h2, .user-form h2 { margin: 0; font-size: 18px; }
.people { display: grid; gap: 8px; margin-top: 14px; }
.person {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.person strong { font-size: 14px; }
.person span { color: var(--muted); font-size: 12px; }
.person em { display: flex; gap: 6px; margin-top: 6px; font-style: normal; }
.person b, .admin-note {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3ece3;
  color: #6d6258;
  font-size: 11px;
  font-weight: 800;
}
.person b.gold { background: var(--gold-soft); color: var(--brand-dark); }
.person b.ok { background: var(--ok-bg); color: var(--ok); }
.person b.off { background: var(--bad-bg); color: var(--bad); }
.person.on {
  border-color: #171412;
  box-shadow: none;
  background: #faf8f5;
}
.editor { display: grid; gap: 10px; align-content: start; }
.id-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.flags { display: flex; gap: 8px; flex-wrap: wrap; }
.flags .switch { width: auto; min-width: 120px; }
.admin-note {
  display: none;
  margin: 0;
  padding: 10px 12px;
  background: var(--gold-soft);
  color: var(--brand-dark);
}
.user-form:has(#is_admin:checked) .admin-note { display: block; }
.user-form:has(#is_admin:checked) .perm-board { display: none; }
.perm-board { display: grid; gap: 14px; }
.perm-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.perm-group h3 {
  margin: 0;
  padding: 10px 12px;
  background: #faf8f5;
  font-size: 13px;
}
.perm-head, .perm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 72px;
  align-items: center;
}
.perm-head {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.perm-head span:not(:first-child), .perm-row label { text-align: center; justify-content: center; }
.perm-row {
  padding: 0 12px;
  border-top: 1px solid #f0e7db;
  min-height: 42px;
}
.perm-row span { font-size: 13px; font-weight: 700; }
.user-form .tick {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.danger-row { margin-top: 10px; }
input[readonly] { background: #f7f1e8; color: #6d6258; }

.sheet {
  width: min(440px, 100%);
  margin: 12px auto;
  background: #fff;
  border: 1px solid #eadfce;
  border-radius: 8px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.sheet.a4 { width: min(980px, 100%); }
.pair {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px dotted #e6dcca;
  padding: 8px 0;
}
figure { margin: 0; }
img { display: block; max-width: min(220px, 100%); height: auto; border-radius: 12px; border: 1px solid var(--line); }
.chart > div { min-width: 42px; text-align: center; }
td, th { overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr); }
  .shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr 1fr; }
  .top { padding: 14px 18px; }
  .top h1 { font-size: 22px; }
  .content { padding: 20px 18px 44px; }
  .stat strong { font-size: 18px; }
}
@media (max-width: 980px) {
  .desk, .id-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .stages { grid-template-columns: repeat(5, minmax(108px, 1fr)); overflow-x: auto; }
  .shell, .shell.collapsed { display: block; }
  .nav-check {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
  }
  .menu-btn, .menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid #e6ddd2;
    background: #fff;
    color: var(--brand-dark);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
  }
  .menu-close {
    border-color: rgba(198, 161, 91, .35);
    background: rgba(255,255,255,.08);
    color: #f3e2b8;
  }
  .fold { display: none; }
  .side, .shell.collapsed .side {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(320px, 88vw);
    height: 100vh;
    height: 100dvh;
    z-index: 40;
    border-bottom: 0;
    border-inline-end: 1px solid rgba(198, 161, 91, .2);
    transform: translateX(105%);
    transition: transform .22s ease;
    padding-top: max(16px, env(safe-area-inset-top));
  }
  .shell.collapsed .brand div,
  .shell.collapsed .group p,
  .shell.collapsed .nav-label,
  .shell.collapsed .side-foot { display: block; }
  .shell.collapsed .brand { justify-content: flex-start; padding-inline: 8px; }
  .shell.collapsed .side a { justify-content: flex-start; padding: 10px 12px; }
  .shell.collapsed .side { padding-inline: 14px; }
  body:has(#nav-open:checked) .side { transform: translateX(0); }
  body:has(#nav-open:checked) { overflow: hidden; }
  .nav-shade {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(20, 17, 14, .46);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body:has(#nav-open:checked) .nav-shade { opacity: 1; pointer-events: auto; }
  .side a { min-height: 44px; }
  .top {
    position: sticky;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    grid-template-areas: "menu title lang bell" "who who who who";
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .menu-btn { grid-area: menu; }
  .heading { grid-area: title; }
  .langbar { grid-area: lang; }
  .bell { grid-area: bell; margin: 0; }
  .top h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .who { grid-area: who; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .userchip { flex: 1 1 auto; justify-content: center; }
  .who form, .who .btn { flex: 1 1 120px; width: auto; }
  .who form button { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, form.grid { grid-template-columns: 1fr; }
  .mat-row { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .content { padding: 16px 14px max(28px, env(safe-area-inset-bottom)); }
  form.row { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  form.row label { min-width: 0; }
  form.row button, form.row .btn { width: 100%; }
  form.row:has(span) { display: flex; align-items: center; }
  form.row:has(span) button { width: auto; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .tabs a { flex: 0 0 auto; }
  .table-wrap { margin-top: 12px; border-radius: 14px; }
  th, td { padding: 10px 8px; font-size: 13px; }
  td:last-child, th:last-child { min-width: 0; }
  .tools { min-width: 148px; }
  .chart { overflow-x: auto; }
  .login { padding: 28px 18px 22px; }
  .login h1 { font-size: 24px; }
  .pair { gap: 8px; }
  .sheet, .sheet.a4 { width: 100%; margin-inline: 0; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .actions button, .actions .btn, .actions a { flex: 1 1 140px; }
  .perm-head, .perm-row { grid-template-columns: minmax(0, 1fr) 52px 52px; padding-inline: 8px; }
  .roster-head, .form-head, .form-foot { align-items: stretch; flex-direction: column; }
}
@media (hover: none) {
  button:hover, .btn:hover, a.go:hover, .jumps a:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .side, .nav-shade, button, .btn { transition: none; }
  .auth-stage span { animation: none; opacity: 0; transform: none; }
  .auth-stage span:first-child { opacity: 1; }
}
@media print {
  .side, .top, .tabs, .jumps, .stages, .stage-banner, .actions, .no-print, .tools, .nav-shade, .menu-btn, .menu-close, .nav-check, .view-switch, .filter-line, .bell, .langbar { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .content { max-width: none; padding: 0; }
  .sheet, .panel, .table-wrap { box-shadow: none; border-color: #ddd; }
  .table-wrap, .table-wrap table { min-width: 0; overflow: visible; }
}
