/* ═══════════════════════════════════════════════════════════════════
   KEST Design Tokens — from MASTER.md
   Sprint 1 shell
   ═══════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'CreatoDisplay';
  src: url('../fonts/CreatoDisplay-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PrometheanBoldCond';
  src: url('../fonts/prometheanboldcond.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MonospaceTypewriter';
  src: url('../fonts/MonospaceTypewriter.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Colors ────────────────────────────────────────────────── */
  --color-primary: #1e3a8a;
  --color-secondary: #1e40af;
  --color-cta: #b45309;
  --color-cta-hover: #92400e;
  --color-background: #f8fafc;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-surface: #ffffff;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;

  /* ── Typography ────────────────────────────────────────────── */
  --font-heading: 'CreatoDisplay', sans-serif;
  --font-body: 'CreatoDisplay', sans-serif;
  --font-mono: 'MonospaceTypewriter', monospace;

  /* ── Spacing ───────────────────────────────────────────────── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* ── Shadows ───────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 24px rgba(15, 23, 42, 0.1);

  /* ── Radii ─────────────────────────────────────────────────── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* ── Reset & Base ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-background);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
}

/* ── Components ──────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-cta);
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition:
    background-color 200ms ease,
    transform 200ms ease,
    box-shadow 200ms ease;
  min-height: 44px;
  min-width: 44px;
}

.btn-primary:hover {
  background: var(--color-cta-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:focus-visible {
  outline: 3px solid rgba(180, 83, 9, 0.25);
  outline-offset: 2px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--color-primary);
  padding: 12px 24px;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 200ms ease;
  min-height: 44px;
  min-width: 44px;
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: white;
}

/* ── App Header (shared) ─────────────────────────────────────────── */

.app-header {
  background: var(--color-primary);
  color: white;
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}
.app-header .header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
}
.app-header .header-logo img {
  height: 28px;
  width: auto;
}
.app-header .header-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-family: 'PrometheanBoldCond', var(--font-heading);
  margin: 0;
}
.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.app-header .auth-status {
  font-size: 0.875rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-header .auth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  display: none;
  animation: pulse-dot 2s ease-in-out infinite;
}
.app-header .auth-dot.active {
  display: inline-block;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.3);
  }
}
.app-header .logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 150ms ease;
}
.app-header .logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Sticky header ───────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ── Auth user badge (logged-in state) ───────────────────────────── */

.app-header .auth-user-badge {
  display: none;
  align-items: center;
  gap: 8px;
}
.app-header .auth-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.app-header .auth-label {
  font-size: 0.6875rem;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.app-header .auth-company {
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.95;
}

/* ── Icon buttons (Notifications / Settings) ─────────────────────── */

.app-header .icon-btn {
  display: none;
}
.page-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-sm);
  padding: calc(var(--space-sm) + 2px) var(--space-xl);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.page-toolbar .toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.page-toolbar .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-text);
  transition: all 150ms ease;
}
.page-toolbar .icon-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.page-toolbar .icon-btn svg {
  width: 20px;
  height: 20px;
}
.app-header .icon-btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}
.app-header .icon-btn svg {
  display: block;
}
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 40;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 180px;
}

html {
  min-height: 100%;
}
/* ── App Footer ──────────────────────────────────────────────────── */

.app-footer {
  background: var(--color-primary);
  color: white;
  padding: var(--space-xl) var(--space-xl);
  margin-top: auto;
  font-size: 0.8125rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-xl) var(--space-2xl);
  align-items: start;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-kest {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.footer-copy {
  opacity: 0.55;
  font-size: 0.75rem;
}
.footer-section-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.5;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.footer-links,
.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-links a,
.footer-legal a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 150ms ease;
}
.footer-links a:hover,
.footer-legal a:hover {
  color: white;
}
@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main,
.page-container {
  flex: 1;
}

.page-container {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
  margin: 0 auto;
  padding: var(--space-xl);
  box-sizing: border-box;
}

.kb-page-back {
  margin-bottom: var(--space-6);
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin-bottom: var(--space-xl);
}

.kb-header-title,
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary) !important;
  margin: 0;
  line-height: 1.15;
}

.page-subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin: 0;
}

.page-subtitle {
  margin: 0;
}

.filters-bar {
  width: 100%;
}

/* ── Nav Bar (shared) ────────────────────────────────────────────── */

.nav-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-xl);
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}
.nav-link {
  padding: var(--space-md) 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav-link:hover,
.nav-link.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.nav-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text);
  transition: none;
}
.nav-action-btn:hover {
  background: transparent;
}
.nav-action-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-positive {
  background: #ecfdf5;
  color: var(--color-success);
}
.badge-warning {
  background: #fffbeb;
  color: var(--color-warning);
}
.badge-blocking {
  background: #fef2f2;
  color: var(--color-error);
}
.badge-neutral {
  background: #f1f5f9;
  color: var(--color-text-muted);
}
