:root {
  --bg: #0b1220;
  --bg2: #0e1626;
  --card: #131c2e;
  --card2: #1b2740;
  --text: #e8eef9;
  --muted: #93a3bd;
  --accent: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent2: #10b981;
  --danger: #f43f5e;
  --border: #243149;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --header-bg: rgba(13,20,34,.85);
  --link: #7dd3fc;
  --money: #34d399;
  --glow1: rgba(6,182,212,.10);
  --glow2: rgba(59,130,246,.12);
}
/* Light theme */
:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f1f5f9;
  --text: #0f1b2d;
  --muted: #5b6b86;
  --accent: #2563eb;
  --accent-cyan: #0891b2;
  --accent2: #059669;
  --danger: #e11d48;
  --border: #e2e8f0;
  --shadow: 0 8px 24px rgba(15,27,45,.08);
  --header-bg: rgba(255,255,255,.9);
  --link: #2563eb;
  --money: #059669;
  --glow1: rgba(6,182,212,.08);
  --glow2: rgba(37,99,235,.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1100px 600px at 80% -10%, var(--glow1), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, var(--glow2), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 28px 18px 72px; }

/* Header */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; }
.brand img { width: 34px; height: 34px; display: block; }
.brand .name { color: var(--text); }
.brand .name b { background: linear-gradient(90deg, #60a5fa, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
nav.row { display: flex; gap: 8px; align-items: center; }

/* Theme toggle */
.theme-toggle { padding: 6px 10px; font-size: 15px; line-height: 1; }
.theme-toggle .t-light { display: none; }
.theme-toggle .t-dark { display: inline; }
:root[data-theme="light"] .theme-toggle .t-light { display: inline; }
:root[data-theme="light"] .theme-toggle .t-dark { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--accent), #2f6fe0);
  color: #fff; font-weight: 600; font-family: inherit;
  padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 14px rgba(59,130,246,.3);
  transition: transform .06s ease, filter .12s ease, box-shadow .12s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.green { background: linear-gradient(180deg, #14c08b, #0e9f72); box-shadow: 0 4px 14px rgba(16,185,129,.3); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--card2); }
.btn.danger { background: transparent; color: #fca5b5; border: 1px solid rgba(244,63,94,.5); box-shadow: none; }
.btn.danger:hover { background: rgba(244,63,94,.12); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

/* Cards & layout */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.02); }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; font-weight: 500; }
input, select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card2); color: var(--text);
  font-size: 14px; font-family: inherit;
}
input::placeholder { color: #5b6b86; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* Misc */
.error { background: rgba(244,63,94,.12); border: 1px solid rgba(244,63,94,.45); color: #fecdd6; padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.notice { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.45); color: #bbf7e0; padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.pill { display:inline-block; background: var(--card2); border:1px solid var(--border); padding:3px 10px; border-radius:999px; font-size:11.5px; color:var(--muted); }
.result-amount { font-size: 36px; font-weight: 800; color: var(--money); letter-spacing: -.5px; }
.kv { display:grid; grid-template-columns: auto 1fr; gap: 7px 20px; font-size: 14px; margin-top: 10px; }
.kv div:nth-child(odd) { color: var(--muted); }
.totalbar { display:flex; gap:28px; flex-wrap:wrap; align-items:center; background: linear-gradient(180deg, var(--card), var(--bg2)); border:1px solid var(--border); border-radius:14px; padding:18px 20px; margin-bottom:18px; box-shadow: var(--shadow); }
.totalbar .big { font-size:26px; font-weight:800; color:var(--money); letter-spacing:-.5px; }
.actions-row { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.center { text-align: center; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 0; }
.footer { text-align:center; color: var(--muted); font-size: 12.5px; margin-top: 26px; }

/* Login */
.login-wrap { max-width: 380px; margin: 11vh auto 0; }
.login-logo { width: 60px; height: 60px; display:block; margin: 0 auto 12px; }

@media (max-width: 640px){
  .grid2 { grid-template-columns: 1fr; }
  header.top { padding: 12px 14px; }
  nav.row { gap: 6px; }
  .brand .name { font-size: 16px; }
}
