/* ============================================================
   Konsol — Dashboard Admin
   Aesthetic: "quiet editorial" — kertas hangat, hijau pinus,
   angka serif besar (Fraunces), UI bersih (Plus Jakarta Sans).
   ============================================================ */

:root {
  --paper:        #F6F3EC;
  --paper-2:      #F1ECE2;
  --surface:      #FFFFFF;
  --ink:          #1B1A17;
  --muted:        #6E6A60;
  --faint:        #9A9588;
  --line:         #E7E1D6;
  --line-strong:  #D9D2C4;

  --pine:         #1F5C4D;
  --pine-700:     #174a3e;
  --sage:         #E4EDE7;
  --sage-200:     #CDE0D6;

  --amber:        #B07A1A;
  --amber-bg:     #F6ECD4;
  --clay:         #B5532B;
  --clay-bg:      #F6E2D8;
  --danger:       #A93B3B;

  --radius:       16px;
  --radius-sm:    11px;
  --radius-pill:  999px;
  --shadow:       0 1px 2px rgba(27,26,23,.04), 0 14px 30px -18px rgba(27,26,23,.18);
  --shadow-sm:    0 1px 2px rgba(27,26,23,.05);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:      "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --sidebar-w:    250px;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(31,92,77,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(176,122,26,.05), transparent 55%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, button { font-size: 1rem; }
h1, h2, h3 { margin: 0; font-weight: 600; }
::selection { background: var(--sage-200); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.main   { min-width: 0; display: flex; flex-direction: column; }
.content {
  padding: 30px clamp(20px, 4vw, 46px) 56px;
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #FBF9F4, #F4EFE6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 10px 18px;
}
.brand .mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--pine);
  color: #F4EFE6;
  box-shadow: 0 6px 16px -8px rgba(31,92,77,.7);
}
.brand .mark svg { width: 19px; height: 19px; }
.brand .name { font-family: var(--font-display); font-size: 1.32rem; font-weight: 600; letter-spacing: -.01em; }
.brand .name b { color: var(--pine); }

.nav-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); padding: 16px 12px 8px;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(31,92,77,.07); color: var(--ink); }
.nav-item.active { background: var(--sage); color: var(--pine-700); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0; background: var(--pine);
}

.side-foot { margin-top: auto; padding-top: 14px; }
.user-card {
  display: flex; align-items: center; gap: 11px;
  padding: 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.user-card .meta { min-width: 0; }
.user-card .meta .nm { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .meta .rl { font-size: .76rem; color: var(--faint); }

/* avatar */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--pine); color: #F4EFE6;
  font-weight: 600; font-size: .82rem; letter-spacing: .02em;
}
.avatar.sm { width: 32px; height: 32px; font-size: .72rem; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px clamp(20px, 4vw, 46px);
  background: rgba(246,243,236,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .eyebrow {
  display: block;
  font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--pine); margin-bottom: 2px;
}
.topbar h1 { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -.01em; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: border-color .15s, color .15s, transform .1s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: 9px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--clay); border: 2px solid var(--surface);
}
.menu-btn { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: .9rem;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #F4EFE6; box-shadow: 0 8px 18px -10px rgba(31,92,77,.8); }
.btn-primary:hover { background: var(--pine-700); border-color: var(--pine-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(31,92,77,.07); color: var(--ink); }

/* ---------- eyebrow / section heads ---------- */
.eyebrow {
  font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
}
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 16px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.18rem; font-weight: 600; }
.section-head .sub { color: var(--muted); font-size: .88rem; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat {
  position: relative; overflow: hidden;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat .label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat .ic {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--sage); color: var(--pine);
}
.stat .ic svg { width: 18px; height: 18px; }
.stat .num { font-family: var(--font-display); font-size: 2.15rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.stat .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .82rem; color: var(--faint); }

.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-pill); font-size: .78rem; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--pine); background: var(--sage); }
.trend.down { color: var(--clay); background: var(--clay-bg); }

/* color variants for stat icon */
.stat.amber .ic { background: var(--amber-bg); color: var(--amber); }
.stat.clay  .ic { background: var(--clay-bg);  color: var(--clay); }

