/**
 * Site Sentinel — Grimdark Warhammer Fantasy Theme
 * "In the grim darkness of uptime monitoring, there is only war."
 */

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    --bg-darkest:     #0a0a0a;
    --bg-dark:        #111111;
    --bg-panel:       #1a1a1a;
    --bg-card:        #1e1e1e;
    --bg-hover:       #252525;
    --bg-input:       #1a1a1a;

    --stone-dark:     #2a2a2a;
    --stone-mid:      #3d3d3d;
    --stone-light:    #555555;

    --blood-dark:     #8b0000;
    --blood-mid:      #a00000;
    --blood-bright:   #c0392b;
    --blood-glow:     #ff2222;

    --gold-dark:      #8a6f08;
    --gold-mid:       #b8960c;
    --gold-bright:    #d4af37;
    --gold-glow:      #f0d060;

    --green-bright:   #2ecc40;
    --green-dark:     #1a9c2e;
    --green-glow:     #40ff60;

    --yellow-mid:     #d4af37;
    --yellow-bright:  #f1c40f;

    --text-primary:   #d4cfc4;
    --text-secondary: #8a8578;
    --text-muted:     #5a5650;
    --text-bright:    #f0ece0;

    --font-gothic:    'UnifrakturMaguntia', cursive;
    --font-mono:      'IBM Plex Mono', monospace;
    --font-body:      'Inter', sans-serif;

    --radius-sm:      4px;
    --radius-md:      8px;
    --radius-lg:      12px;

    --shadow-sm:      0 2px 4px rgba(0,0,0,0.5);
    --shadow-md:      0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg:      0 8px 24px rgba(0,0,0,0.7);
    --shadow-gold:    0 0 15px rgba(184,150,12,0.15);
    --shadow-red:     0 0 15px rgba(192,57,43,0.2);

    --border-stone:   1px solid #2a2a2a;
    --border-gold:    1px solid rgba(184,150,12,0.3);
    --border-red:     1px solid rgba(192,57,43,0.3);

    --sidebar-width:  260px;

    --transition:     0.3s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* Subtle stone texture via noise gradient */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(42,42,42,0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(42,42,42,0.2) 0%, transparent 50%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(30,30,30,0.1) 2px,
            rgba(30,30,30,0.1) 4px
        );
}

a {
    color: var(--gold-bright);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--gold-glow);
}

/* ============================================================
   SCANLINE OVERLAY
   ============================================================ */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR — THE STONE TABLET
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-dark);
    border-right: 2px solid var(--stone-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    /* Stone tablet texture */
    background-image:
        linear-gradient(180deg, var(--bg-dark) 0%, #0d0d0d 100%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 1px,
            rgba(42,42,42,0.1) 1px,
            rgba(42,42,42,0.1) 2px
        );
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: var(--border-gold);
    background: linear-gradient(180deg, rgba(184,150,12,0.05) 0%, transparent 100%);
}

.app-crest {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    animation: slowRotate 60s linear infinite;
}

@keyframes slowRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.crest-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(184,150,12,0.3));
}

.app-title {
    font-family: var(--font-gothic);
    font-size: 1.6rem;
    color: var(--gold-bright);
    text-shadow: 0 0 10px rgba(184,150,12,0.3);
    letter-spacing: 1px;
}

.app-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}

.nav-item:hover {
    color: var(--text-bright);
    background: rgba(184,150,12,0.05);
    border-left-color: var(--gold-dark);
}

.nav-item.active {
    color: var(--gold-bright);
    background: rgba(184,150,12,0.08);
    border-left-color: var(--gold-bright);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: var(--border-stone);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.user-icon {
    font-size: 1.2rem;
}

.logout-btn {
    margin-top: 8px;
    font-size: 0.8rem;
}
.logout-btn:hover {
    color: var(--blood-bright) !important;
    border-left-color: var(--blood-bright) !important;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.page-header-nav {
    width: 100%;
}

.page-title {
    font-family: var(--font-gothic);
    font-size: 2rem;
    color: var(--gold-bright);
    text-shadow: 0 0 20px rgba(184,150,12,0.2);
    flex: 1;
}

.page-subtitle {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ============================================================
   INCIDENT BANNER
   ============================================================ */
.incident-banner {
    background: linear-gradient(90deg, rgba(139,0,0,0.3) 0%, rgba(192,57,43,0.2) 50%, rgba(139,0,0,0.3) 100%);
    border: var(--border-red);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin-bottom: 20px;
    animation: bannerPulse 2s ease-in-out infinite;
}

@keyframes bannerPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(192,57,43,0.2); }
    50%      { box-shadow: 0 0 25px rgba(192,57,43,0.4); }
}

.incident-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--blood-bright);
    font-weight: 600;
}

