@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

/* --- Premium CSS Variables & System Tokens (SaaS Command Center Theme) --- */
:root {
    /* Pure Minimalist SaaS Palette */
    --bg-base: #f8fafc; /* Sleek, crisp modern light slate background */
    --bg-card: #ffffff; /* Pure white containers */
    --bg-elevated: rgba(255, 255, 255, 0.95);
    
    /* Clean Outline Borders */
    --border-glass: rgba(15, 23, 42, 0.06); /* Very subtle slate-900 border */
    --border-glass-hover: rgba(15, 23, 42, 0.12);
    --border-active: rgba(79, 70, 229, 0.25);

    /* Text Colors (Linear/Satoshi contrast alignment) */
    --text-primary: #0f172a; /* Slate-900 */
    --text-secondary: #475569; /* Slate-600 */
    --text-muted: #94a3b8; /* Slate-400 */
    
    /* Desaturated Accent Calibration */
    --accent: #4f46e5; /* Premium Indigo */
    --accent-hover: #4338ca;
    --danger: #ef4444; /* Premium Rose Red */
    --wait: #d97706; /* Premium Amber */
    --ok: #10b981; /* Premium Mint Emerald */
    --work: #8b5cf6; /* Premium Amethyst Purple */
    --queued-gray: #64748b; /* Slate Gray */
    
    /* Physics Animations */
    --ease-out-fluid: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-haptic: all 0.4s var(--ease-out-fluid);
    
    /* Shadows & Bezel Highlights */
    --shadow-ambient: 0 4px 20px rgba(15, 23, 42, 0.015);
    --shadow-diffusion: 0 20px 40px -12px rgba(15, 23, 42, 0.035);
    --shadow-inner-bezel: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
}

/* --- Reset & Global Styling --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body[data-dashboard-mode="rsy"] {
    background: #f2f6fb;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.005);
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 99px;
    transition: var(--transition-haptic);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* --- Typography & Headers --- */
h1, h2, h3 {
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

h1 {
    font-size: clamp(24px, 2.8vw, 36px);
    background: linear-gradient(135deg, var(--text-primary) 50%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: clamp(18px, 1.8vw, 24px);
    background: linear-gradient(135deg, var(--text-primary) 60%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.eyebrow {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* --- Concentric Double-Bezel Card Enclosures --- */
.panel-shell {
    background: rgba(15, 23, 42, 0.002);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 6px;
    box-shadow: var(--shadow-diffusion);
    transition: var(--transition-haptic);
    min-width: 0;
    max-width: 100%;
}

.panel-shell:hover {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(15, 23, 42, 0.005);
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 14px; /* Mathematical concentric radius alignment */
    padding: 22px;
    box-shadow: var(--shadow-inner-bezel), var(--shadow-ambient);
    transition: var(--transition-haptic);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 0;
    max-width: 100%;
}

/* --- Navigation Topbar --- */
.topbar {
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
    position: sticky;
    top: 0;
    width: 100%;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px clamp(18px, 3vw, 44px);
    max-width: 1760px;
    margin: 0 auto;
    width: 100%;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: var(--shadow-ambient);
}

.mode-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition: var(--transition-haptic);
}

.mode-switcher a:hover {
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.03);
}

.mode-switcher a.active {
    color: #ffffff;
    background: var(--text-primary);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
}

.status-pill {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 8px 18px;
    border-radius: 99px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    transition: var(--transition-haptic);
    box-shadow: var(--shadow-ambient);
}

.status-pill.active {
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.04);
    color: var(--ok);
}

.status-pill.inactive {
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.04);
    color: var(--danger);
}

.ghost-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 99px;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    transition: var(--transition-haptic);
    box-shadow: var(--shadow-ambient);
}

.ghost-link:hover {
    border-color: var(--border-glass-hover);
    background: rgba(15, 23, 42, 0.02);
    color: var(--text-primary);
}

