/* =========================================================================
   Voice AI TF — Refined white-tone design
   ========================================================================= */

:root {
  /* Surfaces — pure white with subtle elevations */
  --bg:           #ffffff;
  --bg-elev:      #ffffff;
  --bg-soft:      #f4f4f5;
  --bg-softer:    #fafafa;

  /* Borders — neutral cool greys */
  --border:       #e4e4e7;
  --border-soft:  #f1f1f3;
  --border-strong:#d4d4d8;

  /* Text — zinc grayscale */
  --text:         #09090b;
  --text-1:       #18181b;
  --text-2:       #52525b;
  --text-3:       #71717a;
  --text-4:       #a1a1aa;

  /* Brand ink — refined black */
  --ink:          #09090b;
  --ink-2:        #18181b;
  --ink-soft:     #27272a;

  /* Accent — monochrome */
  --accent:       #18181b;
  --accent-soft:  #52525b;
  --accent-tint:  #f4f4f5;

  /* Links */
  --link:         #18181b;
  --link-hover:   #09090b;

  /* Code */
  --code-bg:      #18181b;
  --code-text:    #f4f4f5;
  --code-inline-bg:#f4f4f5;
  --code-inline-tx:#27272a;

  /* Effects */
  --shadow-xs:    0 1px 2px rgba(0, 0, 0, .04);
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .03);
  --shadow:       0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px -10px rgba(0, 0, 0, .08);
  --shadow-lg:    0 4px 12px rgba(0, 0, 0, .06), 0 24px 48px -16px rgba(0, 0, 0, .12);

  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  --t-fast: .15s ease;
  --t:      .22s cubic-bezier(.4,0,.2,1);

  --container-max: 1760px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02", "cv01", "cv02";
  letter-spacing: -0.005em;
}

a { color: var(--link); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--link-hover); }

::selection { background: rgba(9, 9, 11, .12); }

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  color: var(--text);
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand:hover { color: var(--text); opacity: .7; }
.brand-mark {
  width: 4px; height: 20px;
  background: var(--accent);
  display: inline-block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.header-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}
.header-link:hover { color: var(--text); text-decoration: none; }
.header-link.active { color: var(--text); font-weight: 600; }
.header-action { margin: 0; }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); border-color: var(--border-strong); }

/* =========================================================================
   Layout
   ========================================================================= */
.layout {
  display: flex;
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: calc(100vh - 60px - 56px);
  background: var(--bg-elev);
}
.sidebar {
  width: 244px;
  flex: 0 0 244px;
  padding: 32px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}
.side-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-4);
  padding: 0 12px 12px;
}
.side-section-label-mt {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.side-nav-item:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.side-nav-item.active {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
}
.side-nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.side-nav-icon {
  display: inline-flex;
  width: 18px; height: 18px;
  flex: 0 0 18px;
  color: var(--text-3);
}
.side-nav-item.active .side-nav-icon { color: var(--ink); }

.content {
  flex: 1;
  min-width: 0;
  padding: 56px 88px 80px;
  background: var(--bg-elev);
}

/* =========================================================================
   Page hero
   ========================================================================= */
.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 28px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.page-hero-wide { padding-bottom: 32px; }
.page-hero-text { min-width: 0; max-width: 720px; }
.page-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  margin-bottom: 14px;
}
.page-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
.page-sub {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 640px;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  height: 38px;
}
.btn-sm { height: 30px; padding: 5px 11px; font-size: 12.5px; }
.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--ink-2);
  color: #fff;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.btn-primary:active { transform: translateY(1px); box-shadow: var(--shadow-xs); }
.btn-ghost {
  background: transparent;
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--ink);
  text-decoration: none;
}

/* =========================================================================
   Home dashboard
   ========================================================================= */
.home-hero {
  padding: 8px 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
}
.home-hero-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-3);
  margin-bottom: 22px;
}
.home-hero-title {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
  color: var(--ink);
  max-width: 1100px;
}
.home-hero-accent {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.home-hero-accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 3px;
  background: var(--accent);
}
.home-hero-sub {
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 0;
  max-width: 880px;
  font-weight: 400;
}

