/* ============================================================
   SmartCut — Colorful light professional dashboard
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #f9fafb;
  --bg-elev: #ffffff;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --ink: #111827;
  --ink-soft: #4b5563;
  --muted: #9ca3af;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-soft: #eef2ff;
  --accent: #4338ca;
  --coral: #ef4444;
  --coral-soft: #fee2e2;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --violet: #8b5cf6;
  --violet-soft: #f5f3ff;
  --lime: #10b981;
  --lime-soft: #d1fae5;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --premium: #1f2937;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sidebar-bg: #111827;
  --sidebar-ink: #f9fafb;
  --sidebar-ink-soft: #9ca3af;
  --sidebar-line: #1f2937;
  --sidebar-accent: #6366f1;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

button, input, select, textarea { font: inherit; }
a { color: var(--accent); }

/* ── Global Layout ── */
.app-frame {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.app-sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  position: relative;
  box-shadow: 10px 0 30px rgba(0,0,0,0.1);
  z-index: 50;
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.sidebar-brand {
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand .logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  border-radius: 9px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}
.sidebar-brand div { display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 1.15rem; letter-spacing: 0.02em; background: linear-gradient(90deg, #fff, #bae6fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar-brand span { font-size: 0.62rem; text-transform: uppercase; opacity: 0.7; letter-spacing: 0.1em; margin-top: 2px; }

.sidebar-scroll { flex: 1; padding: 8px 0; }

.sidebar-group { margin-bottom: 20px; }
.sidebar-group-title {
  padding: 0 24px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-ink-soft);
  opacity: 0.8;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  color: var(--sidebar-ink-soft);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.15), transparent);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--sidebar-accent);
}
.nav-item .icon { font-size: 1.15rem; width: 22px; text-align: center; opacity: 0.7; transition: opacity 0.2s; }
.nav-item:hover .icon, .nav-item.active .icon { opacity: 1; }
.nav-item .chevron { margin-left: auto; font-size: 0.7rem; opacity: 0.3; }

.sidebar-footer {
  padding: 20px 24px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid var(--sidebar-line);
}

/* ── Content Area ── */
.app-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

.viewport-header {
  height: 68px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.viewport-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.viewport-header .breadcrumb span:last-child {
  color: var(--ink);
  font-weight: 700;
}
.viewport-header .breadcrumb i {
  font-style: normal;
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.6;
}

.options-strip {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  z-index: 90;
}
.opt-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.opt-item label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; }
.opt-item input[type="number"], .opt-item select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  width: 70px;
}
.opt-item select { width: auto; min-width: 120px; }

/* Switch Toggle Style */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 20px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--sidebar-accent); }
input:checked + .slider:before { transform: translateX(16px); }

.viewport-header .meta { margin-left: auto; display: flex; align-items: center; gap: 20px; }

.app-viewport-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.app-main {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
  min-width: 0;
  background: 
    radial-gradient(600px 400px at 100% 0%, rgba(14, 165, 233, 0.05), transparent),
    radial-gradient(600px 400px at 0% 100%, rgba(99, 102, 241, 0.05), transparent);
}

/* ── Cards / page chrome ── */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.page-head h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #0a4d68, #0891b2 40%, #e11d48);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #0891b2, #38bdf8, #fb7185, #fbbf24);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--brand);
}