.incident-icon {
    font-size: 1.4rem;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-2px); }
    75%      { transform: translateX(2px); }
}

.incident-target {
    background: rgba(192,57,43,0.2);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* ============================================================
   SUMMARY BAR
   ============================================================ */
.summary-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.summary-card {
    flex: 1;
    min-width: 120px;
    background: var(--bg-panel);
    border: var(--border-stone);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    transition: all var(--transition);
}

.summary-card:hover {
    border-color: var(--gold-dark);
    box-shadow: var(--shadow-gold);
}

.summary-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-bright);
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.summary-online .summary-value { color: var(--green-bright); }
.summary-offline .summary-value { color: var(--blood-bright); }

/* ============================================================
   RUNE DIVIDER
   ============================================================ */
.rune-divider {
    text-align: center;
    margin: 16px 0 24px;
    opacity: 0.6;
}

.divider-svg {
    width: 200px;
    height: 20px;
}

/* ============================================================
   TARGET CARDS GRID
   ============================================================ */
.target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.target-card {
    background: var(--bg-card);
    border: var(--border-stone);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition);
    animation: slideInUp 0.4s ease;
    position: relative;
    overflow: hidden;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.target-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stone-mid);
    transition: background var(--transition);
}

.target-card.status-up::before    { background: var(--green-bright); }
.target-card.status-down::before  { background: var(--blood-bright); }
.target-card.status-degraded::before { background: var(--yellow-mid); }

.target-card:hover {
    border-color: var(--stone-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.target-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.target-status-sigil {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sigil-svg {
    width: 100%;
    height: 100%;
}

/* Pulse animations for status sigils */
.pulse-green {
    animation: pulseGreen 2s ease-in-out infinite;
}
.pulse-red {
    animation: pulseRed 1.5s ease-in-out infinite;
}
.pulse-yellow {
    animation: pulseYellow 2s ease-in-out infinite;
}

@keyframes pulseGreen {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(46,204,64,0.3)); }
    50%      { filter: drop-shadow(0 0 12px rgba(46,204,64,0.6)); }
}

@keyframes pulseRed {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(192,57,43,0.3)); }
    50%      { filter: drop-shadow(0 0 12px rgba(192,57,43,0.7)); }
}

@keyframes pulseYellow {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(212,175,55,0.3)); }
    50%      { filter: drop-shadow(0 0 12px rgba(212,175,55,0.6)); }
}

.target-info {
    flex: 1;
    min-width: 0;
}

.target-name {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.target-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.target-status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 12px;
}

.target-metrics {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

.metric-warning .metric-value { color: var(--yellow-bright); }
.metric-danger .metric-value  { color: var(--blood-bright); }

.target-sparkline {
    margin-bottom: 12px;
    opacity: 0.8;
}

.sparkline {
    display: block;
    width: 100%;
    max-height: 30px;
}

.target-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: var(--border-stone);
    padding-top: 10px;
}

.target-last-check {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.target-actions {
    display: flex;
    gap: 4px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blood-dark), var(--blood-mid));
    color: #fff;
    border: 1px solid var(--blood-bright);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--blood-mid), var(--blood-bright));
    box-shadow: 0 0 15px rgba(192,57,43,0.3);
    color: #fff;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-mid));
    color: #111;
    border: 1px solid var(--gold-bright);
}
.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-mid), var(--gold-bright));
    box-shadow: var(--shadow-gold);
    color: #111;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--stone-dark);
}
.btn-ghost:hover {
    color: var(--text-bright);
    border-color: var(--stone-light);
    background: rgba(255,255,255,0.03);
}

