
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --accent: #3b82f6;
  --accent-ink: #ffffff;
  --tone: var(--accent);
  --ok: #22a06b;
  --bad: #e5484d;
  --warn: #d9942b;
  --radius: 18px;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f8;
  --bg-blob-1: rgba(96,152,255,.22);
  --bg-blob-2: rgba(140,180,240,.20);
  --ink: #0f1a2e;
  --ink-2: #4a5873;
  --ink-3: #7a879f;
  --glass: rgba(255,255,255,.66);
  --glass-strong: rgba(255,255,255,.86);
  --glass-border: rgba(255,255,255,.9);
  --line: rgba(15,26,46,.09);
  --field: rgba(255,255,255,.85);
  --shadow: 0 1px 2px rgba(20,35,70,.05), 0 12px 32px -12px rgba(20,35,70,.18);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1c;
  --bg-blob-1: rgba(59,110,220,.20);
  --bg-blob-2: rgba(40,70,140,.18);
  --ink: #e8edf7;
  --ink-2: #a3aec6;
  --ink-3: #6f7a92;
  --glass: rgba(255,255,255,.045);
  --glass-strong: rgba(18,26,46,.82);
  --glass-border: rgba(255,255,255,.085);
  --line: rgba(255,255,255,.08);
  --field: rgba(255,255,255,.05);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 18px 40px -16px rgba(0,0,0,.55);
}

html, body { min-height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -8%, var(--bg-blob-1), transparent 70%),
    radial-gradient(760px 480px at 100% 105%, var(--bg-blob-2), transparent 70%);
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

