:root {
    /* Colors - Dark Theme */
    --bg-app: #0f1115;
    --bg-card: #161b22;
    --bg-card-header: #1f242d;
    --border-color: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #586069;

    /* Status Colors */
    --status-off-bg: #21262d;
    --status-off-text: #484f58;

    --status-wip-bg: #322500;
    --status-wip-text: #d29922;
    --status-wip-border: #9e6a03;

    --status-live-bg: #0f2d18;
    --status-live-text: #3fb950;
    --status-live-border: #238636;

    --status-issue-bg: #380e0e;
    --status-issue-text: #f85149;
    --status-issue-border: #da3633;

    --status-blue-bg: #0d2d4a;
    --status-blue-text: #58a6ff;
    --status-blue-border: #1f6feb;

    /* Spacing & Layout */
    --gap-grid: 0.75rem;
    --gap-card: 0.5rem;
    --pad-card: 0.75rem;

    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    height: 50px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-right: 0.5rem;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Header Global Stats */
.global-stats {
    display: flex;
    gap: 0.75rem;
    margin-left: 1rem;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
    height: 30px;
    flex-shrink: 0;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-icon {
    font-size: 0.7rem;
}

.stat-count {
    font-weight: 600;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn.primary {
    border-color: var(--status-live-border);
    color: var(--status-live-text);
}

.btn.primary:hover:not(:disabled) {
    background: var(--status-live-bg);
}

.btn.danger {
    border-color: var(--status-issue-border);
    color: var(--status-issue-text);
}

.btn.danger:hover:not(:disabled) {
    background: var(--status-issue-bg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Toggle Switch */
.mode-toggle {
    position: relative;
    display: inline-block;
}

.mode-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-label {
    display: flex;
    align-items: center;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2px;
    cursor: pointer;
    position: relative;
    width: 90px;
    height: 24px;
    justify-content: space-between;
}

.mode-text {
    font-size: 0.65rem;
    font-weight: 600;
    z-index: 2;
    padding: 0 8px;
    transition: color 0.3s;
    user-select: none;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 42px;
    height: 18px;
    border-radius: 16px;
    background-color: var(--status-off-text);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
    z-index: 1;
}

/* Toggled Logic */
#editModeToggle:checked+.toggle-label .toggle-slider {
    transform: translateX(42px);
    background-color: var(--status-wip-text);
}

#editModeToggle:not(:checked)+.toggle-label .edit {
    color: var(--text-secondary);
}

#editModeToggle:checked+.toggle-label .view {
    color: var(--text-secondary);
}

#editModeToggle:checked+.toggle-label .edit {
    color: #000;
}

#editModeToggle:not(:checked)+.toggle-label .view {
    color: #fff;
}


/* Main Table Layout */
.dashboard-table-container {
    flex: 1;
    overflow: auto;
    padding: 0;
    position: relative;
}

.websites-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    /* Smaller base font */
    min-width: 100%;
    /* Remove large min-width */
}

.websites-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-card-header);
    box-shadow: 0 1px 0 var(--border-color);
}

.websites-table th {
    padding: 0.4rem 0.15rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.6rem;
}

/* Domain Column Specifics */
.websites-table th:nth-child(2) {
    text-align: left;
    padding-left: 0.5rem;
}

.websites-table td {
    padding: 0.25rem 0.15rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.websites-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.domain-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.7rem;
    padding-left: 0.5rem !important;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domain-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.domain-link:hover {
    color: var(--status-blue-text);
    text-decoration: underline;
}

.status-cell {
    text-align: center;
    width: auto;
    /* Removed fixed width 100px */
}

/* Status Chips (Pills in Table) */
.status-chip {
    display: inline-block;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 32px;
    text-align: center;
    cursor: default;
    transition: all 0.1s;
    user-select: none;
    background-color: var(--status-off-bg);
    color: var(--status-off-text);
    border: 1px solid transparent;
}

.status-chip[data-status="live"] {
    background-color: var(--status-live-bg);
    color: var(--status-live-text);
    border-color: rgba(35, 134, 54, 0.3);
}

.status-chip[data-status="wip"] {
    background-color: var(--status-wip-bg);
    color: var(--status-wip-text);
    border-color: rgba(158, 106, 3, 0.3);
}

.status-chip[data-status="issue"] {
    background-color: var(--status-issue-bg);
    color: var(--status-issue-text);
    border-color: rgba(218, 54, 51, 0.3);
}

.status-chip[data-status="blue"] {
    background-color: var(--status-blue-bg);
    color: var(--status-blue-text);
    border-color: rgba(31, 111, 235, 0.3);
}

.status-chip[data-status="off"] {
    background-color: var(--status-off-bg);
    color: var(--text-muted);
}

/* Edit Mode Interactions */
body.edit-mode .status-chip {
    cursor: pointer;
}

body.edit-mode .status-chip:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}

/* Progress Bar */
.progress-cell {
    width: 120px;
    padding-right: 0.25rem;
}

.progress-container {
    height: 16px;
    background-color: var(--status-off-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background-color: var(--status-live-text);
    /* Always Green as requested */
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}


/* Modal (Copied from servers-a) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.2s;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

select {
    width: 100%;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: var(--font-main);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Button Icon Only adjustments */
.btn.icon-only {
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn.icon-only-small {
    padding: 0;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--status-live-bg);
    color: var(--status-live-text);
    padding: 10px 20px;
    border: 1px solid var(--status-live-border);
    border-radius: 4px;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .global-stats {
        display: none;
        /* Hide global stats on mobile if no space, or adjust */
    }
}

/* TI Column */
.ti-col-header {
    width: 32px;
    text-align: center;
    font-size: 0.6rem;
}

.ti-cell {
    text-align: center;
    width: 32px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.25rem 2px !important;
}

.ti-input {
    width: 28px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px;
    border-radius: 3px;
}

.ti-input:focus {
    outline: none;
    border-color: var(--status-blue-border);
}

/* Header Filters */
.header-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
    height: 30px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Search Box */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 140px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 2px 22px 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    height: 22px;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.search-input:focus {
    outline: none;
    border-color: var(--status-blue-border);
}

.search-clear {
    position: absolute;
    right: 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    display: none;
}

.search-clear:hover {
    color: var(--text-primary);
}

.search-wrapper.has-value .search-clear {
    display: block;
}

.filter-select {
    width: auto;
    min-width: 50px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--status-blue-border);
}

.btn-clear-filters {
    font-size: 0.65rem;
    padding: 2px 6px;
}

/* Checkbox Style */
.select-cell,
.select-col-header {
    text-align: center;
    vertical-align: middle;
}

.row-checkbox,
#selectAllCheckbox {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--status-live-text);
}

/* Delete Button Style */
.btn-delete-row {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-delete-row:hover {
    color: var(--status-issue-text);
    background-color: var(--status-issue-bg);
    border-radius: 4px;
}