/* ═══════════════════════════════════════════════════════════
   viara.css — VIARA Management Design System
   Global tokens, resets, and shared components
   v20260713
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Figtree:wght@400;500;600;700;800&display=swap');

/* ── TOKENS ── */
:root {
  --bg:            #F7F6F1;
  --surface:       #FFFFFF;
  --surface-alt:   #F7F6F1;
  --border:        #E8E8E1;
  --border-strong: #D8D8D0;
  --divider:       #F2F2EC;
  --ink:           #1A1F1C;
  --ink-strong:    #0B1F15;
  --muted:         #7A7F76;
  --faint:         #9CA098;

  --green:         #1E5C40;
  --green-dark:    #0B1F15;
  --green-soft:    #E3EFE7;
  --green-mint:    #8FBF9F;
  --green-avatar:  #DCE8DF;

  --gold:          #C9A96A;
  --gold-border:   rgba(201,169,106,0.35);
  --gold-soft:     rgba(201,169,106,0.08);

  --warn:          #B0762A;
  --warn-soft:     #F4E8D6;
  --warn-border:   #EBD9BC;

  --radius:        12px;
  --radius-lg:     16px;
  --font-body:     'Figtree', -apple-system, sans-serif;
  --font-display:  'Instrument Serif', Georgia, serif;

  /* Aliases kept for backward compat */
  --gd: #0B1F15;
  --gs: #E3EFE7;
}

/* ── DARK MODE ── */
html[data-theme="dark"] {
  --bg:            #0D1512;
  --surface:       #131E18;
  --surface-alt:   rgba(255,255,255,0.04);
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.15);
  --divider:       rgba(255,255,255,0.06);
  --ink:           #DDE6DD;
  --ink-strong:    #F2EFE6;
  --muted:         #9FB3A6;
  --faint:         #7E937F;
  --green-soft:    rgba(143,191,159,0.15);
  --green-avatar:  rgba(143,191,159,0.2);
  --warn-soft:     rgba(201,169,106,0.15);
  --warn-border:   rgba(201,169,106,0.3);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── TOPBAR ── */
/* Always dark — does NOT respond to data-theme */
.topbar {
  background: #0B1F15;
  position: sticky;
  top: 0;
  z-index: 300;
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 60px;
  gap: 16px;
}

/* ── LOGO / BRAND ── */
.brand, .logo {
  font-family: var(--font-display);
  font-size: 20px;
  color: #F2EFE6;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}
.brand span, .logo span { color: var(--gold); }

/* ── TOP NAV ── */
.top-nav { display: flex; gap: 2px; flex-shrink: 0; }
.nav-item {
  font-size: 14px;
  font-weight: 500;
  color: #9FB3A6;
  padding: 6px 14px;
  border-radius: 8px;
  position: relative;
  transition: color .15s, background .15s;
  white-space: nowrap;
  background: none;
  border: none;
  font-family: var(--font-body);
}
.nav-item:hover { color: #F2EFE6; background: rgba(255,255,255,.07); }
.nav-item.active { color: #F2EFE6; font-weight: 600; }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 14px; right: 14px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
/* Dropdown */
.nav-item .nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,22,15,.97);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 14px 8px 8px; /* padding-top 14px buat jaga hover, visual spacing tapi tanpa gap */
  min-width: 200px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  z-index: 400;
}
.nav-item:hover .nav-dropdown { display: block; }
.nav-dropdown-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  transition: background .1s, color .1s;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font-body);
  text-align: left;
}
.nav-dropdown-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-dropdown-sep { height: 1px; background: rgba(255,255,255,.08); margin: 4px 8px; }

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 99px;
  padding: 3px;
  background: none;
  cursor: pointer;
  gap: 2px;
  flex-shrink: 0;
}
.tt-opt {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: rgba(255,255,255,.5);
  transition: background .15s, color .15s;
  user-select: none;
  line-height: 1;
}
.tt-opt.active { background: var(--gold); color: #0B1F15; }

/* ── AVATAR ── */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: #0B1F15;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  user-select: none;
}
.avatar .nav-dropdown { min-width: 180px; left: auto; right: 0; transform: none; top: 100%; }

/* ── BREADCRUMB ── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb-sep { color: var(--faint); }
.breadcrumb-active { color: var(--ink); font-weight: 600; }

/* ── PAGE TITLE ── */
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink-strong);
  margin-top: 6px;
  line-height: 1.15;
}

/* ── BUTTONS ── */
.btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: filter .15s;
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s;
}
.btn-secondary:hover { background: var(--surface-alt); }