.btn-danger {
    background: var(--blood-dark);
    color: #fff;
    border: 1px solid var(--blood-bright);
}
.btn-danger:hover {
    background: var(--blood-bright);
    box-shadow: var(--shadow-red);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: var(--border-stone);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--gold-mid);
    box-shadow: 0 0 8px rgba(184,150,12,0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8578' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group {
    flex: 1;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: 0;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--gold-mid);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.form-notice {
    background: rgba(184,150,12,0.1);
    border: var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--gold-bright);
    font-size: 0.85rem;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
}

.alert-danger {
    background: rgba(139,0,0,0.2);
    border: var(--border-red);
    color: var(--blood-bright);
}

.alert-success {
    background: rgba(46,204,64,0.1);
    border: 1px solid rgba(46,204,64,0.3);
    color: var(--green-bright);
}

/* ============================================================
   PANELS — PARCHMENT STYLE
   ============================================================ */
.panel {
    background: var(--bg-panel);
    border: var(--border-stone);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
    /* Parchment texture simulation */
    background-image:
        linear-gradient(180deg, var(--bg-panel) 0%, rgba(26,26,26,0.95) 100%);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.4s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: var(--border-stone);
    background: rgba(184,150,12,0.03);
}

.panel-header h3 {
    font-family: var(--font-gothic);
    font-size: 1.2rem;
    color: var(--gold-bright);
}

.panel-body {
    padding: 20px;
}

.panel-warning {
    border-color: rgba(212,175,55,0.4);
    box-shadow: 0 0 10px rgba(212,175,55,0.1);
}

.panel-danger {
    border-color: rgba(192,57,43,0.4);
    box-shadow: var(--shadow-red);
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--stone-dark);
    background: rgba(0,0,0,0.2);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: var(--border-stone);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.data-table .row-up { border-left: 3px solid var(--green-bright); }
.data-table .row-down { border-left: 3px solid var(--blood-bright); }
.data-table .row-timeout { border-left: 3px solid var(--yellow-mid); }
.data-table .row-error { border-left: 3px solid var(--blood-dark); }

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.error-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sortable {
    cursor: pointer;
    user-select: none;
}
.sortable:hover {
    color: var(--gold-bright);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    font-family: var(--font-mono);
}

.badge-up {
    background: rgba(46,204,64,0.15);
    color: var(--green-bright);
    border: 1px solid rgba(46,204,64,0.3);
}

.badge-down {
    background: rgba(192,57,43,0.15);
    color: var(--blood-bright);
    border: 1px solid rgba(192,57,43,0.3);
}

.badge-unknown {
    background: rgba(90,86,80,0.15);
    color: var(--text-muted);
    border: 1px solid rgba(90,86,80,0.3);
}

/* ============================================================
   BULK ACTIONS
   ============================================================ */
.bulk-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.bulk-actions .form-input {
    width: auto;
    min-width: 180px;
}

/* ============================================================
   TOOLS PAGE
   ============================================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--bg-card);
    border: var(--border-stone);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    animation: slideInUp 0.4s ease;
}

.tool-card:hover {
    border-color: var(--stone-light);
}

.tool-header {
    padding: 20px;
    border-bottom: var(--border-stone);
    background: rgba(184,150,12,0.03);
}

.tool-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.tool-header h3 {
    font-family: var(--font-gothic);
    font-size: 1.1rem;
    color: var(--gold-bright);
    margin-bottom: 4px;
}

.tool-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tool-body {
    padding: 20px;
}

.tool-result {
    border-top: var(--border-stone);
    animation: fadeIn 0.3s ease;
}

.tool-result-header {
    padding: 12px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: var(--border-stone);
}

.tool-result-header h4 {
    font-size: 0.85rem;
    color: var(--gold-bright);
    font-family: var(--font-gothic);
}

.tool-result-body {
    padding: 20px;
}

.tool-metrics {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.terminal-output {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--green-bright);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.5;
}

.terminal-output::-webkit-scrollbar {
    width: 6px;
}
.terminal-output::-webkit-scrollbar-track {
    background: #0a0a0a;
}
.terminal-output::-webkit-scrollbar-thumb {
    background: var(--stone-mid);
    border-radius: 3px;
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
    width: 100%;
    min-height: 200px;
    position: relative;
}

.chart-container-sm {
    min-height: 250px;
    max-width: 400px;
    margin: 0 auto;
}

/* Uptime bar chart */
.uptime-bar-chart {
    display: flex;
    gap: 1px;
    height: 40px;
    align-items: stretch;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.uptime-bar {
    flex: 1;
    min-width: 1px;
    transition: opacity 0.2s;
    cursor: pointer;
    position: relative;
}
.uptime-bar:hover {
    opacity: 0.8;
}
.uptime-bar.up   { background: var(--green-bright); }
.uptime-bar.down { background: var(--blood-bright); }
.uptime-bar.none { background: var(--stone-dark); }

.uptime-bar-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

/* ============================================================
   SSL INFO
   ============================================================ */
.ssl-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.ssl-stat {
    display: flex;
    flex-direction: column;
}

.ssl-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ssl-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
}

