:root {
  color-scheme: light;
  --bg: #f4f8ff;
  --surface: #fff;
  --primary: #1769ff;
  --primary-hover: #0b57e7;
  --primary-soft: #edf5ff;
  --tech-blue: #37a4ff;
  --cyan: #10bceb;
  --text: #0f172a;
  --muted: #64748b;
  --weak: #94a3b8;
  --border: #dce7f5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 8px 30px rgba(15, 23, 42, .06);
  --shadow-hover: 0 14px 38px rgba(23, 105, 255, .1);
  --radius-lg: 16px;
  --radius: 14px;
  --radius-control: 10px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.tech-pattern { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; color: #5b9cff; opacity: .045; pointer-events: none; }
body::before { content: ""; position: fixed; z-index: 0; inset: 0; pointer-events: none; background: radial-gradient(circle at 76% -10%, rgba(55, 164, 255, .14), transparent 34%), radial-gradient(circle at 5% 36%, rgba(23, 105, 255, .06), transparent 26%); }

.topbar { position: sticky; z-index: 50; top: 0; height: 64px; display: grid; grid-template-columns: minmax(260px, auto) 1fr auto; align-items: center; gap: 24px; padding: 0 28px; border-bottom: 1px solid rgba(206, 222, 242, .9); background: rgba(255, 255, 255, .92); box-shadow: 0 1px 12px rgba(15, 23, 42, .035); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(145deg, var(--primary), var(--cyan)); box-shadow: 0 8px 20px rgba(23, 105, 255, .22); }
.brand-mark::after { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 9px; }
.brand-mark svg { width: 27px; height: 27px; stroke-width: 1.65; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.2px; font-size: 15px; }
.brand small { margin-top: 2px; color: var(--weak); font-size: 9px; letter-spacing: .12em; }
.main-nav { align-self: stretch; display: flex; align-items: center; gap: 4px; }
.nav-item { position: relative; height: 100%; display: inline-flex; align-items: center; gap: 7px; padding: 0 15px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-weight: 600; }
.nav-item::after { content: ""; position: absolute; right: 14px; bottom: -1px; left: 14px; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary); opacity: 0; transform: scaleX(.55); transition: .2s ease; }
.nav-item:hover, .nav-item.is-active { color: var(--primary); }
.nav-item.is-active::after { opacity: 1; transform: scaleX(1); }
.nav-item svg { width: 18px; height: 18px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-search { width: min(300px, 24vw); height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 9px 0 11px; border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--weak); background: #f9fbff; transition: .18s ease; }
.top-search:focus-within { border-color: #8eb7ff; background: #fff; box-shadow: 0 0 0 3px rgba(23, 105, 255, .1); }
.top-search svg { width: 17px; height: 17px; }
.top-search input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; }
kbd { min-width: 20px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--weak); background: #fff; box-shadow: 0 1px 1px rgba(15, 23, 42, .05); font: 11px ui-monospace, monospace; text-align: center; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-control); color: var(--muted); background: #fff; cursor: pointer; transition: .18s ease; }
.icon-button:hover { color: var(--primary); border-color: #afccff; background: var(--primary-soft); transform: translateY(-1px); }
.icon-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.icon-button.is-loading svg, .button.is-loading svg, #topRefresh.is-loading svg, #headingRefresh.is-loading svg, #listRefresh.is-loading svg, #eventsRefresh.is-loading svg { animation: spin .8s linear infinite; }
.connection-pill { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid #ccefe4; border-radius: 999px; color: #08765a; background: #effcf8; font-size: 12px; font-weight: 650; white-space: nowrap; }
.connection-pill i, .sync-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(16, 185, 129, .1); }
.connection-pill.is-checking { color: #a16207; border-color: #fde8b2; background: #fffaf0; }
.connection-pill.is-checking i { background: var(--warning); animation: pulse 1.3s ease infinite; }
.connection-pill.is-error { color: #b42318; border-color: #ffd0cc; background: #fff5f4; }
.connection-pill.is-error i { background: var(--danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, .1); }
.admin-menu { position: relative; }
.admin-menu > summary { height: 40px; display: flex; align-items: center; gap: 7px; padding: 0 8px 0 5px; border-radius: 11px; cursor: pointer; color: var(--muted); list-style: none; font-weight: 600; }
.admin-menu > summary::-webkit-details-marker, .row-menu summary::-webkit-details-marker { display: none; }
.admin-menu > summary:hover { color: var(--text); background: var(--primary-soft); }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #bcd3fa; border-radius: 9px; color: var(--primary); background: #edf5ff; }
.avatar svg { width: 17px; height: 17px; }
.chevron { width: 14px; height: 14px; transition: transform .18s; }
.admin-menu[open] .chevron { transform: rotate(180deg); }
.menu-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 190px; padding: 7px; border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: 0 18px 50px rgba(15, 23, 42, .14); }
.menu-panel button { width: 100%; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; }
.menu-panel button:hover { color: var(--primary); background: var(--primary-soft); }
.menu-panel svg { width: 17px; height: 17px; }
.danger-text { color: var(--danger) !important; }

.app-shell { position: relative; z-index: 1; width: min(1560px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 52px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-heading h1 { margin: 2px 0 5px; font-size: 26px; line-height: 1.2; letter-spacing: -.6px; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary) !important; font-size: 10px; font-weight: 750; letter-spacing: .16em; }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; cursor: pointer; font-weight: 650; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button svg { width: 18px; height: 18px; }
.button.primary { color: #fff; background: linear-gradient(110deg, var(--primary), #2587ff); box-shadow: 0 7px 17px rgba(23, 105, 255, .22); }
.button.primary:hover { background: linear-gradient(110deg, var(--primary-hover), var(--primary)); box-shadow: 0 10px 23px rgba(23, 105, 255, .28); }
.button.secondary { color: #24405f; border-color: var(--border); background: #fff; box-shadow: 0 3px 9px rgba(15, 23, 42, .035); }
.button.secondary:hover { color: var(--primary); border-color: #b4d0ff; background: var(--primary-soft); }
.button.ghost { color: var(--primary); background: var(--primary-soft); }
.button.warning { color: #fff; background: var(--warning); }
.button.danger { color: #fff; background: var(--danger); }
.button.full { width: 100%; }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats-card { position: relative; min-height: 112px; display: flex; align-items: center; gap: 13px; padding: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); color: inherit; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; transition: .2s ease; }
.stats-card::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 2px; opacity: 0; background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent); transform: translateX(-45%); transition: .3s ease; }
.stats-card:hover { border-color: #abc9ff; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stats-card:hover::before { opacity: .75; transform: translateX(0); }
.stats-icon { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.stats-icon.blue { color: var(--primary); background: #edf4ff; }
.stats-icon.green { color: #0b9a70; background: #eafbf5; }
.stats-icon.amber { color: #c87906; background: #fff7e6; }
.stats-icon.red { color: #db3c3c; background: #fff0f0; }
.stats-icon.cyan { color: #0498bc; background: #e9faff; }
.stats-card small, .stats-card strong, .stats-card em { display: block; }
.stats-card small { color: var(--muted); font-size: 12px; font-weight: 650; }
.stats-card strong { margin: 4px 0 1px; font-size: 25px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.stats-card em { color: var(--weak); font-size: 11px; font-style: normal; }

.panel { margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 19px; border-bottom: 1px solid #e8f0fa; }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { margin: 0 0 3px; font-size: 16px; letter-spacing: -.2px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.section-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #cfe0ff; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.section-icon svg { width: 19px; height: 19px; }
.sync-note { display: flex; align-items: center; gap: 7px; color: #08765a; font-size: 12px; }
.sync-note i { display: block; }
.issue-form { display: grid; grid-template-columns: minmax(170px, 200px) minmax(240px, 250px) minmax(310px, 1fr) 105px minmax(180px, 195px) auto; align-items: end; gap: 13px; padding: 18px 19px 14px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #334155; font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea, .advanced-filters select, .pagination select { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #cfdeef; border-radius: var(--radius-control); outline: 0; color: var(--text); background: #fff; transition: .18s ease; }
.field textarea { min-height: 86px; padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .advanced-filters select:focus, .pagination select:focus { border-color: #7caaff; box-shadow: 0 0 0 3px rgba(23, 105, 255, .1); }
.input-with-chips { display: flex; gap: 7px; }
.input-with-chips > input { width: 64px; flex: 0 0 64px; }
.count-field .chips button { min-width: 30px; padding: 0 7px; }
.chips { display: flex; flex-wrap: nowrap; gap: 5px; }
.chips button, .templates button { height: 40px; min-width: 35px; padding: 0 9px; border: 1px solid #d5e2f2; border-radius: 9px; color: var(--muted); background: #f9fbff; cursor: pointer; transition: .16s ease; }
.chips button:hover, .chips button.is-active, .templates button:hover { color: var(--primary); border-color: #9cc0ff; background: var(--primary-soft); }
.duration-chips { flex-wrap: wrap; }
.duration-chips button { min-width: 46px; height: 32px; padding: 0 8px; font-size: 12px; }
.custom-days { display: none; margin-top: 6px; }
.duration-field.is-custom .custom-days { display: block; }
.issue-submit { height: 40px; white-space: nowrap; }
.templates { display: flex; align-items: center; gap: 7px; padding: 0 19px 17px; color: var(--muted); font-size: 11px; }
.templates > span { margin-right: 3px; }
.templates button { height: 29px; border-radius: 999px; background: #fff; font-size: 11px; }

.list-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 12px 18px; padding: 14px 19px; border-bottom: 1px solid #e8f0fa; }
.search-field { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid #cfdeef; border-radius: var(--radius-control); color: var(--weak); background: #fff; transition: .18s ease; }
.search-field:focus-within { border-color: #7caaff; box-shadow: 0 0 0 3px rgba(23, 105, 255, .1); }
.search-field input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-field svg { flex: 0 0 auto; width: 18px; height: 18px; }
.segmented { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: #f7faff; }
.segmented button { height: 32px; padding: 0 11px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; white-space: nowrap; }
.segmented button:hover { color: var(--primary); }
.segmented button.is-active { color: var(--primary); background: #fff; box-shadow: 0 2px 8px rgba(23, 105, 255, .09); }
.advanced-filters { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.advanced-filters select { width: auto; min-width: 135px; height: 36px; padding-right: 30px; color: #475569; font-size: 12px; }
.batch-bar { min-height: 48px; display: flex; align-items: center; gap: 15px; padding: 7px 12px 7px 18px; color: #164b9c; border-bottom: 1px solid #cfe1ff; background: #f0f6ff; animation: slideDown .18s ease; }
.batch-bar strong { white-space: nowrap; }
.batch-bar > div { flex: 1; display: flex; gap: 4px; }
.batch-bar > div button { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 0; border-radius: 8px; color: #315b8e; background: transparent; cursor: pointer; font-size: 12px; }
.batch-bar > div button:hover { color: var(--primary); background: #fff; }
.batch-bar svg { width: 16px; height: 16px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-spacing: 0; border-collapse: separate; color: #334155; font-size: 12px; }
th { height: 42px; padding: 0 10px; color: #718096; border-bottom: 1px solid var(--border); background: #f8fbff; font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; }
td { height: 56px; max-width: 220px; padding: 8px 10px; border-bottom: 1px solid #edf2f8; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f8fbff; }
tbody tr.is-selected { background: #f1f6ff; }
.check-cell { width: 42px; text-align: center; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.key-cell { min-width: 214px; }
.key-line { display: flex; align-items: center; gap: 6px; }
.license-key { max-width: 190px; overflow: hidden; color: #17365d; font: 600 12px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.mini-icon { width: 28px; height: 28px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 0; border-radius: 7px; color: var(--weak); background: transparent; cursor: pointer; }
.mini-icon:hover { color: var(--primary); background: var(--primary-soft); }
.mini-icon svg { width: 15px; height: 15px; }
.source-note { display: block; margin-top: 3px; color: var(--weak); font-size: 10px; }
.product-tag { display: inline-flex; align-items: center; max-width: 160px; padding: 4px 8px; overflow: hidden; border: 1px solid #d8e7fb; border-radius: 999px; color: #32659e; background: #f2f7ff; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { color: #07845f; background: #eafaf4; }
.status-unactivated { color: #607898; background: #eff4fa; }
.status-expiring { color: #ae6804; background: #fff5dc; }
.status-expired { color: #9b4c4c; background: #fff0f0; }
.status-disabled { color: #c52f3c; background: #ffebed; }
.date-main { display: block; color: #334155; white-space: nowrap; }
.date-relative { display: block; margin-top: 2px; color: var(--weak); font-size: 10px; white-space: nowrap; }
.date-relative.is-warning { color: #b36c08; }
.device-button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; color: #38658f; background: transparent; cursor: pointer; font-size: 11px; }
.device-button:hover { color: var(--primary); border-color: #c9dcff; background: var(--primary-soft); }
.device-button svg { width: 16px; height: 16px; }
.truncate { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-cell { color: var(--weak); }
.action-cell { width: 150px; text-align: right; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.text-action { height: 30px; padding: 0 8px; border: 0; border-radius: 7px; color: #4a6380; background: transparent; cursor: pointer; font-size: 11px; }
.text-action:hover { color: var(--primary); background: var(--primary-soft); }
.row-menu { position: relative; }
.row-menu summary { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); cursor: pointer; list-style: none; }
.row-menu summary:hover { color: var(--primary); background: var(--primary-soft); }
.row-menu summary svg { width: 17px; height: 17px; }
.row-menu-panel { position: absolute; z-index: 20; top: 34px; right: 0; width: 174px; padding: 6px; border: 1px solid var(--border); border-radius: 11px; background: #fff; box-shadow: 0 15px 38px rgba(15, 23, 42, .15); text-align: left; }
.row-menu-panel button { width: 100%; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 9px; border: 0; border-radius: 7px; color: #455d78; background: transparent; cursor: pointer; font-size: 11px; }
.row-menu-panel button:hover { color: var(--primary); background: var(--primary-soft); }
.row-menu-panel button.danger-text:hover { background: #fff1f2; }
.row-menu-panel svg { width: 16px; height: 16px; }
.table-state { margin: 20px; padding: 24px; border: 1px dashed #bfd3ee; border-radius: 13px; color: var(--muted); background: #f9fbff; text-align: center; }
.empty-state { display: grid; place-items: center; padding: 42px 20px; color: var(--muted); text-align: center; }
.empty-illustration { width: 76px; height: 76px; display: grid; place-items: center; margin-bottom: 12px; border: 1px solid #cfe0ff; border-radius: 24px; color: var(--primary); background: var(--primary-soft); }
.empty-illustration svg { width: 42px; height: 42px; }
.empty-state h3 { margin: 0 0 5px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 0 14px; }
.skeleton-line { height: 10px; border-radius: 6px; background: linear-gradient(90deg, #edf2f8 25%, #f8fbff 40%, #edf2f8 60%); background-size: 300% 100%; animation: shimmer 1.2s ease infinite; }
.pagination { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; color: var(--muted); border-top: 1px solid #e8f0fa; font-size: 11px; }
.pagination > div { display: flex; align-items: center; gap: 13px; }
.pagination label { display: flex; align-items: center; gap: 6px; }
.pagination select { width: 64px; height: 32px; padding: 0 7px; }
.page-controls { justify-content: flex-end; }
.page-controls .icon-button { width: 32px; height: 32px; }
#pageNumbers { display: flex; gap: 4px; }
.page-number { min-width: 32px; height: 32px; padding: 0 7px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.page-number:hover { color: var(--primary); background: var(--primary-soft); }
.page-number.is-active { color: #fff; background: var(--primary); }
.rotate-90 { transform: rotate(90deg); }
.rotate-minus-90 { transform: rotate(-90deg); }

.events-panel .compact-search { width: 260px; }
.events-table td:first-child { width: 175px; white-space: nowrap; }
.event-detail { max-width: 600px; overflow: hidden; color: var(--muted); font: 11px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }

.drawer-overlay { position: fixed; z-index: 90; inset: 0; background: rgba(15, 23, 42, .24); backdrop-filter: blur(2px); animation: fadeIn .2s ease; }
.drawer { position: fixed; z-index: 91; top: 0; right: 0; width: min(500px, 100%); height: 100vh; display: flex; flex-direction: column; border-left: 1px solid var(--border); background: #fff; box-shadow: -20px 0 60px rgba(15, 23, 42, .14); opacity: 0; pointer-events: none; transform: translateX(18px); transition: .22s ease; }
.drawer.is-open { opacity: 1; pointer-events: auto; transform: translateX(0); }
.drawer > header { min-height: 75px; display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.drawer > header h2 { margin: 2px 0 0; font-size: 19px; }
.drawer-content { flex: 1; padding: 20px; overflow: auto; }
.drawer-license { margin-bottom: 18px; padding: 16px; border: 1px solid #d4e3f7; border-radius: 14px; background: linear-gradient(145deg, #f8fbff, #fff); }
.drawer-license .key-line { margin: 10px 0 5px; }
.drawer-license .license-key { max-width: 360px; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 20px; overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: var(--border); }
.detail-item { min-height: 74px; padding: 12px; background: #fff; }
.detail-item small, .detail-item strong { display: block; }
.detail-item small { margin-bottom: 5px; color: var(--weak); font-size: 10px; }
.detail-item strong { overflow: hidden; color: #334155; font-size: 12px; text-overflow: ellipsis; }
.drawer-section { margin-top: 21px; }
.drawer-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer-section-heading h3 { margin: 0; font-size: 14px; }
.device-card { margin-bottom: 9px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: #fbfdff; }
.device-card-top { display: flex; align-items: flex-start; gap: 10px; }
.device-card-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.device-card-icon svg { width: 18px; height: 18px; }
.device-card-main { min-width: 0; flex: 1; }
.device-card-main strong { display: block; margin-bottom: 4px; font-size: 12px; }
.machine-id { display: flex; align-items: center; gap: 5px; color: #526b87; font: 11px ui-monospace, monospace; }
.machine-id span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-meta { display: flex; gap: 14px; margin-top: 8px; color: var(--weak); font-size: 10px; }
.note-editor { display: flex; gap: 8px; }
.note-editor textarea { flex: 1; min-height: 76px; }

.modal-overlay { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(15, 23, 42, .42); backdrop-filter: blur(4px); animation: fadeIn .18s ease; }
.modal { position: relative; width: min(440px, 100%); max-height: calc(100vh - 44px); padding: 27px; overflow: auto; border: 1px solid rgba(210, 225, 244, .9); border-radius: 18px; background: #fff; box-shadow: 0 26px 80px rgba(15, 23, 42, .22); animation: modalIn .22s ease; }
.modal h2 { margin: 12px 0 7px; font-size: 20px; letter-spacing: -.3px; text-align: center; }
.modal > p { margin: 0 0 20px; color: var(--muted); line-height: 1.6; text-align: center; }
.modal-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto; border-radius: 17px; color: var(--primary); background: var(--primary-soft); }
.modal-icon svg { width: 30px; height: 30px; }
.modal-icon.warning { color: #c87b08; background: #fff5dd; }
.modal-icon.success { color: #07845f; background: #e9faf4; }
.modal-close { position: absolute; top: 13px; right: 13px; width: 32px; height: 32px; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 46px; }
.password-field .icon-button { position: absolute; top: 1px; right: 1px; width: 38px; height: 38px; border: 0; background: transparent; }
.form-error { min-height: 18px; margin: 8px 0 !important; color: var(--danger) !important; font-size: 11px; text-align: left !important; }
.confirm-message { margin: 13px 0 22px; color: var(--muted); line-height: 1.65; text-align: center; }
.confirm-message strong { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.result-modal { width: min(640px, 100%); }
.result-keys { max-height: 260px; margin: 15px 0; padding: 8px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: #f8fbff; }
.result-key { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 10px; border-bottom: 1px solid #e7eff9; color: #274765; font: 12px ui-monospace, monospace; }
.result-key:last-child { border-bottom: 0; }
.result-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.toast-region { position: fixed; z-index: 160; right: 20px; bottom: 20px; width: min(360px, calc(100% - 40px)); display: grid; gap: 9px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; min-height: 52px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 16px 45px rgba(15, 23, 42, .16); animation: toastIn .22s ease; pointer-events: auto; }
.toast > span:first-child { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.toast.success > span:first-child { color: #07845f; background: #e9faf4; }
.toast.warning > span:first-child { color: #b36c08; background: #fff5dd; }
.toast.error > span:first-child { color: #c52f3c; background: #ffebed; }
.toast svg { width: 16px; height: 16px; }
.toast p { margin: 0; color: #334155; font-size: 12px; line-height: 1.4; }
.toast button { width: 26px; height: 26px; border: 0; color: var(--weak); background: transparent; cursor: pointer; }

.reveal { animation: reveal .25s both; }
.stats-card:nth-child(2) { animation-delay: 35ms; }
.stats-card:nth-child(3) { animation-delay: 70ms; }
.stats-card:nth-child(4) { animation-delay: 105ms; }
.stats-card:nth-child(5) { animation-delay: 140ms; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.8); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(23, 105, 255, .8); outline-offset: 2px; }

@media (max-width: 1260px) {
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 20px; gap: 12px; }
  .brand small { display: none; }
  .main-nav { justify-content: center; }
  .top-search { width: 210px; }
  .connection-pill span { display: none; }
  .issue-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .duration-field { grid-column: span 2; }
  .note-field { grid-column: span 2; }
  .issue-submit { grid-column: 4; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .topbar { height: auto; min-height: 64px; grid-template-columns: 1fr auto; padding: 9px 16px; }
  .main-nav { order: 3; grid-column: 1 / -1; height: 42px; justify-content: flex-start; border-top: 1px solid #edf2f8; }
  .nav-item { height: 42px; }
  .top-search { display: none; }
  .app-shell { width: min(100% - 28px, 900px); padding-top: 22px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .issue-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .duration-field, .note-field { grid-column: span 2; }
  .issue-submit { grid-column: 2; }
  .list-toolbar { grid-template-columns: 1fr; }
  .segmented { overflow-x: auto; }
  .advanced-filters { justify-content: flex-start; overflow-x: auto; }
  .license-table { min-width: 1100px; }
}

@media (max-width: 640px) {
  .app-shell { overflow-x: clip; }
  .license-panel { overflow: hidden; }
  .brand strong { font-size: 13px; }
  .top-actions { gap: 5px; }
  .connection-pill { display: none; }
  .admin-menu > summary > span:not(.avatar), .admin-menu .chevron { display: none; }
  .page-heading { align-items: flex-start; }
  .page-heading .button { width: 44px; padding: 0; font-size: 0; }
  .page-heading .button svg { width: 18px; height: 18px; }
  .page-heading h1 { font-size: 22px; }
  .stats-card { min-height: 98px; padding: 13px; }
  .stats-icon { width: 36px; height: 36px; }
  .stats-card strong { font-size: 21px; }
  .issue-form { grid-template-columns: 1fr; }
  .duration-field, .note-field, .issue-submit { grid-column: auto; }
  .issue-submit { width: 100%; }
  .templates { overflow-x: auto; white-space: nowrap; }
  .sync-note { display: none; }
  .panel-heading { padding: 13px; }
  .list-toolbar { padding: 12px; }
  .advanced-filters select { min-width: 125px; }
  .batch-bar { align-items: flex-start; overflow-x: auto; }
  .batch-bar > div { min-width: max-content; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .modal { padding: 24px 18px 20px; }
  .detail-grid { grid-template-columns: 1fr; }
}

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