.hero-banner {
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(10,77,104,0.92), rgba(8,145,178,0.88) 45%, rgba(225,29,72,0.75)),
    radial-gradient(circle at 90% 20%, rgba(255,255,255,0.22), transparent 40%);
  box-shadow: 0 12px 32px rgba(8, 145, 178, 0.28);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.hero-banner h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: #fff;
}
.hero-banner p {
  margin: 0;
  opacity: 0.92;
  font-size: 0.88rem;
  max-width: 460px;
  line-height: 1.45;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-actions .btn {
  background: #fff;
  color: #0a4d68;
  border-color: #fff;
}
.hero-actions .btn.ghost {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute;
  right: -10px; top: -10px;
  width: 56px; height: 56px;
  border-radius: 50%;
  opacity: 0.18;
}
.stat.s1 { border-top: 3px solid #0284c7; }
.stat.s1::after { background: #38bdf8; }
.stat.s2 { border-top: 3px solid #e11d48; }
.stat.s2::after { background: #fb7185; }
.stat.s3 { border-top: 3px solid #d97706; }
.stat.s3::after { background: #fbbf24; }
.stat.s4 { border-top: 3px solid #65a30d; }
.stat.s4::after { background: #a3e635; }
.stat .lbl {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--mono);
}
.stat .val {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
}
.stat.s1 .val { color: #0284c7; }
.stat.s2 .val { color: #e11d48; }
.stat.s3 .val { color: #d97706; }
.stat.s4 .val { color: #65a30d; }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.data-table tr:hover td { background: #f0f9ff; }
.data-table tr.selected td { background: #ecfeff; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: #e0f2fe; color: #0369a1; }
.badge.premium { background: var(--violet-soft); color: var(--violet); }
.badge.mode1 { background: #cffafe; color: #0e7490; }
.badge.mode2 { background: #ffedd5; color: #c2410c; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: linear-gradient(135deg, #0284c7, #0891b2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s ease;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.ghost {
  background: #fff;
  color: var(--brand);
  border-color: var(--line);
}
.btn.ghost:hover {
  border-color: #67e8f9;
  background: #ecfeff;
}
.btn.sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}
.btn.danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecdd3;
}
.btn.amber {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  border-color: #d97706;
  color: #1c1917;
}
.btn.lime {
  background: linear-gradient(135deg, #65a30d, #a3e635);
  border-color: #65a30d;
  color: #14532d;
}

.search-box {
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: linear-gradient(135deg, #0a4d68, #0891b2);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.84rem;
  z-index: 200;
  box-shadow: 0 10px 28px rgba(8, 145, 178, 0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}

.hidden { display: none !important; }
.aside-empty {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  padding: 12px;
  border: 1px dashed #bae6fd;
  border-radius: var(--radius);
  background: #f0f9ff;
}
.aside-kv {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
}
.aside-kv div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.aside-kv span:last-child {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.76rem;
}
.aside-block { margin-bottom: 18px; }
.aside-block h3 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.08);
}
.user-chip .role {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #be123c;
  background: var(--coral-soft);
  padding: 2px 7px;
  border-radius: 999px;
}
.user-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.user-pill {
  font-size: 0.72rem;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.user-pill.more {
  background: var(--coral-soft);
  color: var(--coral);
}
.subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.subtab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab.active {
  color: #15803d;
  border-bottom-color: #65a30d;
}
.pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--ink-soft);
}
.pill.cyan { background: #cffafe; color: #0e7490; }
.demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.demo-card {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
  position: relative;
  overflow: hidden;
}
.demo-card.d1 { background: linear-gradient(165deg, #ecfeff 0%, #fff 55%); border-color: #a5f3fc; }
.demo-card.d2 { background: linear-gradient(165deg, #fff7ed 0%, #fff 55%); border-color: #fdba74; }
.demo-card .tag { display: inline-block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; margin-bottom: 8px; }
.demo-card.d1 .tag { background: #cffafe; color: #0e7490; }
.demo-card.d2 .tag { background: #ffedd5; color: #c2410c; }
.demo-card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--brand); }
.demo-card p { margin: 0 0 12px; font-size: 0.82rem; color: var(--ink-soft); line-height: 1.4; }
.samples-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sample-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.sample-tile.s1 { border-top: 3px solid #0891b2; }
.sample-tile.s2 { border-top: 3px solid #e11d48; }
.sample-tile.s3 { border-top: 3px solid #65a30d; }
.sample-tile strong { font-size: 0.88rem; color: var(--brand); }
.sample-tile span { font-size: 0.76rem; color: var(--ink-soft); line-height: 1.35; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 28, 46, 0.4); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(15, 28, 46, 0.22); }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #ecfeff, #fff1f2); }
.modal-head h3 { margin: 0; font-size: 1rem; color: var(--brand); }
.modal-body { padding: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: #f8fafc; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }
.field.span-2 { grid-column: span 2; }
