:root {
  --ink: #12243a;
  --muted: #64758a;
  --line: #dce5ef;
  --surface: #ffffff;
  --canvas: #eef4fb;
  --primary: #168ef0;
  --primary-dark: #0b65b4;
  --cyan: #0fcff3;
  --shadow: 0 18px 45px rgba(31, 60, 92, .12);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
[hidden] { display: none !important; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #d7f8ff 0, transparent 35%), linear-gradient(145deg, #edf4fc, #dce9f7); }
.login-card { width: min(440px, 100%); padding: 40px; border-radius: 26px; background: #fff; box-shadow: var(--shadow); }
.logo { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; color: #00101d; background: var(--cyan); font-size: 32px; font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin: 14px 0 8px; font-size: 38px; } h1 span, .side-brand span { color: var(--cyan); }
.eyebrow { margin-bottom: 5px; color: #42617f; font-size: 12px; font-weight: 900; letter-spacing: .13em; }
.muted, .hint { color: var(--muted); }
label { display: grid; gap: 7px; margin-top: 16px; color: #3f5670; font-size: 13px; font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid #cad8e7; border-radius: 12px; padding: 13px 14px; color: var(--ink); background: #f9fbfe; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,142,240,.12); }
form > button, .card-title > button, .action.primary { margin-top: 20px; padding: 13px 18px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #199bf9, #1475e3); font-weight: 900; box-shadow: 0 8px 20px rgba(20,117,227,.22); }
.message { min-height: 20px; margin: 12px 0 0; color: #bc2d5d; font-size: 13px; font-weight: 700; }
.app { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
aside { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; color: #fff; background: #071525; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; font-size: 23px; }
.side-brand .logo { width: 44px; height: 44px; font-size: 25px; }
nav { display: grid; gap: 7px; }
.nav, .ghost { padding: 13px 15px; border-radius: 11px; color: #aebed1; background: transparent; text-align: left; font-weight: 800; }
.nav:hover, .nav.active { color: #fff; background: #15304d; }
.account { margin-top: auto; display: grid; gap: 5px; padding: 16px 8px 0; border-top: 1px solid #21344a; }
.account span { color: #8ca2bb; font-size: 12px; text-transform: uppercase; }
.account .ghost { margin-top: 8px; padding-left: 0; }
main { min-width: 0; padding: 28px 34px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h2 { margin: 0; font-size: 30px; }
.live { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: #23c47e; box-shadow: 0 0 0 5px rgba(35,196,126,.13); }
.page { display: none; }.page.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.metric { position: relative; min-height: 205px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 28px; border-radius: 24px; color: #fff; box-shadow: var(--shadow); }
.metric::after { content: ""; position: absolute; width: 170px; height: 260px; right: -30px; top: -65px; transform: rotate(-15deg); background: rgba(255,255,255,.15); }
.metric span { font-size: 14px; letter-spacing: .08em; }.metric strong { margin: 7px 0; font-size: 50px; }.metric small { font-size: 14px; opacity: .92; }
.blue { background: linear-gradient(145deg, #259de3, #176bcd); }.green { background: linear-gradient(145deg, #25bd80, #139b62); }.pink { background: linear-gradient(145deg, #dd6598, #bd397c); }.slate { background: linear-gradient(145deg, #6d8295, #38536c); }
.card { padding: 24px; border: 1px solid rgba(198,215,231,.8); border-radius: 22px; background: var(--surface); box-shadow: 0 12px 35px rgba(43,72,105,.08); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.card-title h3 { margin: 0; font-size: 22px; }.card-title > button { margin: 0; }
.split { display: grid; grid-template-columns: minmax(310px, .8fr) minmax(560px, 1.6fr); gap: 20px; align-items: start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { max-width: 240px; }
.client-list, .reseller-list { display: grid; gap: 11px; }
.client-row, .reseller-row { display: grid; grid-template-columns: minmax(240px,1.8fr) minmax(120px,1fr) minmax(110px,.8fr) minmax(140px,1fr) auto; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f8fbff; }
.client-row:nth-child(even) { background: #eef6ff; }
.client-name strong, .reseller-row strong { display: block; }.client-name span, .cell-sub { color: var(--muted); font-size: 12px; }
.source-details { display: grid; gap: 4px; margin: 11px 0 0; }
.source-details div { min-width: 0; display: grid; grid-template-columns: 66px minmax(0,1fr); gap: 7px; align-items: baseline; }
.source-details dt { color: #55708b; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.source-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #183a5a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 700; }
.code-value { font-size: 17px; font-weight: 900; letter-spacing: .05em; }
.badge { display: inline-flex; padding: 6px 10px; border-radius: 99px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.badge.active { color: #08774a; background: #d7f7e9; }.badge.blocked { color: #a32c59; background: #ffe0eb; }.badge.expired { color: #8d4d0c; background: #ffedd4; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.action { padding: 9px 11px; border-radius: 9px; color: #15547c; background: #e1f2ff; font-size: 12px; font-weight: 900; }
.action.danger { color: #a82a57; background: #ffe1eb; }.action.success { color: #08774a; background: #d8f7e9; }
.action.message-action { color: #65420a; background: #fff0c8; }
.action.source-action { color: #5a36a3; background: #eee7ff; }
.empty { padding: 34px; color: var(--muted); text-align: center; border: 1px dashed #bdccdc; border-radius: 15px; }
.empty.small { padding: 18px; }
.check { display: flex; align-items: center; gap: 10px; }.check input { width: auto; }
.remember-access { cursor: pointer; font-size: 14px; }
.remember-access input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.remember-hint { margin: 7px 0 0 28px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.release { padding: 24px; border-radius: 17px; background: #edf6ff; line-height: 1.8; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 380px; padding: 14px 18px; border-radius: 12px; color: #fff; background: #14324e; box-shadow: var(--shadow); font-weight: 800; }
.message-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 36px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: #fff; box-shadow: 0 28px 90px rgba(6,23,40,.35); }
.message-dialog::backdrop { background: rgba(5,19,33,.64); backdrop-filter: blur(3px); }
.message-dialog form { padding: 26px; }
.source-dialog { width: min(620px, calc(100vw - 28px)); }
.source-dialog input[readonly] { color: #38526b; background: #edf3f8; cursor: default; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-heading h3 { margin: 0; font-size: 23px; }
.dialog-close { width: 42px; height: 42px; border-radius: 50%; color: #52687f; background: #edf3f9; font-size: 26px; }
.dialog-actions { justify-content: flex-end; margin-top: 18px; }
.dialog-actions button { margin: 0; padding: 12px 17px; border-radius: 11px; font-weight: 900; }
.dialog-actions button[type="submit"] { color: #fff; background: linear-gradient(135deg, #199bf9, #1475e3); }
.ghost-button { color: #52687f; background: #edf3f9; }
.message-history { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
#message-history-list { max-height: 260px; overflow: auto; display: grid; gap: 9px; }
.message-history-item { padding: 14px; border-left: 5px solid #1d8ee8; border-radius: 12px; background: #f3f8fd; }
.message-history-item.warning { border-left-color: #e9a719; background: #fff8e7; }
.message-history-item.success { border-left-color: #21a66c; background: #ecfbf4; }
.message-history-item strong, .message-history-item span { display: block; }
.message-history-item span, .message-history-item small { color: var(--muted); font-size: 12px; }
.message-history-item p { margin: 9px 0; white-space: pre-wrap; }
code { padding: 2px 5px; border-radius: 5px; background: #e8f0f8; }
@media (max-width: 1180px) { .metric-grid { grid-template-columns: repeat(2,1fr); }.split { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { display: block; } aside { position: static; height: auto; padding: 14px; } nav { grid-template-columns: repeat(2,1fr); }.account { display: none; }
  main { padding: 20px 14px 40px; }.topbar { align-items: flex-end; }.metric-grid { grid-template-columns: 1fr; }.metric { min-height: 175px; }
  .two { grid-template-columns: 1fr; }.client-row, .reseller-row { grid-template-columns: 1fr 1fr; }.client-row .client-name { grid-column: 1/-1; }.actions { grid-column: 1/-1; justify-content: flex-start; }
  .card { padding: 16px; }.card-title { align-items: flex-start; flex-direction: column; }.search { max-width: none; }
}
