/* ============================================================
   SobatHitung — Shared Design Tokens & Component System
   Direction: Modern Minimal (Linear / Vercel-inspired)
   ============================================================ */

/* ---------- :root tokens ---------- */
:root {
  --bg:        oklch(99% 0.002 240);
  --surface:   oklch(100% 0 0);
  --fg:        oklch(18% 0.012 250);
  --muted:     oklch(54% 0.012 250);
  --border:    oklch(92% 0.005 250);
  --accent:    oklch(58% 0.18 255);
  --accent-bg: oklch(93% 0.04 255);
  --success:   oklch(58% 0.16 145);
  --warn:      oklch(65% 0.18 80);
  --danger:    oklch(58% 0.20 20);

  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.06);
  --shadow-md: 0 4px 12px oklch(0% 0 0 / 0.08);
  --shadow-lg: 0 8px 24px oklch(0% 0 0 / 0.10);

  --max-width: 1120px;
  --nav-height: 64px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }

/* ---------- Utility ---------- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ph-img {
  display: flex; align-items: center; justify-content: center;
  background: oklch(93% 0.005 250);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 14px;
  min-height: 180px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--fg);
}
h1 { font-size: clamp(32px, 5vw, 56px); }
h2 { font-size: clamp(24px, 3.5vw, 40px); }
h3 { font-size: clamp(20px, 2.5vw, 28px); }
h4 { font-size: clamp(18px, 2vw, 22px); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Navigation ---------- */
.topnav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-height);
  display: flex; align-items: center;
  background: oklch(99% 0.002 240 / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topnav .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.topnav .brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--fg); letter-spacing: -0.02em; }
.topnav .brand:hover { text-decoration: none; }
.topnav .nav-links { display: flex; align-items: center; gap: 28px; list-style: none; }
.topnav .nav-links a {
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: color 0.15s;
}
.topnav .nav-links a:hover,
.topnav .nav-links a.active { color: var(--fg); text-decoration: none; }
.topnav .nav-cta { margin-left: 8px; }
.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  width: 44px; height: 44px; padding: 10px;
}
.hamburger svg { width: 22px; height: 22px; stroke: var(--fg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px;
  font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  min-height: 44px;
}
.btn-primary {
  background: var(--accent); color: var(--surface);
}
.btn-primary:hover { background: oklch(52% 0.20 255); text-decoration: none; }
.btn-secondary {
  background: transparent; color: var(--fg);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--muted); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--muted);
}
.btn-ghost:hover { color: var(--fg); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 13px; min-height: 36px; }
.btn-danger { background: var(--danger); color: var(--surface); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: oklch(85% 0.008 250); }
.card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg);
  margin-bottom: 16px;
}
.card-icon svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 2; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--fg); }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(58% 0.18 255 / 0.12);
}
.form-input.error,
.form-textarea.error { border-color: var(--danger); }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.form-checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Section ---------- */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-header { margin-bottom: 48px; }
.section-header h2 { margin-bottom: 12px; }
.section-header p { color: var(--muted); max-width: 560px; font-size: 17px; }
.section-header.center { text-align: center; }
.section-header.center p { margin: 0 auto; }

/* ---------- Grid ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ---------- Stats ---------- */
.stat-card { text-align: center; padding: 32px 20px; }
.stat-number {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ---------- Auth layout ---------- */
.auth-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}
.auth-card h2 { margin-bottom: 8px; }
.auth-card .subtitle { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.auth-card .form-group:last-of-type { margin-bottom: 24px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.auth-divider { display: flex; align-items: center; gap: 16px; margin: 24px 0; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Dashboard ---------- */
.dashboard-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - var(--nav-height)); }
.dashboard-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  font-size: 14px; font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.sidebar-nav a:hover { background: var(--accent-bg); color: var(--fg); text-decoration: none; }
.sidebar-nav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.sidebar-nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.dashboard-main { padding: 32px; overflow-y: auto; }
.prompt-box {
  display: flex; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}
.prompt-box textarea {
  flex: 1; border: none; background: transparent;
  resize: none; font-size: 15px; min-height: 48px;
  outline: none;
}
.prompt-box .btn { flex-shrink: 0; }
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 16px;
}
.result-card .result-time { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.result-card .result-text { margin-top: 12px; font-size: 15px; line-height: 1.7; }

/* ---------- Profile ---------- */
.profile-header {
  display: flex; align-items: center; gap: 24px;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.profile-info h2 { font-size: 24px; margin-bottom: 4px; }
.profile-info p { color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  font-size: 14px;
  color: var(--muted);
}
.footer-grid { display: flex; justify-content: space-between; align-items: start; gap: 40px; flex-wrap: wrap; }
.footer-col h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg); margin-bottom: 12px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--fg); }
.footer-bottom { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; }

/* ---------- Launcher (index.html) ---------- */
.launcher-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; padding: 48px 0; }
.launcher-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  text-decoration: none;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.launcher-card:hover { box-shadow: var(--shadow-md); border-color: oklch(85% 0.008 250); transform: translateY(-2px); text-decoration: none; }
.launcher-card h3 { font-size: 18px; margin-bottom: 8px; color: var(--fg); }
.launcher-card p { font-size: 14px; color: var(--muted); flex: 1; }
.launcher-card .arrow { margin-top: 16px; color: var(--accent); font-size: 14px; font-weight: 600; }

/* ---------- Pills / Tags ---------- */
.pill {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
}
.pill-success { background: oklch(90% 0.04 145); color: var(--success); }
.pill-warn { background: oklch(93% 0.05 80); color: var(--warn); }

/* ---------- Contact Page ---------- */
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.contact-info-card { padding: 24px 0; }
.contact-info-card h3 { font-size: 18px; margin-bottom: 20px; }
.info-item { display: flex; gap: 14px; margin-bottom: 20px; align-items: start; }
.info-item .icon-wrap { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--accent-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-item .icon-wrap svg { width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 2; }
.info-item h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.info-item p { font-size: 14px; color: var(--muted); }
.map-placeholder { margin-top: 24px; }
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- Dashboard Extras ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-mini { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; text-align: center; }
.stat-mini .num { font-size: 28px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat-mini .label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: none; }
.history-item .prompt-text { font-size: 14px; color: var(--fg); }
.history-item .meta { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state svg { width: 48px; height: 48px; stroke: var(--border); margin: 0 auto 16px; }

/* ---------- Profile Extras ---------- */
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-row .label { font-size: 15px; }
.settings-row .desc { font-size: 13px; color: var(--muted); }
.toggle { width: 44px; height: 24px; background: var(--border); border-radius: 12px; position: relative; cursor: pointer; transition: background 0.2s; border: none; }
.toggle.on { background: var(--accent); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: var(--surface); border-radius: 50%; transition: transform 0.2s; }
.toggle.on::after { transform: translateX(20px); }
.activity-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 14px; }
.activity-time { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: var(--success); color: var(--surface);
  padding: 14px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  transform: translateY(80px); opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .dashboard-sidebar { display: none; }
}
@media (max-width: 768px) {
  .section { padding: 56px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topnav .nav-links { display: none; }
  .hamburger { display: block; }
  .topnav .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--nav-height); left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 12px;
  }
  .auth-card { padding: 28px; }
  .profile-header { flex-direction: column; text-align: center; }
  .footer-grid { flex-direction: column; gap: 24px; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 24px; }
}
