:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --bg-soft: #101014;
  --surface: #15151b;
  --surface-2: #1b1b22;
  --surface-3: #202028;
  --line: #292931;
  --line-soft: rgba(255,255,255,.055);
  --txt: #ececf2;
  --txt-soft: #c9c9d2;
  --muted: #8a8a99;
  --accent: #f04e23;
  --accent-2: #ff6a3d;
  --accent-soft: rgba(240,78,35,.12);
  --green: #35c989;
  --blue: #5e94ff;
  --red: #ef5c65;
  --yellow: #e8a84c;
  --shadow: 0 18px 55px rgba(0,0,0,.43);
  --sidebar: 270px;
  --radius: 16px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f1f4;
  --bg-soft: #e9e9ed;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --surface-3: #ececf0;
  --line: #dedee5;
  --line-soft: rgba(12,12,20,.05);
  --txt: #18181e;
  --txt-soft: #3a3a44;
  --muted: #71717e;
  --accent-soft: rgba(240,78,35,.1);
  --shadow: 0 18px 45px rgba(31,31,45,.12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--txt); overflow-x: hidden; }
body.drawer-open, body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }
::selection { background: rgba(240,78,35,.35); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #34343e; border: 2px solid var(--bg-soft); border-radius: 20px; }
.hidden { display: none !important; }
.mobile-only, .mobile-menu { display: none; }

.ambient { position: fixed; z-index: -1; pointer-events: none; border-radius: 50%; filter: blur(5px); opacity: .45; }
.ambient-one { width: 520px; height: 520px; top: -360px; right: 22%; background: radial-gradient(circle, rgba(240,78,35,.15), transparent 68%); }
.ambient-two { width: 450px; height: 450px; bottom: -340px; left: -100px; background: radial-gradient(circle, rgba(94,148,255,.07), transparent 70%); }

.e8-logo { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; color: #111; background: radial-gradient(circle at 38% 30%, #393941 0 7%, #17171c 25%, #09090b 72%); border: 1px solid #393940; box-shadow: inset -5px -8px 14px rgba(0,0,0,.55), 0 5px 16px rgba(0,0,0,.3); }
.e8-logo::before { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #f3f1e9; box-shadow: inset 0 -2px 5px rgba(0,0,0,.15); }
.e8-logo b { position: relative; z-index: 1; color: #15151a; font: 800 13px/1 Arial, sans-serif; }
.e8-logo-xl { width: 72px; height: 72px; border-color: rgba(255,255,255,.18); box-shadow: inset -7px -10px 20px #000, 0 10px 30px rgba(0,0,0,.55), 0 0 0 7px rgba(255,255,255,.025); }
.e8-logo-xl::before { width: 34px; height: 34px; }
.e8-logo-xl b { font-size: 22px; }
.e8-logo-sm { width: 34px; height: 34px; }
.e8-logo-sm::before { width: 17px; height: 17px; }
.e8-logo-sm b { font-size: 11px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; overflow: hidden; }
.login-screen::before { content: ""; position: absolute; inset: 0; background: radial-gradient(720px 480px at 50% 25%, rgba(255,96,52,.10), transparent 70%), linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px); background-size: auto, 40px 40px, 40px 40px; mask-image: linear-gradient(to bottom, #000 0%, transparent 80%); }
.login-card { position: relative; width: min(440px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.085); background: linear-gradient(145deg, rgba(24,24,31,.95), rgba(16,16,21,.96)); border-radius: 24px; box-shadow: 0 30px 100px rgba(0,0,0,.62), inset 0 1px rgba(255,255,255,.04); animation: card-in .55s cubic-bezier(.2,.8,.2,1); }
.login-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, rgba(255,255,255,.03), transparent 38%); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.login-brand { display: flex; align-items: center; gap: 19px; margin-bottom: 22px; }
.login-brand .eyebrow { margin: 0 0 5px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; direction: ltr; text-align: right; }
.login-brand h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.5px; }
.login-brand p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.secure-chip { width: fit-content; display: flex; align-items: center; gap: 7px; margin: 0 0 24px; padding: 7px 11px; border-radius: 99px; background: rgba(53,201,137,.075); color: #79dbb0; font-size: 11px; border: 1px solid rgba(53,201,137,.13); }
.secure-chip span { font-size: 8px; }
.field-label { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; color: var(--txt-soft); font-size: 12px; font-weight: 650; }
.field-label small { color: var(--muted); font-weight: 400; }
.input-wrap { display: flex; align-items: center; gap: 10px; height: 48px; margin-bottom: 15px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; transition: .2s; }
.input-wrap:focus-within { border-color: rgba(240,78,35,.7); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-wrap span { color: var(--muted); }
.input-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--txt); }
.input-wrap input::placeholder { color: #666672; }
.btn { min-height: 41px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 11px; padding: 9px 16px; font-weight: 700; font-size: 13px; transition: transform .18s, filter .18s, background .18s, border-color .18s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(125deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 7px 20px rgba(240,78,35,.2); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 9px 24px rgba(240,78,35,.27); }
.btn-primary.loading { pointer-events: none; color: transparent; position: relative; }
.btn-primary.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-secondary { color: var(--txt-soft); border-color: var(--line); background: var(--surface-2); }
.btn-secondary:hover, .btn-ghost:hover { border-color: #484852; color: var(--txt); background: var(--surface-3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #d94b56, #f2646e); box-shadow: 0 7px 20px rgba(239,92,101,.15); }
.btn-wide { width: 100%; margin-top: 5px; min-height: 48px; }
.btn-wide b { margin-right: auto; font-size: 18px; }
.btn-compact { min-height: 35px; padding: 6px 14px; background: var(--surface-3); border-color: var(--line); }
.form-error { min-height: 20px; margin: 11px 0 0; color: #ff7d84; text-align: center; font-size: 12px; }
.login-foot { margin: 14px 0 -4px; color: #666672; text-align: center; font-size: 11px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 16px 13px; background: linear-gradient(180deg, rgba(18,18,23,.98), rgba(12,12,16,.99)); border-left: 1px solid var(--line); box-shadow: -8px 0 32px rgba(0,0,0,.15); }
body[data-theme="light"] .sidebar { background: rgba(255,255,255,.97); }
.sidebar-head { height: 53px; display: flex; align-items: center; gap: 10px; padding: 0 7px 13px; border-bottom: 1px solid var(--line-soft); }
.sidebar-brand { min-width: 0; display: flex; align-items: center; gap: 10px; }
.sidebar-brand div { min-width: 0; }
.sidebar-brand strong { display: block; overflow: hidden; text-overflow: ellipsis; direction: ltr; font-size: 13px; letter-spacing: -.2px; }
.sidebar-brand span:last-child { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-dot { width: 8px; height: 8px; margin-right: auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(53,201,137,.08), 0 0 10px rgba(53,201,137,.5); }
.all-apps { display: flex; justify-content: space-between; align-items: center; margin: 18px 7px 10px; color: var(--txt-soft); font-size: 11px; font-weight: 700; }
.all-apps b { color: var(--muted); font-size: 16px; }
.app-card { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg, var(--surface-2), rgba(240,78,35,.035)); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.lion-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(240,78,35,.22); border-radius: 11px; background: #211611; font-size: 21px; }
.lion-icon.small { width: 36px; height: 36px; font-size: 18px; }
.app-card div { min-width: 0; }
.app-card strong { display: block; font-size: 13px; }
.app-card div span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; direction: ltr; }
.app-online { margin-right: auto; padding: 3px 6px; color: var(--green); background: rgba(53,201,137,.08); border-radius: 99px; font-size: 8px; }
.nav { margin-top: 17px; }
.nav-label { margin: 16px 11px 7px; color: #61616d; font-size: 9px; font-weight: 800; letter-spacing: .3px; }
.nav-item { position: relative; width: 100%; min-height: 43px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 7px; margin-bottom: 4px; padding: 5px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: right; transition: .2s; }
.nav-item:hover { color: var(--txt); background: rgba(255,255,255,.025); }
.nav-item::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: -13px; width: 3px; border-radius: 3px 0 0 3px; background: transparent; }
.nav-item.active { color: var(--accent-2); background: linear-gradient(90deg, transparent, rgba(240,78,35,.095)); }
.nav-item.active::after { background: var(--accent); box-shadow: 0 0 13px rgba(240,78,35,.45); }
.nav-item b { font-size: 12px; font-weight: 700; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; font-size: 17px; }
.nav-item em { min-width: 23px; padding: 3px 6px; border: 1px solid rgba(240,78,35,.18); border-radius: 99px; background: rgba(240,78,35,.09); color: var(--accent-2); font-size: 9px; font-style: normal; text-align: center; }
.nav-item em.green { color: var(--green); border-color: rgba(53,201,137,.17); background: rgba(53,201,137,.07); }
.sidebar-foot { margin-top: auto; }
.theme-toggle { width: 100%; display: grid; grid-template-columns: 24px 1fr 33px; align-items: center; gap: 6px; padding: 10px 9px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(255,255,255,.018); color: var(--muted); text-align: right; }
.theme-toggle b { font-size: 11px; }
.theme-toggle i { position: relative; width: 32px; height: 18px; border-radius: 99px; background: var(--accent); }
.theme-toggle i::after { content: ""; position: absolute; top: 3px; right: 17px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: .2s; }
body[data-theme="light"] .theme-toggle i::after { right: 3px; }
.operator { display: flex; align-items: center; gap: 9px; margin-top: 11px; padding: 12px 7px 2px; border-top: 1px solid var(--line-soft); }
.avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, #26262f, #17171c); border: 1px solid var(--line); color: var(--accent-2); font-size: 10px; font-weight: 900; }
.operator div { min-width: 0; }
.operator strong { display: block; font-size: 10px; direction: ltr; }
.operator small { color: var(--muted); font-size: 9px; }
.operator button { width: 30px; height: 30px; margin-right: auto; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.operator button:hover { background: var(--surface-2); color: var(--red); }

.main-area { min-height: 100vh; margin-right: var(--sidebar); }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 27px; border-bottom: 1px solid var(--line); background: rgba(13,13,17,.86); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
body[data-theme="light"] .topbar { background: rgba(248,248,250,.88); }
.topbar-side, .top-actions { display: flex; align-items: center; gap: 10px; }
.top-mark { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 12px; background: linear-gradient(145deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); }
.system-copy strong { display: block; font-size: 11px; direction: ltr; }
.system-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.icon-button, .square-button { width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: 17px; transition: .18s; }
.icon-button.mobile-only, .icon-button.mobile-menu { display: none; }
.icon-button:hover, .square-button:hover { color: var(--txt); border-color: var(--line); background: var(--surface-2); }
.notification-button { position: relative; font-size: 18px; }
.notification-button i { position: absolute; top: 8px; right: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg); }
.server-clock { padding-left: 8px; color: var(--muted); font-size: 10px; direction: ltr; font-variant-numeric: tabular-nums; }
.content-wrap { padding: 20px 28px 32px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: 10px; }
.breadcrumb b { color: #51515c; font-size: 15px; }
.breadcrumb strong { color: var(--txt-soft); }
.view { animation: view-in .28s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 19px; }
.title-line { display: flex; align-items: center; gap: 11px; }
.title-line h2 { margin: 0; font-size: 22px; letter-spacing: -.45px; }
.title-glyph { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(240,78,35,.18); border-radius: 10px; color: var(--accent-2); background: var(--accent-soft); font-size: 19px; }
.green-glyph { color: var(--green); border-color: rgba(53,201,137,.18); background: rgba(53,201,137,.08); }
.page-head p { margin: 7px 45px 0 0; color: var(--muted); font-size: 11px; }
.page-actions { display: flex; gap: 8px; }
.filter-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 13px; }
.filter-label { color: var(--muted); font-size: 11px; font-weight: 800; margin-left: 2px; }
.stat-pill { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); text-align: right; transition: .18s; }
.stat-pill:hover { color: var(--txt); border-color: #3d3d47; background: var(--surface-2); }
.stat-pill.active { color: var(--txt); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-pill.active span { color: var(--txt); }
.stat-pill.active b { color: var(--accent-2); }
.stat-pill span { font-size: 10px; }
.stat-pill b { margin-right: auto; color: var(--txt); font-size: 14px; font-variant-numeric: tabular-nums; }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.green-dot { background: var(--green); box-shadow: 0 0 8px rgba(53,201,137,.45); }
.blue-dot { background: var(--blue); }
.red-dot { background: var(--red); }
.gray-dot { background: #70707b; }

.data-card { overflow: hidden; min-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.toolbar { min-height: 62px; display: grid; grid-template-columns: auto minmax(250px, 430px) 36px; align-items: center; gap: 10px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.toolbar-group { display: flex; gap: 8px; }
.select-control { position: relative; display: flex; align-items: center; gap: 5px; }
.select-control span { color: var(--muted); font-size: 9px; }
.select-control select, .bulk-bar select { min-height: 36px; padding: 0 10px 0 26px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--txt-soft); font-size: 10px; }
.search-control { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); transition: .18s; }
.search-control:focus-within { border-color: rgba(240,78,35,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-control > span { color: var(--muted); font-size: 18px; transform: rotate(-15deg); }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--txt); font-size: 11px; }
.search-control input::placeholder { color: #6f6f7c; }
.search-control kbd { padding: 3px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: #666672; background: var(--surface); font: 8px Arial; white-space: nowrap; }
.square-button { border-color: var(--line); background: var(--surface-2); }
.bulk-bar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; border-bottom: 1px solid rgba(240,78,35,.16); background: rgba(240,78,35,.035); }
.bulk-bar > div { display: flex; align-items: center; gap: 8px; }
.bulk-bar strong { font-size: 11px; }
.bulk-bar small { color: var(--muted); font-size: 9px; }
.bulk-icon { color: var(--accent-2); }
.table-shell { position: relative; min-height: 405px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { height: 43px; padding: 0 12px; color: #72727f; background: rgba(255,255,255,.012); border-bottom: 1px solid var(--line); font-weight: 650; text-align: right; white-space: nowrap; }
td { height: 58px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); color: var(--txt-soft); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,.016); }
.check-col { width: 42px; text-align: center; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.key-cell { min-width: 215px; }
.key-code { display: flex; align-items: center; gap: 8px; color: var(--txt); font: 700 11px/1.4 "Consolas", "Courier New", monospace; direction: ltr; }
.mini-logo { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); font: 900 9px Arial; border: 1px solid rgba(240,78,35,.13); }
.key-meta { margin: 4px 32px 0 0; color: #666672; font-size: 8px; }
.status-badge, .source-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.status-active { color: #69dbaa; background: rgba(53,201,137,.085); }
.status-active::before { background: var(--green); }
.status-unused { color: #8fb4ff; background: rgba(94,148,255,.09); }
.status-unused::before { background: var(--blue); }
.status-expired { color: #ff8b92; background: rgba(239,92,101,.09); }
.status-expired::before { background: var(--red); }
.status-disabled, .status-blocked { color: #a2a2ad; background: rgba(138,138,153,.1); }
.status-disabled::before, .status-blocked::before { background: #7b7b87; }
.device-link { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--txt-soft); font-size: 10px; }
.device-link:hover { border-color: rgba(240,78,35,.35); color: var(--accent-2); }
.device-link b { color: var(--txt); font-size: 11px; }
.remaining strong { display: block; color: var(--txt-soft); font-size: 10px; white-space: nowrap; }
.remaining span { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.remaining .infinite { color: #c8a6ff; }
.note-cell { max-width: 165px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; white-space: nowrap; }
.row-action { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 12px; transition: .16s; }
.row-action:hover { border-color: rgba(240,78,35,.35); color: var(--accent-2); transform: translateY(-1px); }
.row-action.danger:hover { border-color: rgba(239,92,101,.4); color: var(--red); background: rgba(239,92,101,.05); }
.empty-state { min-height: 405px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 36px; text-align: center; }
.watermark { position: relative; width: 118px; height: 118px; display: grid; place-items: center; margin-bottom: 17px; }
.watermark::before, .watermark::after { content: ""; position: absolute; border: 1px solid rgba(240,78,35,.07); border-radius: 50%; }
.watermark::before { inset: 5px; }
.watermark::after { inset: 19px; border-style: dashed; animation: orbit 18s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.e8-logo-watermark { width: 66px; height: 66px; opacity: .34; filter: saturate(.7); }
.e8-logo-watermark::before { width: 31px; height: 31px; }
.e8-logo-watermark b { font-size: 20px; }
.watermark i { position: absolute; width: 7px; height: 7px; top: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(240,78,35,.5); }
.empty-state h3 { margin: 0 0 7px; font-size: 14px; }
.empty-state p { max-width: 320px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.empty-state .btn { margin-top: 17px; }
.empty-state.compact { min-height: 340px; }
.empty-search { width: 55px; height: 55px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background: var(--surface-2); font-size: 25px; }
.table-footer { min-height: 45px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 0 14px; border-top: 1px solid var(--line); color: #62626e; font-size: 8px; }
.table-footer p { margin: 0; }
.live-state { justify-self: end; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.live-state i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }

.device-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.device-summary div { display: flex; align-items: center; justify-content: space-between; min-height: 57px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.device-summary span { color: var(--muted); font-size: 10px; }
.device-summary b { font-size: 18px; }
.devices-card { min-height: 530px; }
.devices-card .toolbar { grid-template-columns: minmax(250px, 430px) 1fr; }
.toolbar-note { justify-self: end; color: var(--muted); font-size: 9px; }
.identifier-cell code { display: block; max-width: 250px; overflow: hidden; color: var(--txt); direction: ltr; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.identifier-cell span { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.source-badge { color: #93b7ff; background: rgba(94,148,255,.08); }
.source-badge.hwid { color: #70d9ad; background: rgba(53,201,137,.08); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.settings-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.settings-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; padding-bottom: 15px; border-bottom: 1px solid var(--line-soft); }
.settings-icon { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid rgba(240,78,35,.16); border-radius: 11px; background: var(--accent-soft); color: var(--accent-2); font: 850 11px Arial; }
.lock-icon { font-size: 19px; }
.settings-card-head h3 { margin: 0 0 4px; font-size: 14px; }
.settings-card-head p { margin: 0; color: var(--muted); font-size: 9px; }
.text-input { width: 100%; height: 42px; margin: 0 0 15px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface-2); color: var(--txt); font-size: 11px; transition: .18s; }
.text-input:focus { border-color: rgba(240,78,35,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.ltr-input { direction: ltr; text-align: left; font-family: "Consolas", monospace; }
.form-row-two { display: grid; grid-template-columns: .8fr 1.2fr; gap: 12px; align-items: center; }
.toggle-setting { min-height: 63px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.toggle-setting > span { flex: 1; }
.toggle-setting b, .toggle-setting small { display: block; }
.toggle-setting b { font-size: 10px; }
.toggle-setting small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.toggle-setting input { position: absolute; opacity: 0; }
.toggle-setting i { position: relative; width: 36px; height: 20px; flex: 0 0 auto; border-radius: 99px; background: #393941; transition: .2s; }
.toggle-setting i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%; background: #aaaab3; transition: .2s; }
.toggle-setting input:checked + i { background: var(--accent); }
.toggle-setting input:checked + i::after { right: 19px; background: #fff; }
.align-end { margin-right: auto; }
.password-hint { margin: -5px 0 17px; color: var(--muted); font-size: 9px; }
.appearance-card { grid-column: 1 / -1; }
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-option { display: grid; grid-template-columns: 86px 1fr; grid-template-rows: 1fr 1fr; align-items: center; gap: 1px 12px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); text-align: right; }
.theme-option.active { border-color: rgba(240,78,35,.5); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-option b { align-self: end; font-size: 11px; }
.theme-option small { align-self: start; color: var(--muted); font-size: 8px; }
.theme-preview { grid-row: 1 / 3; width: 86px; height: 49px; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: 13px 1fr; gap: 4px; padding: 6px; border-radius: 7px; overflow: hidden; }
.theme-preview i:first-child { grid-row: 1 / 3; border-radius: 3px; }
.theme-preview i:nth-child(2), .theme-preview i:nth-child(3) { border-radius: 2px; }
.dark-preview { background: #0b0b0f; border: 1px solid #2a2a31; }
.dark-preview i { background: #222229; }
.dark-preview i:nth-child(2) { background: #f04e23; }
.light-preview { background: #eeeef2; border: 1px solid #d5d5dc; }
.light-preview i { background: #d7d7dd; }
.light-preview i:nth-child(2) { background: #f04e23; }

.overlay { position: fixed; z-index: 60; inset: 0; background: rgba(2,2,4,.68); backdrop-filter: blur(3px); animation: fade-in .2s; }
@keyframes fade-in { from { opacity: 0; } }
.create-drawer { position: fixed; z-index: 70; top: 14px; bottom: 14px; left: 14px; width: min(480px, calc(100vw - 28px)); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; border: 1px solid #303039; border-radius: 18px; background: linear-gradient(160deg, #18181f, #111116); box-shadow: 25px 0 80px rgba(0,0,0,.62); transform: translateX(calc(-100% - 30px)); visibility: hidden; transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility .35s; }
body[data-theme="light"] .create-drawer { background: #fff; }
.create-drawer.open { visibility: visible; transform: translateX(0); }
.drawer-head { min-height: 68px; display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 9px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.drawer-head > div { text-align: center; }
.drawer-head h2 { display: inline; margin: 0; font-size: 15px; }
.drawer-app { margin-left: 5px; color: var(--muted); font-size: 10px; }
.drawer-form { overflow-y: auto; padding: 15px 17px 22px; }
.form-section { margin-bottom: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.012); }
.section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.section-title > span { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid rgba(240,78,35,.16); border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); font: 800 9px Arial; }
.section-title h3 { margin: 0 0 3px; font-size: 12px; }
.section-title p { margin: 0; color: var(--muted); font-size: 8px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #0d0d11; }
body[data-theme="light"] .segmented { background: var(--bg-soft); }
.segmented button { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 700; }
.segmented button.active { color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); box-shadow: 0 5px 14px rgba(240,78,35,.2); }
.format-fields { margin-top: 12px; }
.affix-grid { direction: ltr; display: grid; grid-template-columns: minmax(63px,1fr) auto 60px auto 60px auto minmax(63px,1fr); align-items: end; gap: 4px; }
.affix-grid label span, .two-fields label > span, .custom-duration label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 8px; }
.affix-grid input { width: 100%; height: 34px; padding: 0 5px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface-2); color: var(--txt); text-align: center; font: 700 10px "Consolas", monospace; text-transform: uppercase; }
.affix-grid i { padding-bottom: 9px; color: #555560; font-style: normal; }
.random-block { height: 34px; display: grid; place-items: center; border: 1px dashed #35353e; border-radius: 8px; color: #62626d; background: rgba(0,0,0,.13); font: 8px "Consolas", monospace; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: 8px; line-height: 1.6; }
.accent-hint { padding: 7px 9px; border-right: 2px solid var(--accent); border-radius: 5px; background: var(--accent-soft); color: #d39886; }
.duration-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.duration-chips button { min-width: 48px; height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 9px; transition: .16s; }
.duration-chips button:hover { border-color: rgba(240,78,35,.35); color: var(--txt); }
.duration-chips button.active { border-color: rgba(240,78,35,.55); background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(240,78,35,.08); }
.big-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.big-chips button { min-width: 0; height: auto; min-height: 54px; padding: 0 8px; border-radius: 13px; font-size: 14px; font-weight: 700; }
.big-chips button.active { box-shadow: 0 0 0 1px var(--accent) inset; }
.stepper-field { display: grid; grid-template-columns: 54px 1fr 54px; gap: 10px; }
.stepper-field input { height: 54px; padding: 0; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: var(--surface-2); color: var(--txt); text-align: center; font: 800 22px "Consolas", monospace; }
.stepper-field input:focus { border-color: rgba(240,78,35,.55); box-shadow: 0 0 0 3px var(--accent-soft); }
.step-btn { height: 54px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); color: var(--txt); font-size: 24px; font-weight: 700; transition: .16s; }
.step-btn:hover { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.step-btn:active { transform: scale(.95); }
.custom-duration, .two-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
.custom-duration input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: var(--surface-2); color: var(--txt); text-align: center; }
.two-fields { grid-template-columns: 1fr 1fr; margin-top: 0; }
.two-fields small { color: #62626e; }
.trial-check { width: fit-content; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; cursor: pointer; }
.preview-card { margin-bottom: 14px; padding: 13px 14px; border: 1px solid rgba(240,78,35,.2); border-radius: 12px; background: linear-gradient(135deg, rgba(240,78,35,.07), rgba(0,0,0,.12)); }
.preview-card > div { display: flex; justify-content: space-between; align-items: center; }
.preview-card span { color: var(--muted); font-size: 8px; }
.preview-card button { width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--muted); }
.preview-card code { display: block; margin: 9px 0 4px; color: var(--accent-2); direction: ltr; text-align: left; font: 700 13px "Consolas", monospace; letter-spacing: .3px; }
.preview-card small { color: #62626d; font-size: 7px; }
.created-batch { margin-bottom: 8px; padding: 13px; border: 1px solid rgba(53,201,137,.25); border-radius: 12px; background: rgba(53,201,137,.05); }
.batch-head, .batch-head > div { display: flex; align-items: center; gap: 9px; }
.batch-head { justify-content: space-between; margin-bottom: 10px; }
.success-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(53,201,137,.13); color: var(--green); }
.batch-head h3, .batch-head p { margin: 0; }
.batch-head h3 { font-size: 11px; }
.batch-head p { margin-top: 3px; color: var(--muted); font-size: 8px; }
.batch-head > button { border: 0; background: transparent; color: var(--muted); }
.created-batch textarea { width: 100%; height: 92px; resize: vertical; padding: 9px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: rgba(0,0,0,.18); color: #8fe1bd; direction: ltr; font: 9px/1.7 "Consolas", monospace; }
.batch-actions { display: flex; gap: 7px; margin-top: 9px; }
.batch-actions .btn { flex: 1; min-height: 35px; font-size: 9px; }
.drawer-footer { min-height: 68px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 17px; border-top: 1px solid var(--line); background: rgba(10,10,13,.7); }
body[data-theme="light"] .drawer-footer { background: #fafafa; }

.modal { position: fixed; z-index: 90; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(2,2,4,.72); backdrop-filter: blur(4px); animation: fade-in .18s; }
.modal-card { width: min(420px, 100%); max-height: min(82vh, 720px); overflow: hidden; border: 1px solid #33333d; border-radius: 17px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.6); animation: modal-in .25s cubic-bezier(.2,.8,.2,1); }
@keyframes modal-in { from { opacity: 0; transform: scale(.97) translateY(7px); } }
.wide-modal { width: min(720px, 100%); }
.modal-head { min-height: 65px; display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.modal-head > div { display: flex; align-items: center; gap: 10px; }
.modal-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: rgba(53,201,137,.08); color: var(--green); border: 1px solid rgba(53,201,137,.14); }
.modal-head h3 { margin: 0 0 4px; font-size: 12px; }
.modal-head code { color: var(--muted); direction: ltr; font: 8px "Consolas", monospace; }
.modal-body { max-height: calc(82vh - 65px); overflow-y: auto; padding: 14px; }
.device-modal-row { display: grid; grid-template-columns: minmax(150px,1fr) auto auto auto; align-items: center; gap: 10px; min-height: 57px; margin-bottom: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.device-modal-row code { display: block; overflow: hidden; color: var(--txt); direction: ltr; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.device-modal-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 7px; }
.device-modal-row .row-actions { justify-self: end; }
.confirm-card { padding: 24px; text-align: center; }
.confirm-icon { width: 51px; height: 51px; display: grid; place-items: center; margin: 0 auto 14px; border: 1px solid rgba(239,92,101,.25); border-radius: 50%; background: rgba(239,92,101,.08); color: var(--red); font-size: 23px; font-weight: 800; }
.confirm-card h3 { margin: 0 0 8px; font-size: 15px; }
.confirm-card p { margin: 0 auto 20px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.confirm-card > div { display: flex; justify-content: center; gap: 8px; }
.confirm-card .btn { min-width: 100px; }

.toast-region { position: fixed; z-index: 120; bottom: 22px; left: 22px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { min-width: 270px; max-width: 380px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(27,27,34,.96); color: var(--txt); box-shadow: var(--shadow); backdrop-filter: blur(15px); animation: toast-in .3s cubic-bezier(.2,.8,.2,1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
.toast-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: rgba(53,201,137,.1); color: var(--green); }
.toast.error .toast-icon { color: var(--red); background: rgba(239,92,101,.1); }
.toast b { display: block; font-size: 10px; }
.toast span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }

@media (max-width: 1050px) {
  :root { --sidebar: 238px; }
  .content-wrap { padding-inline: 20px; }
  .system-copy { display: none; }
  .stat-pill { padding-inline: 10px; }
  .toolbar { grid-template-columns: 1fr minmax(220px, 320px) 36px; }
  .select-control > span { display: none; }
}

@media (max-width: 820px) {
  .icon-button.mobile-only, .icon-button.mobile-menu { display: inline-grid; }
  .sidebar { width: min(286px, 88vw); transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
  .sidebar.open { transform: translateX(0); }
  .mobile-scrim { position: fixed; z-index: 29; inset: 0; visibility: hidden; opacity: 0; background: rgba(0,0,0,.6); transition: .25s; }
  .mobile-scrim.open { visibility: visible; opacity: 1; }
  .sidebar-head .mobile-only { margin-left: -4px; }
  .main-area { margin-right: 0; }
  .topbar { padding-inline: 16px; }
  .content-wrap { padding: 17px 14px 25px; }
  .page-head { align-items: center; }
  .filter-strip { gap: 7px; }
  .filter-label { width: 100%; margin-bottom: 2px; }
  .stat-pill { flex: 1 1 auto; min-width: 96px; justify-content: space-between; }
  .toolbar { grid-template-columns: 1fr 36px; }
  .toolbar-group { grid-column: 1 / -1; }
  .search-control { grid-column: 1; grid-row: 2; }
  .square-button { grid-column: 2; grid-row: 2; }
  .data-card { min-height: 560px; }
  .table-shell { min-height: 470px; }
  table { min-width: 860px; }
  .empty-state { position: sticky; right: 0; min-width: calc(100vw - 30px); }
  .table-footer { grid-template-columns: 1fr 1fr; }
  .table-footer p { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .appearance-card { grid-column: auto; }
  .theme-options { grid-template-columns: 1fr; }
  .devices-card .toolbar { grid-template-columns: 1fr; }
  .toolbar-note { justify-self: start; }
  .devices-card .search-control { grid-row: auto; }
}

@media (max-width: 560px) {
  .login-screen { padding: 15px; }
  .login-card { padding: 25px 21px; }
  .login-brand { align-items: flex-start; }
  .e8-logo-xl { width: 60px; height: 60px; }
  .login-brand h1 { font-size: 22px; }
  .server-clock, .notification-button { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .title-line h2 { font-size: 19px; }
  .page-head p { margin-right: 0; }
  .bulk-bar { align-items: flex-start; flex-direction: column; }
  .bulk-bar > div { width: 100%; }
  .bulk-bar select { flex: 1; }
  .device-summary { grid-template-columns: 1fr; }
  .form-row-two { grid-template-columns: 1fr; }
  .create-drawer { inset: 0; width: 100vw; border-radius: 0; border-block: 0; }
  .affix-grid { grid-template-columns: minmax(55px,1fr) auto 54px auto 54px auto minmax(55px,1fr); }
  .drawer-footer .btn { flex: 1; }
  .two-fields { grid-template-columns: 1fr 1fr; }
  .toast-region { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .theme-option { grid-template-columns: 70px 1fr; }
  .theme-preview { width: 70px; }
  .device-modal-row { grid-template-columns: 1fr auto; }
  .device-modal-row > .status-badge, .device-modal-row > .source-badge { display: none; }
}

/* الهاتف: الجداول تصبح بطاقات مكدّسة بدل التمرير الأفقي */
@media (max-width: 640px) {
  table, .keys-table, .devices-card table { min-width: 0; }
  .table-shell { overflow: visible; min-height: 0; padding: 10px 10px 3px; }
  .keys-table thead, .devices-card table thead { display: none; }
  .keys-table tbody, .keys-table tr, .keys-table td,
  .devices-card table tbody, .devices-card table tr, .devices-card table td { display: block; width: 100%; }
  .keys-table tr, .devices-card table tr { margin: 0 0 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
  .keys-table tr:hover, .devices-card table tr:hover { background: var(--surface-2); }
  .keys-table td, .devices-card table td { height: auto; min-height: 0; padding: 5px 0; border: 0; }
  .keys-table td[data-label]::before, .devices-card table td[data-label]::before { content: attr(data-label) "：" ; margin-left: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
  .keys-table td.check-col { display: none; }
  .keys-table .key-cell, .devices-card .identifier-cell { margin-bottom: 7px; padding-bottom: 9px; border-bottom: 1px solid var(--line-soft); }
  .key-cell { min-width: 0; }
  .remaining strong, .remaining span { display: inline; font-size: 11px; }
  .remaining span { margin-right: 6px; color: var(--muted); }
  .note-cell { max-width: none; white-space: normal; }
  .row-actions { justify-content: flex-start; gap: 8px; padding-top: 6px; }
  .row-action { width: 38px; height: 38px; font-size: 15px; }
  .device-link { padding: 7px 12px; }
  .identifier-cell code { max-width: 100%; }
  .empty-state { position: static; min-width: 0; }
  .data-card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
