/* =========================================================
   Elite Sportcars Club – Prototype (HTML/Figma-style)
   Minimalist • Edel • White / Gray / Red
   ========================================================= */

:root {
  --bg: #f6f7f8;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e6e8eb;
  --border: #dde1e6;
  --border-2: #c6ccd3;
  --text: #111318;
  --muted: #626975;
  --muted-2: #626975;
  --red: #e10600;
  --red-hover: #b80500;
  --red-soft: rgba(225, 6, 0, 0.12);
  --green: #178c44;
  --amber: #b77900;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.14);
  --sidebar-w: 264px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* Default icon sizing — prevents inline SVGs from rendering at 300x150 and
   breaking the layout. Larger icon wrappers override this below. */
svg { width: 18px; height: 18px; flex: none; }
[data-icon] { display: inline-flex; align-items: center; }
[data-icon] > svg { vertical-align: middle; }

/* Larger icon-wrapper overrides */
.hc-ico svg { width: 26px; height: 26px; }
.up-ico svg { width: 22px; height: 22px; }
.success-mark svg { width: 38px; height: 38px; }
.menu-toggle svg { width: 20px; height: 20px; }
.search-mini svg, .icon-btn svg, .stat .ico svg, .n-ico svg { width: 18px; height: 18px; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c8cdd3; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #aeb5bd; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 600;
}
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- App shell (sidebar layout) ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
}

/* Mobile menu overlay — hidden on desktop so it never occupies a grid cell. */
.scrim { display: none; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--red);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  box-shadow: 0 6px 16px var(--red-soft);
}
.brand .brand-name { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.brand .brand-sub { font-size: 10.5px; color: var(--muted-2); letter-spacing: 0.18em; text-transform: uppercase; }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--muted-2); padding: 14px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s; cursor: pointer;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--red); color: #fff; }
.nav-item.active:hover { background: var(--red-hover); }
.nav-item .badge { margin-left: auto; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 8px;
  border-radius: var(--radius-sm);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--surface-3); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--text);
  border: 1px solid var(--border-2);
}

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; width: 100%; min-width: 0; max-width: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  width: 100%; min-width: 0;
  padding: 16px 30px;
  background: rgba(255,255,255,0.84);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 18px; font-weight: 600; }