.home-section { margin-bottom: 72px; }
.home-section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}
.section-num {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.home-section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--ink);
  flex: 1;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.home-card {
  padding: 28px 28px 24px;
  background: var(--bg-elev);
  display: block;
  position: relative;
  transition: background var(--t-fast);
  color: var(--text);
}
.home-card:hover {
  background: var(--bg-softer);
  text-decoration: none;
  color: var(--text);
}
.home-card-icon {
  display: inline-flex;
  width: 38px; height: 38px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--ink);
  margin-bottom: 18px;
  transition: background var(--t-fast), color var(--t-fast);
}
.home-card:hover .home-card-icon {
  background: var(--ink);
  color: #fff;
}
.home-card-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 0 0 6px;
  color: var(--ink);
}
.home-card-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
  margin: 0 0 18px;
}
.home-card-arrow {
  font-size: 18px;
  color: var(--text-4);
  transition: color var(--t-fast), transform var(--t-fast);
  display: inline-block;
}
.home-card:hover .home-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.home-section-prose .prose { max-width: 800px; }

/* =========================================================================
   Vendor dashboard
   ========================================================================= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 36px;
}
.kpi {
  background: var(--bg-elev);
  padding: 22px 24px 20px;
}
.kpi-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-4);
}
.filter-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-elev);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.pill:hover { background: var(--bg-soft); color: var(--ink); }
.pill-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.pill-active:hover { background: var(--ink-2); color: #fff; }
.pill-count {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.7;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.vendor-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}
.vendor-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.vendor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.vendor-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  background: var(--bg-soft);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.vendor-rating { display: inline-flex; gap: 1px; }
.vendor-rating .star { color: var(--border-strong); font-size: 13px; }
.vendor-rating .star.on { color: var(--accent); }

.vendor-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 4px 0 0;
  color: var(--ink);
}
.vendor-tech {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 4px;
}
.vendor-summary {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-2);
  margin: 4px 0 6px;
}
.vendor-points {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vendor-points li {
  position: relative;
  padding-left: 14px;
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.55;
}
.vendor-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
}
.vendor-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.vendor-meta div { min-width: 0; }
.vendor-meta dt {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
  margin-bottom: 2px;
}
.vendor-meta dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.vendor-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: 4px;
}
.vendor-link {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: none;
  align-self: flex-start;
  transition: color var(--t-fast);
}
.vendor-link:hover { color: var(--accent); text-decoration: none; }

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state p { margin: 0 0 16px; }

/* =========================================================================
   Prose (rendered markdown)
   ========================================================================= */
.prose {
  max-width: 760px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text-1);
}
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.prose h1 { font-size: 26px; font-weight: 700; }
.prose h2 {
  font-size: 20px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 17px; font-weight: 600; }
.prose h4 { font-size: 15px; font-weight: 600; color: var(--text-1); }
.prose p { margin: 0.8em 0; }
.prose ul, .prose ol { padding-left: 26px; margin: 0.6em 0; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--text-4); }

.prose a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 50, 88, .25);
  transition: border-color var(--t-fast);
}
.prose a:hover { border-bottom-color: var(--ink); color: var(--ink); }

.prose blockquote {
  margin: 1.2em 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--bg-softer);
  color: var(--text-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote p { margin: 0.4em 0; }

.prose code {
  background: var(--code-inline-bg);
  color: var(--code-inline-tx);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 500;
}
.prose pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  margin: 1.2em 0;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-weight: 400;
  font-size: inherit;
}

.prose table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 1.2em 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.prose th, .prose td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.prose th {
  background: var(--bg-softer);
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.prose td { color: var(--text-1); }
.prose tr:last-child td { border-bottom: none; }
.prose tbody tr { transition: background var(--t-fast); }
.prose tbody tr:hover td { background: var(--bg-softer); }

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4em 0;
}
.prose img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prose ul:has(input[type="checkbox"]) { padding-left: 0; list-style: none; }
.prose li:has(> input[type="checkbox"]) { display: flex; align-items: flex-start; gap: 8px; padding-left: 0; }
.prose input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px; flex: 0 0 16px;
  margin-top: 5px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-elev);
  cursor: default;
  position: relative;
}
.prose input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}
.prose input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* =========================================================================
   Edit form
   ========================================================================= */
