/* =========================================================================
   Dashboard P3AI -- token warna, tipografi, dan layout
   ========================================================================= */

:root {
  --paper:  #F4F6F1;
  --card:   #FFFFFF;
  --ink:    #17322D;
  --slate:  #5B6B66;
  --line:   #E1E3DB;
  --teal:   #2F6F62;
  --teal-soft: #E7F0EC;
  --gold:   #B8863B;
  --gold-soft: #F5ECDB;
  --rust:   #A9503A;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--font-mono);
  background: var(--gold-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* -------------------------------- Topbar -------------------------------- */

.topbar {
  background: var(--ink);
  color: var(--paper);
  position: relative;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-logo {
  width: 105px;
  border-radius: 10%;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
}
.brand-text small {
  font-size: 11px;
  color: #B9C7C2;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 8px;
}

.topnav-link {
  color: #D6DED9;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.topnav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.topnav-link.is-active {
  background: var(--teal);
  color: #fff;
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.user-name {
  font-size: 13px;
  color: #B9C7C2;
  white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.topbar .btn-ghost { color: #D6DED9; border-color: rgba(255,255,255,0.25); }
.topbar .btn-ghost:hover { border-color: #fff; color: #fff; }

.topnav-toggle {
  display: none;
  position: absolute;
  top: 10px;
  right: 16px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; }
  .topnav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    order: 3;
  }
  .topnav.is-open { display: flex; }
  .topnav-toggle { display: block; }
  .topbar-user { order: 2; }
}

/* ------------------------- Chart canvas wrapper -------------------------- */

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 340px;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-canvas-wrap--tall {
  height: 400px;
  max-height: 400px;
  overflow-y: auto;
}

/* ------------------------------ Theme menu ------------------------------- */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.theme-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  border-top: 3px solid var(--teal);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(23, 50, 45, 0.08);
}
.theme-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 8px;
}
.theme-card p {
  color: var(--slate);
  font-size: 14px;
  margin: 0;
}

/* -------------------------------- Login page ------------------------------ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, #1F473E 55%, var(--teal) 100%);
  padding: 24px;
}

.login-card {
  background: var(--card);
  border-radius: 18px;
  width: 100%;
  max-width: 400px;
  padding: 36px 32px 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-brand img { width: 90px; border-radius: 10%; }
.login-brand strong {
  font-family: var(--font-display);
  font-size: 17px;
}
.login-brand span {
  font-size: 12.5px;
  color: var(--slate);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 21px;
  text-align: center;
  margin: 0 0 22px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.login-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-field input {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}
.login-field input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.login-submit {
  width: 100%;
  margin-top: 6px;
  justify-content: center;
  font-size: 15px;
  padding: 12px 18px;
}

.login-error {
  background: #FBEEE9;
  border: 1px solid #F0D3C7;
  color: var(--rust);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

.login-hint {
  text-align: center;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--slate);
}

/* ---------------------------- Header / Hero --------------------------- */

.hero {
  background: linear-gradient(180deg, #EFF3EA 0%, var(--paper) 100%);
  padding: 56px 24px 0;
  position: relative;
}

.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--teal);
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 820px;
  letter-spacing: -0.01em;
}

.hero-desc {
  max-width: 640px;
  color: var(--slate);
  font-size: 15.5px;
  margin: 0;
}

.arch-divider {
  display: block;
  width: 100%;
  height: 32px;
}
.arch-divider path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  opacity: 0.55;
}

/* -------------------------------- Layout ------------------------------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 20px;
}

/* ------------------------------ Filter bar ------------------------------ */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 28px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

.filter-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-field select {
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.filter-check {
  min-width: auto;
  justify-content: center;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.btn-primary, .btn-ghost {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: #275b50; }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--slate); }

/* --------------------------------- KPI ---------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 20px 18px;
  border-top: 3px solid var(--teal);
}

.kpi-card.kpi-accent { border-top-color: var(--gold); }

.kpi-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
}
.kpi-value small { font-size: 15px; color: var(--slate); font-weight: 500; }

.kpi-label {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--slate);
}

.data-note {
  font-size: 13.5px;
  color: var(--rust);
  background: #FBEEE9;
  border: 1px solid #F0D3C7;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 18px 0 8px;
}

.empty-state, .empty-inline {
  text-align: center;
  color: var(--slate);
  padding: 40px 20px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
}
.empty-inline { padding: 60px 10px; border: none; background: transparent; }

/* ------------------------------ Chart cards ------------------------------ */

.chart-row {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}
.chart-row.two-col { grid-template-columns: repeat(2, 1fr); }
.chart-row.one-col { grid-template-columns: 1fr; }

@media (max-width: 800px) {
  .chart-row.two-col { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px 26px;
}

.chart-card h2 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
}

.chart-sub {
  font-size: 13px;
  color: var(--slate);
  margin: 0 0 18px;
}

/* -------------------------------- Table --------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  border-bottom: 2px solid var(--line);
  padding: 8px 10px;
}
.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td.mono, .data-table th:last-child {
  font-family: var(--font-mono);
  text-align: right;
}

/* -------------------------------- Footer --------------------------------- */

.site-footer {
  max-width: 1180px;
  margin: 20px auto 60px;
  padding: 0 24px;
  color: var(--slate);
  font-size: 12.5px;
}