/* --- Layout Grid --- */
.layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    max-width: 1760px;
    width: 100%;
    margin: 0 auto;
    padding: 24px clamp(18px, 3vw, 44px) 48px;
    overflow-x: hidden;
}

.run-panel-shell {
    align-self: start;
}

/* --- Dynamic Tab Bar (SaaS Command Center style) --- */
.tabs-outer-container {
    width: 100%;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 12px;
    margin-bottom: -8px; /* Offset the main gap so it looks compact */
}

.tabs-header {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar on Firefox */
    padding: 2px;
}

.tabs-header::-webkit-scrollbar {
    display: none; /* Hide scrollbar on Chrome/Safari */
}

.dashboard-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-haptic);
    box-shadow: var(--shadow-ambient);
    position: relative;
    user-select: none;
}

.dashboard-tab:hover {
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.01);
}

.tab-add-new-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(79, 70, 229, 0.06);
    border: 1px dashed rgba(79, 70, 229, 0.25);
    color: var(--accent);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition-haptic);
    box-shadow: var(--shadow-ambient);
    user-select: none;
    margin-left: 4px;
}

.tab-add-new-button:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.tab-add-new-button:active {
    transform: scale(0.96);
}

.dashboard-tab.active {
    background: var(--text-primary); /* Dark theme slate-900 active tab */
    color: #ffffff;
    border-color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.dashboard-tab.active .tab-close {
    color: rgba(255, 255, 255, 0.6);
}

.dashboard-tab.active .tab-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.dashboard-tab .tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-muted);
    transition: var(--transition-haptic);
    margin-right: -4px;
}

.dashboard-tab .tab-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

/* Pulsing processing dot for tabs running background processes */
.tab-processing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--work);
    box-shadow: 0 0 8px var(--work);
    animation: tab-pulse 1.6s infinite ease-in-out;
}

@keyframes tab-pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-width: 0;
}

/* --- Form Elements --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.form-grid.compact-form {
    grid-template-columns: 1fr 1fr;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label span {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input,
textarea,
select {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition-haptic);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01), var(--shadow-ambient);
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), inset 0 2px 4px rgba(0,0,0,0.005);
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), inset 0 2px 4px rgba(0,0,0,0.005);
}

.project-switcher {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.012);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-switcher small {
    font-size: 10px;
    line-height: 1.5;
    color: var(--text-muted);
    font-weight: 700;
}

/* --- RSY Parser Settings --- */
.rsy-layout {
    max-width: 1760px;
    width: 100%;
    margin: 0 auto;
    padding: 24px clamp(18px, 3vw, 44px) 48px;
}

.rsy-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.rsy-save-state {
    min-width: 118px;
    text-align: center;
    padding: 9px 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-ambient);
}

.rsy-save-state.saved {
    color: var(--ok);
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.05);
}

.rsy-save-state.dirty {
    color: var(--wait);
    border-color: rgba(217, 119, 6, 0.22);
    background: rgba(217, 119, 6, 0.05);
}

.rsy-save-state.error {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.05);
}

.rsy-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
}

.rsy-settings-shell {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.rsy-settings-toggle {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--shadow-ambient);
    transition: var(--transition-haptic);
}

.rsy-settings-toggle:hover,
.rsy-settings-toggle.active {
    border-color: var(--border-glass-hover);
    background: rgba(79, 70, 229, 0.045);
}

.rsy-settings-icon {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: relative;
    display: inline-block;
}

.rsy-settings-icon::before,
.rsy-settings-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.rsy-settings-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.rsy-settings-content {
    margin-bottom: 24px;
}

.rsy-settings-content.collapsed {
    display: none;
}

.rsy-sidebar-shell,
.rsy-editor-shell {
    align-self: start;
}

.rsy-profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.rsy-profile-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-ambient);
    transition: var(--transition-haptic);
}

.rsy-profile-card:hover {
    border-color: var(--border-glass-hover);
    transform: translateY(-1px);
}

