:root {
  --bg: #f7f6f2;
  --bg-2: #edf4f3;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-soft: rgba(255, 255, 255, 0.56);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #17202a;
  --muted: #66706f;
  --line: rgba(23, 32, 42, 0.08);
  --brand: #526f69;
  --brand-2: #7aa59a;
  --brand-3: #4e8c6f;
  --danger: #b85c5c;
  --warning: #b9853d;
  --shadow: 0 18px 46px rgba(48, 62, 68, 0.08);
  --shadow-soft: 0 10px 28px rgba(48, 62, 68, 0.06);
  --radius: 20px;
  --sidebar-width: 284px;
}

:root[data-theme="dark"] {
  --bg: #0d1114;
  --bg-2: #101816;
  --panel: rgba(21, 27, 30, 0.76);
  --panel-soft: rgba(25, 33, 36, 0.58);
  --panel-strong: rgba(24, 31, 34, 0.94);
  --text: #edf3ef;
  --muted: #9ba9a5;
  --line: rgba(237, 243, 239, 0.08);
  --brand: #a9c9bd;
  --brand-2: #6e9f91;
  --brand-3: #9bd0b8;
  --danger: #e08a8a;
  --warning: #d7ad70;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  background:
    radial-gradient(circle at 8% 0%, rgba(122, 165, 154, .18), transparent 28rem),
    radial-gradient(circle at 96% 4%, rgba(194, 214, 196, .20), transparent 30rem),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 0%, rgba(122, 165, 154, .11), transparent 28rem),
    radial-gradient(circle at 96% 4%, rgba(82, 111, 105, .10), transparent 30rem),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
strong, b, h1, h2, h3, h4, th { font-weight: 500; }


.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(12,18,16,.40), rgba(12,18,16,.18)),
    url('/assets/login-bg.jpg') center / cover no-repeat;
}
.login-card {
  width: min(100%, 360px);
  padding: 22px;
  border: 1px solid rgba(255,255,255,.30);
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 24px 80px rgba(8,12,15,.20);
  backdrop-filter: blur(18px);
}
:root[data-theme="dark"] .login-card {
  border-color: rgba(255,255,255,.14);
  background: rgba(15,21,23,.76);
}
.login-mark {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: rgba(122,165,154,.13);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-title {
  margin: 14px 0 0;
  font-size: 22px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.045em;
}
.login-form { margin-top: 18px; }
.login-submit { width: 100%; justify-content: center; margin-top: 16px; }
.login-error {
  margin-top: 14px;
  padding: 10px 11px;
  border-radius: 14px;
  color: var(--danger);
  background: rgba(184,92,92,.10);
  border: 1px solid rgba(184,92,92,.16);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
  display: block;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(8, 12, 15, .24);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed;
  inset: 12px auto 12px 12px;
  width: min(var(--sidebar-width), calc(100vw - 24px));
  z-index: 100;
  transform: translateX(calc(-100% - 24px));
  transition: .24s ease;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.brand-box {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(122,165,154,.12), rgba(210,222,214,.20));
  border: 1px solid rgba(122,165,154,.18);
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  font-weight: 500;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 24px rgba(82,111,105,.18);
}

.brand-title { font-size: 13px; font-weight: 500; letter-spacing: -0.02em; }
.brand-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }

.role-card {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}

.label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.select, .input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}
.textarea { min-height: 94px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(122,165,154,.42); box-shadow: 0 0 0 4px rgba(122,165,154,.10); }

.nav { margin-top: 16px; display: grid; gap: 5px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 0;
  padding: 10px 11px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: .18s ease;
}
.nav-button:hover { background: rgba(122,165,154,.09); color: var(--brand); }
.nav-button.active {
  background: var(--panel-strong);
  color: var(--brand);
  box-shadow: var(--shadow-soft);
}
.nav-icon { width: 22px; text-align: center; opacity: .9; }

.main {
  min-width: 0;
  padding: 18px;
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0 14px;
  backdrop-filter: blur(16px);
}

