/* ================================================================
   KTool Web Status — Custom Stylesheet
   Font: Inter (Google Fonts)
   ================================================================ */

:root {
    --bg-dark: #0d1117;
    --bg-sidebar: #161b22;
    --bg-card: #1c2128;
    --bg-card-hover: #222930;
    --bg-input: #0d1117;
    --bg-modal: #1c2128;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 179, 237, 0.5);

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    --accent-blue: #58a6ff;
    --accent-blue-bg: rgba(88, 166, 255, 0.12);
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-orange: #d29922;
    --accent-purple: #a371f7;
    --accent-gray: #8b949e;

    --sidebar-width: 260px;
    --topbar-height: 72px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    --transition: 0.2s ease;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ================================================================
   LAYOUT: App Wrapper
   ================================================================ */
.app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent-blue);
    filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.4));
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 4px 8px 8px;
    text-transform: uppercase;
}

.nav-tab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-tab-item:hover {
    background: var(--accent-blue-bg);
    color: var(--accent-blue);
    text-decoration: none;
}

.nav-tab-item.active {
    background: var(--accent-blue-bg);
    color: var(--accent-blue);
    border-left: 2px solid var(--accent-blue);
}

.nav-tab-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.nav-tab-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-tab-count {
    background: var(--accent-blue-bg);
    color: var(--accent-blue);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

.nav-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.nav-empty i {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
}

.sidebar-footer {
    padding: 12px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn-new-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px;
    background: var(--accent-blue-bg);
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-new-tab:hover {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-footer {
    padding: 20px 24px;
    font-size: 13px;
    background: transparent;
    border-top: 1px solid var(--border-color);
}

.app-footer,
.app-footer .text-muted {
    color: var(--text-secondary) !important;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-footer a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--accent-blue);
}

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-dark);
    flex-shrink: 0;
    gap: 16px;
}

.topbar-left {
    flex: 1;
    min-width: 0;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* Shared action button style */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary-action {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary-action:hover {
    background: #79b8f3;
    color: #fff;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
    text-decoration: none;
}

.btn-secondary-action {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary-action:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    background: var(--bg-card-hover);
    text-decoration: none;
}

/* ================================================================
   FLASH MESSAGES
   ================================================================ */
.flash-zone {
    padding: 12px 28px 0;
    flex-shrink: 0;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.flash-success {
    background: rgba(63, 185, 80, 0.12);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: var(--accent-green);
}

/* ================================================================
   CONTENT AREA
   ================================================================ */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

/* ================================================================
   FILTER BAR
   ================================================================ */
.filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.filter-bar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 180px;
    flex: 1;
}

.filter-group-sm {
    min-width: 110px;
    flex: 0 0 130px;
}

.filter-group-btn {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: flex-end;
    flex: 0 0 auto;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    transition: border-color var(--transition);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.15);
}

.filter-input option {
    background: var(--bg-card);
}

.btn-filter {
    padding: 7px 14px;
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all var(--transition);
}

.btn-filter:hover {
    background: #79b8f3;
}

.btn-filter-reset {
    padding: 7px 12px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all var(--transition);
}

.btn-filter-reset:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.add-btn-area {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
}

.btn-add-url {
    height: 36px;
}

/* ================================================================
   TABLE
   ================================================================ */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.url-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.table-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--accent-blue);
}

.table-responsive {
    overflow-x: auto;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.monitor-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: var(--bg-card);
}

.th-actions {
    text-align: right;
}

.monitor-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}

.monitor-table tbody tr:last-child {
    border-bottom: none;
}

.monitor-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.monitor-table td {
    padding: 10px 12px;
    vertical-align: middle;
}

.td-url {
    max-width: 320px;
}

