:root {
  --olive-950: #0c1009;
  --olive-900: #141a10;
  --olive-800: #1c2616;
  --olive-700: #2a3a22;
  --olive-500: #6b8f4e;
  --olive-400: #8fb56a;
  --brass: #c9a227;
  --brass-soft: #e0c15a;
  --sand: #d9d2c0;
  --sand-dim: #a8a090;
  --ink: #f3efe4;
  --danger: #c44b3a;
  --ok: #6dbf6a;
  --sidebar-w: 260px;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "Barlow", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--olive-950);
  overflow-x: hidden;
}

body.is-authed .hero,
body.is-guest .ucp,
body.is-loading .hero,
body.is-loading .ucp {
  display: none !important;
}

[hidden],
.hero[hidden],
.ucp[hidden] {
  display: none !important;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 41;
  opacity: 0.03;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 2px,
    rgba(0, 0, 0, 0.35) 3px
  );
}

/* ——— LOGIN HERO ——— */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 70% 40%, rgba(107, 143, 78, 0.22), transparent 55%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(201, 162, 39, 0.12), transparent 50%),
    linear-gradient(165deg, #0a0e07 0%, #151c11 40%, #0d120a 100%);
}

.hero-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(143, 181, 106, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 181, 106, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 45%, black 20%, transparent 75%);
  transform: perspective(700px) rotateX(58deg) scale(1.4);
  transform-origin: center 20%;
  animation: gridDrift 18s linear infinite;
}

.hero-glow {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  right: -10%;
  top: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.18), transparent 65%);
  animation: glowBreathe 7s ease-in-out infinite;
}

.hero-silhouette {
  position: absolute;
  right: -2%;
  bottom: -8%;
  width: min(72vw, 820px);
  height: min(88vh, 920px);
  background:
    linear-gradient(180deg, transparent 0%, rgba(12, 16, 9, 0.15) 40%, rgba(12, 16, 9, 0.85) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 520'%3E%3Cpath fill='%231a2414' d='M200 40c18 0 34 12 40 30l18 52c4 12 14 20 26 22l48 8c14 2 24 16 22 30l-8 52c-2 12 2 24 12 32l40 32c12 10 12 30-2 38l-48 28c-10 6-16 18-14 30l8 48c2 14-8 26-22 28l-52 6c-12 2-22 10-26 22l-18 52c-6 18-28 26-44 16l-44-28c-10-6-22-6-32 0l-44 28c-16 10-38 2-44-16l-18-52c-4-12-14-20-26-22l-52-6c-14-2-24-14-22-28l8-48c2-12-4-24-14-30l-48-28c-14-8-14-28-2-38l40-32c10-8 14-20 12-32l-8-52c-2-14 8-28 22-30l48-8c12-2 22-10 26-22l18-52c6-18 22-30 40-30z'/%3E%3Ccircle cx='200' cy='200' r='36' fill='%232a3a22'/%3E%3Cpath fill='%236b8f4e' opacity='.35' d='M200 170l10 28h30l-24 18 9 28-25-17-25 17 9-28-24-18h30z'/%3E%3C/svg%3E")
    center bottom / contain no-repeat;
  opacity: 0.9;
  animation: silhouetteRise 1.4s var(--ease-out) both;
}

.hero-beams {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 40%, rgba(201, 162, 39, 0.05) 48%, transparent 56%),
    linear-gradient(155deg, transparent 50%, rgba(107, 143, 78, 0.08) 58%, transparent 66%);
  mix-blend-mode: screen;
  animation: beamSweep 10s ease-in-out infinite;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(92vw, 640px);
  padding: 5rem 1.25rem 4rem;
  animation: heroIn 1.1s var(--ease-out) 0.15s both;
}

.brand {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(3.8rem, 14vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--brass-soft);
  text-shadow: 0 0 40px rgba(201, 162, 39, 0.35);
}

.headline {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4.8vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.1;
  max-width: 14ch;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.85rem; }