/* ---------- panels ---------- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 22px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-family: var(--font-display); font-size: 1.08rem; }
.panel-head .sub { font-size: .82rem; color: var(--faint); }
.panel-body { padding: 20px; }

/* ---------- bar chart ---------- */
.chart { display: flex; align-items: flex-end; gap: clamp(6px, 1.6vw, 16px); height: 230px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100%; justify-content: flex-end; }
.chart .track { width: 100%; max-width: 46px; height: 100%; display: flex; align-items: flex-end; }
.bar {
  width: 100%; border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #2c7864, var(--pine));
  height: 0; transition: height .9s cubic-bezier(.2,.75,.25,1);
  position: relative;
}
.bar.alt { background: linear-gradient(180deg, #d9b15a, var(--amber)); }
.chart .col:hover .bar { filter: brightness(1.07); }
.chart .col .v { font-size: .74rem; color: var(--faint); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .15s; }
.chart .col:hover .v { opacity: 1; }
.chart .col .x { font-size: .76rem; color: var(--muted); font-weight: 500; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; color: var(--muted); }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ---------- activity list ---------- */
.activity { display: flex; flex-direction: column; }
.act {
  display: flex; gap: 13px; padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.act:last-child { border-bottom: 0; padding-bottom: 0; }
.act:first-child { padding-top: 0; }
.act .dot {
  flex: none; margin-top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pine); box-shadow: 0 0 0 4px var(--sage);
}
.act .dot.amber { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.act .dot.clay  { background: var(--clay);  box-shadow: 0 0 0 4px var(--clay-bg); }
.act .txt { font-size: .9rem; }
.act .txt b { font-weight: 600; }
.act .time { font-size: .76rem; color: var(--faint); margin-top: 2px; }

/* ---------- breakdown bars (reports) ---------- */
.breakdown { display: flex; flex-direction: column; gap: 16px; }
.bd-row .bd-top { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 7px; }
.bd-row .bd-top b { font-weight: 600; }
.bd-row .bd-top .pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.bd-track { height: 9px; border-radius: var(--radius-pill); background: var(--paper-2); overflow: hidden; }
.bd-fill { height: 100%; width: 0; border-radius: inherit; background: var(--pine); transition: width 1s cubic-bezier(.2,.75,.25,1); }

/* ---------- toolbar (users) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.search {
  display: flex; align-items: center; gap: 9px;
  padding: 0 13px; height: 42px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  flex: 1; min-width: 220px; max-width: 360px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--pine); box-shadow: 0 0 0 3px var(--sage); }
.search svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); }
.search input::placeholder { color: var(--faint); }

.select {
  height: 42px; padding: 0 36px 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236E6A60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); font-weight: 500; appearance: none; -webkit-appearance: none;
}
.select:focus { outline: 0; border-color: var(--pine); box-shadow: 0 0 0 3px var(--sage); }

/* ---------- table ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); padding: 14px 18px; background: var(--paper-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #FBFAF6; }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user .nm { font-weight: 600; }
.cell-user .em { font-size: .8rem; color: var(--faint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted-cell { color: var(--muted); }

/* status badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: .78rem; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok    { color: var(--pine);  background: var(--sage); }
.badge.off   { color: var(--muted); background: var(--paper-2); }
.badge.wait  { color: var(--amber); background: var(--amber-bg); }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions button {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--faint);
  transition: background .12s, color .12s;
}
.row-actions button:hover { background: var(--paper-2); color: var(--ink); }
.row-actions svg { width: 16px; height: 16px; }

.empty-row td { text-align: center; color: var(--faint); padding: 38px 18px; font-style: italic; }

.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-size: .85rem; color: var(--muted); }
.pager { display: flex; gap: 6px; }
.pager button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.pager button.active { background: var(--pine); border-color: var(--pine); color: #F4EFE6; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- forms (settings) ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.form-card .panel-body { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: .85rem; font-weight: 600; }
.field .hint { font-size: .78rem; color: var(--faint); }
.input {
  height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 92px; font-family: inherit; }
.input:focus { outline: 0; background: var(--surface); border-color: var(--pine); box-shadow: 0 0 0 3px var(--sage); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0; }
.toggle-row .tl b { display: block; font-weight: 600; font-size: .9rem; }
.toggle-row .tl span { font-size: .78rem; color: var(--faint); }
.switch { position: relative; flex: none; width: 46px; height: 26px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .slider { position: absolute; inset: 0; border-radius: var(--radius-pill); background: var(--line-strong); transition: background .2s; }
.switch .slider::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .slider { background: var(--pine); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--sage); }

.divider { height: 1px; background: var(--line); border: 0; margin: 2px 0; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 17px; border-radius: var(--radius-sm);
  background: var(--ink); color: #F4EFE6; box-shadow: var(--shadow);
  font-size: .9rem; font-weight: 500;
  animation: toast-in .35s cubic-bezier(.2,.75,.25,1);
}
.toast svg { width: 18px; height: 18px; color: #7fd0b6; flex: none; }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- backdrop (mobile nav) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 35;
  background: rgba(27,26,23,.4); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
body.nav-open .backdrop { opacity: 1; visibility: visible; }

/* ---------- page-load reveal ---------- */
.reveal { animation: rise .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  :root { --sidebar-w: 0px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; width: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.2,.7,.2,1);
    box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-btn { display: grid; }
}
@media (max-width: 540px) {
  .stats { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 1.28rem; }
  .toolbar .search { max-width: none; }
  .hide-sm { display: none !important; }
}