.mobile-menu { display: inline-flex; }
.topbar-title { color: var(--muted); font-size: 12px; }
.eyebrow { font-size: 11px; color: var(--brand); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.page-title { margin: 3px 0 0; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.08; letter-spacing: -0.04em; font-weight: 500; }
.page-desc { margin: 8px 0 0; color: var(--muted); max-width: 800px; line-height: 1.55; font-size: 13px; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 9px 12px;
  font-weight: 500;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn.ghost { box-shadow: none; border: 1px solid var(--line); background: var(--panel-soft); }
.btn.danger { color: #fff; background: var(--danger); }
.btn.small { padding: 7px 9px; border-radius: 11px; font-size: 11px; min-height: 30px; }

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  padding: 16px;
}
.card.flat { box-shadow: none; }
.card-title { margin: 0; font-size: 15px; letter-spacing: -0.025em; font-weight: 500; }
.card-desc { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.48; }

.kpi { position: relative; overflow: hidden; min-height: 112px; }
.kpi::after {
  content: "";
  position: absolute;
  width: 112px;
  height: 112px;
  right: -48px;
  bottom: -56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(122,165,154,.14), rgba(210,222,214,.13));
}
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { margin-top: 9px; font-size: 22px; font-weight: 500; letter-spacing: -0.045em; }
.kpi-note { margin-top: 7px; color: var(--muted); font-size: 12px; }
.trend-up { color: var(--brand-3); font-weight: 500; }
.trend-warn { color: var(--warning); font-weight: 500; }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--panel-soft); min-width: 760px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: rgba(122,165,154,.07); }
td { font-size: 12px; }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(122,165,154,.12);
  color: var(--brand);
}
.badge.green { background: rgba(78,140,111,.13); color: var(--brand-3); }
.badge.yellow { background: rgba(185,133,61,.13); color: var(--warning); }
.badge.red { background: rgba(184,92,92,.12); color: var(--danger); }
.badge.gray { background: rgba(102,112,133,.10); color: var(--muted); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(102,112,133,.12);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.simulator {
  background: linear-gradient(135deg, rgba(82,111,105,.98), rgba(45,65,61,.96));
  color: white;
  overflow: hidden;
  position: relative;
}
:root[data-theme="dark"] .simulator { background: linear-gradient(135deg, rgba(21,31,29,.98), rgba(36,54,50,.96)); }
.simulator::before {
  content: "";
  position: absolute;
  inset: auto -15% -58% auto;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(169,201,189,.24), transparent 68%);
}
.simulator .card-desc, .simulator .label { color: rgba(255,255,255,.72); }
.simulator .select, .simulator .input { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.16); color: white; }
.simulator option { color: #17202a; }
.sim-result {
  position: relative;
  margin-top: 14px;
  padding: 15px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.sim-amount { font-size: clamp(24px, 3.5vw, 34px); font-weight: 500; letter-spacing: -0.06em; line-height: 1; }
.sim-meta { margin-top: 9px; color: rgba(255,255,255,.74); line-height: 1.58; font-size: 12px; }

.copy-box {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(122,165,154,.08);
  border: 1px dashed rgba(122,165,154,.24);
}
.copy-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.qr {
  width: 136px;
  height: 136px;
  border-radius: 22px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 9px white;
  overflow: hidden;
}
.qr-pattern {
  width: 112px;
  height: 112px;
  background:
    linear-gradient(90deg, #17202a 7px, transparent 7px) 0 0 / 16px 16px,
    linear-gradient(#17202a 7px, transparent 7px) 0 0 / 16px 16px,
    radial-gradient(circle, #17202a 36%, transparent 37%) 8px 8px / 16px 16px;
  opacity: .82;
}

.asset-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
}
.asset-thumb {
  min-height: 92px;
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(122,165,154,.14), rgba(210,222,214,.16));
  display: grid;
  place-items: center;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--brand);
}

.toast {
  position: fixed;
  z-index: 200;
  right: 16px;
  bottom: 16px;
  background: #17202a;
  color: white;
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .24s ease;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
}

.section { display: grid; gap: 12px; margin-bottom: 14px; }
.mt { margin-top: 12px; }
.hidden { display: none !important; }

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 12px; }
  .main { padding: 12px; }
  .topbar { align-items: flex-start; gap: 8px; }
  .topbar-title { display: none; }
  .action-row { width: 100%; }
  .btn { justify-content: center; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: 18px; }
  .kpi-value { font-size: 22px; }
  .page-title { font-size: 20px; }
  .sim-amount { font-size: 24px; }
}