.auth-msg {
  min-height: 1.25rem;
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--sand-dim);
  max-width: 36ch;
}
.auth-msg.is-error { color: #f08a7a; }

/* ——— BUTTONS ——— */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.9rem 1.4rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease-out), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.55rem 0.9rem; font-size: 0.75rem; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--brass) 0%, #a8841a 100%);
  color: #141000;
  box-shadow: 0 10px 28px rgba(201, 162, 39, 0.25);
}
.btn-ghost {
  background: transparent;
  color: var(--sand);
  border: 1px solid rgba(217, 210, 192, 0.28);
}
.btn-ghost:hover {
  border-color: var(--brass);
  color: var(--brass-soft);
}
.btn-icon {
  appearance: none;
  border: 1px solid rgba(217, 210, 192, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--sand);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1rem;
}
.btn-icon.danger:hover { color: #f08a7a; border-color: rgba(196, 75, 58, 0.5); }

/* ——— UCP SHELL ——— */
.ucp {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 0.85rem;
  background:
    linear-gradient(180deg, rgba(28, 38, 22, 0.98), rgba(12, 16, 9, 0.98));
  border-right: 1px solid rgba(201, 162, 39, 0.18);
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem 1rem;
  border-bottom: 1px solid rgba(217, 210, 192, 0.1);
  margin-bottom: 0.35rem;
}
.sidebar-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: #141000;
  background: linear-gradient(135deg, var(--brass-soft), var(--brass));
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.08em;
  line-height: 1;
}
.sidebar-brand small {
  color: var(--sand-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.nav-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sand-dim);
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.nav-item:hover {
  color: var(--ink);
  background: rgba(143, 181, 106, 0.08);
}
.nav-item.is-active {
  color: var(--brass-soft);
  background: rgba(201, 162, 39, 0.12);
  border-color: rgba(201, 162, 39, 0.28);
}
.nav-ico {
  width: 1.1rem;
  opacity: 0.8;
  text-align: center;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.65rem 0.4rem;
  border-top: 1px solid rgba(217, 210, 192, 0.1);
  margin-top: auto;
}
.side-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: #0c1009;
}
.side-user-meta {
  min-width: 0;
  display: grid;
}
.side-user-meta strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user-meta span {
  font-size: 0.72rem;
  color: var(--brass);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ucp-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(107, 143, 78, 0.12), transparent 55%),
    linear-gradient(180deg, #12180e 0%, #0c1009 100%);
}

.ucp-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid rgba(217, 210, 192, 0.1);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 16, 9, 0.72);
}
.ucp-eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.ucp-title {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1;
}
.ucp-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#menuToggle { display: none; }

.ucp-content {
  padding: 1.25rem 1.35rem 2.5rem;
  display: grid;
  gap: 1rem;
  animation: fadeIn 0.35s ease both;
}

/* ——— PANELS / CARDS ——— */
.panel {
  background: linear-gradient(160deg, rgba(42, 58, 34, 0.55), rgba(20, 26, 16, 0.85));
  border: 1px solid rgba(201, 162, 39, 0.16);
  padding: 1.25rem;
}
.panel h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}
.panel p { margin: 0; color: var(--sand-dim); line-height: 1.45; }
.loading-panel, .empty {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  min-height: 180px;
  text-align: center;
}
.success-empty { border-color: rgba(109, 191, 106, 0.35); }
.error-text { color: #f08a7a; }

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(201, 162, 39, 0.2);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.stat-card {
  padding: 1rem 1.1rem;
  background: rgba(8, 10, 6, 0.45);
  border: 1px solid rgba(217, 210, 192, 0.12);
}
.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sand-dim);
  margin-bottom: 0.35rem;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  font-weight: 400;
}
.text-danger { color: #f08a7a; }
.status-duty { color: var(--ok); }
.status-leave { color: var(--brass-soft); }
.status-off { color: var(--sand-dim); }
.status-discharge { color: #f08a7a; }

.progress {
  margin-top: 0.65rem;
  height: 4px;
  background: rgba(217, 210, 192, 0.12);
  overflow: hidden;
}
.progress.big { height: 6px; margin-top: 0.85rem; width: min(100%, 280px); }
.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--olive-500), var(--brass));
}

