:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel2: #f3f7fb;
  --line: #dce5ef;
  --line-strong: #c9d7e6;
  --text: #162033;
  --muted: #6f8095;
  --cyan: #00a8d8;
  --blue: #246bfe;
  --blue-dark: #174fc2;
  --green: #18a66f;
  --red: #d94c5c;
  --yellow: #bd7a00;
  --shadow: 0 16px 44px rgba(42, 65, 94, .10);
  --shadow-soft: 0 8px 24px rgba(42, 65, 94, .07);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: #ffffff; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(36,107,254,.075), transparent 26%),
    radial-gradient(circle at 95% 25%, rgba(0,168,216,.055), transparent 24%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.app-shell { min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  background: rgba(255,255,255,.96);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
  box-shadow: 8px 0 28px rgba(49,76,108,.04);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 4px 8px 18px;
}
.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 9px 18px rgba(20,103,220,.14));
}
.brand span { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-size: 19px; color: #13213a; }
.brand small { color: var(--muted); font-size: 11px; }
.sidebar nav { display: flex; flex-direction: column; gap: 5px; overflow: auto; }
.sidebar nav a {
  padding: 11px 12px;
  border-radius: 11px;
  text-decoration: none;
  color: #4f6278;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: .18s ease;
}
.sidebar nav a:hover {
  background: linear-gradient(90deg, rgba(36,107,254,.09), rgba(0,168,216,.045));
  border-color: rgba(36,107,254,.10);
  color: #1757d2;
  transform: translateX(2px);
}
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #8a9aad;
  margin: 16px 12px 4px;
}
.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 10px 2px;
  display: grid;
  gap: 4px;
}
.sidebar-foot span { font-weight: 750; color: #24354b; }
.sidebar-foot small { color: var(--muted); }
.sidebar-foot a { margin-top: 8px; color: #c54252; font-size: 13px; font-weight: 700; }

/* Main */
.main-wrap { margin-left: 250px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  box-shadow: 0 6px 24px rgba(49,76,108,.035);
}
.topbar > div:nth-child(2) { display: flex; flex-direction: column; }
.topbar strong { color: #1d2d43; }
.topbar small { color: var(--muted); font-size: 11px; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--line); color: #23364d; font-size: 24px; border-radius: 10px; width: 42px; height: 42px; cursor: pointer; }
.coin-pill {
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid rgba(24,166,111,.19);
  border-radius: 999px;
  background: #effbf6;
  color: #11815a;
  font-weight: 800;
  font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.65);
}
.content { padding: 26px; flex: 1; max-width: 1500px; width: 100%; margin: 0 auto; }
.footer { text-align: center; color: #7d8da0; font-size: 12px; padding: 20px; border-top: 1px solid var(--line); background: rgba(255,255,255,.65); }

/* Layout */
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 20px;
}
.card h2, .card h3 { color: #1d2c41; }
.stat { position: relative; overflow: hidden; }
.stat::after {
  content: "";
  position: absolute;
  width: 84px;
  height: 84px;
  right: -32px;
  top: -34px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36,107,254,.12), rgba(36,107,254,0) 70%);
  pointer-events: none;
}
.stat span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.stat strong { display: block; font-size: 28px; margin-top: 8px; color: #172a45; }
.stat small { color: #8494a7; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-head h2 { font-size: 19px; margin: 0; color: #1d2c41; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--blue), #4b7cff);
  color: #fff;
  text-decoration: none;
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(36,107,254,.16);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(36,107,254,.20); filter: saturate(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: #fff; border-color: var(--line-strong); color: #35506d; box-shadow: 0 4px 12px rgba(42,65,94,.05); }
.btn.secondary:hover { border-color: #a9bdd2; background: #f8fbff; }
.btn.green { background: linear-gradient(135deg, #169c6a, #20bd82); box-shadow: 0 7px 16px rgba(24,166,111,.15); }
.btn.danger { background: #fff4f5; border-color: #f0c8cd; color: #c13f50; box-shadow: none; }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 8px 22px rgba(42,65,94,.045); }
.table { border-collapse: collapse; width: 100%; min-width: 760px; background: #fff; }
.table th, .table td { text-align: left; padding: 13px 14px; border-bottom: 1px solid #e8eef5; font-size: 13px; vertical-align: top; }
.table th { color: #65788e; background: #f7f9fc; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: #fbfdff; }
.table tr:last-child td { border-bottom: 0; }

/* Forms */
.muted { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 7px; margin-bottom: 2px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #4a5d74; font-size: 12px; font-weight: 700; }
.input, .select, .textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: #1e2d41;
  padding: 12px 13px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(42,65,94,.025);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #9aa8b8; }
.input[readonly] { background: #f7f9fc; color: #52657b; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #6e9cff; box-shadow: 0 0 0 3px rgba(36,107,254,.10); background: #fff; }
.help { font-size: 11px; color: var(--muted); }

/* Badges & alerts */
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #eef3f8; color: #566a80; border: 1px solid #e0e8f0; }
.badge.active, .badge.approved, .badge.available { background: #edfaf4; color: #148159; border-color: #cfeee0; }
.badge.pending { background: #fff8e8; color: #9b6808; border-color: #f2e1b6; }
.badge.suspended, .badge.reversed, .badge.cancelled { background: #fff0f2; color: #be4150; border-color: #f0ccd1; }
.alert { border-radius: 13px; padding: 13px 15px; margin-bottom: 14px; border: 1px solid #d6e2ee; background: #f4f8fc; color: #3d536b; }
.alert.success { border-color: #cdebdc; background: #effaf5; color: #14734f; }
.alert.danger { border-color: #efcbd0; background: #fff2f3; color: #ad3747; }
.alert.warning { border-color: #eedda9; background: #fff8e7; color: #87600d; }

/* Hero & network */
.hero { display: grid; grid-template-columns: 1.4fr .8fr; gap: 20px; align-items: center; background: linear-gradient(135deg, #fff 0%, #f7fbff 100%); border-color: #d9e6f3; box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(30px, 5vw, 56px); line-height: 1.05; margin: 0 0 14px; color: #132b4e; letter-spacing: -.035em; }
.hero p { color: var(--muted); font-size: 17px; line-height: 1.65; }
.hero-logo { width: min(300px,100%); justify-self: center; filter: drop-shadow(0 20px 30px rgba(44,103,178,.14)); }
.level-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 11px; }
.level-box { padding: 15px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-align: center; box-shadow: 0 6px 18px rgba(42,65,94,.045); }
.level-box strong { display: block; font-size: 22px; margin-top: 5px; color: #1b375b; }
.copy-box { display: flex; gap: 8px; }
.copy-box .input { flex: 1; }
.empty { text-align: center; padding: 38px; color: var(--muted); }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 15% 12%, rgba(36,107,254,.10), transparent 30%),
    radial-gradient(circle at 86% 80%, rgba(0,168,216,.08), transparent 28%),
    #f7f9fc;
}
.auth-card {
  width: min(980px,100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  background: #fff;
  border: 1px solid #d9e4ef;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(42,65,94,.14);
}
.auth-brand {
  padding: 52px;
  background: linear-gradient(145deg, #f4f9ff, #ffffff 65%);
  border-right: 1px solid #e2eaf3;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-brand img { width: 260px; max-width: 100%; align-self: center; filter: drop-shadow(0 18px 30px rgba(44,103,178,.13)); }
.auth-brand h1 { font-size: 42px; margin: 20px 0 10px; color: #142b4c; letter-spacing: -.035em; }
.auth-brand p { color: var(--muted); line-height: 1.65; }
.auth-form { padding: 46px; display: flex; flex-direction: column; justify-content: center; background: #fff; }
.auth-form h2 { font-size: 26px; margin: 0 0 8px; color: #1a2c43; }
.auth-form > p { color: var(--muted); margin: 0 0 25px; }
.auth-form .field { margin-bottom: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 13px; color: #65778c; }
.auth-links a { color: #1f65dc; font-weight: 700; }
.maintenance { text-align: center; }
.maintenance img { width: 260px; max-width: 80%; }
.maintenance h1 { font-size: 48px; margin: 8px 0; }

/* Utility blocks */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f5f8fb; border: 1px solid #dbe5ef; color: #334b65; border-radius: 10px; padding: 10px; word-break: break-all; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 9px 12px; border-radius: 9px; text-decoration: none; background: #fff; border: 1px solid var(--line); color: #4b6078; font-size: 12px; }
.tabs a:hover { background: #f7faff; border-color: #c7d8e9; color: #205dc5; }
.note { border-left: 3px solid var(--blue); padding: 10px 14px; background: #f2f7ff; color: #4e647c; border-radius: 0 10px 10px 0; }
.kpi-good { color: #13855b; }
.kpi-warn { color: #a97000; }
.kpi-bad { color: #c54555; }

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

@media (max-width: 820px) {
  .sidebar { transform: translateX(-102%); transition: transform .2s ease; box-shadow: 18px 0 45px rgba(42,65,94,.13); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .content { padding: 18px; overflow-x: hidden; }
  .topbar { padding: 0 18px; }
  .auth-card { grid-template-columns: 1fr; }
  .auth-brand { padding: 30px; border-right: 0; border-bottom: 1px solid #e2eaf3; }
  .auth-brand img { width: 180px; }
  .auth-brand h1 { font-size: 30px; }
  .auth-form { padding: 30px; }
  .hero { grid-template-columns: 1fr; }
  .hero-logo { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .table { min-width: 680px; }
}

@media (max-width: 520px) {
  .grid.cards { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: 1fr; }
  .coin-pill { font-size: 11px; padding: 8px 10px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar > div:nth-child(2) small { display: none; }
  .topbar { gap: 10px; height: 66px; }
  .content { padding: 14px; }
  .card { padding: 16px; border-radius: 15px; }
  .auth-links { flex-direction: column; }
  .copy-box { flex-direction: column; }
  .auth-brand, .auth-form { padding: 24px; }
  .auth-card { border-radius: 20px; }
  .section-head { align-items: flex-start; }
}

/* Current navigation state */
.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(36,107,254,.11), rgba(0,168,216,.055));
  border-color: rgba(36,107,254,.13);
  color: #1757d2;
  font-weight: 800;
}
