/* =========================================================
   Bushido HQ — Academy CRM (dark command-center theme)
   Shell stylesheet. Views rely on the class names defined
   here (SPEC §7). View-specific styles are injected by the
   views themselves with the .vx-<view>- prefix.
   ========================================================= */

:root {
  --black:#0d0d0d; --ink:#161616; --ink-2:#1f1f1f; --ink-3:#26262b;
  --red:#cf1126; --red-dark:#a50d1e; --red-light:#ef2238;
  --white:#ffffff; --cream:#f7f5f1;
  /* Text grays lifted for readability on the dark theme (backgrounds 600-800 unchanged) */
  --gray-100:#f4f4f5; --gray-200:#ebebee; --gray-300:#dddde2; --gray-400:#c0c0c8;
  --gray-500:#93939c; --gray-600:#55555c; --gray-700:#34343a; --gray-800:#202024;
  --line:#2c2c31;                 /* borders on dark */
  --ok:#2e9e4a; --warn:#f2c81d;
  --radius:14px; --radius-sm:8px;
  /* One family everywhere — Inter. (Oswald stays on the website/kiosk only.) */
  --font-head:'Inter',system-ui,sans-serif;
  --font-body:'Inter',system-ui,sans-serif;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --ease:cubic-bezier(.22,.61,.36,1);
  --sidebar-w:240px;
  --sidebar-rail:68px;
  --topbar-h:58px;
  color-scheme: dark;
}

/* ----------  Reset  ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(207,17,38,.07), transparent 60%),
    var(--black);
  color: var(--white);
  font-size: 16.5px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; padding: 0; }
h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
body.modal-open, body.nav-open { overflow: hidden; }

/* ----------  Custom scrollbar (dark)  ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-700); border-radius: 8px; border: 2px solid var(--black); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }
* { scrollbar-width: thin; scrollbar-color: var(--gray-700) transparent; }

/* ----------  Focus  ---------- */
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--red); color: #fff; }

/* =========================================================
   Layout: shell / sidebar / topbar
   ========================================================= */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  width: var(--sidebar-w);
  background: var(--ink);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform .32s var(--ease), width .2s var(--ease);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  min-height: 76px;
}
.sidebar__brand img { height: 46px; width: auto; filter: drop-shadow(0 4px 10px rgba(207,17,38,.3)); }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar__brand-text b {
  font-family: var(--font-head); font-size: 17px; font-weight: 700;
  letter-spacing: -0.01em; color: #fff;
}
.sidebar__brand-text span {
  font-size: 10px; letter-spacing: .8px; text-transform: uppercase;
  color: var(--red-light); font-weight: 600; margin-top: 3px;
}

.sidebar__nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-300);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 500;
  letter-spacing: 0;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(207,17,38,.15); color: #fff; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; background: var(--red); border-radius: 0 3px 3px 0;
}
.nav-item__icon {
  flex: none; width: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
}
.nav-item__icon svg { width: 18px; height: 18px; }
.nav-empty { padding: 14px 12px; color: var(--gray-500); font-size: 13px; }

.sidebar__foot { border-top: 1px solid var(--line); padding: 10px; }
.sidebar__quick {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--gray-400); font-size: 13px; font-weight: 500;
  transition: background .18s, color .18s;
}
.sidebar__quick:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar__quick svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.sidebar__quick em { font-style: normal; }
.sidebar__motto {
  font-family: var(--font-body); font-size: 10px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--gray-600); text-align: center; padding: 10px 0 4px;
}