.rsy-profile-card.active {
    border-color: rgba(79, 70, 229, 0.28);
    background: rgba(79, 70, 229, 0.045);
}

.rsy-profile-card strong {
    font-size: 13px;
    font-weight: 900;
}

.rsy-profile-card span,
.rsy-profile-card small {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.45;
}

.button-row.compact {
    justify-content: flex-end;
    gap: 8px;
    margin-top: 0;
}

.button-row.compact button {
    flex: 0 0 auto;
    padding: 10px 13px;
}

.rsy-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.rsy-metrics article {
    min-height: 76px;
    padding: 13px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.012);
}

.rsy-metrics span {
    display: block;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.35;
}

.rsy-metrics strong {
    display: block;
    margin-top: 8px;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
}

.rsy-profile-form {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 18px;
}

.rsy-schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.012);
}

.rsy-behavior-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.012);
}

.rsy-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.rsy-checkbox {
    display: flex;
    min-height: 48px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-ambient);
}

.rsy-checkbox input {
    width: 16px;
    height: 16px;
    padding: 0;
    accent-color: var(--accent);
    box-shadow: none;
}

.rsy-checkbox span {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    line-height: 1.35;
}

.rsy-schedule-grid textarea {
    min-height: 96px;
}

.rsy-lists {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.rsy-lists textarea {
    min-height: 220px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
}

.rsy-results-shell {
    margin-top: 24px;
    background: linear-gradient(180deg, rgba(237, 242, 247, 0.88), rgba(226, 234, 244, 0.7));
    border-color: rgba(51, 65, 85, 0.16);
}

.rsy-results-panel {
    background: #f3f7fb;
    border-color: rgba(51, 65, 85, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        0 20px 52px rgba(15, 23, 42, 0.08);
}

.rsy-result-toolbar {
    display: grid;
    grid-template-columns: minmax(136px, 160px) minmax(150px, 190px) minmax(150px, 190px) minmax(150px, 190px) minmax(240px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.rsy-result-search {
    min-width: 0;
}

.rsy-results-state {
    min-width: 112px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rsy-results-state.saved {
    color: var(--ok);
    border-color: rgba(16, 185, 129, 0.22);
    background: rgba(16, 185, 129, 0.05);
}

.rsy-results-state.error {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.05);
}

.rsy-results-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(108px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.rsy-results-summary article {
    min-height: 70px;
    padding: 13px;
    border: 1px solid rgba(51, 65, 85, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.86);
}

.rsy-results-summary span {
    display: block;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rsy-results-summary strong {
    display: block;
    margin-top: 8px;
    color: var(--text-primary);
    font-family: "JetBrains Mono", monospace;
    font-size: 23px;
    line-height: 1;
}

.rsy-masonry {
    column-count: 4;
    column-gap: 24px;
    margin-top: 24px;
}

.rsy-ad-card {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin: 0 0 24px;
    border: 1px solid rgba(51, 65, 85, 0.22);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8),
        0 2px 7px rgba(15, 23, 42, 0.08),
        0 18px 42px rgba(15, 23, 42, 0.09);
}

.rsy-ad-card.relevant {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow:
        0 0 0 1px rgba(16, 185, 129, 0.12),
        0 2px 7px rgba(15, 23, 42, 0.08),
        0 18px 42px rgba(15, 23, 42, 0.09);
}

.rsy-ad-card.other {
    border-color: rgba(100, 116, 139, 0.2);
}

.rsy-ad-media {
    width: 100%;
    border-bottom: 1px solid rgba(51, 65, 85, 0.1);
    background: #eef4f8;
}

.rsy-ad-media img {
    display: block;
    width: 100%;
    height: auto;
}

.rsy-ad-placeholder {
    min-height: 150px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-family: "JetBrains Mono", monospace;
    font-size: 24px;
    font-weight: 900;
}

.rsy-ad-body {
    padding: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.rsy-ad-meta,
.rsy-ad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 900;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rsy-ad-meta span:last-child {
    color: var(--ok);
}

.rsy-ad-card.other .rsy-ad-meta span:last-child {
    color: var(--text-muted);
}

.rsy-source-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-top: 10px;
    padding: 4px 8px;
    border: 1px solid rgba(51, 65, 85, 0.14);
    border-radius: 8px;
    background: #f6f8fb;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
}

.rsy-source-badge.ours {
    border-color: rgba(37, 99, 235, 0.2);
    background: rgba(37, 99, 235, 0.06);
    color: #1d4ed8;
}

.rsy-ad-body h3 {
    margin: 10px 0 7px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.25;
    letter-spacing: 0;
}

.rsy-ad-body p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.rsy-ad-domain {
    margin-top: 10px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.rsy-ad-footer {
    margin-top: 12px;
    text-transform: none;
    letter-spacing: 0;
}

.rsy-results-empty {
    display: block;
    padding: 24px;
    border: 1px dashed var(--border-glass);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
}

textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.keywords-field {
    grid-column: 1 / -1;
}

.form-hint {
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-top: 12px;
}

/* --- Interactive Date Summary Timeline List --- */
.date-summary {
    margin-top: 20px;
    background: rgba(15, 23, 42, 0.01);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
}

.date-summary > span {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Transformed Dates into beautiful card list items */
.date-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 10px;
    transition: var(--transition-haptic);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.01);
}

.date-summary-row:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
}

.date-summary-row strong {
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 700;
}

.date-summary-row small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.date-pick-button {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    transition: var(--transition-haptic);
    cursor: pointer;
    box-shadow: var(--shadow-ambient);
}

.date-pick-button:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.date-pick-button:active {
    transform: scale(0.96);
}

.date-add-tab-button {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.15);
    color: var(--accent);
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    transition: var(--transition-haptic);
    cursor: pointer;
    box-shadow: var(--shadow-ambient);
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.date-add-tab-button:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.date-add-tab-button:active {
    transform: scale(0.96);
}

/* --- Panel Headers --- */
.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* --- Tactile Spring Buttons --- */
button {
    font-family: inherit;
    border: 0;
    cursor: pointer;
    transition: var(--transition-haptic);
}

.button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
}

button.primary {
    background: var(--text-primary); /* Slate-900 */
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

button.primary:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.25);
}

button.primary:active {
    transform: scale(0.98);
}

button.secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: var(--shadow-ambient);
}

button.secondary:hover {
    background: rgba(15, 23, 42, 0.015);
    border-color: var(--border-glass-hover);
    transform: translateY(-1px);
}

button.secondary:active {
    transform: scale(0.98);
}

button.danger {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-size: 12px;
    font-weight: 800;
    padding: 12px 18px;
    border-radius: 10px;
}

button.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
    transform: translateY(-1px);
}

