:root {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-hover: #334155;

    --border-light: #334155;
    --border-subtle: #1e293b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #3b82f6;
    --primary-hover: #2563eb;

    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-main);
}

.logo svg {
    color: var(--primary);
}

.logo strong {
    font-weight: 600;
    color: var(--text-main);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.view-toggles {
    display: flex;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.btn-toggle {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-right: 1px solid var(--border-light);
}

.btn-toggle:last-child {
    border-right: none;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-toggle.active {
    background: var(--bg-hover);
    color: var(--text-main);
}

.header-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
    font-family: var(--font-code);
}

/* Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
    background: var(--bg-base);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.scrollable {
    overflow-y: auto;
}

.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.flex-between .section-title {
    margin-bottom: 0;
}

.mt-2 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.75rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.w-full {
    width: 100%;
}

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

/* Forms */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input {
    width: 100%;
    background: var(--bg-base);
    color: #FFF;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.input:focus {
    border-color: var(--primary);
}

.input-color-picker {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
    background: var(--bg-base);
}

.code-font {
    font-family: var(--font-code);
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-icon {
    padding: 0.4rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 4px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFF;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Job List */
.job-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.job-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.job-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.job-cron {
    font-family: var(--font-code);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.job-actions {
    display: flex;
    gap: 0.25rem;
}

/* Import */
.import-section textarea {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

/* Calendar Wrapper */
.calendar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    position: relative;
}

.calendar-toolbar {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    gap: 1.5rem;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-date-display {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Grid Body */
.calendar-body {
    flex: 1;
    display: grid;
    overflow-y: auto;
    background: var(--bg-surface);
}

/* Generic Day Cell */
.cal-cell {
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.25rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-cell-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    padding: 0.25rem 0.5rem;
}

.cal-cell-header.today {
    color: #fff;
    background: var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    float: right;
}

/* Event Chip */
.event-chip {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: #FFF;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.event-chip:hover {
    filter: brightness(1.2);
}

.event-overlap {
    background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1) 5px, rgba(0, 0, 0, 0.2) 5px, rgba(0, 0, 0, 0.2) 10px);
}

/* Views Modifiers */
.view-month {
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
}

.view-month .cal-cell-header {
    text-align: center;
}

/* Optional center for month headers */

/* For week/day, we might mock a simpler layout (e.g. list of hours) or just simple columns */
.view-week {
    grid-template-columns: 50px repeat(7, 1fr);
    grid-auto-rows: minmax(40px, auto);
}

.view-day {
    grid-template-columns: 60px 1fr;
    grid-auto-rows: minmax(40px, auto);
}

/* Time Ticks for week/day */
.time-tick {
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    padding: 0.5rem;
}

/* Toasts & Modals */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-close:hover {
    color: #FFF;
}

.modal-body {
    padding: 1.5rem;
}

.modal-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.next-runs-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    border: 1px solid var(--border-light);
    font-family: var(--font-code);
    font-size: 0.85rem;
}

.next-runs-list li {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.next-runs-list li:last-child {
    border-bottom: none;
}

.next-runs-list li::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
}