.nav-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin .2s var(--ease);
}

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: rgba(13,13,13,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__title {
  font-family: var(--font-body); font-size: 14.5px; font-weight: 600;
  letter-spacing: 0; color: var(--gray-300);
}
.topbar__clock { margin-left: auto; font-size: 13px; color: var(--gray-500); white-space: nowrap; letter-spacing: .3px; }
.topbar__menu { display: none; flex-direction: column; gap: 4px; padding: 9px 8px; border-radius: 6px; }
.topbar__menu span { width: 20px; height: 2px; background: #fff; border-radius: 2px; display: block; }
.topbar__menu:hover { background: rgba(255,255,255,.08); }

.view { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 28px 70px; }
.view-in { animation: viewIn .32s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ----------  Page head (used inside views)  ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 26px;
}
.page-title { font-size: clamp(1.45rem, 2.6vw, 1.8rem); letter-spacing: -0.015em; color: #fff; }
.page-title::after {
  content: ""; display: block; width: 48px; height: 3px;
  background: var(--red); margin-top: 10px; border-radius: 2px;
}

/* =========================================================
   Cards / stats / grids
   ========================================================= */
.card {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }
.card h3 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 14px; color: #fff; }

.stat {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; background: var(--red); border-radius: 0 3px 3px 0; opacity: .9;
}
.stat__num {
  font-family: var(--font-body); font-weight: 700;
  font-size: clamp(1.55rem, 2.4vw, 2rem); line-height: 1.05;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  color: var(--red-light);
}
.stat__label {
  text-transform: uppercase; letter-spacing: .6px; font-size: 11.5px;
  color: var(--gray-400); margin-top: 7px; font-weight: 600;
}

.grid-2, .grid-3, .grid-4 { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* =========================================================
   Tables
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
.table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
.table th {
  font-family: var(--font-body); font-weight: 600;
  font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--gray-400);
  text-align: left; padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--ink);
}
.table td {
  padding: 12px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--gray-200);
  /* never wrap mid-value (phones, dates); long text ellipsizes and the wrap scrolls */
  white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis;
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--ink-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* =========================================================
   Buttons (red primary — clean Inter, no all-caps)
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-body);
  letter-spacing: 0;
  font-weight: 600; font-size: 14.5px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, color .18s, border-color .18s;
  white-space: nowrap; cursor: pointer; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 8px 22px rgba(207,17,38,.35); }