button.danger:active {
    transform: scale(0.98);
}

.icon-button {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-ambient);
}

.icon-button:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(180deg) scale(1.05);
}

/* --- Run Statuses --- */
.run-status {
    background: rgba(15, 23, 42, 0.005);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin-top: 16px;
    padding: 16px;
}

.run-status span {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.run-status strong {
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 6px 0;
    overflow-wrap: anywhere;
}

.run-status small {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.runner-status {
    border-top: 1px dashed var(--border-glass);
    margin-top: 12px;
    padding-top: 12px;
}

/* Breathing indicator states */
.runner-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
}

.runner-state::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
    background: currentColor;
}

.state-running { color: var(--work); }
.state-stalled { color: var(--danger); }
.state-failed { color: var(--danger); }
.state-finished { color: var(--ok); }
.state-online { color: var(--ok); }
.state-offline { color: var(--danger); }

.state-idle,
.state-empty,
.state-queued,
.state-dispatched,
.state-waiting_worker {
    color: var(--wait);
}

.collection-status {
    background: rgba(15, 23, 42, 0.002);
}

/* --- Tech Log Console --- */
.log-box {
    max-height: 140px;
    min-height: 100px;
    margin-top: 20px;
    background: #0f172a; /* Keep console dark for clean visual contrast */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: #e2e8f0;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.4);
}