/* ── PILL FILTER ── */
.pill {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s, color .15s, border-color .15s;
}
.pill.active {
  background: #0B1F15;
  color: #F2EFE6;
  border-color: #0B1F15;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.card-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--divider);
}
.card-label, .card-lbl {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.card-link, .card-lnk {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.card-link:hover, .card-lnk:hover { color: var(--ink-strong); }

/* ── HERO CARD ── */
.hero-card {
  background: linear-gradient(135deg, #14311F, #0E2417);
  border: 1px solid rgba(201,169,106,0.35);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* ── PROGRESS BAR ── */
.progress-track {
  height: 6px;
  background: #EFEFE9;
  border-radius: 99px;
  overflow: hidden;
}
html[data-theme="dark"] .progress-track { background: rgba(255,255,255,.08); }
.progress-fill { height: 100%; border-radius: 99px; background: var(--green); }
.progress-fill.gold { background: var(--gold); }
.progress-track.on-dark { background: rgba(255,255,255,.1); }

/* ── BADGES ── */
.badge-ok {
  display: inline-flex;
  align-items: center;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
.badge-warn {
  display: inline-flex;
  align-items: center;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
.badge-neutral {
  display: inline-flex;
  align-items: center;
  background: #EFEFE9;
  color: #5A6058;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
html[data-theme="dark"] .badge-neutral { background: rgba(255,255,255,.1); color: var(--muted); }

/* ── TABLE ── */
.tbl-hd {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
  padding: 10px 22px;
  border-bottom: 1px solid var(--divider);
  display: grid;
}
.tbl-row {
  display: grid;
  align-items: center;
  padding: 14px 22px;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--divider);
}
.tbl-row:last-child { border-bottom: none; }

/* ── AVATAR INITIAL ── */
.av-init {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-avatar);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── BOTTOM NAV (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
  min-height: 44px;
}
.bottom-nav-btn.active { color: var(--green); }
.bottom-nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media(max-width: 768px) {
  .bottom-nav { display: flex; }
  .topbar-inner { padding: 0 16px; height: 52px; }
}
@media(min-width: 769px) {
  .bottom-nav { display: none !important; }
}

/* ── SEARCH BAR ── */
.search-wrap { position: relative; }
.search-input {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 99px;
  padding: 6px 12px 6px 32px;
  color: #fff;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  width: 170px;
  transition: width .2s;
}
.search-input:focus { width: 210px; background: rgba(255,255,255,.14); }
.search-input::placeholder { color: rgba(255,255,255,.4); }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.4);
  pointer-events: none;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: rgba(10,22,15,.97);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 12px 36px rgba(0,0,0,.3);
  min-width: 220px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 400;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  transition: background .1s;
}
.search-result-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.search-empty { padding: 20px; text-align: center; color: rgba(255,255,255,.3); font-size: 13px; }

/* ── BOTTOM SHEET ── */
.sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 250;
}
.sheet-backdrop.open { display: block; }
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  z-index: 300;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.34,1.2,.64,1);
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 12px auto 4px;
}
.sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.sheet-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-strong);
}
.sheet-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.sheet-section-label {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sheet-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: background .1s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font-body);
  text-align: left;
}
.sheet-link:hover, .sheet-link:focus { background: var(--surface-alt); outline: none; }
.sheet-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.sheet-link-info { flex: 1; min-width: 0; }
.sheet-link-name { font-size: 14px; font-weight: 600; color: var(--ink-strong); }
.sheet-link-desc { font-size: 12px; color: var(--muted); margin-top: 1px; }
.sheet-link-arrow { font-size: 18px; color: var(--faint); flex-shrink: 0; }

/* ── IMG PLACEHOLDER ── */
.img-placeholder {
  background: repeating-linear-gradient(45deg, #EFEFE9, #EFEFE9 8px, #E6E6DF 8px, #E6E6DF 16px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-placeholder-label {
  font-family: monospace;
  font-size: 11px;
  color: var(--faint);
}
html[data-theme="dark"] .img-placeholder {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.05), rgba(255,255,255,.05) 8px, rgba(255,255,255,.09) 8px, rgba(255,255,255,.09) 16px);
}

/* ── UTILITY ── */
.text-serif { font-family: var(--font-display); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-warn { color: var(--warn); }
.text-ink-strong { color: var(--ink-strong); }
.desk-only { }
.mob-only { display: none; }
@media(max-width: 768px) {
  .desk-only { display: none !important; }
  .mob-only { display: block; }
}