.ssl-meter {
    grid-column: 1 / -1;
}

.ssl-meter-bar {
    height: 8px;
    background: var(--stone-dark);
    border-radius: 4px;
    overflow: hidden;
}

.ssl-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

/* Text color utilities */
.text-success { color: var(--green-bright); }
.text-danger  { color: var(--blood-bright); }
.text-warning { color: var(--yellow-bright); }
.text-muted   { color: var(--text-muted); }

/* ============================================================
   LOADING / CHAOS SPINNER
   ============================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10,10,10,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    gap: 16px;
    color: var(--gold-bright);
    font-family: var(--font-gothic);
    font-size: 1.2rem;
}

.chaos-spinner {
    width: 60px;
    height: 60px;
    position: relative;
    animation: chaosRotate 2s linear infinite;
}

.chaos-spinner::before,
.chaos-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.chaos-spinner::before {
    width: 40px;
    height: 40px;
    border: 2px solid var(--gold-mid);
    border-top-color: transparent;
    border-radius: 50%;
    animation: chaosRotate 1s linear infinite reverse;
}

.chaos-spinner::after {
    width: 20px;
    height: 20px;
    border: 2px solid var(--blood-bright);
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: chaosRotate 0.75s linear infinite;
}

@keyframes chaosRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10,10,10,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-panel);
    border: 2px solid var(--blood-dark);
    border-radius: var(--radius-lg);
    max-width: 460px;
    width: 90%;
    box-shadow: 0 0 40px rgba(139,0,0,0.3);
    animation: slideInUp 0.3s ease;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: var(--border-stone);
}

.modal-header h3 {
    font-family: var(--font-gothic);
    color: var(--blood-bright);
    font-size: 1.3rem;
}

.modal-body {
    padding: 24px;
    text-align: center;
}

.modal-skull {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    animation: skullBob 2s ease-in-out infinite;
}

@keyframes skullBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

.skull-svg {
    width: 100%;
    height: 100%;
}

.modal-footer {
    padding: 16px 24px;
    border-top: var(--border-stone);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-footer form {
    display: flex;
    gap: 10px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-family: var(--font-gothic);
    color: var(--text-secondary);
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at center, rgba(139,0,0,0.08) 0%, transparent 60%),
        var(--bg-darkest);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    background: var(--bg-panel);
    border: 2px solid var(--stone-dark);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 60px rgba(0,0,0,0.5),
        0 0 20px rgba(184,150,12,0.05);
    text-align: center;
    animation: fadeIn 0.6s ease;
}

.login-crest {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.login-crest-svg {
    width: 100%;
    height: 100%;
    animation: slowRotate 30s linear infinite;
    filter: drop-shadow(0 0 10px rgba(184,150,12,0.3));
}

.login-title {
    font-family: var(--font-gothic);
    font-size: 2.2rem;
    color: var(--gold-bright);
    text-shadow: 0 0 20px rgba(184,150,12,0.3);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.login-flavor {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 24px;
}

.login-form {
    text-align: left;
    margin-top: 20px;
}

.login-form .form-group label {
    text-align: left;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================================
   HEADER SYNTAX HIGHLIGHTING (for HTTP headers)
   ============================================================ */
.header-key {
    color: var(--gold-bright);
}
.header-val {
    color: var(--green-bright);
}
.header-status {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    font-family: var(--font-mono);
}
.header-status.status-2xx { color: var(--green-bright); }
.header-status.status-3xx { color: var(--yellow-mid); }
.header-status.status-4xx { color: var(--blood-bright); }
.header-status.status-5xx { color: var(--blood-bright); }