.welcome-panel .quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.1rem;
}

.head-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 1rem;
  align-items: start;
}

.card-list { display: grid; gap: 0.75rem; }
.list-card {
  padding: 1rem 1.1rem;
  background: rgba(8, 10, 6, 0.4);
  border: 1px solid rgba(217, 210, 192, 0.12);
}
.list-card.is-done { border-color: rgba(109, 191, 106, 0.28); }
.list-card.is-warn { border-color: rgba(196, 75, 58, 0.4); }
.list-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}
.list-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
.card-body {
  margin: 0 0 0.55rem;
  color: var(--sand-dim);
  white-space: pre-wrap;
  line-height: 1.4;
}
.card-link {
  color: var(--brass-soft);
  font-weight: 600;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.muted { color: var(--sand-dim); font-size: 0.85rem; }

.chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
  border: 1px solid rgba(217, 210, 192, 0.2);
  color: var(--sand);
}
.chip-ok { border-color: rgba(109, 191, 106, 0.45); color: var(--ok); }
.chip-pending { border-color: rgba(201, 162, 39, 0.35); color: var(--brass-soft); }
.chip-req { border-color: rgba(196, 75, 58, 0.35); color: #f08a7a; }
.chip-opt { opacity: 0.8; }
.chip-danger { border-color: rgba(196, 75, 58, 0.55); color: #f08a7a; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.75rem; }

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.field span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sand-dim);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(217, 210, 192, 0.2);
  background: rgba(8, 10, 6, 0.55);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 0.85rem;
  outline: none;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(201, 162, 39, 0.65);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.12);
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  color: var(--sand-dim);
  font-size: 0.9rem;
}

.profile-panel {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 2px solid rgba(201, 162, 39, 0.45);
}
.profile-rank {
  margin: 0.35rem 0 0.55rem !important;
  color: var(--brass-soft) !important;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.duty-panel {
  text-align: center;
  padding: 2rem 1.25rem;
}
.duty-panel h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.75rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  z-index: 80;
  transform: translateX(-50%);
  padding: 0.85rem 1.2rem;
  background: rgba(26, 36, 20, 0.96);
  border: 1px solid rgba(143, 181, 106, 0.4);
  color: var(--ink);
  font-weight: 600;
  animation: toastIn 0.35s var(--ease-out) both;
}
.toast.is-error { border-color: rgba(196, 75, 58, 0.5); color: #f08a7a; }
.toast[hidden] { display: none !important; }

.faction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.faction-bar .chip {
  cursor: pointer;
  background: rgba(0, 0, 0, 0.25);
}
.faction-bar .chip:hover { border-color: var(--brass); }

.card-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(217, 210, 192, 0.12);
}

.picker-results {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.45rem;
  max-height: 220px;
  overflow: auto;
}
.picker-hit {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(217, 210, 192, 0.15);
  background: rgba(8, 10, 6, 0.55);
  color: var(--ink);
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  font-family: var(--font-body);
}
.picker-hit:hover { border-color: rgba(201, 162, 39, 0.45); }
.picker-hit img {
  width: 32px;
  height: 32px;
  object-fit: cover;
}
.picker-hit small {
  display: block;
  color: var(--sand-dim);
  font-size: 0.75rem;
}

.person-hit {
  width: 100%;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.person-hit:hover { border-color: rgba(201, 162, 39, 0.4); }

.row-actions { display: flex; gap: 0.4rem; align-items: center; }

.split-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(217, 210, 192, 0.08);
  font-size: 0.9rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.catalog-card {
  padding: 0.85rem;
  background: rgba(8, 10, 6, 0.45);
  border: 1px solid rgba(217, 210, 192, 0.12);
}
.catalog-card strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 0.95rem;
}
.catalog-card p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--sand-dim);
}
.catalog-card.severity-4,
.catalog-card.severity-5 {
  border-color: rgba(196, 75, 58, 0.35);
}