.topbar .crumb { font-size: 12px; color: var(--muted-2); }
.topbar .spacer { flex: 1; }
.menu-toggle {
  display: none; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
}
.search-mini {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 13px; border-radius: 10px; color: var(--muted); font-size: 13px;
  min-width: 220px;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
  position: relative;
}
.icon-btn:hover { border-color: var(--border-2); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

.content { padding: 30px; max-width: 1180px; width: 100%; flex: 1 0 auto; }
.content.narrow { max-width: 880px; }
.app-footer {
  width: 100%;
  padding: 18px 30px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  max-width: 1180px;
}
.app-footer nav { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.app-footer a { color: inherit; }
.app-footer a:hover { color: var(--text); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card.pad-lg { padding: 28px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.card-head h3 { font-size: 16px; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-sm { gap: 8px; }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 10px; }
.mb { margin-bottom: 18px; }
.flex1 { flex: 1; }

/* ---------- Stat cards ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: -0.02em; }
.stat .trend { font-size: 12px; margin-top: 6px; color: var(--muted-2); }
.stat .trend.up { color: var(--green); }
.stat .trend.down { color: var(--red-hover); }
.stat .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-dark { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-dark:hover { border-color: var(--border-2); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 26px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.red { background: var(--red-soft); color: #b80500; border-color: transparent; }
.badge.green { background: rgba(29,185,84,.12); color: #116f37; border-color: transparent; }
.badge.amber { background: rgba(224,168,0,.14); color: #7a4f00; border-color: transparent; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; outline: none;
  transition: border .15s, box-shadow .15s; font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.textarea { resize: vertical; min-height: 110px; }
.field-row { display: flex; gap: 14px; }
.field-row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted-2); margin-top: 6px; }

.check { display: flex; align-items: flex-start; gap: 11px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--red); width: 16px; height: 16px; }

/* Upload */
.upload {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--muted);
  background: var(--surface-2); transition: border .15s, background .15s; cursor: pointer;
}
.upload:hover { border-color: var(--red); background: #fff4f3; }
.upload .up-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 12px; color: var(--red); }
.upload.done { border-color: var(--green); border-style: solid; color: var(--text); }
.upload.done .up-ico { color: var(--green); }

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; padding: 14px 16px; color: var(--muted-2);
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  background: var(--bg-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }
td .sub { color: var(--muted-2); font-size: 12px; }

/* Operational tables use the available desktop card width; mobile keeps the contained scroll fallback below. */
@media (min-width: 721px) {
  table.table-fit { min-width: 0; max-width: 100%; table-layout: fixed; }
  table.table-fit th, table.table-fit td { width: 1%; min-width: 0; padding: 10px; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
  table.table-fit .input, table.table-fit .select, table.table-fit .textarea { min-width: 0; max-width: 100%; }
  table.table-fit .field-row, table.table-fit .field-row > * { min-width: 0; }
  table.table-fit .row { gap: 8px; }
  table.table-fit .check { align-items: flex-start; white-space: normal; }
  table.table-fit .tiny { white-space: normal; overflow-wrap: anywhere; }
  table.table-fit .btn-sm { padding: 7px 10px; }
  table.table-fit .btn { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  table.table-fit .table-actions { display: grid; min-width: 0; gap: 8px; }
  table.table-fit .table-actions form { width: 100%; min-width: 0; }
  table.table-fit .table-actions .btn { width: 100%; }
  table.table-fit-dense .field-row { flex-direction: column; gap: 8px; }
  table.table-fit-dense .textarea { min-height: 78px; }
}

/* Responsive table adjustments */
@media (max-width: 720px) {
  .card.pad-lg { padding: 15px; }
  thead th, tbody td { font-size: 13px; padding: 10px 12px; white-space: nowrap; }
  .table-wrap table { min-width: 680px; font-size: 13px; }
  .table-wrap table.mobile-key-value { min-width: 0; table-layout: fixed; }
  table.mobile-key-value td { width: 58%; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
  table.mobile-key-value td:first-child { width: 42%; }
}

/* Full-width admin record tables with compact summary rows and expandable details. */
.admin-record-card { overflow: hidden; }
.admin-record-table-wrap { border: 0; border-radius: 0; overflow-x: hidden; }
table.admin-record-table { min-width: 0; table-layout: fixed; }
table.table-fit.admin-record-table th {
  width: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.admin-record-table th:last-child { width: 222px; }
table.admin-record-table .admin-record-cell { padding: 0; white-space: normal; }
.admin-record-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}
.admin-record-accordion { min-width: 0; }
.admin-record-summary {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(0, 1fr));
  gap: 16px;
  min-height: 62px;
  align-items: center;
  padding: 12px 34px 12px 16px;
  cursor: pointer;
  list-style: none;
}
.admin-record-summary::-webkit-details-marker { display: none; }
.admin-record-summary::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted-2);
  border-bottom: 2px solid var(--muted-2);
  transform: translateY(-65%) rotate(45deg);
  transition: transform .16s ease;
}
.admin-record-accordion[open] .admin-record-summary::after {
  transform: translateY(-25%) rotate(225deg);
}
.admin-record-summary > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.admin-record-summary strong,
.admin-record-summary small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-record-summary strong { font-size: 13px; }
.admin-record-summary small { color: var(--muted-2); font-size: 11.5px; }
.admin-record-detail {
  padding: 18px 16px 20px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.admin-record-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.admin-record-detail-grid section { min-width: 0; }
.admin-record-detail-grid h3 { margin-bottom: 12px; font-size: 14px; }
.admin-record-field-stack { display: grid; gap: 10px; }
.admin-record-status-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-record-status-list > span { min-width: 0; }
.admin-accordion-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  min-height: 62px;
  padding: 12px 16px 12px 8px;
}
.admin-accordion-actions form { display: contents; }
.admin-action-icon {
  width: 30px;
  height: 30px;
  min-width: 30px !important;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  white-space: nowrap;
}
.admin-action-icon svg { width: 16px; height: 16px; }

@media (max-width: 1100px) {
  table.admin-record-table th:last-child { width: 192px; }
  .admin-record-summary { gap: 10px; }
  .admin-accordion-actions { gap: 4px; padding-left: 4px; padding-right: 10px; }
  .admin-action-icon { width: 28px; height: 28px; min-width: 28px !important; }
}

@media (max-width: 720px) {
  .admin-record-table-wrap table.admin-record-table { min-width: 0; }
  .admin-record-table thead { display: none; }
  .admin-record-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-record-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 15px 38px 12px 14px;
  }
  .admin-record-summary strong,
  .admin-record-summary small { white-space: normal; overflow-wrap: anywhere; }
  .admin-record-detail { padding: 16px 14px; }
  .admin-record-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-accordion-actions {
    justify-content: flex-start;
    min-height: 0;
    padding: 0 14px 14px;
  }
}

/* ---------- Steps / progress ---------- */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 11px; flex: 1; }
.step .num {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.step .st-label { font-size: 12.5px; color: var(--muted); }
.step .line { flex: 1; height: 1.5px; background: var(--border); margin: 0 12px; }
.step.done .num { background: var(--red); border-color: var(--red); color: #fff; }
.step.active .num { border-color: var(--red); color: #fff; box-shadow: 0 0 0 4px var(--red-soft); }
.step.active .st-label { color: var(--text); font-weight: 600; }
.step.done .st-label { color: var(--text); }

/* ---------- Auth / centered flow ---------- */
.flow-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.flow-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 30px; border-bottom: 1px solid var(--border);
}
.flow-body { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.flow-card { width: 100%; max-width: 460px; }
.flow-card.wide { max-width: 720px; }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-aside {
  background:
    linear-gradient(180deg, rgba(255,255,255,.68), rgba(255,255,255,.94)),
    url("https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1200&q=80") center/cover;
  padding: 50px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside .quote { font-size: 24px; font-weight: 600; line-height: 1.35; max-width: 420px; }
.auth-form { display: grid; place-items: center; padding: 40px; }

/* ---------- Calendar ---------- */
.calendar { }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .08em; padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: start;
  gap: 5px; font-size: 14px; cursor: pointer; position: relative; transition: border .12s, background .12s;
}
.cal-cell:hover { border-color: var(--border-2); }
.cal-cell.muted-day { color: var(--muted-2); background: transparent; cursor: default; }
.cal-cell.work { }
.cal-cell.holiday::after { content: "Feiertag"; font-size: 9px; color: var(--amber); position: absolute; bottom: 2px; }
.cal-cell .pip { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.cal-cell.disabled { opacity: .35; cursor: not-allowed; }
.cal-cell.selected { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
.cal-cell.booked { border-color: var(--green); }
.cal-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------- Vehicle / list cards ---------- */
.veh-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.veh-card .ph { aspect-ratio: 16/10; background: var(--surface-2) center/cover; position: relative; }
.veh-card .plate { position: absolute; top: 12px; left: 12px; }
.veh-card .vc-body { padding: 16px; }

/* ---------- Photo grid (handover) ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.photo-slot {
  aspect-ratio: 4/3; border: 1.5px dashed var(--border-2); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: var(--muted-2); font-size: 11.5px; text-align: center; background: var(--surface-2); cursor: pointer; padding: 8px;
}
.photo-slot:hover { border-color: var(--red); color: var(--text); }
.photo-slot.filled { border-style: solid; border-color: var(--green); color: var(--text); background-size: cover; background-position: center; }
.photo-slot.filled span { background: rgba(255,255,255,.82); padding: 2px 6px; border-radius: 5px; }

/* signature */
.signpad {
  height: 130px; border: 1.5px dashed var(--border-2); border-radius: 12px;
  background: var(--surface-2); display: grid; place-items: center; color: var(--muted-2);
  font-style: italic; position: relative;
}

/* ---------- Hub (landing) ---------- */
.hub { min-height: 100vh; display: flex; flex-direction: column; }
.hub-hero { padding: 70px 24px 30px; text-align: center; }
.hub-hero h1 { font-size: 44px; letter-spacing: -0.02em; }
.hub-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 1080px; margin: 0 auto; padding: 10px 24px 40px; width: 100%; }
.hub-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; transition: border .18s, transform .18s, background .18s; cursor: pointer;
  display: flex; flex-direction: column; gap: 14px; min-height: 250px;
}
.hub-card:hover { border-color: var(--red); transform: translateY(-4px); }
.hub-card .hc-ico { width: 54px; height: 54px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--red); }
.hub-card .arrow { margin-top: auto; color: var(--red); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.hub-sub { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; max-width: 1080px; margin: 0 auto 60px; padding: 0 24px; width: 100%; }

.divider { height: 1px; background: var(--border); margin: 22px 0; border: none; }

/* description list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 12px 26px; font-size: 14px; }
.dl dt { color: var(--muted-2); }
.dl dd { margin: 0; color: var(--text); }

/* timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-2); }
.tl-item.done::before { background: var(--red); border-color: var(--red); }
.tl-item .tl-title { font-size: 14px; font-weight: 600; }
.tl-item .tl-meta { font-size: 12.5px; color: var(--muted-2); margin-top: 3px; }

/* notice */
.notice { display: flex; gap: 13px; padding: 15px 17px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.notice .n-ico { color: var(--red); flex: none; }
.notice > :last-child { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.notice.success { background: rgba(29,185,84,.08); border-color: rgba(29,185,84,.3); }
.notice.success .n-ico { color: var(--green); }

/* progress bar */
.pbar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--red); border-radius: 999px; }

/* success big */
.success-mark { width: 84px; height: 84px; border-radius: 50%; background: rgba(29,185,84,.12); display: grid; place-items: center; margin: 0 auto 22px; color: var(--green); }

/* style guide swatches */
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
.sw { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.sw .chip { height: 76px; }
.sw .meta { padding: 11px 13px; font-size: 12px; }
.sw .meta b { display: block; font-size: 13px; margin-bottom: 2px; }
.type-row { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.type-row:last-child { border-bottom: none; }

/* device toggle (prototype frame) */
.proto-bar {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 6px; padding: 7px;
  background: rgba(255,255,255,.92); border: 1px solid var(--border-2); border-radius: 14px;
  backdrop-filter: blur(10px); box-shadow: var(--shadow);
}
.proto-bar a, .proto-bar button { padding: 8px 14px; border-radius: 9px; font-size: 12.5px; color: var(--muted); background: transparent; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.proto-bar a:hover, .proto-bar button:hover { background: var(--surface-3); color: var(--text); }
.proto-bar .sep { width: 1px; height: 20px; background: var(--border-2); }

/* phone frame for mobile preview pages */
body.mobile-frame { background: #eef1f4; display: grid; place-items: center; padding: 24px; }
body.mobile-frame .app { width: 390px; max-width: 100%; grid-template-columns: 1fr; min-height: 800px; height: 844px; border-radius: 40px; border: 1px solid var(--border-2); overflow: hidden; box-shadow: var(--shadow); }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; place-items: center; }
  .scrim { position: fixed; inset: 0; background: rgba(17,24,39,.28); z-index: 55; display: none; }
  .scrim.show { display: block; }
  .search-mini { display: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hub-grid { grid-template-columns: 1fr; }
  .hub-sub { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 620px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app, .main, .content, .topbar, .card, .notice, .flow-wrap, .flow-body, .auth-form { min-width: 0; max-width: 100%; }
  .content { padding: 20px 16px; overflow-x: hidden; }
  .topbar { padding: 14px 16px; gap: 10px; }
  .app-footer { padding: 16px; }
  .app-footer-inner { align-items: flex-start; flex-direction: column; gap: 10px; }
  .topbar > :not(.spacer), .topbar .page-title { min-width: 0; }
  .topbar .page-title { overflow-wrap: anywhere; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .field-row { flex-direction: column; gap: 0; }
  .card-head { align-items: flex-start; flex-wrap: wrap; }
  .card-head > *, .row > *, .field, .notice > :last-child { min-width: 0; max-width: 100%; }
  .notice > :last-child, .card-head h3, .dl dd { overflow-wrap: anywhere; }
  .btn, .badge, .tag { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }
  .input, .select, .textarea { min-width: 0; max-width: 100%; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .table-wrap { overscroll-behavior-x: contain; }
  .steps { overflow-x: auto; }
  .step .st-label { display: none; }
  .hub-hero h1 { font-size: 32px; }
  h1 { font-size: 24px; }
}

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 13px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 13.5px; min-width: 250px; max-width: 360px;
  transform: translateY(14px); opacity: 0; transition: transform .25s, opacity .25s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast .t-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(29,185,84,.14); color: var(--green); flex: none; }
.toast.error .t-ico { background: var(--red-soft); color: #ff6b66; }
.toast.info .t-ico { background: var(--surface-3); color: var(--text); }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(17,24,39,.35); backdrop-filter: blur(4px);
  z-index: 150; display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .2s;
}
.modal-back.show { opacity: 1; }
.modal {
  width: 100%; max-width: 480px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); max-height: 90vh; overflow: auto;
  transform: translateY(10px) scale(.985); transition: transform .2s;
}
.modal-back.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-x { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.modal-x:hover { border-color: var(--border-2); }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-success { text-align: center; padding: 8px 6px 4px; }

/* Newly added / edited row flash */
.row-added { animation: rowflash 1.4s ease; }
@keyframes rowflash { 0% { background: var(--red-soft); } 100% { background: transparent; } }

@media (max-width: 620px) {
  .toast-host { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
}
