:root {
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand-50: #fbf6e8;
  --brand-100: #f4e8c5;
  --brand-200: #ead48e;
  --brand-300: #dfbf5c;
  --brand-400: #d9ad35;
  --brand-500: #d6a21e;
  --brand-600: #b98512;
  --brand-700: #8d620e;
  --brand-800: #61430c;
  --brand-900: #382607;
  --success: #13b86a;
  --success-soft: #def8eb;
  --danger: #f0445e;
  --danger-soft: #ffe4e9;
  --warning: #ff9f1c;
  --warning-soft: #fff0db;
  --info: #16b8c5;
  --info-soft: #dcf8fb;
  --violet: #7c4dff;
  --violet-soft: #ede7ff;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .035);
  --shadow-sm: 0 8px 20px rgba(15, 23, 42, .045);
  --shadow-md: 0 16px 38px rgba(15, 23, 42, .08);
  --sidebar-width: 252px;
}

:root,
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --text: #111827;
  --muted: #5d6b82;
  --subtle: #8a96aa;
  --border: #e5e9f1;
  --border-strong: #d3dae7;
  --nav-active: #fbf4df;
  --brand-rgb: 214, 162, 30;
  --chart-grid: rgba(93, 107, 130, .16);
}

[data-theme="dark"] {
  --bg: #0f141d;
  --bg-elevated: #121a26;
  --surface: #162031;
  --surface-2: #1a2638;
  --surface-3: #253348;
  --text: #f1f6ff;
  --muted: #b7c4d8;
  --subtle: #8998af;
  --border: #2b3a50;
  --border-strong: #3a4c66;
  --nav-active: rgba(224, 184, 85, .17);
  --success-soft: rgba(19, 184, 106, .16);
  --danger-soft: rgba(240, 68, 94, .17);
  --warning-soft: rgba(255, 159, 28, .18);
  --info-soft: rgba(22, 184, 197, .16);
  --violet-soft: rgba(124, 77, 255, .18);
  --brand-rgb: 224, 184, 85;
  --chart-grid: rgba(174, 185, 205, .16);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-sm: 0 16px 38px rgba(0, 0, 0, .24);
  --shadow-md: 0 26px 62px rgba(0, 0, 0, .38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 84% -10%, rgba(var(--brand-rgb), .10), transparent 31rem),
    radial-gradient(circle at 6% 5%, rgba(75, 105, 155, .08), transparent 28rem),
    linear-gradient(180deg, var(--bg), var(--bg));
  font-size: 13px;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
}

a { color: var(--brand-600); text-decoration: none; }

[data-theme="dark"] a { color: var(--brand-300); }

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

.tms-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.tms-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: flex;
  align-items: center;
  height: 38px;
  margin-bottom: 16px;
  padding: 0 5px;
}

.brand-logo {
  max-width: 176px;
  width: 100%;
  height: 32px;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-dark,
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

.sidebar-account,
.sidebar-upgrade {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-xs);
}

.sidebar-account strong,
.sidebar-upgrade strong { display: block; font-size: 12px; font-weight: 700; }

.sidebar-account span,
.sidebar-upgrade span { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(19, 184, 106, .12);
}

.sidebar-nav { margin-top: 18px; }

.nav-label {
  margin: 18px 10px 7px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sidebar-nav .nav-link,
.demo-sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--text);
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.sidebar-nav .nav-link i,
.demo-sidebar a i {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link:hover,
.demo-sidebar a.active {
  background: var(--nav-active);
  color: var(--brand-700);
  border-color: rgba(var(--brand-rgb), .22);
  box-shadow: inset 2px 0 0 rgba(var(--brand-rgb), .72);
}

[data-theme="dark"] .sidebar-nav .nav-link.active,
[data-theme="dark"] .sidebar-nav .nav-link:hover,
[data-theme="dark"] .demo-sidebar a.active { color: var(--brand-200); }

.sidebar-upgrade {
  margin-top: 20px;
  align-items: flex-start;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(var(--brand-rgb), .17), transparent 62%),
    var(--surface);
  border-color: rgba(var(--brand-rgb), .22);
}

.sidebar-upgrade-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--brand-700) !important;
  background: var(--brand-100);
}
.sidebar-upgrade i { font-size: 15px; }
.sidebar-upgrade span { color: var(--muted); }

.tms-main {
  min-width: 0;
  padding: 14px 18px 22px;
}

.tms-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2px 8px 12px;
  background: linear-gradient(180deg, var(--bg) 78%, color-mix(in srgb, var(--bg) 20%, transparent));
  backdrop-filter: blur(18px);
}

