/* ==========================================================================
   Supply Ikan Planner — Warm Paper theme
   Minimalis, tanpa gradient, tanpa bayangan berat, tanpa dependensi eksternal.
   ========================================================================== */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3f0e9;
  --ink: #26241f;
  --ink-soft: #3c3931;
  --muted: #6e6a61;
  --faint: #9a9488;
  --line: #e7e2d8;
  --line-strong: #d8d1c2;
  --accent: #6b7a48;
  --accent-ink: #4f5a34;
  --accent-soft: #edf0e3;
  --terracotta: #b4552d;
  --terracotta-soft: #f6ece5;
  --amber: #a9761f;
  --amber-soft: #f6efe1;
  --danger: #a23b1e;
  --radius: 10px;
  --side: 248px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, ui-serif, serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* Atribut hidden harus menang atas display dari kelas (mis. .boot { display:flex }). */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.25; margin: 0; }
p { margin: 0 0 12px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); font-size: 14px; letter-spacing: .02em;
}
.boot-mark {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.noscript {
  max-width: 520px; margin: 12vh auto; padding: 20px 24px; border: 1px solid var(--line);
  background: var(--surface); border-radius: var(--radius); color: var(--ink);
}

/* ---------- Layout ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 16px 16px; z-index: 40;
}
.brand { padding: 0 8px 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.brand-name { font-family: var(--font-serif); font-size: 18px; letter-spacing: -.01em; display: block; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--ink-soft); font-size: 14px; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 11px; color: var(--faint); font-family: var(--font-mono); }
.nav a.active .count { color: var(--accent-ink); }
.nav .ico { width: 16px; height: 16px; flex: none; opacity: .8; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none;
}
.user-name { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--faint); }

.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(250,248,244,.86);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  padding: 15px 32px; display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 20px; }
.topbar .crumb { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }

.content { padding: 28px 32px 64px; max-width: 1060px; width: 100%; }
.page-intro { color: var(--muted); max-width: 68ch; margin: 2px 0 26px; }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; }
.section-head .rule { flex: 1; height: 1px; background: var(--line); }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 22px; border: 1px solid;
}
.banner.demo { background: var(--amber-soft); border-color: #e7dcc4; color: #6b5417; }
.banner.error { background: var(--terracotta-soft); border-color: #ecd9cd; color: var(--danger); }
.banner .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px;
}
.card + .card { margin-top: 14px; }
/* Di dalam grid, kartu berjajar — jangan ditambah margin atas (bikin border tidak sejajar). */
.grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }
.card.tight { padding: 14px 16px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* ---------- KPI ---------- */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .k-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.kpi .k-value { font-family: var(--font-serif); font-size: 26px; margin-top: 6px; line-height: 1; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress.thin { height: 4px; }
.progress .bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.progress .bar.amber { background: var(--amber); }

/* ---------- Phase ---------- */
.phase { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.phase-head { display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.phase-num { font-family: var(--font-serif); font-size: 30px; line-height: 1; color: var(--line-strong); min-width: 44px; }
.phase-title h3 { font-size: 16px; }
.phase-title .win { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-top: 3px; }
.phase-meter { margin-left: auto; text-align: right; min-width: 130px; }
.phase-meter .pct { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* ---------- Task ---------- */
.tasks { }
.task { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px 14px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--line); }
.task:first-child { border-top: none; }
.task:hover { background: #fdfcfa; }
.task input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.task-title { font-size: 14.5px; font-weight: 600; }
.task-title.done { text-decoration: line-through; color: var(--faint); font-weight: 500; }
.task-code { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.task-detail { font-size: 13px; color: var(--muted); margin-top: 3px; }
.task-meta { display: flex; align-items: center; gap: 8px; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap;
}
.pill.todo { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); }
.pill.doing { background: var(--amber-soft); color: #6b5417; border-color: #e7dcc4; }
.pill.done { background: var(--accent-soft); color: var(--accent-ink); border-color: #d9e0c6; }
.pill.batal { background: var(--terracotta-soft); color: var(--danger); border-color: #ecd9cd; }
.tag { display: inline-block; font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 99px; padding: 2px 8px; }

/* task expandable */
.task-body { grid-column: 2 / 4; }
.disclosure { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--accent-ink); background: none; border: none; cursor: pointer; padding: 2px 0; font-family: inherit; }
.disclosure .chev { transition: transform .18s ease; }
.disclosure.open .chev { transform: rotate(90deg); }
.task-panel { margin-top: 12px; display: grid; gap: 14px; }
.panel-block h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 8px; }
.note-input { width: 100%; min-height: 60px; resize: vertical; }
.owner-input { width: 190px; }

/* ---------- Komentar / diskusi tim ---------- */
.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-head strong { font-size: 13px; }
.comment-del { margin-left: auto; opacity: .55; padding: 3px 6px; }
.comment-del:hover { opacity: 1; }
.comment-body { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; margin-top: 2px; }
.comment-form { border-top: 1px solid var(--line); padding-top: 12px; }
.comment-form textarea { width: 100%; }

/* steps / tips */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { position: relative; padding: 3px 0 3px 26px; font-size: 13.5px; color: var(--ink-soft); }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 3px;
  width: 17px; height: 17px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono);
}
.tips { list-style: none; margin: 0; padding: 0; }
.tips li { position: relative; padding: 3px 0 3px 18px; font-size: 13px; color: var(--muted); }
.tips li::before { content: "→"; position: absolute; left: 0; top: 3px; color: var(--terracotta); font-size: 12px; }

.sources { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sources a { font-size: 12px; }
.sources a::before { content: "↗ "; color: var(--faint); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint);
  font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbf9f5;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fdfcfa; }
table.data .num { font-family: var(--font-mono); text-align: right; white-space: nowrap; }
table.data tfoot td { font-weight: 600; background: #fbf9f5; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--faint); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
select { appearance: none; background-image: none; cursor: pointer; }
input[type="number"] { font-family: var(--font-mono); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1; min-width: 150px; }
.inline { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 8px 14px;
  border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 7px; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #faf8f4; }
.btn-primary:hover { background: #000; }
.btn-danger { color: var(--danger); border-color: #e5cfc4; }
.btn-danger:hover { background: var(--terracotta-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 6px 9px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { font-size: 12px; padding: 5px 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Calculator ---------- */
.calc-out { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.calc-hero { font-family: var(--font-serif); font-size: 32px; line-height: 1.1; margin: 4px 0 2px; }
.calc-formula { font-family: var(--font-mono); font-size: 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 10px 12px; margin-top: 14px; }

/* ---------- SOP flow ---------- */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.flow-node { flex: 1; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.flow-node .n-title { font-size: 13px; font-weight: 600; }
.flow-node .n-sub { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); margin-top: 4px; }
.flow-arrow { display: flex; align-items: center; color: var(--line-strong); padding: 0 6px; font-size: 16px; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 28px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-name { font-size: 21px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }
.login-note { font-size: 12.5px; color: var(--muted); margin-top: 16px; text-align: center; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { font-size: 15px; color: var(--ink); margin-bottom: 6px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--ink); color: #faf8f4; border-radius: var(--radius); padding: 10px 15px; font-size: 13px;
  max-width: 340px; border-left: 3px solid var(--accent);
}
.toast.err { border-left-color: var(--terracotta); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .field { margin-bottom: 0; }
.toolbar select, .toolbar input { width: auto; min-width: 120px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { font: inherit; font-size: 12.5px; background: var(--surface); border: none; border-right: 1px solid var(--line); padding: 6px 11px; cursor: pointer; color: var(--muted); }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ---------- Mobile ---------- */
.overlay { display: none; }
@media (max-width: 900px) {
  :root { --side: 264px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(38,36,31,.32); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 20px 16px 56px; }
  .topbar { padding: 12px 16px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .task { grid-template-columns: 20px 1fr; }
  .task-meta { grid-column: 2; }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); justify-content: center; padding: 4px 0; }
}
