:root {
  --color-bg: #f5f6fb;
  --color-surface: #ffffff;
  --color-surface-2: #fafbff;
  --color-border: #e6e8f0;
  --color-text: #161a2b;
  --color-muted: #6b7280;
  --color-primary: #0b8ec2;
  --color-primary-dark: #086e97;
  --color-primary-soft: #e6f4fa;
  --color-danger: #e5484d;
  --color-warning: #f59e0b;
  --color-success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 30px rgba(16, 24, 40, .10);
  font-size: 15px;
}

[data-theme="dark"] {
  --color-bg: #0d0f1a;
  --color-surface: #14172a;
  --color-surface-2: #191d33;
  --color-border: #262b45;
  --color-text: #e8e9f5;
  --color-muted: #9498b3;
  --color-primary: #38b6e8;
  --color-primary-dark: #5cc5ec;
  --color-primary-soft: #113549;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--color-surface-2); padding: 1px 6px; border-radius: 5px; font-size: .85em; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 22px 16px;
  flex-shrink: 0;
  transition: background .2s ease, border-color .2s ease;
}
.sidebar .brand {
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.02em;
}
.sidebar .brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #a78bfa);
  box-shadow: 0 0 12px var(--color-primary);
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  margin-bottom: 2px;
  font-size: .92rem;
  transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  text-decoration: none;
}
.sidebar .section-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-muted);
  margin: 20px 0 8px 12px;
  font-weight: 700;
}

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  position: sticky; top: 0; z-index: 20;
  transition: background .2s ease, border-color .2s ease;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.cmdk-trigger {
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .82rem;
  cursor: pointer;
  max-width: 320px;
}
.cmdk-trigger kbd {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .72rem;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--color-muted);
  padding: 6px; border-radius: 8px; display: flex; position: relative;
}
.icon-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.icon-btn svg { width: 19px; height: 19px; }
.notif-dot {
  position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-danger); border: 2px solid var(--color-surface);
}
.topbar .user { font-size: .87rem; color: var(--color-muted); display:flex; align-items:center; gap:10px; }