.terror-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.terror-card {
  padding: 1rem;
  background: rgba(8, 10, 6, 0.5);
  border: 1px solid rgba(217, 210, 192, 0.14);
}
.terror-lv-3 { border-color: rgba(196, 75, 58, 0.55); box-shadow: inset 0 0 0 1px rgba(196, 75, 58, 0.2); }
.terror-lv-4 { border-color: rgba(255, 255, 255, 0.25); background: #0a0a0a; }
.terror-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.terror-badge {
  color: #111;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
}
.terror-lv-4 .terror-badge { color: #eee; }
.terror-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

/* Clearance / Verschluss */
.clearance-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(201, 162, 39, 0.28);
  background: linear-gradient(135deg, rgba(42, 58, 34, 0.65), rgba(12, 16, 9, 0.9));
}
.clearance-hero-meta { display: grid; gap: 0.2rem; min-width: 0; }
.clearance-code {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  letter-spacing: 0.06em;
  font-weight: 400;
  line-height: 1;
  color: var(--brass-soft);
}
.clearance-ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.25rem;
}
.clearance-step {
  padding: 0.85rem 0.65rem;
  border: 1px solid rgba(217, 210, 192, 0.12);
  background: rgba(8, 10, 6, 0.4);
  text-align: center;
}
.clearance-step.is-reached {
  border-color: rgba(109, 191, 106, 0.4);
  background: rgba(42, 58, 34, 0.45);
}
.clearance-step.is-current {
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.22);
}
.clearance-step strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}
.clearance-step span {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--sand-dim);
  line-height: 1.3;
}
.clearance-section { margin-bottom: 1.25rem; }
.clearance-section h3 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sand-dim);
}
.chip-clearance {
  border-color: rgba(201, 162, 39, 0.45);
  color: var(--brass-soft);
}
.chip-locked {
  border-color: rgba(196, 75, 58, 0.4);
  color: #f08a7a;
}
.lock-msg {
  margin: 0 0 0.75rem;
  color: #f08a7a;
  font-size: 0.9rem;
  font-weight: 600;
}
.soft-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(201, 162, 39, 0.08);
  color: var(--sand);
  font-size: 0.92rem;
  line-height: 1.45;
}
.soft-banner .linkish {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--brass-soft);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

@media (max-width: 720px) {
  .clearance-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.doc-sheet {
  background: linear-gradient(180deg, #f4efdf, #e8e0cc);
  color: #1a1812;
  padding: 1.5rem;
  border: 1px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  position: relative;
}
.doc-seal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  border: 2px solid rgba(196, 75, 58, 0.7);
  color: rgba(196, 75, 58, 0.85);
  padding: 0.4rem 0.55rem;
  transform: rotate(8deg);
}
.doc-sheet h2 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  margin: 0.4rem 0 1rem;
  color: #1a1812;
}
.doc-body {
  white-space: pre-wrap;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.35);
  padding: 1rem;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  overflow: auto;
}
.sign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.2rem;
}
.sign-box {
  border: 1px solid rgba(0, 0, 0, 0.18);
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.4);
}
.sign-box h3 { margin: 0 0 0.35rem; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sig-img {
  width: 100%;
  max-height: 110px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.sign-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 8, 5, 0.78);
  backdrop-filter: blur(8px);
}
.sign-modal[hidden] { display: none !important; }
.sign-modal-card {
  width: min(100%, 720px);
  background: linear-gradient(160deg, rgba(42, 58, 34, 0.98), rgba(16, 20, 12, 0.98));
  border: 1px solid rgba(201, 162, 39, 0.35);
  padding: 1.25rem;
}
.sign-modal-card canvas {
  width: 100%;
  height: auto;
  touch-action: none;
  border: 1px solid rgba(217, 210, 192, 0.25);
  background: #f3efe4;
  cursor: crosshair;
  margin: 0.75rem 0;
}