.edit-form { display: flex; flex-direction: column; max-width: 1000px; }
.editor {
  width: 100%;
  min-height: 62vh;
  padding: 18px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.7;
  resize: vertical;
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.editor-mono { font-size: 13px; }
.editor:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 31, 58, .08);
}
.edit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.edit-hint {
  color: var(--text-3);
  font-size: 13px;
  margin: 0;
  flex: 1; min-width: 240px;
}
.edit-hint code {
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-2);
}

/* =========================================================================
   Login
   ========================================================================= */
body.auth-screen {
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 0, 0, .03), transparent 40%),
    radial-gradient(circle at 80% 100%, rgba(0, 0, 0, .02), transparent 40%),
    var(--bg-softer);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  padding: 48px 40px 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-mark {
  width: 4px;
  height: 36px;
  margin: 0 auto 22px;
  background: var(--accent);
}
.login-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.login-sub {
  color: var(--text-3);
  margin: 0 0 28px;
  font-size: 14px;
}
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  background: var(--bg-elev);
}
.login-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 31, 58, .08);
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 14.5px;
  justify-content: center;
  height: auto;
}
.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}
.login-foot {
  margin-top: 28px;
  color: var(--text-4);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* =========================================================================
   Flash
   ========================================================================= */
.flash { margin-bottom: 16px; }
.flash-item {
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
}

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-4);
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.text-mute { color: var(--text-3); }

/* =========================================================================
   Header search
   ========================================================================= */
.header-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  width: 320px;
  max-width: 360px;
  height: 34px;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.header-search:focus-within {
  background: var(--bg-elev);
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px rgba(9, 9, 11, .06);
}
.header-search-icon {
  display: inline-flex;
  color: var(--text-3);
}
.header-search:focus-within .header-search-icon { color: var(--text); }
.header-search input[type="search"] {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  padding: 0;
  height: 100%;
  min-width: 0;
}
.header-search input[type="search"]::placeholder {
  color: var(--text-4);
}
.header-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background:
    linear-gradient(45deg, transparent 45%, var(--text-3) 47%, var(--text-3) 53%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, var(--text-3) 47%, var(--text-3) 53%, transparent 55%);
  cursor: pointer;
  opacity: 0.6;
}
.header-search input[type="search"]::-webkit-search-cancel-button:hover { opacity: 1; }

/* Dropdown results */
.header-search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 460px;
  max-width: 92vw;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
}
.hsr-empty {
  padding: 16px 14px;
  font-size: 13.5px;
  color: var(--text-3);
  text-align: center;
}
.hsr-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background var(--t-fast);
}
.hsr-item:hover, .hsr-item.hsr-active {
  background: var(--bg-soft);
  text-decoration: none;
}
.hsr-meta {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 3px;
}
.hsr-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
  line-height: 1.4;
}
.hsr-snippet {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hsr-item mark, .hsr-title mark, .hsr-snippet mark {
  background: var(--accent-tint);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}
.hsr-more {
  display: block;
  text-align: center;
  padding: 10px 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.hsr-more:hover {
  background: var(--bg-soft);
  color: var(--accent);
  text-decoration: none;
}

/* =========================================================================
   Search page (full results)
   ========================================================================= */
.search-page-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  margin-bottom: 28px;
  max-width: 720px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-page-form:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 31, 58, .08);
}
.search-page-icon { display: inline-flex; color: var(--text-3); }
.search-page-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  padding: 6px 0;
  background: transparent;
  color: var(--text);
  min-width: 0;
}
.search-page-input::placeholder { color: var(--text-4); }

.search-results {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 920px;
}
.search-result {
  display: block;
  padding: 18px 22px;
  background: var(--bg-elev);
  text-decoration: none;
  color: var(--text);
  transition: background var(--t-fast);
}
.search-result:hover {
  background: var(--bg-softer);
  text-decoration: none;
}
.search-result-meta {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.search-result-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 0 0 6px;
  color: var(--ink);
}
.search-result-snippet {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}
.search-result mark,
.search-result-title mark,
.search-result-snippet mark {
  background: var(--accent-tint);
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}
.search-empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--text-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  max-width: 720px;
}