/* SSL detail panel in tools */
.ssl-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ssl-detail-item {
    display: flex;
    flex-direction: column;
}

.ssl-detail-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ssl-detail-item .value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.ssl-detail-item.full-width {
    grid-column: 1 / -1;
}

/* Port check result */
.port-status {
    font-size: 1.4rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-align: center;
    padding: 12px;
}
.port-open   { color: var(--green-bright); }
.port-closed { color: var(--blood-bright); }

/* Target link in table */
.target-link {
    font-weight: 600;
    color: var(--text-bright);
}
.target-link:hover {
    color: var(--gold-bright);
}

/* ============================================================
   RUNE GLOW EFFECTS (for interactive elements)
   ============================================================ */
.btn-primary:active,
.btn-gold:active {
    animation: runeFlash 0.3s ease;
}

@keyframes runeFlash {
    0%   { box-shadow: 0 0 5px rgba(184,150,12,0.3); }
    50%  { box-shadow: 0 0 20px rgba(184,150,12,0.6); }
    100% { box-shadow: 0 0 5px rgba(184,150,12,0.3); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.3s ease;
        z-index: 200;
    }
    .sidebar.open {
        left: 0;
    }
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    .summary-bar {
        flex-direction: column;
    }
    .summary-card {
        min-width: auto;
    }
    .target-grid {
        grid-template-columns: 1fr;
    }
    .tools-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
    }
    .data-table {
        font-size: 0.75rem;
    }
    .login-container {
        margin: 16px;
        padding: 24px;
    }
    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
    }

    .page-title {
        font-size: 1.5rem;
    }
    .ssl-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 201;
    background: var(--bg-panel);
    border: var(--border-gold);
    color: var(--gold-bright);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Panel filters */
.panel-filters {
    display: flex;
    gap: 8px;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}
::-webkit-scrollbar-thumb {
    background: var(--stone-mid);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--stone-light);
}

/* ============================================================
   SVG CHART STYLES
   ============================================================ */
.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-grid-line {
    stroke: var(--stone-dark);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.chart-axis-label {
    fill: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.chart-line {
    fill: none;
    stroke-width: 2;
}

.chart-area {
    opacity: 0.1;
}

.chart-dot {
    r: 3;
    opacity: 0;
    transition: opacity 0.2s;
}
.chart-dot:hover {
    opacity: 1;
}

/* Donut chart */
.donut-label {
    fill: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
}
.donut-center-text {
    fill: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
}
.donut-center-sub {
    fill: var(--text-muted);
    font-family: var(--font-body);
    font-size: 10px;
}

/* ============================================================
   Email Template Editor — The Scribe's Sanctum
   ============================================================ */

.template-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 768px) {
    .template-editor-grid {
        grid-template-columns: 1fr;
    }
}

.template-editor-grid textarea {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    width: 100%;
    min-height: 300px;
    resize: vertical;
    line-height: 1.5;
}
.template-editor-grid textarea:focus {
    border-color: var(--gold);
    outline: none;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.template-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.template-token {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--gold);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.template-token:hover {
    background: var(--bg-hover);
    border-color: var(--gold);
}

.preview-iframe {
    width: 100%;
    min-height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #ffffff;
}

.editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* Dispatch result message */
.dispatch-result {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}
.dispatch-result.dispatch-success {
    background: rgba(46, 204, 64, 0.1);
    border: 1px solid rgba(46, 204, 64, 0.3);
    color: #2ecc40;
}
.dispatch-result.dispatch-error {
    background: rgba(192, 57, 43, 0.1);
    border: 1px solid rgba(192, 57, 43, 0.3);
    color: #c0392b;
}

/* Report schedule target select list */
.target-select-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    background: var(--bg-card);
}
.target-select-list label {
    display: block;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
    transition: background 0.15s;
}
.target-select-list label:hover {
    background: var(--bg-hover);
}
.target-select-list label.select-all-label {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    padding-bottom: 8px;
    font-weight: 600;
    color: var(--gold);
}

/* Test email modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 24px;
    min-width: 360px;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-content h3 {
    color: var(--gold);
    margin-bottom: 16px;
    font-family: var(--font-heading);
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}
