@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Auth UI (ADR 0007) --- */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: #F5F7FB;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-overlay[hidden] { display: none !important; }
.auth-card {
    background: #fff;
    padding: 32px 36px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 380px;
}
.auth-card h2 {
    margin-bottom: 8px;
    font-size: 20px;
    color: #2A2F36;
}
.auth-card .auth-sub {
    color: #6B7280;
    font-size: 13px;
    margin-bottom: 20px;
}
.auth-card label {
    display: block;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
    margin-top: 12px;
    font-weight: 500;
}
.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #2A2F36;
}
.auth-card input:focus {
    outline: none;
    border-color: #2C6FDB;
    box-shadow: 0 0 0 2px rgba(44,111,219,0.15);
}
.auth-card .btn-primary {
    width: 100%;
    margin-top: 18px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.auth-card .btn-primary:disabled {
    opacity: 0.6;
    cursor: wait;
}
.auth-error {
    color: #C92A2A;
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
}
.auth-qr-wrap {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    margin-bottom: 8px;
}
.auth-qr-wrap img {
    width: 200px;
    height: 200px;
    background: #fff;
    padding: 8px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
}
.auth-mfa-uri {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 11px;
    word-break: break-all;
    background: #F5F7FB;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    color: #374151;
    user-select: all;
    display: none;  /* URI скрыт по умолчанию, можно показать через devtools */
}
.auth-mfa-secret {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 2px;
    background: #F5F7FB;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    margin-top: 6px;
    color: #2A2F36;
    user-select: all;
}
.logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #F5F7FB;
    color: #2A2F36;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.header-logo {
    height: 32px;
    display: block;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-actions .card-sub {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

.btn {
    padding: 7px 14px;
    border: 1px solid #E3E8F0;
    background: #fff;
    color: #2A2F36;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

.btn:hover { background: #F5F7FB; border-color: #c8d0dc; }

.btn-primary {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2560C8 0%, #19A3B5 100%);
    border-color: transparent;
}

.tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #E3E8F0;
    padding: 0 24px;
}

.tab {
    padding: 14px 18px;
    cursor: pointer;
    color: #6B7280;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: color .15s;
    margin-bottom: -1px;
}

.tab:hover { color: #2A2F36; }
.tab.active { color: #2C6FDB; border-bottom-color: #2C6FDB; font-weight: 500; }

.content { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* Servers page uses the full viewport width — the configurable table can
   grow with additional columns and needs the room. Other pages keep the
   1400px cap so their layouts stay proportioned. */
body.page-servers .content { max-width: none; padding: 24px 16px; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform .2s, box-shadow .2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.card-label {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #2A2F36;
}

.card-sub {
    font-size: 12px;
    color: #6B7280;
    margin-top: 4px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-box {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-box h3 {
    font-size: 11px;
    color: #6B7280;
    margin-bottom: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.chart-box canvas { width: 100% !important; }

.table-wrap {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.table-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #E3E8F0;
}

.table-header h3 {
    font-size: 14px;
    color: #2A2F36;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.period-filter {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 16px;
}

.period-btn {
    padding: 5px 10px;
    font-size: 12px;
}

.period-btn.active {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    border-color: transparent;
    color: #fff;
}

.filters .period-filter {
    margin-bottom: 0;
}

.filters select, .filters input {
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #E3E8F0;
    color: #2A2F36;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
}

.filters select:focus, .filters input:focus {
    outline: none;
    border-color: #2C6FDB;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #E3E8F0;
    cursor: pointer;
    background: #F5F7FB;
    font-weight: 500;
}

th:hover { color: #2A2F36; }
th.sorted { color: #2C6FDB; }

td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid #E3E8F0;
    color: #2A2F36;
}

tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F5F7FB; }

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-green { background: #dcfce7; color: #16a34a; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-blue { background: #E8F0FF; color: #2C6FDB; }

/* --- Configurable / resizable servers table --- */

.servers-scroll {
    overflow-x: auto;
    /* Keeps the sticky columns' shadow visible on the right edge. */
    position: relative;
}

.resizable-table {
    table-layout: fixed;
    border-collapse: collapse;
    /* Let the layout grow past the container so horizontal scroll appears. */
    min-width: max-content;
}

.resizable-table th, .resizable-table td {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    position: relative;
}

.resizable-table th {
    user-select: none;
    background: #F5F7FB;
}

/* Sticky first columns to keep server identity visible during horizontal scroll. */
.resizable-table th.col-sticky, .resizable-table td.col-sticky {
    position: sticky;
    background: #F5F7FB;
    z-index: 3;
}
.resizable-table td.col-sticky { background: #fff; }
.resizable-table tbody tr:hover td.col-sticky { background: #F5F7FB; }
.resizable-table th.col-sticky-1, .resizable-table td.col-sticky-1 { left: 0; }
.resizable-table th.col-sticky-2, .resizable-table td.col-sticky-2 { }
.resizable-table th.col-sticky-shadow, .resizable-table td.col-sticky-shadow {
    box-shadow: 4px 0 6px -4px rgba(0,0,0,0.12);
}

/* Column resize handle: a slim vertical bar on the right edge of the header. */
.col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 4;
}
.col-resize-handle:hover, .col-resize-handle.dragging {
    background: linear-gradient(90deg, transparent, rgba(44,111,219,0.35));
}

/* Column-picker popover reuses tag-filter-panel styling. */
.col-picker { position: relative; }
.col-picker-panel .col-picker-list { padding: 8px 4px; }
.col-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}
.col-picker-item:hover { background: #F5F7FB; }
.col-picker-item input { margin: 0; }

/* Compact last-update-time cell */
.last-data-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.last-data-fresh { color: #2A2F36; }
.last-data-stale { color: #B45309; }
.last-data-stale-90 { color: #dc2626; }

.import-log { padding: 20px; }

.import-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #E3E8F0;
}

.import-item:last-child { border-bottom: none; }
.import-item strong { font-size: 13px; color: #2A2F36; }

.loading {
    text-align: center;
    padding: 60px;
    color: #6B7280;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #E3E8F0;
    font-size: 13px;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: #6B7280; }
.detail-value { color: #2A2F36; font-weight: 500; }

.version-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.version-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2C6FDB;
    flex-shrink: 0;
}

.version-dot.changed { background: #F59E0B; }

.version-date { color: #6B7280; min-width: 90px; }
.version-val { color: #2A2F36; }

/* Compact version runs (one line per version) */
.version-runs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.version-run {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 4px 8px;
    border-radius: 4px;
}
.version-run:nth-child(odd) { background: #F5F7FB; }

.version-run-date { color: #6B7280; min-width: 90px; }
.version-run-sep { color: #6B7280; }
.version-run-ver { color: #2A2F36; font-weight: 500; }
.version-run-days { color: #6B7280; margin-left: auto; }

@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
    .cards { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Tags ---------- */

.tags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    max-width: 340px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tag-icon {
    font-size: 10px;
    opacity: 0.7;
    line-height: 1;
}

.tag-event { background: #FFF7E6; color: #B45309; border-color: #FDE68A; }
.tag-availability { background: #E8F0FF; color: #2C6FDB; border-color: #C7D9F7; }
.tag-availability.tag-slug-stable_online { background: #dcfce7; color: #16a34a; border-color: #bbf7d0; }
.tag-availability.tag-slug-mostly_online { background: #E8F0FF; color: #2C6FDB; border-color: #C7D9F7; }
.tag-availability.tag-slug-sometimes_online { background: #FFF7E6; color: #B45309; border-color: #FDE68A; }
.tag-availability.tag-slug-disabled { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.tag-user { background: #F5F7FB; color: #2A2F36; border-color: #E3E8F0; }

.tag-remove {
    margin-left: 4px;
    opacity: 0.6;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}
.tag-remove:hover { opacity: 1; }

/* Tag filter dropdown */
.tag-filter { position: relative; }

.tag-filter-btn.has-selection {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    color: #fff;
    border-color: transparent;
}

.tag-filter-panel {
    position: fixed;
    min-width: 320px;
    max-width: 400px;
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
}

/* display:flex above overrides the native [hidden] display:none. Restore it. */
.tag-filter-panel[hidden] { display: none; }

.tag-filter-panel-body {
    overflow-y: auto;
    padding: 12px 12px 4px;
    flex: 1 1 auto;
    min-height: 0;
}

.tag-filter-panel-footer {
    padding: 8px 12px;
    border-top: 1px solid #E3E8F0;
    background: #fff;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
}

/* Geo filter */
.geo-filter { position: relative; }

.geo-filter-btn.has-selection {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    color: #fff;
    border-color: transparent;
}

.geo-filter-panel .tag-filter-panel-header {
    padding: 10px 12px 6px;
    border-bottom: 1px solid #E3E8F0;
    flex-shrink: 0;
}

.geo-filter-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #2A2F36;
}
.geo-filter-search:focus { outline: none; border-color: #2C6FDB; }

.geo-country-block { margin-bottom: 6px; }
.geo-country-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2A2F36;
    cursor: pointer;
    border-radius: 4px;
}
.geo-country-head:hover { background: #F5F7FB; }
.geo-country-head .card-sub { font-weight: 500; }
.geo-country-cities { margin: 2px 0 4px 4px; }

.geo-city-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    color: #2A2F36;
}
.geo-city-item:hover { background: #F5F7FB; }
.geo-city-item.selected { background: #E8F0FF; color: #2C6FDB; font-weight: 500; }
.geo-city-item .geo-city-count { color: #6B7280; font-size: 12px; }

.geo-quick-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    color: #2A2F36;
    margin-bottom: 2px;
}
.geo-quick-item:hover { background: #F5F7FB; }
.geo-quick-item.selected { background: #E8F0FF; color: #2C6FDB; font-weight: 500; }
.geo-quick-item .card-sub { font-size: 12px; }

.tag-filter-group { margin-bottom: 12px; }
.tag-filter-group:last-child { margin-bottom: 0; }

.tag-filter-group-title {
    font-size: 10px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    font-weight: 600;
}

.tag-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.tag-filter-item:hover { background: #F5F7FB; }
.tag-filter-item input { margin-right: 8px; }

.tag-filter-item .tag-filter-count {
    color: #6B7280;
    font-size: 12px;
    margin-left: 8px;
}

.tag-filter-item-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-filter-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tag-filter-user-cat {
    padding-left: 4px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #2A2F36;
    font-weight: 500;
}

/* Popover with tag details */
.tag-popover {
    position: absolute;
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 12px 14px;
    min-width: 220px;
    max-width: 320px;
    font-size: 13px;
    z-index: 200;
    color: #2A2F36;
    line-height: 1.5;
}

.tag-popover h4 {
    margin: 0 0 6px;
    font-size: 13px;
    color: #2A2F36;
    font-weight: 600;
}

.tag-popover .popover-row {
    color: #6B7280;
}

.tag-popover .popover-row b {
    color: #2A2F36;
    font-weight: 500;
}

/* --- SSL column states (ТЗ п.14) --- */
.ssl-cell { white-space: nowrap; }
.ssl-valid { color: #16a34a; }
.ssl-expiring-soon { color: #B45309; font-weight: 500; }
.ssl-expiring-today { color: #dc2626; font-weight: 600; }
.ssl-expired { color: #dc2626; font-weight: 500; }
.ssl-no-cert { color: #6B7280; }
.ssl-no-data { color: #6B7280; font-style: italic; }

/* Dashboard SSL attention card */
.ssl-attention {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    padding: 18px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.ssl-attention-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ssl-attention-title {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}
.ssl-attention-total {
    font-size: 28px;
    font-weight: 700;
    color: #2A2F36;
}
.ssl-attention-items {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.ssl-attention-item {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    background: #F5F7FB;
    transition: background .15s;
    min-width: 120px;
}
.ssl-attention-item:hover { background: #EBF0F8; }
.ssl-attention-item-label {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.ssl-attention-item-value {
    font-size: 20px;
    font-weight: 600;
}
.ssl-attention-expiring .ssl-attention-item-value { color: #B45309; }
.ssl-attention-expired .ssl-attention-item-value { color: #dc2626; }
.ssl-attention-empty {
    color: #16a34a;
    font-size: 13px;
    padding: 2px 6px;
}

/* Domain directory summary (ТЗ 09 §6) */
.domain-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #F5F7FB;
    border-radius: 8px;
    margin-bottom: 4px;
}
.domain-summary-item { display: flex; flex-direction: column; gap: 2px; min-width: 110px; }
.domain-summary-label {
    font-size: 10px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.domain-summary-value { font-size: 20px; font-weight: 700; color: #2A2F36; }
.domain-summary-item.sv-configured .domain-summary-value { color: #16a34a; }
.domain-summary-item.sv-unconfigured .domain-summary-value { color: #B45309; }
.domain-summary-item.sv-ignored .domain-summary-value { color: #6B7280; }
.domain-summary-item.sv-nodomain { cursor: pointer; }
.domain-summary-item.sv-nodomain:hover { text-decoration: underline; }

/* Filter pills under summary */
.domain-filter-pill {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 14px;
    cursor: pointer;
    background: #fff;
    color: #2A2F36;
    border: 1px solid #E3E8F0;
    transition: background .15s, color .15s, border-color .15s;
}
.domain-filter-pill:hover { background: #F5F7FB; }
.domain-filter-pill.active {
    background: linear-gradient(135deg, #2C6FDB 0%, #1EB6C9 100%);
    color: #fff;
    border-color: transparent;
}

/* Status badges in domain table */
.domain-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.domain-status.configured { background: #dcfce7; color: #16a34a; }
.domain-status.unconfigured { background: #FFF7E6; color: #B45309; }
.domain-status.ignored { background: #F5F7FB; color: #6B7280; }
.domain-row-new {
    display: inline-block;
    padding: 1px 6px;
    background: #2C6FDB;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

/* Inline edit controls */
.domain-inline-select {
    padding: 4px 6px;
    font-size: 12px;
    border: 1px solid #E3E8F0;
    border-radius: 4px;
    background: #fff;
    color: #2A2F36;
    font-family: inherit;
    max-width: 160px;
}
.domain-inline-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Domain rules table */
.domain-rules-table { width: 100%; border-collapse: collapse; }
.domain-rules-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    border-bottom: 1px solid #E3E8F0;
    cursor: pointer;
    user-select: none;
}
.domain-rules-table th.sorted { color: #2C6FDB; }
.domain-rules-table td {
    padding: 10px;
    border-bottom: 1px solid #F5F7FB;
    font-size: 13px;
}
.domain-rules-table tr:last-child td { border-bottom: none; }
.domain-rules-domain {
    font-family: monospace;
    background: #F5F7FB;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}
.domain-rules-empty {
    padding: 24px;
    text-align: center;
    color: #6B7280;
}

/* Domain rule modal (reuses assign-tag-modal structure) */
.domain-rule-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}
.domain-rule-form label {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.domain-rule-form input,
.domain-rule-form select {
    padding: 8px 10px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #2A2F36;
}
.domain-rule-form input:focus,
.domain-rule-form select:focus { outline: none; border-color: #2C6FDB; }
.domain-rule-form .normalized-hint {
    font-size: 12px;
    color: #6B7280;
    padding-top: 2px;
}

/* Tag management page */
.tag-manage-category {
    background: #F5F7FB;
    border: 1px solid #E3E8F0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.tag-manage-cat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tag-manage-cat-head h4 {
    font-size: 14px;
    color: #2A2F36;
    margin: 0;
}

.tag-manage-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.tag-manage-actions {
    display: flex;
    gap: 6px;
}

.btn-danger {
    color: #dc2626;
    border-color: #fecaca;
}
.btn-danger:hover { background: #fef2f2; border-color: #fecaca; }

.btn-small { padding: 3px 8px; font-size: 12px; }

/* Period-compare popover on Dashboard */
.period-compare { position: relative; display: inline-block; }
.period-compare-panel {
    /* Reuses tag-filter-panel base for position: fixed, hidden, etc. */
    min-width: 280px;
    max-width: 340px;
    padding: 12px;
}
.period-compare-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.period-compare-row label {
    font-size: 12px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}
.period-compare-row input[type=date] {
    padding: 6px 8px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #2A2F36;
    flex: 1;
    max-width: 170px;
}
.period-compare-row input[type=date]:focus {
    outline: none;
    border-color: #2C6FDB;
}
.period-compare-err {
    color: #dc2626;
    font-size: 12px;
    padding: 4px 0;
    min-height: 18px;
}
.period-compare-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

/* Reinstalled tag uses same event colouring but a distinct accent icon */
.tag-slug-reinstalled { background: #F3E8FF; color: #7C3AED; border-color: #DDD6FE; }

/* Rollout block on dashboard */
.rollout-block {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.rollout-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
}

.rollout-header h3 {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin: 0 0 4px;
}

.rollout-header .rollout-version-select {
    padding: 5px 8px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #E3E8F0;
    background: #fff;
}

.rollout-progress {
    height: 10px;
    background: #F5F7FB;
    border-radius: 6px;
    overflow: hidden;
    margin: 12px 0;
}

.rollout-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2C6FDB, #1EB6C9);
    border-radius: 6px;
    transition: width .3s;
}

.rollout-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.rollout-stat {
    background: #F5F7FB;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background .15s;
}
.rollout-stat:hover { background: #EBF0F8; }

.rollout-stat-label {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 2px;
}

.rollout-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #2A2F36;
}

/* Reinstall candidates */
.reinstall-card {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.reinstall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.reinstall-score {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.reinstall-score-value {
    font-size: 16px;
    font-weight: 700;
    color: #2A2F36;
}

.reinstall-conf-high { color: #16a34a; }
.reinstall-conf-medium { color: #B45309; }
.reinstall-conf-low { color: #6B7280; }

.reinstall-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 6px 12px;
    font-size: 12px;
    color: #2A2F36;
    background: #F5F7FB;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
}

.reinstall-feature-row { display: flex; justify-content: space-between; }
.reinstall-feature-row .reinstall-feature-weight { color: #6B7280; font-weight: 500; }
.reinstall-feature-matched { color: #16a34a; }
.reinstall-feature-unmatched { color: #6B7280; }

.reinstall-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.reinstall-distribution {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: #F5F7FB;
    border-radius: 6px;
    font-size: 12px;
    color: #6B7280;
}

.reinstall-distribution b { color: #2A2F36; }

/* UUID chain */
.uuid-chain {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
}

.uuid-chain-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 10px;
    background: #F5F7FB;
    border-radius: 6px;
}

.uuid-chain-row.current { background: #E8F0FF; }
.uuid-chain-order { color: #6B7280; font-weight: 500; min-width: 24px; }
.uuid-chain-uuid { font-family: monospace; font-size: 12px; }
.uuid-chain-dates { color: #6B7280; font-size: 12px; margin-left: auto; }

/* Tag-assign popover on server detail */
.assign-tag-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 55, 0.35);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.assign-tag-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    width: min(480px, 100%);
    max-height: min(80vh, 640px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.assign-tag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #E3E8F0;
}

.assign-tag-header h3 {
    margin: 0;
    font-size: 15px;
    color: #2A2F36;
    font-weight: 600;
}

.assign-tag-close {
    cursor: pointer;
    padding: 4px 8px;
    color: #6B7280;
    font-size: 20px;
    line-height: 1;
    border-radius: 4px;
}
.assign-tag-close:hover { background: #F5F7FB; color: #2A2F36; }

.assign-tag-body {
    padding: 12px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.assign-tag-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E3E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #2A2F36;
    margin-bottom: 12px;
}
.assign-tag-search:focus { outline: none; border-color: #2C6FDB; }

.assign-tag-section-title {
    font-size: 10px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 12px;
}
.assign-tag-section-title:first-child { margin-top: 0; }

.assign-tag-current {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: #F5F7FB;
    border-radius: 6px;
    min-height: 32px;
}

.assign-tag-current .tag { cursor: default; }

.assign-tag-category { margin-bottom: 10px; }

.assign-tag-category-name {
    font-size: 13px;
    color: #2A2F36;
    font-weight: 500;
    margin-bottom: 6px;
}

.assign-tag-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.assign-tag-option {
    padding: 4px 10px;
    background: #fff;
    color: #2A2F36;
    border: 1px solid #E3E8F0;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.assign-tag-option:hover { background: #F5F7FB; border-color: #c8d0dc; }
.assign-tag-option.assigned {
    background: #E8F0FF;
    color: #2C6FDB;
    border-color: #C7D9F7;
    cursor: default;
}

.assign-tag-empty {
    padding: 12px;
    text-align: center;
    color: #6B7280;
    font-size: 13px;
}

.assign-tag-footer {
    padding: 10px 18px;
    border-top: 1px solid #E3E8F0;
    background: #F5F7FB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #6B7280;
}

/* Server detail tag section */
.srv-tags-block {
    background: #fff;
    border: 1px solid #E3E8F0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.srv-tags-block h3 {
    font-size: 11px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    font-weight: 600;
}
.srv-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}
.srv-tags-row:last-child { margin-bottom: 0; }