/* =========================================================================
   Admin (sections, upload form)
   ========================================================================= */
.admin-section {
  margin-bottom: 56px;
  max-width: 1080px;
}
.admin-section:last-child { margin-bottom: 0; }
.admin-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.admin-section-head > div {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--ink);
}
.admin-section-sub {
  width: 100%;
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.55;
}

/* Upload form */
.upload-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-softer);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.upload-file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  transition: border-color var(--t-fast), background var(--t-fast);
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  overflow: hidden;
}
.upload-file-label:hover {
  border-color: var(--ink);
  background: var(--bg-elev);
}
.upload-file-label input[type="file"] {
  display: none;
}
.upload-file-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}
.upload-title-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.upload-title-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 31, 58, .08);
}

/* Upload list */
.upload-list {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}
.upload-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev);
  transition: background var(--t-fast);
}
.upload-item:last-child { border-bottom: none; }
.upload-item:hover { background: var(--bg-softer); }
.upload-item-title {
  flex: 0 0 auto;
  max-width: 320px;
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-item-title:hover {
  border-bottom-color: var(--accent);
  text-decoration: none;
  color: var(--ink);
}
.upload-item-meta {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-feature-settings: "tnum";
}
.upload-empty {
  padding: 24px 16px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 13.5px;
}
.inline-form { margin: 0; display: inline-block; }

/* =========================================================================
   Admin chat
   ========================================================================= */
.chat-shell {
  display: flex;
  flex-direction: column;
  max-width: 920px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  height: calc(100vh - 320px);
  min-height: 500px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-softer);
}
.chat-msg { display: flex; width: 100%; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant, .chat-msg-system { justify-content: flex-start; }

.chat-bubble {
  max-width: 78%;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
  border: 1px solid transparent;
}
.chat-msg-user .chat-bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant .chat-bubble {
  background: var(--bg-elev);
  color: var(--text-1);
  border-color: var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-system .chat-bubble {
  background: var(--accent-tint);
  color: var(--text-1);
  border-color: var(--accent-soft);
  font-size: 13.5px;
}
.chat-msg-system .chat-bubble strong { display: block; margin-bottom: 6px; color: var(--ink); }
.chat-msg-system .chat-bubble ul { margin: 6px 0 0; padding-left: 20px; }
.chat-msg-system .chat-bubble li { font-size: 13px; color: var(--text-2); margin: 3px 0; }

.chat-bubble code {
  background: rgba(0,0,0,.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.chat-msg-user .chat-bubble code { background: rgba(255,255,255,.18); }

.chat-bubble-error {
  background: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #b91c1c !important;
}
.chat-pre {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: rgba(0,0,0,.05);
  border-radius: 4px;
  font-size: 11.5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
}

.dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  animation: dot-pulse 1.4s infinite ease-in-out both;
}
.dots span:nth-child(2) { animation-delay: .16s; }
.dots span:nth-child(3) { animation-delay: .32s; }
@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(.6); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.chat-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
  background: var(--bg-elev);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.chat-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 31, 58, .08);
}
.chat-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.chat-status { font-size: 12.5px; color: var(--text-3); }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {
  .content { padding: 40px 40px 64px; }
  .home-hero-title { font-size: 42px; }
}
@media (max-width: 900px) {
  .header-inner { padding: 12px 20px; }
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 14px 20px;
  }
  .side-section-label { padding: 0 0 8px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .side-nav-item { padding: 6px 10px; font-size: 13px; }
  .side-nav-item.active::before { display: none; }
  .content { padding: 32px 20px 48px; }
  .page-title { font-size: 26px; }
  .home-hero { padding: 0 0 36px; margin-bottom: 36px; }
  .home-hero-title { font-size: 32px; }
  .home-hero-sub { font-size: 15.5px; }
  .home-section { margin-bottom: 48px; }
  .vendor-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
