*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; }
html { line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { margin: 0; font-family: "Outfit", sans-serif; color: var(--text-500); background: var(--background-color); }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--medium-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
code, .mono { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85em; }
table { border-collapse: collapse; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-expanded-width);
  min-width: var(--sidebar-min-expanded-width);
  max-width: var(--sidebar-max-expanded-width);
  background: var(--sidebar-background);
  color: var(--sidebar-text-500);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 10px 0 rgba(0, 0, 5, 0.1);
  position: sticky;
  top: 0;
  height: 100vh;
  user-select: none;
}
.sidebar__top { display: flex; align-items: center; gap: 10px; padding: 20px; }
.sidebar__logo { width: 38px; height: 38px; }
.sidebar__title { font-size: var(--font-size-2xl); font-weight: 600; color: var(--sidebar-text-600); line-height: 1.1; }
.sidebar__subtitle { font-size: var(--font-size-xs); font-weight: 700; color: var(--sidebar-text-300); letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar__menu { padding: 15px 20px 15px 15px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--border-radius--medium);
  color: var(--sidebar-text-500); font-size: var(--font-size-lg); font-weight: 500;
  cursor: pointer; list-style: none;
}
.nav-item:hover { background: var(--sidebar-highlight); text-decoration: none; }
.nav-item--active { background: var(--sidebar-highlight); color: var(--sidebar-text-600); box-shadow: inset 3px 0 0 var(--primary-color); }
.nav-item svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-parent summary::-webkit-details-marker { display: none; }
.nav-parent summary .chevron { margin-left: auto; transition: transform var(--sidebar-animation-duration); }
.nav-parent[open] summary .chevron { transform: rotate(90deg); }
.nav-children { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px 32px; }
.nav-children .nav-item { font-size: var(--font-size-md); padding: 7px 12px; color: var(--sidebar-text-400); }
.nav-children .nav-item--active { color: var(--sidebar-text-600); }
.sidebar__divider { height: 1px; background: var(--sidebar-border-color); margin: 8px 4px; }
.sidebar__profile { border-top: 1px solid var(--sidebar-border-color); padding: 16px 20px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--primary-color); color: var(--button-text);
  display: flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase;
}
.sidebar__profile-text { min-width: 0; flex: 1; }
.sidebar__email { font-size: var(--font-size-ms); color: var(--sidebar-text-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__role { font-size: var(--font-size-xs); color: var(--sidebar-text-300); }
.sidebar__signout { color: var(--sidebar-text-400); font-size: var(--font-size-sm); background: none; border: none; cursor: pointer; padding: 4px; }
.sidebar__signout:hover { color: var(--sidebar-text-600); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topnav {
  position: sticky; top: 0; z-index: 10;
  height: 63px; min-height: 63px; display: flex; align-items: center; gap: 12px;
  padding: 0 35px; background: var(--background-color); box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}
.topnav__route { flex: 1; font-size: var(--font-size-lg); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav__route .parent { color: var(--text-300); }
.topnav__route .sep { color: var(--text-300); margin: 0 6px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: var(--border-radius--medium); background: none; border: 1px solid transparent; cursor: pointer; color: var(--text-500);
}
.icon-button:hover { background: var(--background-third); }
.icon-button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.badge-env { font-size: var(--font-size-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--warning); color: #243e5e; }

.content { padding: 28px var(--default-page-padding) 60px; width: 100%; max-width: 1500px; }
.page-header { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { font-size: var(--font-size-3xl); font-weight: 600; }
.page-header .sub { color: var(--text-400); font-size: var(--font-size-md); }
.page-header .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--background-core); border: 1px solid var(--light-border-color);
  border-radius: var(--border-radius--large); padding: var(--standard-container-padding); margin-bottom: 20px;
}
.card h2 { font-size: var(--font-size-xl); font-weight: 600; margin-bottom: 12px; }
.card--danger { border-color: var(--danger); background: var(--danger-light); }
.card--warning { border-color: var(--warning); }
.muted { color: var(--text-400); }
.small { font-size: var(--font-size-sm); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: var(--font-size-md); }
.kv dt { color: var(--text-400); }
.kv dd { margin: 0; word-break: break-word; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--border-radius--medium);
  font-weight: 500; font-size: var(--font-size-md); cursor: pointer;
  border: 1px solid var(--input-area-border-color); background: var(--background-color); color: var(--text-500);
}
.btn:hover { background: var(--background-third); text-decoration: none; }
.btn--primary { background: var(--primary-color); border-color: var(--primary-color); color: var(--button-text); }
.btn--primary:hover { background: var(--primary-color--hover); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }
.btn--small { padding: 4px 10px; font-size: var(--font-size-sm); }
.btn--large { padding: 12px 22px; font-size: var(--font-size-lg); }
.btn[disabled], .btn--disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.inline-form { display: inline; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: var(--font-size-md); }
.field .hint { color: var(--text-400); font-size: var(--font-size-sm); }
.input, select.input, textarea.input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--input-area-border-color);
  border-radius: var(--border-radius--medium); background: var(--background-color); font-size: var(--font-size-md);
}
.input:focus { outline: 2px solid var(--primary-color-light-alpha); border-color: var(--primary-color); }
textarea.input { min-height: 90px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.field-error, .validation-summary-errors { color: var(--danger); font-size: var(--font-size-sm); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { width: auto; min-width: 220px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--light-border-color); border-radius: var(--border-radius--large); background: var(--background-core); }
.table { width: 100%; font-size: var(--font-size-md); }
.table th { text-align: left; font-weight: 500; color: var(--text-400); font-size: var(--font-size-sm); padding: 10px 14px; background: var(--background-secondary); border-bottom: 1px solid var(--light-border-color); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--light-border-color); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--background-secondary); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--text-400); }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: var(--font-size-xs); font-weight: 600; background: var(--background-third); color: var(--text-500); white-space: nowrap; }
.pill--ok { background: var(--primary-color-light); color: #1f7a4f; }
.pill--amber { background: #fff4dc; color: #9a6500; }
.pill--red, .pill--revoked { background: #fde8e8; color: var(--danger); }
.pill--superseded { background: var(--background-third); color: var(--text-400); }
:root[data-mode="dark"] .pill--ok { background: rgba(0, 240, 145, 0.15); color: #7ff5c4; }
:root[data-mode="dark"] .pill--amber { background: rgba(242, 164, 9, 0.2); color: #f7c05a; }
:root[data-mode="dark"] .pill--red, :root[data-mode="dark"] .pill--revoked { background: rgba(202, 64, 64, 0.25); color: #ff9b9b; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot--on { background: var(--success); }
.dot--off { border: 2px solid var(--text-300); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning-hover); }
.text-success { color: var(--success); }

.flash { padding: 12px 16px; border-radius: var(--border-radius--medium); margin-bottom: 18px; border: 1px solid; font-size: var(--font-size-md); }
.flash--success { border-color: var(--success); background: var(--primary-color-light); }
.flash--warning { border-color: var(--warning); background: #fff8e8; }
.flash--danger { border-color: var(--danger); background: var(--danger-light); }
:root[data-mode="dark"] .flash--success, :root[data-mode="dark"] .flash--warning { background: var(--background-secondary); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--light-border-color); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 10px 16px; color: var(--text-400); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-500); text-decoration: none; }
.tab--active { color: var(--text-500); border-bottom-color: var(--primary-color); }
.picker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.picker .input { width: auto; min-width: 260px; }

.island-note { color: var(--text-400); font-size: var(--font-size-sm); margin-bottom: 12px; }
.island-host { min-height: 400px; }
.island-placeholder { border: 2px dashed var(--input-area-border-color); border-radius: var(--border-radius--large); padding: 40px; text-align: center; color: var(--text-400); }
.island-placeholder code { color: var(--text-500); }

.download-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.download-card { flex: 1; min-width: 260px; border: 1px solid var(--light-border-color); border-radius: var(--border-radius--large); padding: 18px; background: var(--background-secondary); }
.download-card h3 { font-size: var(--font-size-lg); margin-bottom: 4px; }
.download-card p { margin-bottom: 12px; }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar-background); padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--background-color); border-radius: var(--border-radius--extra-large); padding: 34px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); }
.auth-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-card .brand img { width: 44px; height: 44px; }
.auth-card h1 { font-size: var(--font-size-2xl); font-weight: 600; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.or { text-align: center; color: var(--text-300); margin: 16px 0 8px; font-size: var(--font-size-sm); }

.chain-ok { color: var(--success); font-weight: 700; }
.chain-bad { color: var(--danger); font-weight: 700; }

@media (max-width: 1000px) {
  .content { padding-left: var(--default-page-padding--small); padding-right: var(--default-page-padding--small); }
  .sidebar { min-width: 200px; }
}

.nowrap { white-space: nowrap; }
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card__head h2 { margin-bottom: 0; }
.card__actions { margin-left: auto; display: flex; gap: 8px; }
.file-link { display: inline-flex; align-items: center; gap: 5px; margin-right: 14px; font-weight: 500; font-size: var(--font-size-md); }
.file-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row-actions { text-align: right; }
.row-actions a { margin-left: 14px; font-size: var(--font-size-md); }
.add-site { margin-top: 16px; }
.licence-table tr.has-extras td { border-bottom: 0; }
.extra-clients td { padding-top: 0; }
.extra-clients summary { cursor: pointer; color: var(--text-400); font-size: var(--font-size-sm); width: max-content; }
.extra-clients ul { list-style: none; margin: 6px 0 0; padding: 0; }
.extra-clients li { display: flex; align-items: center; gap: 12px; font-size: var(--font-size-sm); padding: 3px 0; }
.extra-clients li .file-link { margin-right: 0; font-size: var(--font-size-sm); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.choice-card { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--light-border-color); border-radius: var(--border-radius--large); padding: 14px 14px 14px 40px; cursor: pointer; }
.choice-card input { position: absolute; left: 14px; top: 16px; margin: 0; }
.choice-card:has(input:checked) { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); }
.choice-card--disabled { cursor: not-allowed; opacity: 0.6; }
.choice-card__title { font-weight: 600; }
.choice-card__text { color: var(--text-400); font-size: var(--font-size-sm); }
.mode-client { display: none; }
.issue-form:has(input[name="Mode"][value="client"]:checked) .mode-client { display: block; }
.issue-form:has(input[name="Mode"][value="client"]:checked) .mode-server { display: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--background-core); border: 1px solid var(--light-border-color); border-radius: var(--border-radius--large); padding: 16px 18px; }
.stat__label { color: var(--text-400); font-size: var(--font-size-sm); font-weight: 500; }
.stat__value { font-size: var(--font-size-4xl); font-weight: 600; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__sub { color: var(--text-400); font-size: var(--font-size-xs); min-height: 1.2em; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 0 20px; }

:root { --chart-bar: #0092d3; --chart-grid: var(--light-border-color); }
:root[data-mode="dark"] { --chart-bar: #4cc2ee; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; }
.chart .bar { fill: var(--chart-bar); pointer-events: none; }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar--hover { opacity: 0.75; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-label { fill: var(--text-400); font-size: 11px; font-family: inherit; }
.chart__empty { padding: 60px 0; text-align: center; }
.chart__tip { position: absolute; pointer-events: none; background: var(--background-core); border: 1px solid var(--light-border-color); border-radius: var(--border-radius--medium); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); padding: 6px 10px; font-size: var(--font-size-sm); white-space: nowrap; transform: translate(-50%, -100%); display: none; }
.chart__tip strong { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
}

.stat--accent-ok { box-shadow: inset 3px 0 0 var(--success); }
.stat--accent-warning { box-shadow: inset 3px 0 0 var(--warning); }
.stat--accent-danger { box-shadow: inset 3px 0 0 var(--danger); }
.tri-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 20px; }
.card__subhead { font-size: var(--font-size-md); font-weight: 600; margin: 18px 0 8px; }
.card--flush { padding: 0; overflow: hidden; }
.card__head--padded { padding: var(--standard-container-padding) var(--standard-container-padding) 4px; }
.table-scroll { overflow-x: auto; }
.health-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--background-third); margin: 6px 0 14px; }
.health-bar__seg { display: block; width: 0; height: 100%; }
.health--online { background: var(--success); }
.health--disabled { background: var(--warning); }
.health--down { background: var(--danger); }
.legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: var(--font-size-md); }
.legend-list li { display: flex; align-items: center; gap: 8px; }
.legend-list li strong, .legend-list li .pill { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hbar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: var(--font-size-md); }
.hbar-list li { display: grid; grid-template-columns: minmax(0, 9em) 1fr auto; align-items: center; gap: 10px; }
.hbar-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-list strong { font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar { height: 8px; border-radius: 4px; background: var(--background-third); overflow: hidden; }
.hbar__fill { display: block; width: 0; height: 100%; border-radius: 4px; background: var(--chart-bar); }
.hbar__fill--danger { background: var(--danger); }
.facts { margin: 0; padding-left: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 28px; color: var(--text-500); font-size: var(--font-size-md); }
.fleet-table th:first-child, .fleet-table td:first-child { padding-left: var(--standard-container-padding); }
.row-link { cursor: pointer; }
.spark { display: inline-block; vertical-align: middle; margin-right: 8px; }
.spark svg { display: block; }
.spark-bar { fill: var(--chart-bar); }
.spark-value { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .tri-grid { grid-template-columns: 1fr; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--light-border-color); background: var(--background-core); color: var(--text-500);
  font-size: var(--font-size-sm); font-weight: 500; text-decoration: none; transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--text-300); text-decoration: none; }