.content { padding: 26px; max-width: 1240px; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
  transition: background .2s ease, border-color .2s ease;
}
.card h2, .card h3 { margin-top: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #a78bfa);
}
.stat-card .icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--color-primary-soft); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.stat-card .icon svg { width: 18px; height: 18px; }
.stat-card .value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.stat-card .label { color: var(--color-muted); font-size: .84rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--color-border); font-size: .89rem; }
th { color: var(--color-muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
tr { transition: background .12s ease; }
tr:hover td { background: var(--color-surface-2); }

.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .75rem; font-weight: 700; color: #fff; }

.btn {
  display: inline-flex; align-items:center; gap:6px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--color-primary);
  background: var(--color-primary); color: #fff; font-size: .89rem; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-2); }
.btn-sm { padding: 5px 11px; font-size: .8rem; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .87rem; font-weight: 600; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: .92rem; font-family: inherit; background: var(--color-surface); color: var(--color-text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
textarea.form-control { resize: vertical; min-height: 100px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .9rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
[data-theme="dark"] .alert-error { background: #2a1418; color: #f87171; border-color: #4a1e24; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
[data-theme="dark"] .alert-success { background: #10261a; color: #4ade80; border-color: #1c4a2e; }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-bg);
  background-image: radial-gradient(circle at 20% 20%, var(--color-primary-soft), transparent 40%), radial-gradient(circle at 80% 80%, var(--color-primary-soft), transparent 40%); }
.auth-box { width: 380px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 16px; padding: 34px; box-shadow: var(--shadow-lg); }
.auth-box h1 { font-size: 1.35rem; margin-bottom: 4px; letter-spacing: -.02em; }
.auth-box .sub { color: var(--color-muted); font-size: .88rem; margin-bottom: 22px; }

.timeline { border-left: 2px solid var(--color-border); margin-left: 9px; padding-left: 22px; }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
  content: '';
  position: absolute; left: -27px; top: 3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.timeline-item .meta { font-size: .78rem; color: var(--color-muted); }

.message { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; background: var(--color-surface); }
.message.internal { background: #fffbeb; border-color: #fde68a; }
[data-theme="dark"] .message.internal { background: #2a2410; border-color: #4a3f1a; }
.message .meta { font-size: .78rem; color: var(--color-muted); margin-bottom: 6px; }

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

.req-list { list-style: none; padding: 0; margin: 0 0 16px; }
.req-list li { padding: 6px 0; font-size: .9rem; }
.req-ok { color: var(--color-success); }
.req-fail { color: var(--color-danger); }

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

.sla-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 700;
}
.sla-healthy { background: #dcfce7; color: #166534; }
.sla-warning { background: #fef3c7; color: #92400e; }
.sla-breached { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .sla-healthy { background: #10261a; color: #4ade80; }
[data-theme="dark"] .sla-warning { background: #2a2410; color: #fbbf24; }
[data-theme="dark"] .sla-breached { background: #2a1418; color: #f87171; }

/* Command palette */
.cmdk-overlay {
  position: fixed; inset: 0; background: rgba(10,12,20,.55); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 1000;
}
.cmdk-overlay.open { display: flex; }
.cmdk-box {
  width: 560px; max-width: 92vw; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.cmdk-input {
  width: 100%; border: none; padding: 16px 18px; font-size: 1rem; background: transparent; color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.cmdk-input:focus { outline: none; }
.cmdk-results { max-height: 340px; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: .91rem;
}
.cmdk-item:hover, .cmdk-item.active { background: var(--color-primary-soft); }
.cmdk-item .hint { color: var(--color-muted); font-size: .78rem; }
.cmdk-empty { padding: 20px; text-align: center; color: var(--color-muted); font-size: .88rem; }

/* Notification dropdown */
.notif-panel {
  position: absolute; right: 0; top: 42px; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px;
  box-shadow: var(--shadow-lg); display: none; z-index: 50;
}
.notif-panel.open { display: block; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-size: .86rem; }
.notif-item:last-child { border-bottom: none; }
.notif-item .title { font-weight: 600; }
.notif-item .meta { color: var(--color-muted); font-size: .76rem; margin-top: 2px; }
.notif-panel-header { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-border); }
.notif-panel-header h4 { margin: 0; font-size: .9rem; }

@media (max-width: 700px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); }
  .grid-2 { grid-template-columns: 1fr; }
  .cmdk-trigger span.hide-mobile { display: none; }
  .notif-panel { width: 92vw; right: -8px; }
}

/* Public marketing / knowledge base pages */
.lp-nav { display:flex; align-items:center; justify-content:space-between; padding:16px 32px; background:var(--color-surface); border-bottom:1px solid var(--color-border); position:sticky; top:0; z-index:30; }
.lp-nav .brand { font-weight:800; font-size:1.25rem; display:flex; align-items:center; gap:8px; letter-spacing:-.02em; }
.lp-nav .brand .dot { width:11px; height:11px; border-radius:50%; background:linear-gradient(135deg, var(--color-primary), #38b6e8); box-shadow:0 0 12px var(--color-primary); }
.lp-nav nav a { margin-right:22px; color:var(--color-text); font-size:.92rem; font-weight:500; }
.lp-nav nav a:hover { color:var(--color-primary); text-decoration:none; }
.lp-nav .actions { display:flex; align-items:center; gap:10px; }
.lp-hero { padding:80px 24px 100px; text-align:center; position:relative; overflow:hidden; background: linear-gradient(180deg, var(--color-primary-soft), var(--color-bg) 70%); }
.lp-hero.lp-hero-sm { padding:48px 24px 56px; }
.lp-hero h1 { font-size:2.6rem; font-weight:800; letter-spacing:-.03em; margin-bottom:14px; max-width:760px; margin-left:auto; margin-right:auto; }
.lp-hero.lp-hero-sm h1 { font-size:2rem; }
.lp-hero p.sub { font-size:1.1rem; color:var(--color-muted); max-width:560px; margin:0 auto 34px; }
.lp-search { max-width:600px; margin:0 auto 30px; display:flex; gap:8px; }
.lp-search input { flex:1; padding:14px 18px; border-radius:999px; border:1px solid var(--color-border); font-size:1rem; background:var(--color-surface); color:var(--color-text); box-shadow:var(--shadow); }
.lp-search input:focus { outline:none; border-color:var(--color-primary); }
.lp-search button { padding:14px 26px; border-radius:999px; }
.lp-cta { display:flex; gap:14px; justify-content:center; flex-wrap:wrap; }
.lp-cta .btn { padding:13px 28px; font-size:.95rem; }
.lp-section { max-width:1120px; margin:0 auto; padding:60px 24px; }
.lp-section h2 { font-size:1.6rem; font-weight:800; letter-spacing:-.02em; margin-bottom:8px; }
.lp-section p.section-sub { color:var(--color-muted); margin-bottom:32px; }
.feature-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:20px; }
.feature-card { background:var(--color-surface); border:1px solid var(--color-border); border-radius:var(--radius); padding:24px; box-shadow:var(--shadow); }
.feature-card .icon { width:42px; height:42px; border-radius:12px; background:var(--color-primary-soft); color:var(--color-primary); display:flex; align-items:center; justify-content:center; margin-bottom:14px; }
.feature-card .icon svg { width:22px; height:22px; }
.feature-card h3 { font-size:1.02rem; margin:0 0 6px; }
.feature-card p { font-size:.87rem; color:var(--color-muted); margin:0; line-height:1.55; }
.cat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; }
.cat-card { background:var(--color-surface); border:1px solid var(--color-border); border-radius:var(--radius-sm); padding:18px 20px; display:flex; justify-content:space-between; align-items:center; box-shadow:var(--shadow); }
.cat-card:hover { border-color:var(--color-primary); text-decoration:none; }
.article-list { list-style:none; padding:0; margin:0; display:grid; gap:10px; }
.article-list li a { display:block; background:var(--color-surface); border:1px solid var(--color-border); border-radius:var(--radius-sm); padding:14px 18px; color:var(--color-text); }
.article-list li a:hover { border-color:var(--color-primary); text-decoration:none; }
.lp-footer { text-align:center; padding:32px 24px; color:var(--color-muted); font-size:.85rem; border-top:1px solid var(--color-border); }
.kb-article-body { max-width:760px; margin:0 auto; line-height:1.75; font-size:1.02rem; }
.kb-article-body h1, .kb-article-body h2, .kb-article-body h3 { margin-top:1.5em; }
.kb-rich-body img { max-width:100%; height:auto; border-radius:8px; }
.kb-feedback { display:flex; gap:10px; align-items:center; margin-top:40px; padding-top:24px; border-top:1px solid var(--color-border); }
@media (max-width:640px) { .lp-nav nav { display:none; } .lp-hero h1 { font-size:1.9rem; } }