.tms-topbar h1 {
  margin: 0;
  font-size: clamp(16px, 1.7vw, 21px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

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

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(310px, 28vw);
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-xs);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.search-field:focus-within {
  border-color: rgba(var(--brand-rgb), .42);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .10);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.icon-btn,
.theme-switcher,
.btn {
  min-height: 32px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0;
}

.icon-btn {
  width: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.theme-switcher:hover,
.profile-menu:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--brand-rgb), .35);
}

.theme-moon,
[data-theme="dark"] .theme-sun { display: none; }
[data-theme="dark"] .theme-moon { display: inline; color: var(--brand-300); }
.theme-sun { color: var(--brand-600); }

.notification-dot {
  position: absolute;
  top: -6px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
}

.notification-dot.is-muted { background: var(--brand-600); color: #fff8e7; }

.profile-menu {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 2px 8px 2px 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.profile-copy {
  display: grid;
  text-align: left;
  line-height: 1.15;
}

.profile-copy strong { font-size: 11px; font-weight: 650; }
.profile-copy small { color: var(--muted); font-size: 10px; }

.system-section {
  max-width: 1440px;
  margin: 0 auto 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-2) 42%, var(--surface))),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-system {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(480px, 1.22fr);
  gap: 20px;
  align-items: center;
  min-height: 330px;
  overflow: hidden;
  position: relative;
}

.hero-system::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(var(--brand-rgb), .045), transparent 22rem),
    linear-gradient(90deg, transparent, rgba(148, 163, 184, .035));
  pointer-events: none;
}

