:root {
  --primary: #2563ff;
  --primary-dark: #1e40ff;
  --accent: #10d8c4;
  --success: #00d68f;
  --danger: #ff4d6d;
  --warning: #ffb020;
  --bg: #eef6ff;
  --card-bg: rgba(255, 255, 255, 0.72);
  --text-main: #0f172a;
  --text-sub: #64748b;
  --line: rgba(148, 163, 184, 0.28);
  --shadow: 0 20px 60px rgba(37, 99, 255, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, #dbeafe 0, transparent 35%),
    radial-gradient(circle at 80% 30%, #c7d2fe 0, transparent 35%),
    linear-gradient(135deg, #f8fbff 0%, #eaf3ff 45%, #f7efff 100%);
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.72);
  color: var(--text-main);
  outline: none;
}
textarea { min-height: 92px; resize: vertical; }
label { color: var(--text-sub); font-size: 13px; display: grid; gap: 8px; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 18px 16px;
  background: rgba(255,255,255,.46);
  backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255,255,255,.74);
}
.side-brand { display: flex; align-items: center; gap: 12px; height: 48px; margin-bottom: 28px; }
.brand-cube, .brand-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.sidebar nav { display: grid; gap: 10px; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: #6b7280; border-radius: 22px; }
.sidebar a span { width: 22px; text-align: center; }
.sidebar a.active { background: #151a1f; color: #fff; box-shadow: 0 16px 34px rgba(15,23,42,.18); }
.logout-link { position: absolute; bottom: 22px; left: 16px; right: 16px; }

.main-area { min-width: 0; }
.topbar {
  height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 28px; border-bottom: 1px solid rgba(255,255,255,.7);
  background: rgba(238,246,255,.42); backdrop-filter: blur(18px);
}
.search-box {
  max-width: 420px; width: 46%; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; background: rgba(255,255,255,.72); border-radius: 24px; border: 1px solid rgba(255,255,255,.84);
}
.search-box input { border: 0; background: transparent; padding: 13px 0; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 16px; background: linear-gradient(135deg, #111827, #64748b); color: #fff; display: grid; place-items: center; font-weight: 700; }
.mobile-menu { display: none; }
.content { padding: 26px; display: grid; gap: 22px; }

.glass-card, .metric-card, .auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.7);
}
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-grid.mini { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card { padding: 20px; display: flex; gap: 16px; align-items: center; min-height: 118px; }
.metric-card strong, .compact strong { display: block; font-size: 23px; margin-bottom: 8px; }
.metric-card p, .compact p { margin: 0; color: var(--text-sub); }
.icon { width: 42px; height: 42px; border-radius: 18px; display: grid; place-items: center; font-weight: 800; }
.blue { background: #e0f2fe; color: #0284c7; }
.mint { background: #d1fae5; color: #059669; }
.purple { background: #ede9fe; color: #6d28d9; }
.red { background: #ffe4e6; color: var(--danger); }
.compact { padding: 18px 20px; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart-card { min-height: 320px; padding: 22px; }
.chart-card canvas { width: 100% !important; height: 240px !important; }
.chart-card.wide { grid-row: span 2; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 18px; }
.card-head span { color: var(--text-sub); font-size: 13px; }

.table-card, .form-card { padding: 24px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0 10px; min-width: 760px; }
th { text-align: left; color: var(--text-sub); font-weight: 600; padding: 0 16px 8px; }
td { padding: 16px; background: rgba(255,255,255,.62); border-top: 1px solid rgba(255,255,255,.8); border-bottom: 1px solid rgba(255,255,255,.8); }
td:first-child { border-radius: 16px 0 0 16px; border-left: 1px solid rgba(255,255,255,.8); }
td:last-child { border-radius: 0 16px 16px 0; border-right: 1px solid rgba(255,255,255,.8); }
tr:hover td { background: rgba(255,255,255,.9); }
.right { text-align: right; }
.amount { font-weight: 800; }
.success { color: var(--success); }
.danger { color: var(--danger); }
.empty { text-align: center; color: var(--text-sub); }
.pill { display: inline-flex; padding: 6px 12px; border-radius: 999px; background: rgba(16,216,196,.14); color: #0f9f8f; }

.btn {
  border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 10px 18px; border-radius: 16px; font-weight: 700;
}
.btn.primary { color: #fff; background: linear-gradient(135deg, #2563ff, #1d4ed8); box-shadow: 0 14px 28px rgba(37,99,255,.22); }
.btn.ghost { background: rgba(255,255,255,.72); border: 1px solid var(--line); color: var(--text-main); }
.wide { width: 100%; }
.link-btn { border: 0; background: transparent; color: var(--primary); cursor: pointer; padding: 0 8px 0 0; }
.link-btn.danger { color: var(--danger); }
.icon-btn { border: 0; background: rgba(15,23,42,.08); width: 36px; height: 36px; border-radius: 12px; cursor: pointer; }

.filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.stack-form { display: grid; gap: 16px; }

.modal { position: fixed; inset: 0; display: none; place-items: center; padding: 20px; background: rgba(15,23,42,.32); z-index: 20; }
.modal.show { display: grid; }
.modal-panel { width: min(720px, 100%); max-height: 92vh; overflow: auto; padding: 24px; border-radius: 28px; background: rgba(255,255,255,.92); box-shadow: 0 30px 80px rgba(15,23,42,.24); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }

.install-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(460px, 100%); padding: 32px; }
.install-card { width: min(760px, 100%); }
.auth-card h1 { margin: 18px 0 8px; font-size: 28px; }
.auth-card p { color: var(--text-sub); margin: 0 0 24px; }
.alert, .toast { padding: 12px 14px; border-radius: 16px; margin-bottom: 14px; }
.alert.danger, .toast.danger { background: #ffe4e6; color: #be123c; }
.toast.success { background: #d1fae5; color: #047857; }
.toast { position: fixed; right: 28px; top: 82px; z-index: 30; box-shadow: var(--shadow); }
.fab { display: none; }