.chip__count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--background-third); color: var(--text-500); font-size: var(--font-size-xs); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-300); }
.chip--ok .chip__dot { background: var(--success); }
.chip--warn .chip__dot { background: var(--warning); }
.chip--down .chip__dot { background: var(--danger); }
.chip--info .chip__dot { background: var(--info); }
.chip--active { border-color: var(--primary-color); background: var(--primary-color-light); color: var(--text-500); }
.chip--active .chip__count { background: var(--background-core); }
.toolbar__note { margin-left: auto; }

.customer-table td { vertical-align: middle; }
.customer-table tbody tr { transition: background .1s; }
.row--archived td { opacity: .6; }
.cust { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.cust__text { min-width: 0; }
.cust__name { font-weight: 600; color: var(--text-500); }
.cust__avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-sm); font-weight: 700; letter-spacing: .02em;
}
.cust__avatar--0 { background: #e3f4fc; color: #006a9c; }
.cust__avatar--1 { background: #e6f8ef; color: #1f7a4f; }
.cust__avatar--2 { background: #fff1db; color: #9a6500; }
.cust__avatar--3 { background: #efe9fd; color: #5b3fb5; }
.cust__avatar--4 { background: #fde8ef; color: #a8325a; }
.cust__avatar--5 { background: #e8edf4; color: #3d5370; }

.status {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px 3px 9px; border-radius: 999px;
  font-size: var(--font-size-xs); font-weight: 600; white-space: nowrap; background: var(--background-third); color: var(--text-500);
}
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--ok { background: #e4f6e1; color: #2a8a1b; }
.status--ok .status__dot { box-shadow: 0 0 0 3px rgba(58, 184, 37, .22); animation: status-pulse 2.4s ease-in-out infinite; }
.status--warn { background: #fff4dc; color: #9a6500; }
.status--down { background: #fde8e8; color: var(--danger); }
.status--info { background: #e3f2ff; color: #0f6fb8; }
.status--muted { color: var(--text-400); }
.status--muted .status__dot { background: transparent; border: 2px solid currentColor; width: 6px; height: 6px; }
@keyframes status-pulse { 50% { box-shadow: 0 0 0 5px rgba(58, 184, 37, 0); } }
@media (prefers-reduced-motion: reduce) { .status--ok .status__dot { animation: none; } }

:root[data-mode="dark"] .status--ok { background: rgba(58, 184, 37, .18); color: #8ee07f; }
:root[data-mode="dark"] .status--warn { background: rgba(242, 164, 9, .2); color: #f7c05a; }
:root[data-mode="dark"] .status--down { background: rgba(202, 64, 64, .25); color: #ff9b9b; }
:root[data-mode="dark"] .status--info { background: rgba(44, 166, 255, .2); color: #8fcbff; }
:root[data-mode="dark"] .cust__avatar { background: var(--background-third); color: var(--text-500); }
