:root {
  --ink: #151a27;
  --muted: #727989;
  --line: #e7e9ef;
  --canvas: #f4f5f8;
  --panel: #ffffff;
  --nav: #111522;
  --blue: #4e5ce8;
  --blue-dark: #3945c8;
  --violet: #7568f7;
  --green: #15805e;
  --amber: #a45c0a;
  --red: #b33948;
  --shadow: 0 16px 45px rgba(22, 28, 45, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body { color: var(--ink); background: var(--canvas); font: 14px/1.5 "DM Sans", sans-serif; }
body.nav-open { overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.login-shell { display: grid; grid-template-columns: 1.08fr .92fr; min-height: 100vh; }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 10vw; color: white; background: radial-gradient(circle at 85% 10%, #5967ed 0, transparent 35%), linear-gradient(145deg, #0f1424 5%, #171d36 58%, #26306d 100%); }
.login-brand::after { position: absolute; right: -14vw; bottom: -22vw; width: 42vw; height: 42vw; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 7vw rgba(255,255,255,.025), 0 0 0 14vw rgba(255,255,255,.02); content: ""; }
.brand-mark { position: relative; display: grid; width: 52px; height: 52px; margin-bottom: 56px; place-items: center; border-radius: 15px; color: white; background: linear-gradient(135deg, #7180ff, #4a50d6); box-shadow: 0 10px 30px rgba(63, 76, 218, .4); font: 700 25px "Space Grotesk", sans-serif; }
.brand-mark::after { position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.3); border-radius: 10px; content: ""; }
.brand-mark span { position: relative; z-index: 1; }
.login-brand .eyebrow { color: #99a3ff; }
.login-brand h1 { max-width: 660px; margin: 0; font: 600 clamp(50px, 5vw, 78px)/.98 "Space Grotesk", sans-serif; letter-spacing: -.045em; }
.login-brand h1 em { color: #8792ff; font-style: normal; }
.brand-copy { max-width: 530px; margin: 28px 0 48px; color: #bdc3d5; font-size: 17px; }
.brand-stats { display: flex; gap: 12px; }
.brand-stats span { padding: 10px 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 30px; color: #bec5d9; background: rgba(255,255,255,.04); font-size: 12px; }
.brand-stats strong { color: white; }
.login-panel { display: grid; padding: 40px; place-items: center; background: #fff; }
.login-card { width: min(100%, 420px); }
.login-card h2 { margin: 0; font: 600 34px/1.2 "Space Grotesk", sans-serif; letter-spacing: -.03em; }
.login-card > .muted { margin: 9px 0 34px; }
label { display: grid; gap: 8px; margin: 0 0 18px; font-weight: 600; }
input, select { width: 100%; border: 1px solid #dfe2e9; border-radius: 10px; outline: none; padding: 12px 14px; color: var(--ink); background: white; transition: .2s; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(78,92,232,.12); }
.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; gap: 14px; border: 0; border-radius: 9px; padding: 10px 16px; font-weight: 700; }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(78,92,232,.2); }
.button.primary:hover { background: var(--blue-dark); }
.button.ghost { color: var(--ink); background: #eff1f5; }
.button.danger { color: white; background: var(--red); }
.button.wide { width: 100%; justify-content: space-between; padding-inline: 18px; }
.form-error { min-height: 21px; margin: 12px 0 0; color: var(--red); }
.modal-error:empty { display: none; }
.modal-error:not(:empty) { border-radius: 8px; padding: 9px 11px; background: #fde9ec; }
.button:disabled { cursor: wait; opacity: .65; }
.mobile-logo { display: none; }
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 4; display: flex; height: 100vh; flex-direction: column; padding: 25px 16px 18px; color: #d4d7e3; background: var(--nav); }
.nav-scrim, .sidebar-close { display: none; }
.logo-row { display: flex; align-items: center; gap: 12px; padding: 0 10px 31px; color: white; }
.brand-mark.small { width: 35px; height: 35px; margin: 0; border-radius: 10px; font-size: 17px; }
.brand-mark.small::after { inset: 5px; border-radius: 7px; }
.logo-row strong { display: block; font: 600 19px "Space Grotesk", sans-serif; }
.logo-row small { display: block; margin-top: 1px; color: #6f7895; font-size: 8px; letter-spacing: .15em; }
nav { display: grid; gap: 5px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; border: 0; border-radius: 9px; padding: 11px 12px; color: #9399ab; background: transparent; text-align: left; }
.nav-item:hover, .nav-item.active { color: white; background: #22283a; }
.nav-item.active { box-shadow: inset 3px 0 0 #7480ff; }
.nav-icon { width: 20px; color: #747d9c; font-size: 18px; text-align: center; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 15px 7px 0; border-top: 1px solid #262b3a; }
.user-chip { display: flex; min-width: 0; flex: 1; align-items: center; gap: 9px; }
.user-chip > span { display: grid; width: 31px; height: 31px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: #4e5ce8; font-weight: 700; }
.user-chip div { min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { color: white; font-size: 12px; }
.user-chip small { color: #7f879d; font-size: 10px; text-transform: capitalize; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 0; color: #7f879d; background: transparent; font-size: 19px; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; min-height: 86px; align-items: center; gap: 18px; padding: 17px 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.topbar h2 { margin: 0; font: 600 25px "Space Grotesk", sans-serif; letter-spacing: -.025em; }
.topbar .eyebrow { margin-bottom: 2px; }
.top-actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.status-dot { color: var(--muted); font-size: 12px; }
.status-dot::before { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #33ae7a; box-shadow: 0 0 0 4px rgba(51,174,122,.1); content: ""; }
.menu-button { display: none; width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 9px; background: #f0f2f7; font-size: 22px; }
.content { padding: 30px 34px 50px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.summary-card { position: relative; overflow: hidden; min-height: 136px; padding: 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 4px 16px rgba(22,28,45,.025); }
.summary-card::after { position: absolute; right: -25px; bottom: -36px; width: 93px; height: 93px; border-radius: 50%; background: var(--accent-soft); content: ""; }
.summary-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.summary-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.summary-value { display: block; margin-top: 17px; font: 600 31px "Space Grotesk", sans-serif; }
.summary-note { color: var(--muted); font-size: 11px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(285px, .7fr); gap: 18px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 4px 16px rgba(22,28,45,.025); }
.panel-head { display: flex; min-height: 82px; align-items: center; justify-content: space-between; padding: 17px 21px; border-bottom: 1px solid var(--line); }
.panel h3, .modal h3 { margin: 0; font: 600 18px "Space Grotesk", sans-serif; }
.panel-head .eyebrow { margin-bottom: 2px; }
.text-button { border: 0; color: var(--blue); background: transparent; font-weight: 700; }
.quick-panel { display: grid; align-content: start; gap: 13px; padding: 21px; }
.admin-data-tools { display: grid; gap: 10px; margin-top: 5px; border-top: 1px solid var(--line); padding-top: 18px; }
.admin-data-tools .button.wide { justify-content: center; }
.unit-card { display: flex; align-items: center; gap: 12px; border-radius: 10px; padding: 13px; background: #f7f8fb; }
.unit-card div { display: grid; }
.unit-card small { color: var(--muted); }
.unit-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; font: 700 13px "Space Grotesk"; }
.token-unit .unit-icon { color: #4b57d4; background: #e5e8ff; }
.coin-unit .unit-icon { color: #9c6206; background: #fff0c8; }
.tip { margin: 0; border-radius: 9px; padding: 11px 13px; color: #73798a; background: #f2f3f7; font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: #858b99; background: #fafbfc; font-size: 10px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
td { padding: 14px 18px; border-top: 1px solid #edf0f4; color: #414758; white-space: nowrap; }
.identity { display: flex; align-items: center; gap: 10px; }
.identity-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: var(--blue); background: #eef0ff; font-weight: 800; }
.identity div { display: grid; min-width: 0; }
.identity small { overflow-wrap: anywhere; color: var(--muted); white-space: normal; }
.badge { display: inline-flex; align-items: center; border-radius: 20px; padding: 4px 8px; font-size: 10px; font-weight: 700; }
.badge.active, .badge.bound { color: var(--green); background: #e5f6ef; }
.badge.expired, .badge.unbound { color: var(--amber); background: #fff2dd; }
.badge.suspended { color: var(--red); background: #fde9ec; }
.empty { padding: 48px 20px; color: var(--muted); text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.mini-button { border: 1px solid #e1e4eb; border-radius: 7px; padding: 6px 9px; color: #545b6b; background: white; font-size: 11px; font-weight: 700; }
.mini-button:hover { border-color: #aeb5c6; }
.mini-button.danger { color: var(--red); border-color: #f1cbd1; }
.section-toolbar { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.section-toolbar p { margin: 0; }
.search { position: relative; width: min(100%, 390px); margin: 0; }
.search span { position: absolute; top: 9px; left: 13px; color: var(--muted); font-size: 20px; }
.search input { padding-left: 39px; }
.modal { width: min(92vw, 490px); max-height: calc(100dvh - 30px); overflow-y: auto; border: 0; border-radius: 15px; padding: 0; box-shadow: 0 30px 80px rgba(11,17,35,.26); }
.modal::backdrop { background: rgba(13,18,31,.58); backdrop-filter: blur(3px); }
.modal form { padding: 25px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 24px; }
.modal-close { border: 0; color: #8c92a0; background: transparent; font-size: 26px; line-height: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label small { color: var(--muted); font-weight: 400; }
.optional { color: var(--muted); font-size: 11px; font-weight: 400; }
.input-suffix { display: flex; align-items: center; overflow: hidden; border: 1px solid #dfe2e9; border-radius: 10px; background: #f5f6f9; }
.input-suffix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(78,92,232,.12); }
.input-suffix input { min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
.input-suffix input:focus { box-shadow: none; }
.input-suffix strong { overflow: hidden; max-width: 52%; padding: 0 14px 0 8px; color: #626a7d; text-overflow: ellipsis; white-space: nowrap; }
.balance-banner { display: flex; justify-content: space-between; margin-bottom: 18px; border-radius: 9px; padding: 11px 13px; color: #4e57a1; background: #eff1ff; }
.cleanup-preview { display: grid; gap: 3px; margin: 4px 0 16px; border: 1px solid #e4e7ee; border-radius: 10px; padding: 14px; background: #f8f9fb; }
.cleanup-preview strong { font: 600 24px "Space Grotesk", sans-serif; }
.cleanup-preview small { color: var(--muted); }
.toast { position: fixed; z-index: 20; top: 20px; right: 20px; max-width: 360px; transform: translateY(-12px); border-radius: 9px; padding: 12px 16px; opacity: 0; color: white; background: #202638; box-shadow: var(--shadow); pointer-events: none; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #a63746; }
.positive { color: var(--green); font-weight: 700; }
.negative { color: var(--red); font-weight: 700; }

@media (max-width: 1000px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  input, select { min-height: 48px; font-size: 16px; }
  .button { min-height: 46px; }
  .login-shell { min-height: 100dvh; grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100dvh; padding: max(25px, env(safe-area-inset-top)) 22px max(25px, env(safe-area-inset-bottom)); }
  .login-card h2 { font-size: 30px; }
  .mobile-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 48px; font: 600 20px "Space Grotesk"; }
  .mobile-logo .brand-mark { width: 38px; height: 38px; margin: 0; border-radius: 11px; font-size: 18px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 11; width: min(84vw, 310px); height: 100dvh; padding: max(22px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 35px rgba(0,0,0,.25); }
  .sidebar-close { display: grid; width: 42px; height: 42px; margin-left: auto; place-items: center; border: 0; border-radius: 9px; color: #a7adc0; background: #23293a; font-size: 25px; }
  .logo-row { padding-right: 0; }
  .nav-scrim { position: fixed; inset: 0; z-index: 10; display: block; visibility: hidden; border: 0; opacity: 0; background: rgba(8,12,22,.58); transition: opacity .25s, visibility .25s; }
  .nav-scrim.open { visibility: visible; opacity: 1; }
  .nav-item { min-height: 48px; }
  .menu-button { display: block; }
  .topbar { min-height: 72px; gap: 11px; padding: 10px 15px; }
  .topbar > div:not(.top-actions) { min-width: 0; }
  .topbar h2 { overflow: hidden; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions .status-dot { display: none; }
  .top-actions { gap: 8px; }
  .content { padding: 18px 14px max(40px, env(safe-area-inset-bottom)); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { min-height: 122px; padding: 16px; }
  .summary-value { font-size: 26px; }
  .top-actions .button { width: 44px; min-height: 44px; padding: 0; font-size: 0; }
  .top-actions .button::after { content: "+"; font-size: 20px; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .section-toolbar > .button { width: 100%; }
  .panel-head { min-height: 72px; padding: 15px 16px; }
  .quick-panel { padding: 17px; }
  .table-wrap { overflow: visible; padding: 10px; background: #f7f8fb; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; }
  .table-wrap tr { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 3px 12px rgba(22,28,45,.035); }
  .table-wrap td { display: grid; min-height: 48px; grid-template-columns: minmax(72px, .34fr) minmax(0, 1fr); align-items: center; gap: 12px; border-top: 1px solid #edf0f4; padding: 11px 13px; white-space: normal; }
  .table-wrap td:first-child { border-top: 0; }
  .table-wrap td::before { align-self: start; color: #8a909e; content: attr(data-label); font-size: 9px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
  .table-wrap td[data-label="Actions"] { grid-template-columns: 1fr; }
  .table-wrap td[data-label="Actions"]::before { margin-bottom: -4px; }
  .actions { width: 100%; }
  .mini-button { min-height: 40px; flex: 1 1 92px; padding: 8px 10px; }
  .modal { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .modal form { padding: 20px 18px max(20px, env(safe-area-inset-bottom)); }
  .modal-head { margin-bottom: 20px; }
  .modal-close { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 9px; background: #f2f3f7; }
  .modal-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-actions .button { width: 100%; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .balance-banner { align-items: flex-start; flex-direction: column; gap: 4px; }
  .toast { top: max(12px, env(safe-area-inset-top)); right: 12px; left: 12px; max-width: none; }
}
@media (max-width: 460px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 112px; }
  .table-wrap td { grid-template-columns: 68px minmax(0, 1fr); }
  .modal-actions { grid-template-columns: 1fr; }
}
