:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #fbfcfe;
  --ink: #101828;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-soft: #eef2ff;
  --green: #067647;
  --green-soft: #ecfdf3;
  --red: #b42318;
  --red-soft: #fef3f2;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --blue: #175cd3;
  --blue-soft: #eff8ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 248px;
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--brand);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(79, 70, 229, 0.14), transparent 36%),
    radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.12), transparent 38%),
    var(--bg);
}

.boot-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
}

.boot-text {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Auth ---------- */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(420px, 0.95fr);
  background:
    radial-gradient(circle at 12% 12%, rgba(129, 140, 248, 0.2), transparent 34%),
    radial-gradient(circle at 70% 80%, rgba(14, 165, 233, 0.12), transparent 36%),
    #f8fafc;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  padding: 64px clamp(32px, 6vw, 88px);
  color: #fff;
  background:
    linear-gradient(150deg, rgba(15, 23, 42, 0.94), rgba(49, 46, 129, 0.92)),
    radial-gradient(circle at 20% 10%, #6366f1, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.auth-brand::before {
  width: 520px;
  height: 520px;
  right: -220px;
  top: -160px;
}

.auth-brand::after {
  width: 340px;
  height: 340px;
  left: -140px;
  bottom: -150px;
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 48px;
}

.auth-logo-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  font-size: 20px;
  font-weight: 800;
}

.auth-logo-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-logo-sub {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-brand h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.auth-brand p {
  margin: 0;
  max-width: 450px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  line-height: 1.8;
}

.auth-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 36px;
}

.auth-feature {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}

.auth-feature strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.auth-feature span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(228, 231, 236, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.1);
  backdrop-filter: blur(18px);
}

.auth-card h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.auth-card .auth-sub {
  margin: 7px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: #f2f4f7;
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.auth-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-note {
  margin: 16px 0 0;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.7;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 12px;
}

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
}

/* ---------- Layout ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.3), transparent 32%),
    linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px 22px;
}

.sidebar-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.3);
  font-size: 17px;
  font-weight: 800;
}

.sidebar-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sidebar-sub {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.nav-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 2px;
  scrollbar-width: none;
}

.nav-scroll::-webkit-scrollbar {
  display: none;
}

.nav-group-label {
  padding: 18px 12px 7px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin: 2px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  text-align: left;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.2);
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 14px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.org-switch {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 12px;
}

.org-switch option {
  color: var(--ink);
  background: #fff;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 9px;
  border-radius: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-email {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  color: rgba(255, 255, 255, 0.38);
  font-size: 10px;
}

.logout-btn {
  border: 0;
  padding: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-size: 15px;
}

.main {
  width: calc(100% - var(--sidebar));
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(228, 231, 236, 0.8);
  background: rgba(245, 247, 251, 0.86);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-sub {
  color: var(--soft);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu {
  display: none;
}

.content {
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 30px 60px;
}

/* ---------- Headings / buttons ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.btn:hover {
  background: var(--panel-2);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 5px 14px rgba(79, 70, 229, 0.24);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #eef2f6;
  box-shadow: none;
}

.btn-danger {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}

.btn-sm {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--panel-2);
}

/* ---------- Cards / stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  top: -46px;
  right: -34px;
  border-radius: 50%;
  background: var(--stat-tint, #eef2ff);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-icon {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--stat-tint, #eef2ff);
  color: var(--stat-color, var(--brand));
  font-size: 16px;
}

.stat-value {
  position: relative;
  z-index: 1;
  font-size: 29px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-foot {
  margin-top: 10px;
  color: var(--soft);
  font-size: 11px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.panel-sub {
  margin: 3px 0 0;
  color: var(--soft);
  font-size: 11px;
}

.panel-body {
  padding: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfcfe;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .actions {
  text-align: right;
  white-space: nowrap;
}

.cell-main {
  font-weight: 650;
  color: var(--ink);
}

.cell-sub {
  margin-top: 2px;
  color: var(--soft);
  font-size: 10px;
}

.sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--muted);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-gray {
  background: #f2f4f7;
  color: var(--muted);
}

.badge-purple {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.filters .field {
  min-width: 150px;
}

.filters .field.grow {
  flex: 1;
  min-width: 220px;
}

.size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.size-option {
  position: relative;
}

.size-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.size-option span {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.size-option input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.hint {
  color: var(--soft);
  font-size: 10px;
  line-height: 1.6;
}

.stock-hint {
  padding: 9px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Chart ---------- */

.chart {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 150px;
  padding: 8px 4px 0;
}

.chart-col {
  flex: 1;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.chart-bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
}

.chart-bar {
  width: 42%;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
}

.chart-bar.out {
  background: linear-gradient(180deg, #fda29b, #f04438);
}

.chart-label {
  color: var(--soft);
  font-size: 9px;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 4px;
  color: var(--soft);
  font-size: 10px;
}

.chart-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 2px;
  background: var(--brand);
}

.chart-legend .out {
  background: #f04438;
}

/* ---------- Product matrix ---------- */

.matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.matrix th,
.matrix td {
  padding: 8px 9px;
  border-right: 1px solid #eef0f3;
  border-bottom: 1px solid #eef0f3;
  text-align: center;
  white-space: nowrap;
}

.matrix th {
  background: #fafbfc;
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
}

.matrix th:first-child,
.matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  text-align: left;
}

.matrix th:first-child {
  background: #fafbfc;
}

.matrix td strong {
  display: block;
  font-size: 12px;
}

.matrix td small {
  color: var(--soft);
  font-size: 9px;
}

.matrix-empty {
  color: #d0d5dd;
}

/* ---------- Modal ---------- */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.16s ease;
}

.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.modal.wide {
  width: min(980px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--soft);
  font-size: 11px;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 17px;
}

.modal-body {
  overflow: auto;
  padding: 20px 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

/* ---------- Toast / empty ---------- */

#toast-root {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 12px;
  animation: toastIn 0.2s ease;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

.toast.info {
  border-left: 3px solid var(--brand);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.empty-state {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: #f2f4f7;
  color: var(--soft);
  font-size: 20px;
}

.empty-state h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 11px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.divider {
  height: 1px;
  margin: 16px 0;
  background: var(--line);
}

.muted {
  color: var(--muted);
}

.soft {
  color: var(--soft);
}

.nowrap {
  white-space: nowrap;
}

.right {
  text-align: right;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Onboarding ---------- */

.onboard-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 10%, rgba(99, 102, 241, 0.14), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(14, 165, 233, 0.1), transparent 36%),
    var(--bg);
}

.onboard-card {
  width: min(900px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.onboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.onboard-head .auth-logo {
  margin: 0;
}

.onboard-head .auth-logo-name {
  color: var(--ink);
}

.onboard-head .auth-logo-sub {
  color: var(--soft);
}

.onboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.onboard-option {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}

.onboard-option h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.onboard-option p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.invite-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  background: var(--brand-soft);
}

.invite-code strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--brand-dark);
}

/* ---------- Responsive ---------- */

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

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar: 232px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu {
    display: inline-grid;
  }

  .content {
    padding: 20px 18px 50px;
  }

  .topbar {
    padding: 0 18px;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    display: none;
  }

  .auth-panel {
    min-height: 100vh;
  }
}

@media (max-width: 700px) {
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 24px;
  }

  .form-grid,
  .form-grid-3,
  .onboard-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: 94vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .auth-card {
    padding: 26px 22px;
  }

  .topbar-sub {
    display: none;
  }
}