.eyebrow {
  color: var(--brand-700);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

[data-theme="dark"] .eyebrow { color: var(--brand-300); }

.hero-copy h2,
.section-heading h2 {
  margin: 8px 0 6px;
  font-size: clamp(19px, 2.2vw, 26px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: clamp(16px, 1.7vw, 21px);
  font-weight: 680;
}

.hero-copy p,
.section-heading p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
  margin-bottom: 0;
}

.hero-actions,
.component-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.hero-copy,
.preview-dashboard { position: relative; z-index: 1; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.hero-stats span {
  min-width: 92px;
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  color: var(--muted);
  box-shadow: var(--shadow-xs);
  font-size: 10px;
  font-weight: 600;
}

.hero-stats strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

.btn-brand {
  background: linear-gradient(180deg, #ddb044, var(--brand-600));
  color: #1d1607;
  border: 0;
  box-shadow: 0 8px 16px rgba(var(--brand-rgb), .16), inset 0 1px 0 rgba(255,255,255,.3);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.btn-brand:hover {
  color: #1d1607;
  transform: translateY(-1px);
  filter: saturate(1.02) brightness(1.02);
  box-shadow: 0 10px 22px rgba(var(--brand-rgb), .2), inset 0 1px 0 rgba(255,255,255,.34);
}

.btn-outline-brand {
  border: 1px solid var(--brand-500);
  color: var(--brand-700);
  background: transparent;
}

[data-theme="dark"] .btn-outline-brand { color: var(--brand-200); }

.btn-soft,
.btn-control {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.btn-soft:hover,
.btn-control:hover,
.btn-outline-brand:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--brand-rgb), .34);
  background: var(--surface);
}

.pill,
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
}

.pill-brand { color: var(--brand-800); background: var(--brand-100); }
[data-theme="dark"] .pill-brand { color: var(--brand-100); background: rgba(var(--brand-rgb), .16); }

.badge-soft.success { background: var(--success-soft); color: #087844; }
.badge-soft.warning { background: var(--warning-soft); color: #b05b00; }
.badge-soft.danger { background: var(--danger-soft); color: #bd1730; }
.badge-soft.neutral { background: var(--surface-3); color: var(--muted); }

[data-theme="dark"] .badge-soft.success { background: rgba(19, 184, 106, .16); color: #66e4a5; }
[data-theme="dark"] .badge-soft.warning { background: rgba(255, 159, 28, .17); color: #ffc26b; }
[data-theme="dark"] .badge-soft.danger { background: rgba(240, 68, 94, .17); color: #ff8899; }
[data-theme="dark"] .badge-soft.neutral { background: rgba(148, 163, 184, .14); color: #c8d3e5; }

.preview-dashboard,
.card-panel,
.chart-card,
.metric-card,
.role-card,
.component-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.preview-dashboard {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  padding: 7px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.42)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .preview-dashboard {
  background: linear-gradient(180deg, rgba(18, 25, 37, .95), rgba(15, 21, 32, .96));
}

.preview-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px 0 0 10px;
}

.rail-dot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.rail-dot.active {
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  border-color: rgba(var(--brand-rgb), .35);
  box-shadow: 0 7px 16px rgba(var(--brand-rgb), .16);
}

.preview-workspace { padding: 12px; min-width: 0; }

.preview-header,
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.preview-header span,
.metric-card small,
.type-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.preview-header strong { font-size: 14px; }

.preview-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(190px, 32%);
  height: 29px;
  padding: 0 9px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.preview-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
}

.metric-grid,
.dashboard-grid,
.token-grid,
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.preview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.token-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.role-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric-card {
  padding: 11px;
  display: grid;
  gap: 7px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.metric-card:hover,
.chart-card:hover,
.role-card:hover,
.component-block:hover,
.token-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--border-strong) 82%, var(--brand-500));
  box-shadow: var(--shadow-xs);
}

.metric-card strong {
  font-size: 18px;
  line-height: 1;
}

.metric-icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  font-size: 17px;
}

.metric-icon.brand { color: var(--brand-700); background: var(--brand-100); }
.metric-icon.green { color: var(--success); background: var(--success-soft); }
.metric-icon.orange { color: var(--warning); background: var(--warning-soft); }
.metric-icon.red { color: var(--danger); background: var(--danger-soft); }

[data-theme="dark"] .metric-icon.brand { color: var(--brand-200); background: rgba(var(--brand-rgb), .17); }
[data-theme="dark"] .metric-icon.green { background: rgba(19, 184, 106, .17); }
[data-theme="dark"] .metric-icon.orange { background: rgba(255, 159, 28, .17); }
[data-theme="dark"] .metric-icon.red { background: rgba(240, 68, 94, .17); }

.trend { font-size: 11px; font-weight: 600; color: var(--muted); }
.trend.up, .trend.live { color: var(--success); }
.trend.down { color: var(--danger); }

.chart-card {
  padding: 12px;
  min-height: 154px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.card-title-row h3,
.component-block h3,
.role-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.preview-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(190px, .8fr);
  gap: 9px;
  margin-top: 9px;
}

.schedule-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 11px;
  box-shadow: var(--shadow-xs);
}

.schedule-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.schedule-row:first-of-type { border-top: 0; }
.schedule-row strong { display: block; font-size: 12px; font-weight: 650; }
.schedule-row small { color: var(--muted); font-size: 11px; }

.time-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.time-dot.green { background: var(--success); }
.time-dot.amber { background: var(--brand-500); }
.time-dot.violet { background: var(--violet); }

.line-chart {
  position: relative;
  height: 116px;
  border-bottom: 1px solid var(--chart-grid);
  background: repeating-linear-gradient(to top, var(--chart-grid) 0 1px, transparent 1px 30px);
  overflow: hidden;
}

.line-chart::before {
  content: "";
  position: absolute;
  inset: 24px 10px 20px;
  background: linear-gradient(180deg, rgba(var(--brand-rgb), .20), rgba(var(--brand-rgb), .02));
  clip-path: polygon(0 72%, 18% 45%, 36% 58%, 55% 30%, 76% 42%, 100% 16%, 100% 100%, 0 100%);
}

.line-chart::after {
  content: "";
  position: absolute;
  inset: 24px 10px 20px;
  background: var(--brand-600);
  clip-path: polygon(0 70%, 18% 43%, 36% 56%, 55% 28%, 76% 40%, 100% 14%, 100% 17%, 76% 43%, 55% 31%, 36% 59%, 18% 46%, 0 73%);
}

.line-chart span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 7px;
  height: 7px;
  border: 2px solid var(--brand-600);
  border-radius: 50%;
  background: var(--surface);
  z-index: 2;
}

.bar-chart {
  height: 138px;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px 6px 0;
  background: repeating-linear-gradient(to top, var(--chart-grid) 0 1px, transparent 1px 32px);
}

.bar-chart span {
  flex: 1;
  min-width: 12px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--brand-300), var(--brand-600));
}

.donut-wrap {
  min-height: 135px;
  display: grid;
  place-items: center;
  position: relative;
}

.donut {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 58%, var(--brand-500) 58% 75%, var(--danger) 75% 86%, var(--violet) 86% 100%);
  mask: radial-gradient(circle, transparent 0 39px, #000 40px);
}

.donut-wrap strong {
  position: absolute;
  display: grid;
  text-align: center;
  font-size: 20px;
}

.donut-wrap small { color: var(--muted); font-size: 11px; }

