/* ===== Buku Kas UMKM — gaya antarmuka ===== */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #6b7686;
  --line: #e4e8ef;
  --primary: #2f54c6;
  --primary-dark: #23449f;
  --in: #0e9f6e;
  --in-soft: #e6f6f0;
  --out: #d64545;
  --out-soft: #fbeaea;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 30, 55, 0.06), 0 8px 24px rgba(20, 30, 55, 0.06);
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'Consolas', 'Menlo', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13.5px; }
.mono { font-family: var(--mono); letter-spacing: 0.08em; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14.5px; }

/* ===== Logo ===== */
.logo-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #6d8dff);
  display: inline-block; position: relative; flex: none;
}
.logo-mark::after {
  content: '';
  position: absolute; inset: 10px;
  border: 2.5px solid #fff; border-radius: 6px;
  border-top-color: transparent; border-right-color: transparent;
  transform: rotate(-45deg);
}

/* ===== Layar login ===== */
.auth-screen {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; padding: 24px;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(47, 84, 198, 0.10), transparent),
    radial-gradient(600px 300px at 80% 100%, rgba(14, 159, 110, 0.08), transparent),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--panel); border-radius: 18px;
  box-shadow: var(--shadow); padding: 30px;
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.brand h1 { font-size: 19px; letter-spacing: -0.01em; }
.brand p { color: var(--muted); font-size: 12.5px; }

.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 20px;
}
.auth-tabs button {
  border: 0; background: transparent; padding: 9px;
  border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted);
}
.auth-tabs button.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.auth-form input {
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px;
  outline: none; transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--primary); }
.auth-note { font-size: 12px; color: var(--muted); text-align: center; }
.auth-foot { font-size: 11px; color: var(--muted); }

/* ===== Tombol ===== */
.btn-primary {
  background: var(--primary); color: #fff; border: 0;
  padding: 12px 20px; border-radius: 10px;
  font-weight: 700; font-size: 13px; letter-spacing: 0.05em;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.btn-ghost {
  background: var(--panel); color: var(--ink);
  border: 1.5px solid var(--line); padding: 11px 18px;
  border-radius: 10px; font-weight: 600; font-size: 13px;
}
.btn-ghost:hover { border-color: #c4ccda; }

.btn-icon {
  background: transparent; border: 0; padding: 6px;
  border-radius: 8px; color: var(--muted);
}
.btn-icon:hover { background: var(--bg); color: var(--out); }

/* ===== Kerangka aplikasi ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 20px; border-bottom: 1px solid var(--line); }
.side-brand .logo-mark { width: 34px; height: 34px; border-radius: 9px; }
.side-brand .logo-mark::after { inset: 8px; border-width: 2px; }
.side-brand strong { display: block; font-size: 15px; line-height: 1.25; }
.side-brand small { color: var(--muted); font-size: 12px; }

.menu { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; flex: 1; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border: 0; background: transparent;
  border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted);
  text-align: left; transition: all 0.15s;
}
.menu-item svg { width: 19px; height: 19px; fill: currentColor; flex: none; }
.menu-item:hover { background: var(--bg); color: var(--ink); }
.menu-item.active { background: #e9effc; color: var(--primary); }

.side-user {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6d8dff);
  color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center; flex: none;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.side-user .btn-icon svg { width: 18px; height: 18px; fill: currentColor; }

.content { flex: 1; padding: 28px 32px 60px; max-width: 1080px; }

/* ===== View ===== */
.view { display: flex; flex-direction: column; gap: 18px; }
.view-head h2 { font-size: 22px; letter-spacing: -0.01em; }

/* ===== Kartu statistik ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
  border-left: 4px solid var(--primary);
}
.card-in { border-left-color: var(--in); }
.card-out { border-left-color: var(--out); }
.card-label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.card strong { display: block; font-size: 24px; margin-top: 6px; letter-spacing: -0.01em; }
.card-in strong { color: var(--in); }
.card-out strong { color: var(--out); }
.card small { color: var(--muted); font-size: 12px; }

/* ===== Panel ===== */
.panel {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; }
.panel.empty { color: var(--muted); text-align: center; padding: 34px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== Grafik batang ===== */
.chart {
  display: flex; align-items: flex-end; gap: 10px;
  height: 170px; padding: 10px 4px 0;
  border-bottom: 1.5px solid var(--line);
}
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; }
.chart .bar { width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.5s ease; }
.chart .bar.in { background: var(--in); }
.chart .bar.out { background: var(--out); opacity: 0.85; }
.chart .lbl { font-size: 11px; color: var(--muted); white-space: nowrap; }

.legend { display: flex; gap: 20px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.dot-in { background: var(--in); }
.dot-out { background: var(--out); }

/* ===== Tabel ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.amt-in { color: var(--in); font-weight: 700; }
.amt-out { color: var(--out); font-weight: 700; }
td .ket { color: var(--muted); font-size: 12.5px; }

.row-actions { display: flex; gap: 6px; }
.row-actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px;
  padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.row-actions button:hover { color: var(--ink); border-color: #c4ccda; }
.row-actions button.danger:hover { color: #fff; background: var(--out); border-color: var(--out); }

.empty-note { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 13.5px; }

/* ===== Form grid ===== */
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.grid-form input, .grid-form select, .grid-form textarea {
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  outline: none; background: #fff; resize: vertical;
}
.grid-form input:focus, .grid-form select:focus, .grid-form textarea:focus { border-color: var(--primary); }
.span2 { grid-column: span 2; }
.form-actions { grid-column: span 2; display: flex; gap: 10px; }

.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.filter-bar input { padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; outline: none; }
.filter-bar input:focus { border-color: var(--primary); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: #1c2430; color: #fff; padding: 13px 22px;
  border-radius: 12px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 100; max-width: min(90vw, 480px); text-align: center;
  animation: toast-in 0.25s ease;
}
.toast.error { background: var(--out); }
.toast.success { background: var(--in); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ===== Responsif ===== */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 12px 14px; overflow-x: auto;
  }
  .side-brand { border: 0; padding: 0 10px 0 0; }
  .side-brand small { display: none; }
  .menu { flex-direction: row; margin: 0; }
  .menu-item { white-space: nowrap; padding: 9px 12px; }
  .side-user { border: 0; padding: 0; margin: 0; }
  .user-meta { display: none; }
  .content { padding: 20px 16px 50px; }
  .grid-form { grid-template-columns: 1fr; }
  .span2, .form-actions { grid-column: span 1; }
  .two-col { grid-template-columns: 1fr; }
}

/* ===== Cetak (laporan saja) ===== */
@media print {
  body { background: #fff; }
  .sidebar, .filter-bar, .row-actions, .toast, #laporan-empty { display: none !important; }
  .content { max-width: none; padding: 0; }
  .view.hidden { display: none !important; }
  .panel, .card { box-shadow: none; border: 1px solid #ccc; }
}