@media (max-width: 720px) {
  .sign-row { grid-template-columns: 1fr; }
}

@keyframes gridDrift { to { background-position: 0 64px; } }
@keyframes glowBreathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes beamSweep {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes silhouetteRise {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 0.9; transform: translateY(0); }
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .ucp { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.3s var(--ease-out);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
  }
  .sidebar.is-open { transform: translateX(0); }
  #menuToggle { display: inline-flex; }
  .hero-silhouette { opacity: 0.35; right: -28%; width: 110vw; }
  .hero-content { text-align: center; }
  .headline, .auth-msg { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .profile-panel { flex-direction: column; text-align: center; }
  .ucp-actions .btn { padding: 0.5rem 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== v6 Modal / PDF / Clean lists ===== */
:root {
  --font-doc: "Libre Baskerville", Georgia, serif;
}

.view-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.view-h {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.view-sub {
  margin: 0.25rem 0 0;
  color: var(--sand-dim);
  font-size: 0.9rem;
}
.view-actions { display: flex; gap: 0.5rem; }
.badge-warn {
  color: var(--brass-soft);
  font-weight: 700;
}

.list-clean {
  display: grid;
  gap: 0.45rem;
}
.row-item {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  text-align: left;
  padding: 0.95rem 1.05rem;
  border: 1px solid rgba(217, 210, 192, 0.12);
  background: rgba(8, 10, 6, 0.35);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.row-item:hover:not(.static) {
  border-color: rgba(201, 162, 39, 0.4);
  background: rgba(42, 58, 34, 0.35);
  transform: translateY(-1px);
}
.row-item.static { cursor: default; }
.row-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.row-main strong {
  font-size: 1rem;
}
.row-with-av {
  display: flex !important;
  grid: none !important;
  align-items: center;
  gap: 0.75rem;
}
.row-with-av img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid rgba(201, 162, 39, 0.35);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 2rem;
  border: 1px dashed rgba(217, 210, 192, 0.18);
  color: var(--sand-dim);
  text-align: center;
}

.soft-details {
  margin-top: 1rem;
  border: 1px solid rgba(217, 210, 192, 0.12);
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
}
.soft-details summary {
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sand);
}
.soft-details summary:hover { color: var(--brass-soft); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.filter-bar .chip {
  cursor: pointer;
  background: rgba(0, 0, 0, 0.25);
}

.stat-grid.compact { gap: 0.65rem; }
.stat-card.clickable {
  cursor: pointer;
  appearance: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card.clickable:hover {
  border-color: rgba(201, 162, 39, 0.45);
  transform: translateY(-2px);
}
.stat-value.small { font-size: 1.05rem; line-height: 1.15; }

.profile-hero {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(201, 162, 39, 0.22);
  background: linear-gradient(135deg, rgba(42, 58, 34, 0.55), rgba(12, 16, 9, 0.8));
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.profile-hero img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid rgba(201, 162, 39, 0.4);
}
.profile-hero strong { display: block; font-size: 1.2rem; }
.profile-hero span { color: var(--sand-dim); font-size: 0.9rem; }

.search-box input {
  width: 100%;
  border: 1px solid rgba(217, 210, 192, 0.2);
  background: rgba(8, 10, 6, 0.55);
  color: var(--ink);
  font: inherit;
  padding: 0.95rem 1rem;
  margin-bottom: 0.85rem;
  outline: none;
}
.search-box input:focus {
  border-color: rgba(201, 162, 39, 0.6);
}

.duty-hero {
  text-align: center;
  padding: 2.5rem 1.25rem;
  border: 1px solid rgba(217, 210, 192, 0.14);
  background: rgba(8, 10, 6, 0.4);
  margin-bottom: 1rem;
}
.duty-hero.on { border-color: rgba(109, 191, 106, 0.4); }
.duty-hero h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0.35rem 0 0.5rem;
  font-weight: 400;
}
.duty-hero .btn { margin-top: 1rem; }

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.clickable { cursor: pointer; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 4, 0.78);
  backdrop-filter: blur(10px);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(34, 46, 28, 0.98), rgba(12, 16, 9, 0.98));
  border: 1px solid rgba(201, 162, 39, 0.3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: panelIn 0.35s var(--ease-out) both;
}
.modal.is-wide .modal-card { width: min(100%, 980px); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(217, 210, 192, 0.1);
}
.modal-eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}
.modal-head h2 {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.modal-body {
  padding: 1.1rem 1.15rem;
  overflow: auto;
  flex: 1;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid rgba(217, 210, 192, 0.1);
  background: rgba(0, 0, 0, 0.2);
}
.modal-img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(217, 210, 192, 0.15);
}
.avatar-lg {
  width: 120px !important;
  height: 120px !important;
  object-fit: cover;
  margin: 0 auto 0.85rem;
  display: block;
}
.akte-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1.25rem;
}
.akte-clearance {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(217, 210, 192, 0.18);
}
.akte-clearance .chip { margin: 0.35rem 0; }
.akte-grid h3 {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}
.hist-mini { margin-top: 1rem; border-top: 1px solid rgba(217, 210, 192, 0.1); padding-top: 0.75rem; }

.sign-card { width: min(100%, 680px) !important; }
#signCanvas {
  width: 100%;
  height: auto;
  touch-action: none;
  border: 1px solid rgba(217, 210, 192, 0.25);
  background: #f7f2e6;
  cursor: crosshair;
  margin: 0.65rem 0;
}

