/* Palette and type come from tokens.css + design-system.css aliases. */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    background-color: var(--background);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.02em;
}

.brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    margin-right: 10px;
    object-fit: cover;
}

.nav-menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 12px 24px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.nav-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0 24px;
    margin: 16px 0 8px 0;
}

.nav-group-title:first-child {
    margin-top: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--rv-motion-base) ease;
}

.nav-link:hover {
    color: var(--text);
    background-color: var(--background);
}

.nav-link.active {
    color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 8%, transparent);
    border-right: 3px solid var(--primary);
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header Layout */
.header {
    height: var(--header-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
}

.header-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-role {
    font-size: 13px;
    color: var(--text-muted);
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.display-title {
    font-family: var(--font-heading);
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px 0;
    letter-spacing: -0.03em;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    max-width: 650px;
    line-height: 1.5;
}

.header-actions {
    margin-top: 0;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.public-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background:
        radial-gradient(900px 480px at 110% -10%, rgba(240, 253, 250, 0.16), transparent 50%),
        linear-gradient(165deg, #115E59 0%, #0F766E 42%, #134E4A 100%);
    color: #F0FDFA;
}

.public-home .display-title {
    color: #F0FDFA;
}

.public-home .subtitle {
    color: #CCFBF1;
    font-size: 16px;
}

.public-logo {
    display: block;
    margin-bottom: 20px;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.btn-on-brand {
    background: #F0FDFA;
    color: #0F766E;
    height: 44px;
    padding: 0 22px;
    border-radius: 8px;
    font-weight: 600;
}

.btn-on-brand:hover {
    background: #CCFBF1;
    color: #115E59;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--rv-button-height);
    padding: 0 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color var(--rv-motion-fast) ease;
}

.icon {
    display: block;
    flex-shrink: 0;
}

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

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

/* Data List */
.list-container {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.list-header {
    display: grid;
    grid-template-columns: 2.5fr 2fr 1.5fr 1fr 1fr;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background-color: #FAFAFB;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.list-item {
    display: grid;
    grid-template-columns: 2.5fr 2fr 1.5fr 1fr 1fr;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background-color 0.15s ease;
}

.list-item:hover {
    background-color: rgba(249, 250, 251, 0.6);
}

.list-item:last-child {
    border-bottom: none;
}

/* Column Specifics */
.job-name {
    display: block;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.job-script {
    display: block;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.place-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.place-device {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.cron-expression {
    display: block;
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: 0.1em;
}

.cron-translation {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.col-age {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.col-status {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.error-text {
    color: var(--text);
}

.warning-text {
    color: var(--text);
}

/* Status Dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.success {
    background-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.status-dot.danger {
    background-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.status-dot.warning {
    background-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.sidebar-toggle {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

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

@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        flex-direction: column;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 45;
        height: 36px;
        padding: 0 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface);
        color: var(--text);
        font: inherit;
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        transform: translateX(-100%);
        transition: transform var(--rv-motion-base) ease;
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        z-index: 40;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
    }

    body.sidebar-open .sidebar-toggle {
        left: var(--sidebar-width);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.4);
        z-index: 35;
    }

    .sidebar-backdrop:not([hidden]) {
        display: block;
    }

    .main-wrapper {
        width: 100%;
    }

    .header {
        padding: 0 16px 0 72px;
    }

    .content {
        padding: 16px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        gap: 8px;
    }
}