[data-tone="money"] { --tone: #14a38b; }
[data-tone="story"] { --tone: #8a7cf0; }
[data-tone="secure"] { --tone: #e0883a; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.glass-solid { background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--shadow); }
.hairline { border-color: var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  height: 2.6rem; padding: 0 1.1rem; border-radius: 12px; font-weight: 550; font-size: .92rem;
  border: 1px solid var(--line); background: var(--field); color: var(--ink);
  transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--field); }
.btn-icon { width: 2.6rem; padding: 0; }

.field {
  width: 100%; height: 2.7rem; padding: 0 .9rem; border-radius: 12px;
  background: var(--field); border: 1px solid var(--line); color: var(--ink); font-size: .95rem;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
textarea.field { height: auto; padding: .7rem .9rem; line-height: 1.55; resize: vertical; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.label { display: block; font-size: .78rem; font-weight: 550; color: var(--ink-2); margin-bottom: .35rem; letter-spacing: .01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: .75rem; height: 2.7rem; padding: 0 .8rem; border-radius: 12px;
  color: var(--ink-2); font-weight: 520; font-size: .92rem; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--field); color: var(--ink); }
.nav-item[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
.nav-item[aria-current="page"] svg { color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 550; background: var(--field); border: 1px solid var(--line); color: var(--ink-2); }

.cat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  aspect-ratio: 1 / .92; border-radius: 14px; border: 1px solid var(--line); background: var(--field);
  font-size: .78rem; font-weight: 550; color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.cat-tile:hover { border-color: var(--accent); color: var(--ink); transform: translateY(-1px); }
.cat-tile[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }

/* Modal CSS (pengganti confirm()/alert bawaan browser) */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(5,10,22,.55); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@media (min-width: 640px) { .overlay { align-items: center; } }
.sheet { width: 100%; max-width: 32rem; max-height: 92dvh; overflow: auto; animation: rise .22s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { transform: translateY(14px); opacity: 0 } }
.toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: 5.5rem; padding: .7rem 1rem; border-radius: 12px; animation: rise .2s ease; }
@media (min-width: 1024px) { .toast { bottom: 1.5rem; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.scroll-hide::-webkit-scrollbar { display: none; }


/* ===== Reset kecil (pengganti Tailwind) ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.5; }
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Utilitas ===== */
.flex { display: flex; } .inline-flex { display: inline-flex; } .col { flex-direction: column; } .wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-end { align-items: flex-end; } .items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; } .justify-center { justify-content: center; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-5 { gap: 1.25rem; }
.grow { flex: 1 1 0%; } .shrink-0 { flex-shrink: 0; } .min-w-0 { min-width: 0; } .w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { overflow-wrap: anywhere; } .pre { white-space: pre-wrap; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; } .mt-5 { margin-top: 1.25rem; } .mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }
.p-5 { padding: 1.25rem; } .p-6 { padding: 1.5rem; } .p-8 { padding: 2rem; }
.stack > * + * { margin-top: 1.25rem; } .stack-sm > * + * { margin-top: .75rem; }
.text-xs { font-size: .75rem; } .text-sm { font-size: .875rem; } .text-lg { font-size: 1.125rem; } .text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; } .text-3xl { font-size: 1.875rem; line-height: 1.2; }
.bold { font-weight: 600; } .medium { font-weight: 500; } .center { text-align: center; }
.tight { letter-spacing: -.02em; } .serif { font-family: var(--font-serif); }
.divide > li + li { border-top: 1px solid var(--line); }
.divide > li { padding-block: .7rem; }
.grid { display: grid; gap: 1.25rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > * { min-width: 0; }
.cols-3.tight-gap, .cols-2.tight-gap, .cols-4.tight-gap { gap: .75rem; }
.field-tile { border-radius: 12px; padding: .85rem; background: var(--field); border: 1px solid var(--line); min-width: 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.icon-box { width: 2.75rem; height: 2.75rem; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.icon-sm { width: 2.25rem; height: 2.25rem; border-radius: 10px; display: grid; place-items: center; background: var(--field); flex-shrink: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--field); } .bar > i { display: block; height: 100%; border-radius: 99px; background: var(--tone); }
.seg { display: flex; padding: .25rem; gap: .25rem; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--glass-border); }
.seg a, .seg button { height: 2.25rem; padding: 0 .9rem; border-radius: 9px; display: grid; place-items: center; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.seg [aria-selected="true"], .seg [aria-pressed="true"] { background: var(--tone); color: #fff; }

/* ===== Kerangka halaman ===== */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: .75rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; height: 3.5rem; position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); }
.content { padding: 1rem 1rem 7rem; max-width: 72rem; margin: 0 auto; overflow-x: clip; }
.bottomnav { position: fixed; inset: auto 0 0 0; z-index: 40; padding: 0 .75rem max(env(safe-area-inset-bottom), .6rem); }
.bottomnav-inner { display: flex; align-items: center; justify-content: space-around; height: 4rem; padding: 0 .5rem; position: relative; }
.mlink { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; width: 4rem; height: 3.5rem; border-radius: 12px; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.mlink[aria-current="page"] { color: var(--accent); }
.fab { width: 3rem; height: 3rem; border-radius: 16px; margin-top: -1.5rem; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 70%, #000); }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card { width: 100%; max-width: 24rem; padding: 2rem; } .auth-card.wide { max-width: 28rem; }
.chart-svg { width: 100%; height: auto; }
.mono-key { font-variant-numeric: tabular-nums; letter-spacing: .06em; word-break: break-all; }
.collapsed .nav-label, .collapsed .brand { display: none; }
.collapsed .nav-item, .collapsed .btn.sb { justify-content: center; padding: 0; }

@media (min-width: 640px) { .content { padding-inline: 1.5rem; } .only-mobile { display: none !important; } }
@media (max-width: 639px) { .only-desktop { display: none !important; } .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) {
  .app { display: flex; }
  .sidebar { display: block; position: sticky; top: 0; height: 100dvh; padding: .75rem; width: 16rem; transition: width .2s; flex-shrink: 0; }
  .sidebar.collapsed { width: 76px; }
  .sidebar .glass { height: 100%; }
  .topbar, .bottomnav { display: none; }
  .main { flex: 1; min-width: 0; }
  .content { padding: 2rem 2rem 3rem; }
  .split-3-2 { grid-template-columns: 3fr 2fr; } .split-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1023px) { .toast { bottom: 5.5rem; } }
.nav-item { text-decoration: none; }
.err { color: var(--bad); font-size: .875rem; }
.checkrow { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkrow input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.hide-sm { display: none; } @media (min-width: 640px) { .hide-sm { display: inline-flex; } }
.btn.sm { height: 2.25rem; padding: 0 .8rem; } .btn.btn-icon.sm { width: 2.25rem; padding: 0; } .btn.lg { height: 3rem; }
.field.sm { height: 2.5rem; } .field.auto { width: auto; }
.btn-danger-solid { background: var(--bad); color: #fff; border-color: transparent; }
.tile-btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.modal-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -.01em; }
@media (max-width: 639px) { .grid.m1 { grid-template-columns: minmax(0, 1fr); } }

/* ===== Catatan / Harian / Masa lalu ===== */
.entry { display: flex; flex-direction: column; gap: .5rem; width: 100%; text-align: left; padding: 1rem; cursor: pointer; transition: transform .12s, border-color .15s; color: inherit; }
.entry:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--glass-border)); transform: translateY(-1px); }
.entry.row { flex-direction: row; align-items: flex-start; gap: .9rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.datebox { width: 3rem; flex-shrink: 0; text-align: center; border-radius: 12px; padding: .35rem 0; background: color-mix(in srgb, var(--tone) 14%, transparent); }
.datebox b { display: block; font-size: 1.15rem; line-height: 1.2; } .datebox i { display: block; font-style: normal; font-size: .7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.thumb { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 12px; flex-shrink: 0; border: 1px solid var(--line); }
.timeline { list-style: none; position: relative; padding-left: 1.4rem; display: flex; flex-direction: column; gap: .9rem; }
.timeline::before { content: ""; position: absolute; left: .35rem; top: .5rem; bottom: .5rem; width: 2px; background: var(--line); border-radius: 2px; }
.timeline > li { position: relative; }
.timeline > li::before { content: ""; position: absolute; left: -1.4rem; top: 1.25rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 4px var(--bg); }
.seg a[role=tab] { white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: .45rem; }
.sheet.wide { max-width: 46rem; }
.editor-body { min-height: 11rem; font-size: 1rem; line-height: 1.7; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .6rem; }
.mitem { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--field); min-height: 5rem; }
.mitem img, .mitem video { width: 100%; height: 8rem; object-fit: cover; display: block; background: #000; }
.mitem audio { width: 100%; display: block; margin-top: 2.2rem; padding: 0 .4rem 2.2rem; }
.mitem.wide-item { grid-column: 1 / -1; }
.mitem .mrm { position: absolute; top: .3rem; right: .3rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: rgba(10,15,28,.72); color: #fff; z-index: 2; }
.mitem .mname { position: absolute; left: .5rem; top: .45rem; right: 2.5rem; font-size: .72rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem.up { display: grid; place-items: center; font-size: .8rem; color: var(--ink-2); height: 5rem; }
.rec-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25 } }
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 1rem; }
.viewer img { max-width: 100%; max-height: 90dvh; border-radius: 8px; }
.editor-actions { position: sticky; bottom: -1.5rem; margin: 1rem -1.5rem -1.5rem; padding: .9rem 1.5rem; background: var(--glass-strong); border-top: 1px solid var(--line); }

/* ===== Lampu RGB (opsional): garis pelangi yang mengalir di tepi kartu seperti lampu LED ===== */
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes rgb-spin { to { --ang: 360deg; } }
@keyframes rgb-flow { to { background-position: 200% 0; } }
html[data-rgb="on"] :is(.glass, .glass-solid):not(.sheet) { position: relative; border-color: transparent; }
html[data-rgb="on"] :is(.glass, .glass-solid):not(.sheet)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--ang), #ff1744, #ffea00, #00e676, #00e5ff, #2979ff, #d500f9, #ff1744);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: rgb-spin 4s linear infinite;
}
html[data-rgb="on"] :is(.btn-primary, .fab, .seg [aria-selected="true"]) {
  background: linear-gradient(90deg, #ff1744, #ffea00, #00e676, #00e5ff, #2979ff, #d500f9, #ff1744) 0 0 / 200% 100%;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.65); border-color: transparent; animation: rgb-flow 5s linear infinite;
}
html[data-rgb="on"] .brand {
  background: linear-gradient(90deg, #ff1744, #ffea00, #00e676, #00e5ff, #2979ff, #d500f9, #ff1744) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; animation: rgb-flow 5s linear infinite;
}
[data-rgb-toggle][aria-pressed="true"] { color: #00e5ff; }
@media (prefers-reduced-motion: reduce) { html[data-rgb="on"] * { animation: none !important; } }

/* ===== Animasi dan efek (v0.4) ===== */
@keyframes fx-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.fx-in { animation: fx-in .5s cubic-bezier(.2,.8,.2,1) backwards; }
.fx-host { overflow: hidden; }
.fx-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,255,255,0) 70%); transform: scale(0); animation: fx-rip .65s ease-out forwards; }
@keyframes fx-rip { to { transform: scale(1); opacity: 0; } }
@keyframes fx-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.btn:active, .nav-item:active, .chip:active { transform: scale(.95); }
.modal-title { animation: fx-in .35s .05s backwards; }
.overlay { animation: fade .2s ease both; }
.toast { animation: toast-in .35s cubic-bezier(.2,1.2,.3,1) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.92); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
[data-sound-toggle][aria-pressed="true"] svg { color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .glass, .glass-solid, .entry, .field-tile { transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .2s, background-color .2s; }
  .glass:not(.sidebar-inner):hover, .entry:hover, .field-tile:hover {
    background-image: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 65%);
  }
  .glass:not(.sidebar-inner):not(.sheet):hover { transform: translateY(-3px); box-shadow: 0 16px 40px -16px rgba(0,0,0,.45); }
  .entry:hover { transform: translateY(-3px); box-shadow: 0 16px 36px -16px rgba(0,0,0,.5); }
  .btn:hover { transform: translateY(-2px); }
  .btn:active { transform: scale(.95); }
  .btn-primary:hover { box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
  .nav-item:hover { transform: translateX(4px); }
  .nav-item:hover svg { transform: scale(1.15) rotate(-6deg); }
  .nav-item svg, .btn svg { transition: transform .22s cubic-bezier(.2,1.4,.4,1); }
  .btn:hover svg { transform: scale(1.12); }
  .field:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
  .thumb, .mitem img { transition: transform .3s; } .entry:hover .thumb { transform: scale(1.06) rotate(1deg); }
}
@media (prefers-reduced-motion: reduce) { .fx-in, .toast, .overlay, .modal-title { animation: none !important; } }
