/* =========================================================
   Fiber Locator V2.1 — Engineering Diagnostics
   Production UI (Premium & Proportional Scale)
   ========================================================= */
:root {
  --fl-blue: #1e40af;
  --fl-blue-dark: #1e3a8a;
  --fl-blue-soft: #eff6ff;
  --fl-cyan: #0891b2;
  --fl-green: #059669;
  --fl-green-soft: #d1fae5;
  --fl-amber: #d97706;
  --fl-red: #dc2626;
  
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  
  --shadow-sm: 0 4px 6px -1px rgba(15,23,42,.05);
  --shadow-md: 0 10px 15px -3px rgba(15,23,42,.08);
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; /* Naik dari 13px ke standar pembacaan ideal */
  line-height: 1.5;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

/* =========================================================
   TOPBAR & BRANDING
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 66px; /* Proporsi header premium */
  padding: 0 24px;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 28px;
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--fl-blue), var(--fl-cyan));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(30,64,175,.25);
}
.brand-name {
  font-weight: 800;
  font-size: 20px; /* Terlihat tegas */
  color: var(--fl-blue-dark);
}
.brand-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

nav {
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #64748b;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.nav-link:hover { color: var(--fl-blue); }
.nav-link.active { color: var(--fl-blue); }
.nav-link.active:after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  background: var(--fl-blue);
  border-radius: 3px 3px 0 0;
}

.mode-badge {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  background: var(--fl-green-soft);
  color: #065f46;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
}

/* =========================================================
   LAYOUT & HERO
   ========================================================= */
.page {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 40px;
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}
.eyebrow {
  color: var(--fl-cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 8px 0 6px;
  font-size: 28px;
  line-height: 1.2;
  color: #0f172a;
  letter-spacing: -0.5px;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
/* Status Kapsul Atas (Seirama dengan Engineering Diagnostics) */
.hero-status {
    padding: 8px 16px;
    border-radius: 999px;
    background: #ecfaf5;
    color: #0c9a72;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(12, 154, 114, 0.1);
    white-space: nowrap;
}

.hero-status .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0c9a72;
    box-shadow: 0 0 0 3px rgba(12, 154, 114, 0.15);
}

.hero-status.loading { background: var(--fl-blue-soft); color: var(--fl-blue); }
.hero-status.error { background: #fee2e2; color: var(--fl-red); }

/* =========================================================
   WORKSPACE & PANELS
   ========================================================= */
.workspace-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.input-panel {
  padding: 24px;
  position: sticky;
  top: 90px;
}
.result-panel {
  padding: 24px;
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 24px;
}
.panel-title strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
}
.panel-title small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--fl-blue-soft);
  color: var(--fl-blue);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 900;
}
.icon.green { background: var(--fl-green-soft); color: var(--fl-green); }

/* =========================================================
   FORMS & BUTTONS
   ========================================================= */
label {
  display: block;
  margin: 16px 0;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}
label span {
  float: right;
  color: #94a3b8;
  font-weight: 600;
}
select, input {
  width: 100%;
  height: 46px; /* Tap area sangat lega */
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 15px; /* Angka input lebih jelas dibaca */
  outline: none;
  transition: all .2s ease;
}
select:focus, input:focus {
  border-color: var(--fl-cyan);
  box-shadow: 0 0 0 3px rgba(8,145,178,.15);
}
select:disabled, input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.primary-btn {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--fl-blue), var(--fl-cyan));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(30,64,175,.2);
  transition: all .2s ease;
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30,64,175,.3);
  filter: brightness(1.1);
}
.primary-btn:disabled {
  opacity: .6;
  cursor: wait;
  transform: none;
  filter: none;
}

.secondary-btn {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s ease;
}
.secondary-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

/* =========================================================
   DIAGNOSTIC GRIDS & METRICS
   ========================================================= */
.summary-grid {
  display: grid;
  grid-template-columns: 1.8fr repeat(3, 1fr);
  gap: 12px;
}
.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.metric strong {
  display: block;
  margin-top: 8px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
  word-break: break-word;
}
.metric.primary {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: #334155;
}
.metric.primary span { color: #94a3b8; }
.metric.primary strong {
  font-size: 36px;
  color: #34d399; /* Kontras meteran menonjol */
  letter-spacing: -1px;
}

.status-high { color: #059669 !important; }
.status-medium { color: #d97706 !important; }
.status-low, .status-error { color: var(--fl-red) !important; }

/* =========================================================
   DATA KVs (Key-Value)
   ========================================================= */
.section { margin-top: 32px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section h2 {
  margin: 0;
  color: #1e293b;
  font-size: 16px;
  font-weight: 800;
}
.section-sub { color: var(--muted); font-size: 13px; }
.section-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0 16px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kv {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
}
.kv .k {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.kv .v {
  margin-top: 6px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  word-break: break-word;
}

/* =========================================================
   ANCHORS & COUNTERS
   ========================================================= */
.anchor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.anchor-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--fl-cyan);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.anchor-label {
  margin-bottom: 12px;
  color: var(--fl-cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.anchor-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.anchor-card-grid .kv { background: #f8fafc; }

.count-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.count {
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.count b {
  font-size: 28px;
  color: var(--fl-blue-dark);
}
.count span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* =========================================================
   STATES & NOTES
   ========================================================= */
.empty-state {
  min-height: 320px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}
.empty-state strong { font-size: 18px; color: #334155; }
.empty-state span { margin-top: 8px; font-size: 14px; }
.empty-state.error-state { border-color: #fca5a5; background: #fef2f2; color: var(--fl-red); }
.hidden { display: none !important; }

.hint {
  margin-top: 20px;
  padding: 16px;
  border-radius: 10px;
  background: var(--fl-blue-soft);
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}
.hint code { font-size: 12px; color: var(--fl-blue-dark); font-weight: 600; }
.inline-note {
  padding: 12px 16px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
}
.inline-note strong { color: #1e293b; }
.danger-note { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.success-note { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* =========================================================
   RESPONSIVE DESIGN
   ========================================================= */
@media (max-width: 1100px) {
  .topbar { padding: 0 16px; gap: 16px; }
  .brand { min-width: auto; }
  .workspace-grid { grid-template-columns: 1fr; }
  .input-panel { position: static; }
  .summary-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .kv-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; padding: 12px 16px; gap: 12px;}
  .brand-sub, .mode-badge { display: none; }
  nav { order: 3; width: 100%; height: 44px; overflow-x: auto; }
  .nav-link { padding: 0 12px; font-size: 15px; }
  .page { width: 100%; padding: 16px 12px 32px; }
  
  .hero { align-items: flex-start; flex-direction: column; gap: 12px; }
  .hero h1 { font-size: 24px; }
  
  .result-panel, .input-panel { padding: 16px; }
  .summary-grid, .anchor-grid, .count-grid { grid-template-columns: 1fr 1fr; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .summary-grid, .anchor-grid, .count-grid, .kv-grid, .anchor-card-grid { grid-template-columns: 1fr; }
  .metric.primary strong { font-size: 32px; }
  .hero p { font-size: 13px; }
  select, input { height: 48px; } /* Maksimal untuk sentuhan jempol */
  .primary-btn { height: 52px; font-size: 16px; }
}