/* --- Metrics Grid & Color-Coded left borders --- */
.metrics {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    align-self: stretch;
}

.metric-shell {
    background: rgba(15, 23, 42, 0.005);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 5px;
    box-shadow: var(--shadow-diffusion);
    transition: var(--transition-haptic);
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-left: 4px solid var(--text-primary); /* Left indicator strip! */
    border-radius: 11px; /* Concentric radius calculation */
    padding: 14px 18px;
    min-height: 96px;
    box-shadow: var(--shadow-inner-bezel), var(--shadow-ambient);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-haptic);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.metric-shell:hover {
    border-color: rgba(15, 23, 42, 0.08);
}

.metric-shell:hover .metric-card {
    background: rgba(15, 23, 42, 0.003);
    transform: translateY(-2px);
}

.metric-card span {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.metric-card strong {
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(28px, 2.5vw, 36px);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary) 50%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Explicit color calibration for metrics border highlights */
.metric-shell.total { border-color: rgba(99, 102, 241, 0.12); }
.metric-shell.total .metric-card { border-left-color: var(--accent); } /* Indigo total */
.metric-shell.total .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-shell.done { border-color: rgba(16, 185, 129, 0.12); }
.metric-shell.done .metric-card { border-left-color: var(--ok); } /* Emerald done */
.metric-shell.done .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--ok) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-shell.failed { border-color: rgba(239, 68, 68, 0.12); }
.metric-shell.failed .metric-card { border-left-color: var(--danger); } /* Rose failed */
.metric-shell.failed .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--danger) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-shell.remaining { border-color: rgba(217, 119, 6, 0.12); }
.metric-shell.remaining .metric-card { border-left-color: var(--wait); } /* Amber remaining */
.metric-shell.remaining .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--wait) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-shell.queued { border-color: rgba(100, 116, 139, 0.12); }
.metric-shell.queued .metric-card { border-left-color: var(--queued-gray); } /* Slate queued */
.metric-shell.queued .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--queued-gray) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-shell.processing { border-color: rgba(139, 92, 246, 0.12); }
.metric-shell.processing .metric-card { border-left-color: var(--work); } /* Amethyst processing */
.metric-shell.processing .metric-card strong {
    background: linear-gradient(135deg, var(--text-primary) 40%, var(--work) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Infinite Table Panel Overhaul --- */
.table-panel-shell {
    width: 100%;
    min-width: 0;
}

.table-panel {
    padding: 24px 22px 22px;
    overflow: hidden;
    min-width: 0;
}

.legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend span {
    display: inline-flex;
    align-items: center;
}

/* Infinite wrapping without inner scrollbar */
.table-wrap {
    margin-top: 18px;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-ambient), 0 4px 30px rgba(0, 0, 0, 0.01);
    width: 100%;
    max-width: 100%;
    max-height: none;
    overflow-x: hidden !important;
    overflow-y: visible;
}

table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    min-width: 0;
    table-layout: fixed;
}

th, td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(15, 23, 42, 0.045);
    overflow-wrap: anywhere;
    word-break: normal;
}

th {
    background: #f8fafc; /* Elegant light slate header! */
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 2px solid #e2e8f0;
}

td {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    transition: var(--transition-haptic);
}

tr:hover td {
    background: rgba(15, 23, 42, 0.005);
}

/* Balanced column widths */
th:nth-child(1), td:nth-child(1) {
    font-family: "JetBrains Mono", monospace;
    font-weight: 700;
    color: var(--text-muted);
    width: 8%;
    padding-left: 8px;
    padding-right: 8px;
}

th:nth-child(2), td:nth-child(2) {
    width: 22%;
    font-weight: 700;
    color: var(--text-primary);
}

th:nth-child(3), td:nth-child(3) {
    width: 28%;
}

th:nth-child(4), td:nth-child(4) {
    width: 16%;
}