.token-card {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: grid;
  gap: 8px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.token-card code {
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 5px;
  font-size: 11px;
}

.swatch {
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.swatch.brand-500 { background: var(--brand-500); }
.swatch.brand-600 { background: var(--brand-600); }
.swatch.ink-900 { background: #10162f; }
.swatch.surface { background: var(--surface); }
.swatch.success { background: var(--success); }
.swatch.danger { background: var(--danger); }
.swatch.info { background: var(--info); }
.swatch.violet { background: var(--violet); }

.type-spec {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
  padding: 16px;
}

.display-sample { font-size: clamp(22px, 3vw, 30px); line-height: 1.12; font-weight: 750; }
.type-spec p { color: var(--muted); margin: 0; }

.layout-demo {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 236px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.demo-sidebar { padding: 14px; border-right: 1px solid var(--border); background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.demo-sidebar img { width: 138px; height: 28px; object-fit: contain; object-position: left; margin-bottom: 14px; }
.demo-workspace { padding: 14px; }
.demo-topbar { display: flex; align-items: center; gap: 9px; justify-content: flex-end; margin-bottom: 12px; }
.demo-content-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.demo-content-grid span {
  height: 112px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, transparent 45%, rgba(var(--brand-rgb), .07)),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.component-block {
  padding: 13px;
  margin-top: 10px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

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

.form-field { display: grid; gap: 6px; }
.form-field span { font-weight: 650; font-size: 12px; }
.form-field b { color: var(--danger); }

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .14);
}

.span-2 { grid-column: span 2; }

.upload-zone {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-2);
}

.upload-zone small { display: block; color: var(--muted); margin-top: 3px; }

.chart-layout {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 10px;
  margin-top: 10px;
}

.tms-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  color: var(--text);
}

.tms-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  padding: 10px 12px;
  background: var(--surface-2);
}

.tms-table td {
  padding: 11px 12px;
  font-weight: 550;
  vertical-align: middle;
}

.tms-table tbody tr {
  transition: background .18s ease;
}

.tms-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-50) 58%, transparent);
}

.role-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.role-card i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--brand-700);
  background: var(--brand-100);
  font-size: 17px;
}

[data-theme="dark"] .role-card i { color: var(--brand-200); background: rgba(var(--brand-rgb), .16); }

.role-card p { color: var(--muted); margin: 0; line-height: 1.5; font-size: 12px; }
.role-card span { color: var(--brand-700); font-size: 11px; font-weight: 700; }
[data-theme="dark"] .role-card span { color: var(--brand-300); }

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

.responsive-rules article {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.responsive-rules span { display: block; color: var(--muted); margin-top: 6px; line-height: 1.5; font-size: 12px; }

.avatar,
.avatar-gold {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  font-weight: 750;
  font-size: 12px;
  flex: 0 0 auto;
}

.tms-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tms-modal .modal-header,
.tms-modal .modal-footer { border-color: var(--border); }
.tms-modal .modal-title { font-weight: 800; }
.tms-modal .modal-header p { margin: 4px 0 0; color: var(--muted); }

[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%); }
[data-theme="dark"] .tms-table tbody tr:hover { background: rgba(var(--brand-rgb), .07); }
[data-theme="dark"] .sidebar-upgrade-icon { color: var(--brand-200) !important; background: rgba(var(--brand-rgb), .16); }

@media (max-width: 1199.98px) {
  .tms-shell { grid-template-columns: 1fr; }
  .tms-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-width));
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar-open .tms-sidebar { transform: translateX(0); }
  .hero-system,
  .layout-demo { grid-template-columns: 1fr; }
  .hero-system { min-height: auto; }
  .preview-dashboard { max-width: 880px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search-field { min-width: min(100%, 340px); }
  .token-grid,
  .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767.98px) {
  .tms-main { padding: 12px; }
  .tms-topbar { align-items: flex-start; flex-wrap: wrap; }
  .tms-topbar { padding-left: 0; padding-right: 0; }
  .topbar-actions { width: 100%; }
  .search-field { order: 3; width: 100%; min-width: 100%; }
  .system-section { padding: 14px; border-radius: var(--radius-md); }
  .metric-grid,
  .dashboard-grid,
  .token-grid,
  .role-grid,
  .form-grid,
  .chart-layout,
  .responsive-rules,
  .demo-content-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .hero-system { min-height: auto; }
  .preview-dashboard { grid-template-columns: 1fr; padding: 0; overflow: hidden; }
  .preview-rail { display: none; }
  .preview-workspace { padding: 14px; }
  .preview-header { align-items: flex-start; flex-wrap: wrap; }
  .preview-search { order: 3; width: 100%; }
  .preview-lower { grid-template-columns: 1fr; }
  .layout-demo { display: block; }
  .demo-sidebar { display: none; }
  .theme-switcher span { display: none; }
  .profile-copy,
  .profile-menu .bi-chevron-down { display: none; }
  .profile-menu { padding: 2px; min-height: 34px; }
  .type-spec { grid-template-columns: 1fr; }
}