.btn--primary:hover { background: var(--red-dark); box-shadow: 0 10px 26px rgba(207,17,38,.45); }
.btn--ghost { background: transparent; color: var(--gray-200); border-color: var(--gray-600); }
.btn--ghost:hover { color: #fff; border-color: var(--gray-400); background: rgba(255,255,255,.06); }
.btn--dark { background: var(--ink-2); color: #fff; border-color: var(--line); }
.btn--dark:hover { background: var(--ink-3); border-color: var(--gray-600); }
.btn--danger { background: rgba(207,17,38,.14); color: var(--red-light); border-color: rgba(207,17,38,.5); }
.btn--danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn--sm { padding: 6px 12px; font-size: 13px; gap: 6px; }
.btn--block { width: 100%; }

/* =========================================================
   Forms (dark inputs)
   ========================================================= */
label {
  display: block;
  font-size: 13.5px; font-weight: 600;
  letter-spacing: 0;
  color: var(--gray-300);
  margin-bottom: 6px;
}
label:has(> input[type=checkbox]), label:has(> input[type=radio]) {
  display: inline-flex; align-items: center; gap: 9px;
  text-transform: none; letter-spacing: .2px;
  font-size: 14px; font-weight: 500; color: var(--gray-200);
  cursor: pointer;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
select, textarea {
  padding: 11px 14px;
  font-family: var(--font-body); font-size: 16px;
  color: #fff;
  background: var(--ink-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
/* Full width only in form layouts — toolbar filters size to their content */
.field input, .field select, .field textarea,
.search-input, textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--gray-500); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  background: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(207,17,38,.18);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23a8a8af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}
select[multiple] { background-image: none; padding-right: 14px; }
select option, select optgroup { background: var(--ink-2); color: #fff; }
input[type=checkbox], input[type=radio] { accent-color: var(--red); width: 17px; height: 17px; cursor: pointer; flex: none; }
input::-webkit-calendar-picker-indicator { filter: invert(.65); cursor: pointer; }

.field { margin-bottom: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input.search-input {
  padding-left: 40px;
  max-width: 340px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%2374747c' d='M15.5 14h-.79l-.28-.27a6.5 6.5 0 1 0-.7.7l.27.28v.79l5 4.99L20.49 19zM10 14.5A4.5 4.5 0 1 1 14.5 10 4.5 4.5 0 0 1 10 14.5z'/></svg>");
  background-repeat: no-repeat;
  background-position: 13px center;
  background-size: 17px;
}
.search-input { border-radius: 50px; }

/* =========================================================
   Chips / badges / avatar
   ========================================================= */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 50px;
  background: var(--ink-3); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--gray-200); white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 50px;
  font-family: var(--font-body); font-weight: 600;
  font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--ink-3); color: var(--gray-300);
  white-space: nowrap;
}
.badge--ok   { background: rgba(46,158,74,.14);  color: #5ecb7b;        border-color: rgba(46,158,74,.4); }
.badge--warn { background: rgba(242,200,29,.12); color: var(--warn);    border-color: rgba(242,200,29,.35); }
.badge--err  { background: rgba(207,17,38,.16);  color: #ff7585;        border-color: rgba(207,17,38,.45); }
.badge--muted{ background: var(--gray-800);      color: var(--gray-400);border-color: var(--gray-700); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  letter-spacing: .3px; /* initials are uppercased in JS */
  box-shadow: 0 4px 10px rgba(207,17,38,.3);
  user-select: none;
}

/* =========================================================
   Belt chip — looks like a real BJJ belt: colored bar with a
   rank-bar segment at the right (red on black belts) carrying
   white stripe ticks.
   ========================================================= */
.belt-chip { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; vertical-align: middle; }
.belt-chip__bar {
  position: relative;
  display: inline-flex; align-items: stretch; justify-content: flex-end;
  width: 66px; height: 14px; flex: none;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.4), inset 0 2px 2px rgba(255,255,255,.12), 0 1px 3px rgba(0,0,0,.45);
  overflow: hidden;
}
.belt-chip__rank {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 22px; height: 100%; padding: 0 3px;
  background: #111;
  box-shadow: inset 0 0 3px rgba(0,0,0,.5);
}
.belt-chip__stripe { display: inline-block; width: 3px; height: 9px; background: #fff; border-radius: 1px; box-shadow: 0 0 2px rgba(0,0,0,.6); }
.belt-chip__label { font-size: 13px; color: var(--gray-200); letter-spacing: .3px; }

/* =========================================================
   Tabs
   ========================================================= */
.tabs {
  display: flex; gap: 2px; align-items: flex-end;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  font-family: var(--font-body); font-weight: 550;
  letter-spacing: 0; font-size: 14px;
  color: var(--gray-400);
  padding: 10px 16px 11px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .18s, border-color .18s, background .18s;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}
.tab:hover { color: #fff; background: rgba(255,255,255,.04); }
.tab.active { color: #fff; border-bottom-color: var(--red); }

/* =========================================================
   Kanban (leads pipeline)
   ========================================================= */
.kanban {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 252px; min-width: 252px; min-height: 220px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
}
.kanban-col h3, .kanban-col h4 {
  font-size: 11.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--gray-400);
  margin-bottom: 12px; padding: 0 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.kanban-card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.kanban-card:hover { transform: translateY(-2px); border-color: var(--gray-600); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.kanban-card:last-child { margin-bottom: 0; }

/* =========================================================
   Modal
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(5,5,5,.72);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; }
.modal {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%; max-width: 600px;
  max-height: min(92vh, 880px);
  display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: modalPop .26s var(--ease);
}
@keyframes modalPop { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal__head h3 {
  font-size: 1.1rem; letter-spacing: -0.01em;
  position: relative; padding-left: 14px;
}
.modal__head h3::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 4px; background: var(--red); border-radius: 2px;
}
.modal__close {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); color: #fff;
  font-size: 20px; line-height: 1;
  display: grid; place-items: center;
  transition: background .18s, transform .18s;
}
.modal__close:hover { background: var(--red); transform: rotate(90deg); }
.modal__body { padding: 20px 22px; overflow-y: auto; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  flex: none;
}
.confirm-msg { font-size: 15px; color: var(--gray-200); line-height: 1.6; }

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(160%);
  z-index: 7000;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: #fff;
  padding: 13px 22px;
  border-radius: 50px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  transition: transform .38s var(--ease);
  max-width: min(92vw, 560px);
  font-size: 14.5px; font-weight: 500;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast__icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; line-height: 1;
}
.toast--err { border-color: rgba(207,17,38,.55); }
.toast--err .toast__icon { background: var(--red); }

/* =========================================================
   Empty / error states
   ========================================================= */
.empty-note {
  text-align: center;
  color: var(--gray-500);
  padding: 36px 22px;
  background: var(--ink);
  border: 1px dashed var(--gray-700);
  border-radius: var(--radius);
  font-size: 15.5px;
  line-height: 1.7;
}
.empty-note b { color: var(--gray-300); font-weight: 650; font-size: 15px; }
.empty-note--err { border-color: rgba(207,17,38,.5); }
.empty-note--err b { color: #ff8b98; }

/* =========================================================
   Sparkline
   ========================================================= */
.spark { display: inline-block; vertical-align: middle; overflow: visible; }

/* =========================================================
   PIN gate
   ========================================================= */
.pin-gate {
  position: fixed; inset: 0; z-index: 6000;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(720px 420px at 50% -8%, rgba(207,17,38,.30), transparent 62%),
    radial-gradient(640px 380px at 50% 112%, rgba(207,17,38,.16), transparent 55%),
    var(--black);
  opacity: 1;
  transition: opacity .3s ease;
  overflow-y: auto;
}
.pin-gate--hide { opacity: 0; pointer-events: none; }
.pin-gate__box {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 34px 26px;
  width: 100%; max-width: 380px;
}
.pin-gate__logo {
  height: 112px; width: auto;
  filter: drop-shadow(0 14px 34px rgba(207,17,38,.4));
  animation: gatePulse 3.4s ease-in-out infinite;
}
@keyframes gatePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.pin-gate__box h1 { font-size: 27px; letter-spacing: -0.01em; margin-top: 20px; color: #fff; }
.pin-gate__box h1::after {
  content: ""; display: block; width: 72px; height: 4px;
  background: var(--red); margin: 12px auto 0; border-radius: 2px;
}
.pin-gate__sub { color: var(--gray-400); font-size: 13.5px; margin: 16px 0 24px; letter-spacing: .3px; max-width: 300px; }
.pin-gate__dots { display: flex; gap: 12px; justify-content: center; }
.pin-gate__dot {
  width: 52px; height: 62px;
  border-radius: 12px;
  background: var(--ink);
  border: 2px solid var(--gray-700);
  display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.pin-gate__dot.filled { border-color: var(--gray-500); background: var(--ink-2); }
.pin-gate__dot.filled::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.pin-gate__dot.next { border-color: var(--red); box-shadow: 0 0 0 3px rgba(207,17,38,.18); }
.pin-gate.busy .pin-gate__dot { border-color: var(--red); }
.pin-gate__err { min-height: 22px; color: var(--red-light); font-size: 13.5px; letter-spacing: .3px; margin: 12px 0 10px; }
.pin-gate__pad { display: grid; grid-template-columns: repeat(3, 78px); gap: 10px; justify-content: center; }
.pin-key {
  height: 60px;
  border-radius: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: #fff;
  font-family: var(--font-body); font-size: 21px; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s;
}
.pin-key:hover { border-color: var(--red); background: var(--ink-3); }
.pin-key:active { transform: scale(.94); background: var(--red); border-color: var(--red); }
.pin-key--muted { color: var(--gray-400); font-size: 17px; }
.pin-gate__foot {
  margin-top: 30px;
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--gray-600);
}
.pin-gate.shake .pin-gate__dots { animation: gateShake .42s ease; }
@keyframes gateShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  /* sidebar collapses to an icon rail */
  .sidebar { width: var(--sidebar-rail); }
  .sidebar__brand { justify-content: center; padding: 14px 8px; }
  .sidebar__brand img { height: 38px; }
  .sidebar__brand-text { display: none; }
  .sidebar__nav { padding: 12px 8px; }
  .nav-item { justify-content: center; padding: 12px 8px; gap: 0; }
  .nav-item__label { display: none; }
  .nav-item.active::before { left: -8px; }
  .sidebar__quick { justify-content: center; padding: 9px 8px; gap: 0; }
  .sidebar__quick em { display: none; }
  .sidebar__motto { display: none; }
  .main { margin-left: var(--sidebar-rail); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  /* sidebar becomes an off-canvas drawer, hamburger in topbar */
  .sidebar {
    width: 256px;
    transform: translateX(-106%);
    box-shadow: 14px 0 44px rgba(0,0,0,.5);
  }
  body.nav-open .sidebar { transform: none; }
  .sidebar__brand { justify-content: flex-start; padding: 16px 16px 14px; }
  .sidebar__brand img { height: 46px; }
  .sidebar__brand-text { display: flex; }
  .sidebar__nav { padding: 14px 10px; }
  .nav-item { justify-content: flex-start; padding: 12px; gap: 12px; }
  .nav-item__label { display: inline; }
  .nav-item.active::before { left: -10px; }
  .sidebar__quick { justify-content: flex-start; padding: 8px 12px; gap: 10px; }
  .sidebar__quick em { display: inline; }
  .sidebar__motto { display: block; }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
  .topbar__menu { display: flex; }
  .view { padding: 18px 14px 70px; }
  .page-head { margin-bottom: 20px; }
  .modal__head, .modal__body, .modal__foot { padding-left: 16px; padding-right: 16px; }
  .pin-gate__pad { grid-template-columns: repeat(3, 72px); }
  input.search-input { max-width: 100%; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .kanban-col { flex-basis: 232px; min-width: 232px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
