:root {
  --ink: #17182c;
  --muted: #777a91;
  --line: #e6e8f0;
  --soft: #f5f6fa;
  --purple: #6d52ed;
  --purple-dark: #2d236d;
  --green: #27aa84;
  --red: #d9485f;
  --amber: #b27c1f;
  --shadow: 0 18px 55px rgba(30, 32, 67, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--soft); font-family: Tahoma, Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.page-width { width: min(1180px, calc(100% - 36px)); margin-inline: auto; }
.brand { display: flex; align-items: center; gap: 11px; direction: ltr; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-weight: 900; background: linear-gradient(145deg, #7c5cff, #4c32ce); box-shadow: 0 10px 25px rgba(98, 74, 227, .28); }
.brand > div { display: grid; gap: 3px; }
.brand strong { font-size: 13px; letter-spacing: .07em; }
.brand small { color: #8a8da0; font-size: 9px; }
.button { min-height: 42px; border: 0; border-radius: 12px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; font-weight: 700; font-size: 12px; }
.button.primary { color: #fff; background: linear-gradient(135deg, #795df4, #5b3edb); box-shadow: 0 10px 25px rgba(98, 72, 224, .22); }
.button.secondary { color: #3d3d50; background: #f2f3f7; border: 1px solid #e1e3eb; }
.button.ghost { color: #6151c8; background: #f0eeff; }
.button.danger { color: #fff; background: var(--red); }
.button.success { color: #fff; background: var(--green); }
.button.tiny { min-height: 34px; padding-inline: 11px; font-size: 10px; }
.button.wide { width: 100%; }
.quiet-link { color: #6c5bc8; font-size: 11px; text-decoration: none; }
.muted { color: var(--muted); font-size: 11px; line-height: 1.9; }

.access-page { min-height: 100vh; background: radial-gradient(circle at 50% 0, #eae6ff 0, #f7f7fc 36%, #f3f4f8 100%); }
.access-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.access-card { width: min(440px, 100%); padding: 34px; border: 1px solid rgba(225, 225, 238, .9); border-radius: 28px; background: rgba(255, 255, 255, .94); box-shadow: 0 30px 90px rgba(47, 42, 100, .15); text-align: center; }
.access-card .brand { justify-content: center; margin-bottom: 26px; }
.hero-icon { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 18px; display: grid; place-items: center; background: #f0edff; font-size: 25px; }
.hero-icon.danger { color: var(--red); background: #fff0f2; font-weight: 900; }
.access-card h1 { margin: 0 0 11px; font-size: 24px; }
.access-card > p { margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 2; }
.access-card .button { margin-top: 14px; }
.access-card .quiet-link { display: block; margin-top: 18px; }
.login-card { text-align: right; }
.login-card h1, .login-card > p { text-align: center; }
.login-card .field { margin-top: 13px; }

.notice { padding: 12px 14px; color: #5b4bad; background: #f2efff; border: 1px solid #e2dcff; border-radius: 13px; font-size: 10px; line-height: 1.9; }
.notice.trust { color: #266f5f; background: #ecfaf6; border-color: #d3f1e8; }
.danger-notice { color: #a63c4e; background: #fff1f3; border-color: #f4cfd6; }
.field { display: grid; gap: 7px; text-align: right; }
.field > span { color: #5b5d70; font-size: 10px; font-weight: 700; }
.field input, .field select { width: 100%; min-height: 44px; border: 1px solid #dfe1e9; border-radius: 11px; padding: 0 12px; color: var(--ink); background: #fafafd; outline: none; }
.field input:focus, .field select:focus { border-color: #8c76ef; box-shadow: 0 0 0 3px rgba(111, 82, 237, .1); }

.topbar { height: 74px; position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .93); border-bottom: 1px solid #e5e7ee; backdrop-filter: blur(14px); }
.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.health-pill { max-width: 310px; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; color: #27775f; background: #eaf9f4; border: 1px solid #d6f0e8; border-radius: 99px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-pill i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #35c99c; box-shadow: 0 0 0 4px rgba(53, 201, 156, .12); }
.health-pill.offline { color: #a44757; background: #fff1f3; border-color: #f3d1d6; }
.health-pill.offline i { background: var(--red); box-shadow: 0 0 0 4px rgba(217, 72, 95, .1); }

.dashboard-stack, .customer-stack { display: grid; gap: 20px; padding-block: 28px 48px; }
.welcome-card { min-height: 155px; padding: 28px; border-radius: 27px; color: #fff; background: linear-gradient(118deg, #211d59, #3e2d97 55%, #6a4bf0); box-shadow: 0 22px 55px rgba(56, 41, 142, .24); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.welcome-card h1 { margin: 6px 0 8px; font-size: 27px; }
.welcome-card p { margin: 0; color: #cbc6ed; font-size: 11px; }
.eyebrow { display: block; color: #745bec; font-size: 9px; font-weight: 900; letter-spacing: .03em; }
.welcome-card .eyebrow, .service-hero .eyebrow { color: #cbc2ff; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.metric { min-height: 132px; padding: 19px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); display: grid; align-content: center; }
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { margin: 8px 0 2px; font-size: 28px; }
.metric small { color: #a1a3b0; font-size: 9px; }
.infra-grid { display: grid; grid-template-columns: 1.5fr .7fr; gap: 15px; }
.panel-card { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.panel-card.compact h2 { margin: 8px 0; font-size: 28px; }
.panel-card.compact > p { color: var(--muted); font-size: 10px; direction: ltr; text-align: right; overflow-wrap: anywhere; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-title h2 { margin: 6px 0 0; font-size: 21px; }
.section-title p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.route-visual { min-height: 135px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; background: #f8f7fe; border: 1px solid #e8e4fb; border-radius: 18px; }
.route-node { min-width: 120px; display: grid; place-items: center; gap: 6px; text-align: center; }
.route-node b { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: #33415f; font-size: 11px; }
.route-node.featured b { background: linear-gradient(145deg, #7b5ef0, #5a3ed1); }
.route-node span { font-size: 11px; font-weight: 800; }
.route-node small { max-width: 120px; color: #9294a5; font-size: 8px; direction: ltr; overflow: hidden; text-overflow: ellipsis; }
.route-arrow { color: #8d7be8; font-style: normal; }

.services-card { padding: 0; overflow: hidden; }
.services-card > .section-title { padding: 23px 24px 0; }
.search { min-width: 270px; height: 42px; border: 1px solid #e1e3ea; border-radius: 12px; background: #fafafd; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.search span { color: #8b8d9b; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 10px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 12px 16px; color: #8d8f9d; background: #f8f9fb; border-block: 1px solid #eceef3; text-align: right; font-size: 9px; }
td { padding: 15px 16px; border-bottom: 1px solid #edeef3; font-size: 10px; vertical-align: middle; }
td > strong, td > small { display: block; }
td > small { margin-top: 5px; color: #9698a7; }
.customer-cell { display: flex; align-items: center; gap: 10px; }
.customer-cell > span { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #6249d7; background: #efeafe; font-weight: 900; }
.customer-cell div { display: grid; gap: 5px; }
.customer-cell small { color: #9b9dab; font-size: 8px; }
.progress { width: 120px; height: 6px; margin-top: 8px; display: block; overflow: hidden; border-radius: 99px; background: #e8e9ef; }
.progress i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #6ce1c2, #6b54e8); }
.status { min-height: 24px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 99px; color: #268068; background: #eaf9f4; font-size: 8px; font-weight: 800; }
.status.disabled, .status.offline { color: #777a89; background: #eff0f3; }
.status.expired, .status.quota { color: #a66d13; background: #fff5df; }
.status.light { color: #e7e3ff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); }
.empty { padding: 35px; color: var(--muted); text-align: center; font-size: 11px; }

.modal { width: min(580px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 24px; border: 0; border-radius: 24px; color: var(--ink); background: #fff; box-shadow: 0 30px 90px rgba(20, 17, 59, .28); overflow: auto; }
.modal::backdrop { background: rgba(20, 18, 48, .58); backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.modal-head h2 { margin: 6px 0 5px; font-size: 21px; }
.modal-head p, .modal > p { color: var(--muted); font-size: 10px; line-height: 1.9; }
.close { width: 36px; height: 36px; border: 1px solid #e2e3e9; border-radius: 11px; color: #6d6f7e; background: #f8f8fa; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.modal .notice { margin: 12px 0; }
.service-modal { width: min(650px, calc(100% - 28px)); }
.copy-box { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border: 1px solid #e5e2f6; border-radius: 14px; background: #f8f6ff; }
.copy-box span { grid-column: 1 / -1; color: #7262bd; font-size: 9px; }
.copy-box input { min-width: 0; border: 0; color: #555668; background: transparent; font-size: 9px; }
.copy-box button { border: 0; border-radius: 9px; color: #fff; background: var(--purple); font-size: 9px; }
.drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 14px 0; }
.drawer-stats article { padding: 13px; display: grid; gap: 6px; border: 1px solid #e7e8ee; border-radius: 13px; }
.drawer-stats span { color: var(--muted); font-size: 8px; }
.drawer-stats strong { font-size: 13px; }
.renew-box { padding: 16px; border: 1px solid #e6e2fb; border-radius: 16px; background: #f9f8ff; }
.renew-box h3 { margin: 0; font-size: 14px; }
.renew-box p { margin: 7px 0 13px; color: var(--muted); font-size: 9px; line-height: 1.8; }
.action-row { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.action-row form { margin: 0; }
.danger-text { color: var(--red); }
.qr-modal { text-align: center; width: min(400px, calc(100% - 28px)); }
.qr-modal .modal-head { text-align: right; }
.qr-modal img { width: min(260px, 80vw); height: auto; border: 1px solid #e5e1f7; border-radius: 18px; padding: 12px; }

.service-hero { padding: 29px; border-radius: 28px; color: #fff; background: linear-gradient(118deg, #211d59, #3d2c96 50%, #6a4bf0); box-shadow: 0 22px 55px rgba(56, 41, 142, .25); }
.hero-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.hero-title > div > span { color: #c5bff0; font-size: 9px; }
.hero-title h1 { margin: 7px 0; font-size: 27px; }
.hero-title p { margin: 0; color: #c7c2e9; font-size: 10px; }
.quota-layout { display: grid; grid-template-columns: auto 1.2fr .6fr .6fr; align-items: center; gap: 18px; margin-top: 24px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .13); }
.quota-ring { --value: 0%; width: 125px; height: 125px; padding: 12px; border-radius: 50%; background: conic-gradient(#6ee4c4 var(--value), rgba(255, 255, 255, .13) 0); display: grid; place-items: center; }
.quota-ring > div { width: 100%; height: 100%; border-radius: 50%; background: #342a7f; display: grid; place-content: center; text-align: center; }
.quota-ring strong { font-size: 24px; }
.quota-ring span { margin-top: 5px; color: #c6c1e8; font-size: 8px; }
.quota-copy { display: grid; gap: 9px; }
.quota-copy > span { color: #bcb7df; font-size: 9px; }
.quota-copy > strong { font-size: 13px; }
.hero-progress { width: 100%; background: rgba(255, 255, 255, .13); }
.hero-stat { min-height: 88px; padding: 13px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 15px; background: rgba(255, 255, 255, .07); display: grid; align-content: center; gap: 8px; text-align: center; }
.hero-stat span { color: #bbb6de; font-size: 8px; }
.hero-stat strong { font-size: 11px; }
.device-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.device-card { padding: 16px; border: 1px solid #e6e7ed; border-radius: 18px; background: #fff; }
.device-head { display: flex; align-items: center; gap: 10px; }
.device-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; background: #eeeafe; font-size: 20px; }
.device-head > div { min-width: 0; flex: 1; display: grid; gap: 5px; }
.device-head strong { font-size: 11px; }
.device-head small { color: #9698a6; font-size: 8px; direction: ltr; text-align: right; }
.device-usage { margin: 14px 0; padding-top: 12px; border-top: 1px dashed #e2e4ea; display: flex; align-items: center; justify-content: space-between; }
.device-usage span { color: var(--muted); font-size: 9px; }
.device-usage strong { font-size: 11px; }
.device-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }
.flash-stack { position: fixed; z-index: 1000; left: 50%; top: 18px; width: min(430px, calc(100% - 28px)); transform: translateX(-50%); display: grid; gap: 7px; }
.flash { padding: 12px 15px; border-radius: 12px; color: #fff; background: #292b43; box-shadow: 0 15px 45px rgba(25, 25, 52, .2); font-size: 10px; }
.flash.success { background: #247b64; }
.flash.error { background: #a43d4e; }

@media (max-width: 850px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .infra-grid { grid-template-columns: 1fr; }
  .quota-layout { grid-template-columns: auto 1fr; }
  .hero-stat { grid-row: 2; }
}

@media (max-width: 650px) {
  .page-width { width: min(100% - 20px, 1180px); }
  .topbar { height: 66px; position: static; }
  .brand-mark { width: 39px; height: 39px; border-radius: 12px; font-size: 12px; }
  .brand strong { font-size: 11px; }
  .brand small { font-size: 8px; }
  .health-pill { max-width: 125px; font-size: 8px; }
  .top-actions .button { min-height: 35px; padding-inline: 10px; font-size: 9px; }
  .dashboard-stack, .customer-stack { padding-block: 14px 28px; gap: 13px; }
  .welcome-card { min-height: 175px; padding: 20px; border-radius: 21px; flex-direction: column; align-items: stretch; }
  .welcome-card h1 { font-size: 22px; }
  .metric-grid { gap: 9px; }
  .metric { min-height: 110px; padding: 14px; border-radius: 16px; }
  .metric strong { font-size: 23px; }
  .panel-card { padding: 16px; border-radius: 20px; }
  .section-title { align-items: flex-end; }
  .section-title h2 { font-size: 18px; }
  .services-card > .section-title { padding: 18px 15px 0; flex-direction: column; align-items: stretch; }
  .search { min-width: 0; width: 100%; }
  .route-visual { gap: 7px; padding: 12px 6px; }
  .route-node { min-width: 74px; }
  .route-node span { font-size: 9px; }
  .route-node small { max-width: 75px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .drawer-stats { gap: 6px; }
  .drawer-stats article { padding: 10px 7px; }
  .service-hero { padding: 20px 15px; border-radius: 21px; }
  .hero-title h1 { font-size: 21px; }
  .quota-layout { grid-template-columns: 1fr 1fr; gap: 10px; }
  .quota-ring { grid-column: 1 / -1; width: 120px; height: 120px; margin-inline: auto; }
  .quota-copy { grid-column: 1 / -1; }
  .hero-stat { grid-row: auto; min-height: 75px; }
  .device-grid { grid-template-columns: 1fr; }
  .devices-card .section-title { align-items: stretch; flex-direction: column; }
  .access-card { padding: 26px 18px; border-radius: 23px; }
  .modal { padding: 18px 14px; border-radius: 20px; }
}