th:nth-child(5), td:nth-child(5) {
    width: 16%;
}

th:nth-child(6), td:nth-child(6) {
    width: 10%;
}

.attempts,
.row-error {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    font-weight: 700;
}

.attempts {
    color: var(--text-muted);
}

.row-error {
    color: var(--danger);
}

/* --- Delicate Light-Tech Glassmorphic Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--border-glass);
    line-height: 1;
    white-space: nowrap;
    background: var(--bg-base);
}

.status-done {
    background: rgba(16, 185, 129, 0.06);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--ok);
}

.status-queued,
.status-created {
    background: rgba(217, 119, 6, 0.06);
    border-color: rgba(217, 119, 6, 0.2);
    color: var(--wait);
}

.status-processing,
.status-running {
    background: rgba(139, 92, 246, 0.06);
    border-color: rgba(139, 92, 246, 0.2);
    color: var(--work);
}

.status-failed {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Soft row highlights */
.row-status-failed td {
    background: rgba(239, 68, 68, 0.003) !important;
}

.row-status-processing td {
    background: rgba(139, 92, 246, 0.003) !important;
}

/* Lightweight desaturated indigo tag pills (Gorgeous tag list) */
.phrase-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.phrase-list span {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 99px; /* Fully rounded pill! */
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    display: inline-block;
    max-width: 100%;
    transition: var(--transition-haptic);
}

.phrase-list span:hover {
    background: #e2e8f0;
    border-color: rgba(15, 23, 42, 0.1);
}

/* Status dots */
.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 2px;
}

.dot-ok { color: var(--ok); background: var(--ok); }
.dot-wait { color: var(--wait); background: var(--wait); }
.dot-work { color: var(--work); background: var(--work); }
.dot-error { color: var(--danger); background: var(--danger); }

/* --- Ethereal Glass Login Page --- */
.login-page {
    display: grid;
    place-items: center;
    background-color: var(--bg-base);
    min-height: 100dvh;
}

.login-shell {
    width: min(400px, calc(100vw - 32px));
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-diffusion), var(--shadow-ambient);
}

.mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-primary);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.login-card h1 {
    font-size: 26px;
    margin-bottom: 12px;
}

.login-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.remember-option {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.remember-option input {
    width: 16px;
    height: 16px;
    padding: 0;
    accent-color: var(--accent);
    box-shadow: none;
}

.remember-option span {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.login-form button {
    background: var(--text-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.login-form button:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.2);
}

.login-form button:active {
    transform: scale(0.98);
}

.alert {
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* --- Responsive Adaptability --- */
@media (max-width: 1280px) {
    .layout {
        grid-template-columns: 340px minmax(0, 1fr);
    }

    .metrics {
        grid-template-columns: repeat(3, 1fr);
    }

    .rsy-grid {
        grid-template-columns: 320px minmax(0, 1fr);
    }

    .rsy-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rsy-masonry {
        column-count: 3;
    }

    .rsy-result-toolbar,
    .rsy-results-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rsy-profile-form,
    .rsy-schedule-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-top: 16px;
    }

    .run-panel-shell {
        align-self: stretch;
    }

    .metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .rsy-grid {
        grid-template-columns: 1fr;
    }

    .rsy-profile-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rsy-result-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rsy-results-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rsy-masonry {
        column-count: 2;
    }
}

@media (max-width: 680px) {
    .topbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .top-actions {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-panel {
        padding: 16px;
    }

    .rsy-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .rsy-profile-list,
    .rsy-metrics,
    .rsy-result-toolbar,
    .rsy-results-summary,
    .rsy-profile-form,
    .rsy-schedule-grid,
    .rsy-behavior-grid,
    .rsy-toggle-grid,
    .rsy-lists {
        grid-template-columns: 1fr;
    }

    .button-row.compact {
        justify-content: stretch;
    }

    .button-row.compact button {
        flex: 1 1 auto;
    }

    .rsy-masonry {
        column-count: 1;
    }
}