/* PDF page — official letterhead */
.pdf-page {
  --pdf-ink: #16140f;
  --pdf-muted: #5e564a;
  --pdf-line: rgba(22, 20, 15, 0.18);
  --pdf-accent: #3d4a2e;
  background: #ebe6da;
  color: var(--pdf-ink);
  padding: 1.1rem;
  min-height: 560px;
  font-family: "Libre Baskerville", Georgia, serif;
}
.pdf-frame {
  background: #faf8f2;
  border: 1px solid rgba(22, 20, 15, 0.2);
  box-shadow: inset 0 0 0 3px #faf8f2, inset 0 0 0 4px rgba(61, 74, 46, 0.35);
  padding: 2.1rem 2.25rem 1.6rem;
  min-height: 520px;
}
.pdf-letterhead {
  margin-bottom: 1.25rem;
}
.pdf-letterhead-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 2.5px solid var(--pdf-ink);
}
.pdf-org-kicker {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pdf-accent);
}
.pdf-org-name {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 2.05rem;
  letter-spacing: 0.1em;
  line-height: 1;
  color: var(--pdf-ink);
}
.pdf-meta {
  text-align: right;
  font-family: var(--font-body);
  line-height: 1.35;
}
.pdf-docno {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--pdf-ink);
}
.pdf-cat {
  font-size: 0.7rem;
  color: var(--pdf-muted);
  margin-top: 0.12rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pdf-letterhead-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--pdf-line);
  font-family: var(--font-body);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pdf-muted);
}
.pdf-stamp {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border: 1.5px solid #9a2f24;
  color: #9a2f24;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 0.64rem;
}
.pdf-stamp.executed { border-color: #2f6b34; color: #2f6b34; }
.pdf-stamp.rejected { border-color: #6b2f2f; color: #6b2f2f; }
.pdf-title {
  margin: 0.35rem 0 1.25rem;
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--pdf-ink);
  line-height: 1.3;
}
.pdf-parties {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 0.2rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
}
.pdf-parties strong {
  font-weight: 600;
  color: var(--pdf-ink);
}
.pdf-parties span {
  display: block;
  color: var(--pdf-muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.22rem;
}
.pdf-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--pdf-line), var(--pdf-ink), var(--pdf-line), transparent);
  opacity: 0.7;
  margin: 1.25rem 0;
}
.pdf-body {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.75;
  margin: 0;
  color: #2a241a;
}
.pdf-signs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 0.25rem;
  font-family: var(--font-body);
}
.pdf-signs-single {
  grid-template-columns: minmax(0, 320px);
}
.pdf-sign-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pdf-muted);
  margin-bottom: 0.5rem;
}
.pdf-sign img {
  width: 100%;
  max-height: 88px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--pdf-line);
}
.pdf-sign-empty {
  border-bottom: 1px solid var(--pdf-ink);
  height: 52px;
  opacity: 0.4;
}
.pdf-sign-na {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  justify-content: center;
  min-height: 52px;
  padding: 0.55rem 0.65rem;
  border: 1px dashed var(--pdf-line);
  background: rgba(61, 74, 46, 0.04);
  font-size: 0.78rem;
  color: var(--pdf-muted);
}
.pdf-sign-na em {
  font-style: normal;
  font-weight: 600;
  color: var(--pdf-ink);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.pdf-sign-na span {
  font-size: 0.68rem;
}
.pdf-sign-meta {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--pdf-muted);
}
.pdf-foot {
  margin-top: 1.5rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--pdf-line);
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: #8a8070;
  text-transform: uppercase;
}