.url-link {
    color: var(--text-primary);
    font-size: 12.5px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-link:hover {
    color: var(--accent-blue);
}

.td-code {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.actual-code {
    color: var(--text-primary);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-ok {
    background: rgba(63, 185, 80, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.status-fail {
    background: rgba(248, 81, 73, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.status-error {
    background: rgba(210, 153, 34, 0.15);
    color: var(--accent-orange);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.status-unknown {
    background: rgba(139, 148, 158, 0.12);
    color: var(--accent-gray);
    border: 1px solid rgba(139, 148, 158, 0.3);
}

.status-checking {
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(88, 166, 255, 0.3);
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Tags */
.td-tags {
    max-width: 200px;
}

.tag-chip {
    display: inline-block;
    background: rgba(163, 113, 247, 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(163, 113, 247, 0.25);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    margin: 1px 2px 1px 0;
    white-space: nowrap;
}

.td-date {
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.td-error {
    max-width: 200px;
    font-size: 11.5px;
    color: var(--accent-red);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

.td-actions {
    text-align: right;
    white-space: nowrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
}

.btn-edit {
    color: var(--accent-blue);
}

.btn-edit:hover {
    background: var(--accent-blue-bg);
    border-color: rgba(88, 166, 255, 0.3);
}

.btn-delete {
    color: var(--accent-red);
}

.btn-delete:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.3);
}

/* Empty table state */
.empty-row td {
    text-align: center;
    padding: 48px;
}

.empty-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.empty-table i {
    font-size: 36px;
}

.empty-table p {
    font-size: 13px;
}

/* Spinner inside table toolbar */
.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(88, 166, 255, 0.25);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   EMPTY STATE (no tabs)
   ================================================================ */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
    text-align: center;
    padding: 60px 40px;
}

.empty-state i {
    font-size: 64px;
    color: rgba(88, 166, 255, 0.3);
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
    max-width: 340px;
}

/* ================================================================
   MODALS
   ================================================================ */
.modal-dark {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.modal-dark .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 24px;
}

.modal-dark .modal-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.modal-dark .modal-body {
    padding: 20px 24px;
}

.modal-dark .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 14px 24px;
    gap: 8px;
}

.modal-input {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    font-size: 13px !important;
    font-family: inherit !important;
    padding: 8px 12px !important;
    transition: border-color var(--transition);
}

.modal-input:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2) !important;
    border-color: var(--accent-blue) !important;
}

.modal-input option {
    background: var(--bg-card);
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    padding: 7px 16px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-primary-modal {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    padding: 7px 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all var(--transition);
}

.btn-primary-modal:hover {
    background: #79b8f3;
    color: #fff;
}

/* CSV hint box */
.csv-format-hint {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.csv-format-hint code {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--accent-green);
    font-family: 'Consolas', 'Monaco', monospace;
}

.import-result {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 4px;
}

.import-result.success {
    background: rgba(63, 185, 80, 0.12);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: var(--accent-green);
}

.import-result.error {
    background: rgba(248, 81, 73, 0.12);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--accent-red);
}

/* ================================================================
   SCROLLBAR (Webkit)
   ================================================================ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 200px;
    }

    .topbar-title {
        font-size: 16px;
    }
}

@media (max-width: 700px) {
    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        max-height: 56px;
        flex-direction: row;
        overflow: hidden;
    }

    .sidebar-nav,
    .sidebar-footer {
        display: none;
    }

    .sidebar-header {
        border-bottom: none;
        padding: 10px 14px;
    }

    .main-content {
        overflow-y: auto;
    }

    .topbar {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
        align-items: flex-start;
    }

    .topbar-actions {
        flex-wrap: wrap;
    }

    .content-area {
        padding: 12px 16px 20px;
    }
}

/* ================================================================
   THEME TOGGLE BUTTON (in sidebar footer)
   ================================================================ */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-top: 8px;
}

.theme-toggle-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--accent-blue-bg);
}

/* ================================================================
   DASHBOARD METRICS EXTENSION
   ================================================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 320px);
    gap: 24px;
    margin-top: 10px;
    justify-content: center;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.dashboard-card h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.dashboard-card h3 a:hover {
    color: var(--accent-blue) !important;
}

.dashboard-card .tab-desc,
.dashboard-card .text-muted {
    color: var(--text-secondary) !important;
}

.dashboard-card .tab-desc {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.metric-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 16px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.metric-main .metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

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

.metric-box {
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.metric-box .metric-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-box .metric-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-top: 2px;
}

.trend-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.trend-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 40px;
    background: var(--bg-input);
    padding: 6px;
    border-radius: var(--radius-sm);
    justify-content: center;
}

.trend-bar {
    flex: 1;
    max-width: 15px;
    min-height: 4px;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

.btn-validate-dash {
    width: 100%;
    justify-content: center;
}

@media (max-width: 600px) {
    .metrics-subgrid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   LIGHT MODE  (applied when <body data-theme="light">)
   ================================================================ */
body[data-theme="light"] {
    --bg-dark: #f0f2f5;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f8fa;
    --bg-input: #f0f2f5;
    --bg-modal: #ffffff;

    --border-color: rgba(0, 0, 0, 0.1);
    --border-active: rgba(37, 99, 235, 0.4);

    --text-primary: #1a1f2e;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --accent-blue: #2563eb;
    --accent-blue-bg: rgba(37, 99, 235, 0.08);
    --accent-green: #16a34a;
    --accent-red: #dc2626;
    --accent-orange: #d97706;
    --accent-purple: #7c3aed;
    --accent-gray: #6b7280;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .brand-icon {
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.3));
}

body[data-theme="light"] .nav-tab-item {
    color: #4b5563;
}

body[data-theme="light"] .nav-tab-item:hover {
    color: var(--accent-blue);
}

body[data-theme="light"] .nav-tab-item.active {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

body[data-theme="light"] .nav-tab-count {
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent-blue);
}

body[data-theme="light"] .btn-new-tab {
    border-color: rgba(37, 99, 235, 0.2);
}

body[data-theme="light"] .btn-new-tab:hover {
    background: var(--accent-blue);
    color: #fff;
}

body[data-theme="light"] .topbar {
    background: #ffffff;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .sidebar {
    border-right-color: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .monitor-table thead th {
    background: #ffffff;
}

body[data-theme="light"] .url-link {
    color: #1a1f2e;
}

body[data-theme="light"] .url-link:hover {
    color: var(--accent-blue);
}

body[data-theme="light"] .status-ok {
    background: rgba(22, 163, 74, 0.1);
    color: var(--accent-green);
    border-color: rgba(22, 163, 74, 0.3);
}

body[data-theme="light"] .status-fail {
    background: rgba(220, 38, 38, 0.1);
    color: var(--accent-red);
    border-color: rgba(220, 38, 38, 0.3);
}

body[data-theme="light"] .status-error {
    background: rgba(217, 119, 6, 0.1);
    color: var(--accent-orange);
    border-color: rgba(217, 119, 6, 0.3);
}

body[data-theme="light"] .status-checking {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-blue);
    border-color: rgba(37, 99, 235, 0.3);
}

body[data-theme="light"] .status-unknown {
    background: rgba(107, 114, 128, 0.1);
    color: var(--accent-gray);
    border-color: rgba(107, 114, 128, 0.3);
}

body[data-theme="light"] .tag-chip {
    background: rgba(124, 58, 237, 0.08);
    color: var(--accent-purple);
    border-color: rgba(124, 58, 237, 0.2);
}

body[data-theme="light"] .td-error {
    color: var(--accent-red);
}

body[data-theme="light"] .modal-dark {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
}

body[data-theme="light"] .modal-dark .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .modal-dark .modal-footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .modal-dark .modal-title {
    color: #1a1f2e;
}

body[data-theme="light"] .modal-input {
    background: #f0f2f5 !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #1a1f2e !important;
}

body[data-theme="light"] .modal-input option {
    background: #ffffff;
}

body[data-theme="light"] .form-label {
    color: #4b5563;
}

body[data-theme="light"] .btn-ghost {
    border-color: rgba(0, 0, 0, 0.15);
    color: #4b5563;
}

body[data-theme="light"] .btn-ghost:hover {
    color: #1a1f2e;
    border-color: rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] .csv-format-hint {
    background: #f0f2f5;
    border-color: rgba(0, 0, 0, 0.1);
    color: #4b5563;
}

body[data-theme="light"] .csv-format-hint code {
    color: var(--accent-green);
}

body[data-theme="light"] .btn-filter-reset {
    color: #4b5563;
}

body[data-theme="light"] .btn-filter-reset:hover {
    color: #1a1f2e;
    border-color: rgba(0, 0, 0, 0.3);
}

body[data-theme="light"] .filter-input option {
    background: #ffffff;
}

body[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}