:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #f4f8ff;
  background: #020914;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 72% 12%, rgba(0, 100, 255, .08), transparent 34%), #020914; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(30px, 3vw, 42px); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 8px; color: #20a2ff; font-size: 11px; font-weight: 800; letter-spacing: 2px; }
.subtitle, .muted { margin-bottom: 0; color: #8fa4bf; font-size: 15px; }
.error { min-height: 20px; margin: 14px 0 0; color: #ff758c; }

.app-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid #075d95; background: #020b17; box-shadow: 18px 0 50px rgba(0, 67, 144, .12); }
.sidebar::before, .sidebar::after { content: ""; position: absolute; pointer-events: none; opacity: .35; }
.sidebar::before { inset: 180px -80px auto 40px; width: 300px; height: 300px; border: 1px solid #064f83; transform: rotate(45deg); }
.sidebar::after { right: -10px; bottom: 35px; width: 230px; height: 160px; border-right: 2px solid #0a8fff; border-bottom: 2px solid #0a8fff; transform: skewY(-12deg); }
.brand-panel { position: relative; z-index: 1; height: 178px; padding: 20px 22px 8px; display: grid; place-items: center; border-bottom: 1px solid rgba(22, 95, 147, .4); }
.brand-panel img { display: block; width: 100%; max-height: 140px; object-fit: contain; filter: saturate(1.18) contrast(1.06); }
.sidebar-nav { position: relative; z-index: 2; display: grid; padding-top: 12px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 17px; min-height: 66px; padding: 0 32px; border: 0; border-left: 3px solid transparent; color: #91a3ba; background: transparent; text-decoration: none; font-size: 16px; text-align: left; }
.nav-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover, .nav-item.active { color: #0ea5ff; background: rgba(0, 127, 255, .08); }
.nav-item.active { border-left-color: #159dff; box-shadow: inset 0 -1px rgba(12, 137, 221, .5), inset 0 1px rgba(12, 137, 221, .5); }
.nav-item.active::after { content: ""; position: absolute; right: -1px; top: 19px; width: 5px; height: 28px; background: #1ca7ff; box-shadow: 0 0 18px 5px #0e80ed; }
.nav-button { width: 100%; }
.sidebar-footer { position: relative; z-index: 2; display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 24px 31px; color: #647d98; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #25cf8a; box-shadow: 0 0 10px #25cf8a; }

.main-content { width: 100%; max-width: 1640px; padding: 42px 44px 72px; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-bottom: 32px; }
.top-actions { display: flex; gap: 14px; flex-shrink: 0; }
.primary-button, .outline-button, .ghost-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 6px; padding: 0 22px; font-weight: 750; }
.primary-button { border: 1px solid #158dff; color: white; background: #086cf0; box-shadow: 0 0 24px rgba(0, 119, 255, .32), inset 0 1px rgba(255, 255, 255, .16); }
.primary-button:hover { background: #147cff; }
.primary-button:disabled { opacity: .6; cursor: wait; }
.outline-button { border: 1px solid #087fd0; color: #25a7ff; background: rgba(2, 12, 25, .65); }
.outline-button:hover { color: white; border-color: #24a8ff; background: rgba(7, 79, 139, .28); }
.ghost-button { border: 1px solid #263e58; color: #a8bbcf; background: #0a1625; }
.button-icon { font-size: 25px; font-weight: 400; line-height: 1; }
.compact { min-height: 40px; padding: 0 15px; font-size: 13px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 30px; }
.metric-card { --tone: #0a91ff; position: relative; min-height: 145px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; padding: 27px 28px; border: 1px solid #1b3f60; border-radius: 10px; background: rgba(7, 20, 36, .82); box-shadow: inset 0 -1px var(--tone), 0 15px 45px rgba(0, 0, 0, .18); }
.metric-card::after { content: ""; position: absolute; left: 28%; right: 28%; bottom: -4px; height: 6px; background: var(--tone); filter: blur(7px); }
.metric-card.orange { --tone: #ff7800; }
.metric-card.gold { --tone: #ffb20e; }
.metric-card span { display: block; margin-bottom: 11px; color: #a8b7cb; font-size: 15px; }
.metric-card strong { display: block; color: var(--tone); font-size: 43px; line-height: 1; font-weight: 600; }
.metric-icon { color: var(--tone); filter: drop-shadow(0 0 9px color-mix(in srgb, var(--tone), transparent 50%)); }
.metric-icon svg { width: 50px; height: 50px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.panel { margin-bottom: 26px; border: 1px solid #1a405f; border-radius: 10px; background: rgba(5, 17, 31, .88); box-shadow: 0 24px 50px rgba(0, 0, 0, .2); scroll-margin-top: 22px; }
.panel-header { padding: 28px 28px 17px; }
.panel-header.split { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-header p { margin: 6px 0 0; color: #7088a2; font-size: 13px; }
.license-toolbar { min-height: 87px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 0 28px 24px; border-bottom: 1px solid #1a3c59; }
.search-box { width: min(380px, 100%); min-height: 45px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border: 1px solid #264967; border-radius: 6px; background: #071525; }
.search-box:focus-within { border-color: #0c92ee; box-shadow: 0 0 0 3px rgba(12, 146, 238, .1); }
.search-box svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: #8ca4bd; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; }
.filters { display: flex; gap: 12px; }
input, select, textarea { width: 100%; border: 1px solid #294764; border-radius: 6px; outline: 0; padding: 11px 12px; color: #edf6ff; background: #071524; }
input::placeholder, textarea::placeholder { color: #71869c; }
input:focus, select:focus, textarea:focus { border-color: #1199f1; box-shadow: 0 0 0 3px rgba(17, 153, 241, .1); }
select { min-width: 190px; }
textarea { min-height: 84px; resize: vertical; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 970px; border-collapse: collapse; text-align: left; }
th, td { height: 73px; padding: 13px 28px; border-bottom: 1px solid #17364f; font-size: 13px; white-space: nowrap; }
th { height: 50px; color: #87a5c5; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .02em; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(14, 104, 176, .07); }
tbody tr:last-child td { border-bottom: 0; }
.client-name { color: #f3f7fc; font-weight: 600; }
.notes-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.clients-data-table { min-width: 1060px; }
td small { display: block; margin-top: 5px; color: #678098; font-size: 11px; }
.key-cell { display: inline-flex; align-items: center; gap: 8px; }
.icon-button { width: 30px; height: 30px; padding: 0; border: 0; color: #0b9cff; background: transparent; font-size: 17px; }
.icon-button:hover { color: #70cbff; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 11px; border: 1px solid #41536a; border-radius: 7px; color: #b7c4d2; background: rgba(65, 83, 106, .15); font-size: 12px; }
.badge.active { border-color: #27750c; color: #82f26b; background: rgba(35, 119, 10, .22); }
.badge.trial { border-color: #9b5800; color: #ffad32; background: rgba(151, 80, 0, .2); }
.badge.expired, .badge.suspended, .badge.cancelled { border-color: #7a2638; color: #ff8296; background: rgba(122, 38, 56, .2); }
.actions { width: 225px; text-align: center; }
.row-actions { display: inline-flex; align-items: center; gap: 7px; }
.build-exe-button { min-width: 140px; height: 39px; padding: 0 12px; border: 1px solid #078bea; border-radius: 6px; color: #dff4ff; background: #086cca; box-shadow: 0 0 15px rgba(0, 126, 255, .16); font-size: 12px; font-weight: 750; white-space: nowrap; }
.build-exe-button:hover { border-color: #4cb9ff; background: #0b82ed; box-shadow: 0 0 19px rgba(0, 126, 255, .28); }
.build-exe-button:disabled { opacity: .6; cursor: wait; }
.delete-icon { width: 39px; height: 39px; padding: 0; border: 1px solid #703040; border-radius: 6px; color: #ff8296; background: rgba(84, 22, 36, .28); font-size: 20px; line-height: 1; }
.delete-icon:hover { border-color: #db4967; color: white; background: #7f2338; }
.action-menu { position: relative; display: inline-block; }
.action-menu summary { width: 39px; height: 39px; display: grid; place-items: center; list-style: none; border: 1px solid #2b4e6c; border-radius: 6px; color: #d3e5f7; background: #071525; font-size: 24px; line-height: 1; cursor: pointer; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu[open] summary { border-color: #0b91ec; color: #28aaff; }
.action-menu-popover { position: fixed; z-index: 50; min-width: 175px; overflow: hidden; padding: 5px; border: 1px solid #284865; border-radius: 7px; background: #091827; box-shadow: 0 14px 35px rgba(0, 0, 0, .5); }
.action-menu-popover button { width: 100%; padding: 10px 11px; border: 0; border-radius: 4px; color: #cfe0f0; background: transparent; text-align: left; font-size: 12px; }
.action-menu-popover button:hover { color: white; background: #12314c; }
.action-menu-popover .danger-action { color: #ff8296; }
.empty { height: 110px; color: #70879f; text-align: center; }
.table-footer { min-height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-top: 1px solid #17364f; color: #7790aa; font-size: 12px; }
.page-chip { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #098fe9; border-radius: 5px; color: #21a7ff; background: #071727; font-weight: 700; }

.modal { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: 0; border: 1px solid #225478; border-radius: 10px; color: #f2f7fd; background: #071522; box-shadow: 0 35px 100px rgba(0, 0, 0, .75), 0 0 45px rgba(0, 114, 255, .13); }
.modal::backdrop { background: rgba(0, 5, 12, .78); backdrop-filter: blur(5px); }
.small-modal { width: min(520px, calc(100vw - 28px)); }
.modal-heading { display: flex; align-items: center; justify-content: space-between; padding: 23px 25px; border-bottom: 1px solid #1a3b55; }
.modal-heading h2 { font-size: 23px; }
.modal-heading .eyebrow { margin-bottom: 5px; }
.close-button { width: 38px; height: 38px; padding: 0; border: 1px solid #294963; border-radius: 5px; color: #8ba2ba; background: #0a1b2b; font-size: 25px; }
.close-button:hover { color: white; border-color: #168fdf; }
.modal form { display: grid; gap: 15px; padding: 24px 25px 26px; }
label { display: grid; gap: 7px; color: #a5b9cc; font-size: 12px; font-weight: 700; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 11px; margin-top: 6px; }
.form-note { margin: -2px 0 0; color: #7890a8; font-size: 12px; line-height: 1.55; }
.installer-status { min-height: 20px; margin: 0; color: #7f98b0; font-size: 12px; line-height: 1.5; }
.installer-status.working { color: #5dc3ff; }
.installer-status.success { color: #70e4b5; }
.installer-status.error { color: #ff8296; }
.key-result { display: grid; gap: 10px; margin: 0 25px 25px; padding: 16px; border: 1px solid #0a94eb; border-radius: 7px; background: rgba(8, 81, 128, .13); color: #bcd1e3; }
.key-result code { color: #4fc3ff; font-size: 15px; word-break: break-all; }
.key-result small { color: #7893ab; }
.revealed-key { display: grid; gap: 18px; padding: 27px; }
.revealed-key code { padding: 18px; border: 1px solid #1d5278; border-radius: 6px; color: #55c7ff; background: #030d18; font-size: 16px; text-align: center; word-break: break-all; user-select: all; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(390px, calc(100vw - 48px)); padding: 14px 18px; border: 1px solid #178b68; border-radius: 7px; color: #baffea; background: #092820; box-shadow: 0 16px 45px rgba(0, 0, 0, .48); font-size: 13px; }
.toast.error { border-color: #97354b; color: #ffd0d8; background: #2b0e17; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 520px) minmax(340px, 480px); place-content: center; gap: 60px; padding: 30px; }
.login-brand { display: grid; place-items: center; }
.login-brand img { width: 100%; max-height: 320px; object-fit: contain; filter: saturate(1.18); }
.login-card { padding: 38px; border: 1px solid #1e4e73; border-radius: 10px; background: rgba(6, 19, 34, .9); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.login-card h1 { font-size: 34px; }
.login-card form { display: grid; gap: 17px; margin-top: 28px; }

@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .nav-item { padding: 0 22px; }
  .main-content { padding: 32px 26px 60px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-panel { height: 150px; }
}

@media (max-width: 760px) {
  .app-layout { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid #14517a; }
  .brand-panel { height: 100px; padding: 9px; }
  .brand-panel img { max-height: 84px; width: 190px; }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 0; }
  .nav-item { min-width: max-content; min-height: 55px; padding: 0 17px; border-left: 0; border-bottom: 2px solid transparent; font-size: 13px; }
  .nav-item.active { border-bottom-color: #159dff; }
  .nav-item.active::after, .sidebar-footer { display: none; }
  .nav-item svg { width: 19px; height: 19px; }
  .main-content { padding: 24px 14px 50px; }
  .topbar, .license-toolbar { align-items: stretch; flex-direction: column; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .primary-button, .outline-button { padding: 0 13px; }
  .metrics { gap: 10px; }
  .metric-card { min-height: 120px; padding: 20px; }
  .metric-card strong { font-size: 34px; }
  .metric-icon svg { width: 38px; height: 38px; }
  .license-toolbar { align-items: stretch; padding-top: 5px; }
  .search-box { width: 100%; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters select { min-width: 0; }
  .panel-header.split { align-items: stretch; flex-direction: column; }
  th, td { padding-left: 18px; padding-right: 18px; }
  .login-screen { grid-template-columns: 1fr; gap: 15px; padding: 18px; }
  .login-brand img { max-height: 170px; }
  .login-card { padding: 25px; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .top-actions, .filters, .form-row { grid-template-columns: 1fr; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions button { width: 100%; }
}