.seg {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.seg-btn {
  appearance: none;
  border: 1px solid rgba(217, 210, 192, 0.28);
  background: rgba(0, 0, 0, 0.2);
  color: var(--sand-dim);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
}
.seg-btn.is-on {
  border-color: rgba(201, 162, 39, 0.55);
  color: var(--ink);
  background: rgba(201, 162, 39, 0.16);
}
.doc-party-hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.78rem;
}

/* Offscreen high-res PNG export */
.pdf-export-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1400px;
  pointer-events: none;
  opacity: 1;
  z-index: -1;
}
.pdf-page-export {
  width: 1400px;
  box-sizing: border-box;
  padding: 2rem;
}
.pdf-page-export .pdf-frame {
  padding: 3.25rem 3.5rem 2.5rem;
  min-height: 0;
}
.pdf-page-export .pdf-org-name {
  font-size: 2.6rem;
}
.pdf-page-export .pdf-org-kicker {
  font-size: 0.78rem;
}
.pdf-page-export .pdf-docno {
  font-size: 1rem;
}
.pdf-page-export .pdf-cat {
  font-size: 0.85rem;
}
.pdf-page-export .pdf-title {
  font-size: 1.85rem;
  margin-bottom: 1.6rem;
}
.pdf-page-export .pdf-parties {
  font-size: 1.05rem;
  gap: 1.25rem;
  margin-bottom: 0.4rem;
}
.pdf-page-export .pdf-parties span {
  font-size: 0.72rem;
  margin-bottom: 0.3rem;
}
.pdf-page-export .pdf-body {
  font-size: 1.12rem;
  line-height: 1.85;
}
.pdf-page-export .pdf-sign-label {
  font-size: 0.72rem;
  margin-bottom: 0.65rem;
}
.pdf-page-export .pdf-sign img {
  max-height: 130px;
}
.pdf-page-export .pdf-sign-empty {
  height: 72px;
}
.pdf-page-export .pdf-signs {
  gap: 2.25rem;
  margin-top: 0.5rem;
}
.pdf-page-export .pdf-signs-single {
  grid-template-columns: minmax(0, 480px);
}
.pdf-page-export .pdf-foot {
  margin-top: 2.25rem;
  font-size: 0.72rem;
}
.pdf-page-export .pdf-rule {
  margin: 1.6rem 0;
}
.pdf-page-export .pdf-letterhead {
  margin-bottom: 1.75rem;
}
.pdf-page-export .pdf-stamp {
  font-size: 0.78rem;
  padding: 0.25rem 0.7rem;
}

.modal.is-wide .modal-body {
  background: #2a2418;
}

@media (max-width: 720px) {
  .akte-grid,
  .pdf-parties,
  .pdf-signs { grid-template-columns: 1fr; }
  .pdf-page { padding: 1.25rem; }
}
