:root {
  --ink: #241b3d;
  --ink-soft: #4e4762;
  --muted: #716b80;
  --line: #e3e1ed;
  --line-strong: #d3cfe2;
  --paper: #ffffff;
  --bg: #f7f8fc;
  --surface: #f1f3fa;
  --primary: #3a2078;
  --primary-dark: #29145f;
  --primary-soft: #eee9fb;
  --accent: #00afe8;
  --accent-dark: #008cbd;
  --accent-soft: #e4f8ff;
  --danger: #b33145;
  --warning: #a66708;
  --success: #24734b;
  --shadow: 0 14px 38px rgba(47, 31, 91, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% 0, rgba(0,175,232,.07), transparent 28rem), var(--bg); }
a { color: var(--primary); }

.topbar { min-height: 82px; display: flex; align-items: center; gap: 22px; padding: 12px 26px; color: #fff; background: linear-gradient(112deg, #241052 0%, #392075 56%, #2d1765 100%); border-bottom: 3px solid var(--accent); box-shadow: 0 8px 26px rgba(38,21,82,.18); position: relative; z-index: 20; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 275px; color: #fff; text-decoration: none; }
.brand img { width: 138px; height: auto; max-height: 48px; object-fit: contain; background: #fff; border-radius: 7px; padding: 4px 7px; }
.brand > span { display: flex; flex-direction: column; gap: 2px; }
.brand strong { font-size: 19px; letter-spacing: .08em; }
.brand small { max-width: 180px; color: #dcd5f0; font-size: 10px; line-height: 1.25; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.topbar nav a, .user-actions > a, .link-button { color: #f9f7ff; text-decoration: none; padding: 10px 11px; border-radius: 9px; background: transparent; border: 0; font: inherit; white-space: nowrap; cursor: pointer; }
.topbar nav a { font-weight: 400; font-size: 15px; }
.user-actions > a, .link-button { font-weight: 650; font-size: 14px; }
.topbar nav a:hover, .topbar nav a:focus-visible, .user-actions > a:hover, .link-button:hover { background: rgba(255,255,255,.12); }
.user-actions { display: flex; align-items: center; gap: 2px; border-left: 1px solid rgba(255,255,255,.18); padding-left: 8px; }
.topbar .user-actions { flex-shrink: 0; margin-left: auto; }
.topbar .current-user { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; max-width: 180px; margin-right: 8px; font-size: 13px; line-height: 1.3; color: #f9f7ff; }

.container { width: min(100% - 40px, 1480px); margin: 0 auto; padding: 32px 0 48px; }
footer { padding: 25px 28px 32px; text-align: center; color: var(--muted); font-size: 13px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.devices-page-head { min-width: 0; margin-bottom: 20px; }
.devices-head-main { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px; min-width: 0; }
.devices-head-main h1 { flex: 1 1 180px; min-width: 0; }
.devices-head-actions { display: flex; flex-wrap: wrap; gap: 9px; min-width: 0; }
.devices-head-actions .button { min-width: 0; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.devices-background-status { max-width: 100%; margin: 8px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.unified-head { min-height: 116px; padding: 20px 22px 20px 26px; background: linear-gradient(120deg, #fff 0%, #fff 70%, #eefaff 100%); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow); }
.eyebrow { display: block; margin-bottom: 7px; color: var(--accent-dark); font-size: 11px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0 0 5px; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.035em; color: var(--primary-dark); }
h2 { margin: 0 0 12px; font-size: 22px; color: var(--primary-dark); }
h3 { margin: 0 0 8px; font-size: 18px; color: var(--primary-dark); }
p { margin: 5px 0 14px; line-height: 1.5; }
.muted, small { color: var(--muted); }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }

.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; border: 1px solid var(--primary); border-radius: 10px; background: var(--primary); color: #fff; text-decoration: none; font-weight: 750; cursor: pointer; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover, button:hover { background: var(--primary-dark); box-shadow: 0 8px 20px rgba(58,32,120,.16); transform: translateY(-1px); }
.button.secondary { color: var(--primary); background: #fff; border-color: var(--line-strong); }
.button.secondary:hover { background: var(--primary-soft); box-shadow: none; }
.compact { min-height: 34px; padding: 7px 11px; font-size: 12px; }
button:disabled { opacity: .46; cursor: not-allowed; transform: none; box-shadow: none; }
.danger { background: #fff; color: var(--danger); border-color: #e9bfc6; }
.danger:hover { background: #fff1f3; color: #8e2235; box-shadow: none; }

.card, .login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; padding: 22px; margin-bottom: 18px; box-shadow: 0 2px 7px rgba(47,31,91,.035); }
.section-card { scroll-margin-top: 18px; }
.section-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.section-heading h2, .section-heading h3 { margin-bottom: 3px; }
.section-heading p { margin: 0; color: var(--muted); }
.section-number { display: inline-grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 850; }
.section-nav, .profile-tabs { display: flex; align-items: center; gap: 6px; margin: 0 0 18px; padding: 7px; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px rgba(47,31,91,.04); }
.section-nav a, .profile-tabs a { flex: 1; min-width: max-content; padding: 9px 12px; color: var(--ink-soft); text-align: center; text-decoration: none; font-size: 13px; font-weight: 750; border-radius: 8px; }
.section-nav a:hover, .profile-tabs a:hover { color: var(--primary); background: var(--primary-soft); }

.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.metric-row > div { display: flex; flex-direction: column; gap: 4px; min-height: 92px; padding: 15px; background: var(--surface); border-radius: 11px; }
.metric-row span, .application-facts span, .future-update-slot span { color: var(--muted); font-size: 12px; }
.metric-row strong { font-size: 18px; color: var(--primary-dark); }
.metric-row small { margin-top: auto; }
.policy-metrics { grid-template-columns: repeat(4, minmax(0,1fr)); }
.readiness-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

.status, .tag { display: inline-flex; width: max-content; align-items: center; padding: 4px 8px; border-radius: 99px; background: #ececf2; color: #625d6e; font-size: 11px; font-weight: 800; }
.status.pass, .status.fresh { background: #e1f3e8; color: var(--success); }
.status.warn, .status.stale, .status.warning { background: #fff0ce; color: var(--warning); }
.status.info { background: var(--accent-soft); color: #006c95; }
.status.fail { background: #f9dfe3; color: var(--danger); }
.status.browser { color: #006c95; background: var(--accent-soft); }
.status.draft { color: var(--primary); background: var(--primary-soft); }
.status.neutral, .status.unknown { background: #ececf2; color: #625d6e; }
.alert, .notice { border-radius: 11px; padding: 13px 15px; margin-bottom: 16px; border: 1px solid transparent; overflow-wrap: anywhere; }
.alert.warning, .notice.warning { background: #fff7e5; color: #734b00; border-color: #f0d89f; }
.alert.error { background: #fff0f2; color: #822538; border-color: #efc2ca; }
.alert.success, .notice.success { background: #eaf7ef; color: #1c603e; border-color: #c7e8d4; }
.alert.info { background: #eff9fd; color: #275368; border-color: #ccecf7; }
.compatibility-note { margin: 0 0 15px; font-size: 13px; }
.warning-text { color: var(--warning) !important; }
.ok-text { color: var(--success); }

label { display: flex; flex-direction: column; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #c7c3d6; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,175,232,.16); border-color: var(--accent-dark); }
textarea { min-height: 96px; resize: vertical; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; min-height: auto; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; align-items: end; gap: 11px; flex-wrap: wrap; }
.inline-form label { min-width: 190px; }
.summary-grid, dl { display: grid; grid-template-columns: minmax(140px,.7fr) minmax(0,1.4fr); gap: 8px 14px; margin: 12px 0 0; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; }
details > summary { cursor: pointer; color: var(--primary); font-weight: 750; }
.technical { margin-top: 12px; }
.technical[open] summary { margin-bottom: 10px; }
.technical-card { background: #fafaff; box-shadow: none; }
.technical-card p { margin: 12px 0 0; color: var(--muted); }
.break { overflow-wrap: anywhere; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.sim-iccid { font-size: inherit; font-weight: inherit; overflow-wrap: anywhere; }
.wifi-mac-field { min-width: 0; }
.wifi-card dd, .wifi-observation { overflow-wrap: anywhere; }
.wifi-card .wifi-apply-failure { margin-top: 12px; }
@media (max-width: 560px) {
  .wifi-card > dl { grid-template-columns: 1fr; gap: 6px; }
  .wifi-card > dl > dd { margin-bottom: 10px; }
}
.wifi-mac-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.wifi-mac-value { font-size: inherit; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wifi-mac-line button { width: auto; flex: 0 0 auto; }
.wifi-mac-note { display: block; margin-top: 5px; color: var(--muted); }
.wifi-config-details { margin-top: 8px; overflow-wrap: anywhere; }
.wifi-config-details > div { margin-top: 5px; }
.wifi-candidate-list { margin: 7px 0 0; padding-left: 20px; }
.wifi-candidate-list li + li { margin-top: 5px; }
code { padding: 1px 4px; border-radius: 4px; background: #efeff5; }
.table-wrap { width: 100%; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: #5d576c; background: #f1f2f8; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.application-updates-table > table { min-width: 960px; }
.application-updates-table th, .application-updates-table td { vertical-align: top; }
.application-updates-table td { overflow-wrap: anywhere; }
.application-updates-table > table > thead > tr > th:nth-child(1) { width: 16%; }
.application-updates-table > table > thead > tr > th:nth-child(2) { width: 16%; }
.application-updates-table > table > thead > tr > th:nth-child(3) { width: 17%; }
.application-updates-table > table > thead > tr > th:nth-child(4) { width: 21%; }
.application-updates-table > table > thead > tr > th:nth-child(5) { width: 19%; }
.application-updates-table > table > thead > tr > th:nth-child(6) { width: 11%; }
.update-select { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: .85rem; }
.update-device-panel-row[hidden] { display: none !important; }
.update-device-panel-row > td { padding: 18px 20px; background: #f8f9fd; }
.update-device-panel h3 { margin: 0 0 16px; }
.update-device-role + .update-device-role { margin-top: 20px; }
.update-device-role h4 { margin: 0 0 8px; }
.update-device-table { min-width: 0; width: 100%; table-layout: fixed; background: white; border: 1px solid var(--line); }
.update-device-table th, .update-device-table td { padding: 9px; overflow-wrap: anywhere; }
.update-device-table td small { display: block; margin-top: 5px; color: var(--muted); }
.update-device-table td form { margin: 0; }
.update-device-table td button { white-space: normal; }
.update-row-actions form { margin-bottom: 7px; }
.application-updates-table input[type="checkbox"] { width: 18px; min-height: 18px; margin-top: 3px; accent-color: var(--primary); }
.update-detail, .update-result { display: block; max-width: 240px; margin-top: 7px; color: var(--muted); line-height: 1.35; }
.success-text { color: var(--success); }
.error-text { color: var(--danger); }
.application-update-actions { margin-top: 16px; }
.empty { padding: 32px; color: var(--muted); text-align: center; }
pre { overflow: auto; max-height: 400px; padding: 14px; color: #eef9ff; background: #25164c; border-radius: 10px; }

.auth-shell { width: min(1120px, calc(100% - 36px)); min-height: calc(100vh - 110px); margin: 0 auto; display: grid; grid-template-columns: minmax(360px, .82fr) minmax(420px, 1.18fr); align-items: center; gap: 54px; }
.login-card { width: 100%; max-width: 460px; margin: 32px auto; padding: 34px; box-shadow: var(--shadow); }
.login-logo { display: block; width: min(100%, 340px); height: auto; margin: 0 auto 28px; object-fit: contain; }
.login-title { margin-bottom: 22px; text-align: center; }
.login-title > span { color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.login-title h1 { margin: 7px 0; font-size: 25px; line-height: 1.15; }
.login-title p { color: var(--muted); }
.login-card form { display: grid; gap: 16px; }
.login-card form button { min-height: 47px; margin-top: 4px; background: linear-gradient(100deg, var(--primary), #4a2b91); }
.auth-note { display: block; margin-top: 20px; text-align: center; }
.logistics-hero { align-self: stretch; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 40px; overflow: hidden; position: relative; }
.logistics-hero::before { content: ""; position: absolute; inset: 8% 0; z-index: -1; border-radius: 34px; background: linear-gradient(145deg, #f0ecfb, #e9faff); transform: skewY(-2deg); }
.logistics-hero h2 { max-width: 610px; margin: 0 0 12px; font-size: clamp(32px, 4vw, 52px); line-height: 1.03; letter-spacing: -.045em; }
.logistics-hero p { max-width: 520px; color: var(--ink-soft); font-size: 17px; }
.logistics-hero img { width: min(100%, 650px); height: auto; margin-top: 18px; opacity: .92; }

@media (max-width: 1240px) {
  .topbar { gap: 12px; padding-inline: 18px; }
  .brand { min-width: 215px; }
  .brand img { width: 120px; }
  .brand small { display: none; }
  .topbar nav a, .user-actions > a, .link-button { padding-inline: 8px; }
  .topbar nav a { font-size: 14px; }
  .user-actions > a, .link-button { font-size: 13px; }
  .policy-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; }
  .brand { flex: 1; }
  .topbar nav { order: 3; width: 100%; flex-basis: 100%; overflow-x: auto; padding-top: 3px; }
  .topbar nav a { flex: 1; text-align: center; }
  .user-actions { border-left: 0; }
  .metric-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .auth-shell { grid-template-columns: minmax(340px,.85fr) minmax(340px,1fr); gap: 18px; }
  .logistics-hero { padding: 28px; }
}
@media (max-width: 760px) {
  .application-updates-table { overflow: visible; border: 0; background: transparent; }
  .application-updates-table > table, .application-updates-table > table > tbody { display: block; width: 100%; min-width: 0; }
  .application-updates-table > table > thead { display: none; }
  .application-updates-table .update-summary-row { display: block; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 11px; background: white; }
  .application-updates-table .update-summary-row > td { display: block; width: 100%; border: 0; padding: 10px 12px; }
  .application-updates-table .update-summary-row > td + td { border-top: 1px solid var(--line); }
  .application-updates-table .update-summary-row > td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
  .application-updates-table .update-device-panel-row { display: block; margin: -10px 0 14px; }
  .application-updates-table .update-device-panel-row > td { display: block; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 0 0 11px 11px; }
  .update-device-table, .update-device-table tbody, .update-device-table tr, .update-device-table td { display: block; width: 100%; min-width: 0; }
  .update-device-table { border: 0; background: transparent; }
  .update-device-table thead { display: none; }
  .update-device-table tr { margin-bottom: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: white; }
  .update-device-table td { padding: 6px 0; border: 0; }
  .update-device-table td + td { border-top: 1px solid var(--line); }
  .update-device-table td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
  .container { width: min(100% - 24px, 1480px); padding-top: 20px; }
  .page-head, .unified-head { align-items: flex-start; flex-direction: column; }
  .devices-head-main { flex-direction: column; align-items: stretch; }
  .devices-head-main h1 { flex: none; width: 100%; }
  .devices-head-actions { flex: none; width: 100%; }
  .devices-head-actions .button { flex: 1 1 150px; }
  .unified-head { min-height: auto; padding: 18px; }
  .actions, .actions .button { width: 100%; }
  .metric-row, .policy-metrics, .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .auth-shell { display: flex; flex-direction: column; min-height: auto; }
  .login-card { order: 1; margin-bottom: 0; padding: 26px 22px; }
  .logistics-hero { order: 2; width: 100%; padding: 28px 22px; text-align: center; }
  .logistics-hero h2 { font-size: 31px; }
  .logistics-hero img { margin-inline: auto; }
}
