/* ===== Job-Run — Antigravity Premium Design System ===== */

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fdfdfd;
    --bg-tertiary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(0, 0, 0, 0.03);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-input: rgba(0, 0, 0, 0.12);
    --border-focus: #00727f;

    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-muted: #86868b;

    --accent: #00727f;
    --accent-hover: #005a65;
    --accent-light: rgba(0, 114, 127, 0.08);
    --accent-success: #10b981;
    --accent-success-bg: rgba(16, 185, 129, 0.12);
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-danger-bg: rgba(239, 68, 68, 0.12);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 4px 24px -2px rgba(0, 0, 0, 0.06);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 980px;

    --transition: 400ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 200ms ease;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    background: var(--bg-secondary);
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 114, 127, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 114, 127, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 400;
    letter-spacing: 0.01em;
    min-height: 100vh;
}

/* ===== NAVIGATION ===== */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: transform var(--transition);
}

.nav.hidden {
    transform: translateY(-100%);
}

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

.nav-logo {
    font-size: 20px;
}

.nav-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    letter-spacing: -0.01em;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-user-name {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-user-role {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== MAIN APP ===== */

#app {
    min-height: 100vh;
    padding-top: 0;
    transition: padding-top var(--transition);
}

#app.with-nav {
    padding-top: 48px;
}

/* ===== AUTH PAGES ===== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top right, rgba(47, 153, 151, 0.12) 0%, transparent 40%),
                radial-gradient(circle at bottom left, rgba(0, 154, 182, 0.08) 0%, transparent 40%),
                var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 44px 40px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-header .logo {
    font-size: 44px;
    margin-bottom: 16px;
    display: block;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 6px;
    font-weight: 400;
}

/* ===== FORMS ===== */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    letter-spacing: -0.01em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all var(--transition-fast);
    outline: none;
    letter-spacing: -0.01em;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: var(--bg-primary);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2386868b' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
}

.form-textarea {
    resize: vertical;
    min-height: 72px;
}

/* ===== BUTTONS ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.btn:disabled {
    opacity: 0.42;
    cursor: default;
}

.btn-primary {
    background: linear-gradient(135deg, #2f9997, #009ab6);
    color: white;
    box-shadow: 0 4px 12px rgba(47, 153, 151, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #009ab6, #00727f);
    box-shadow: 0 6px 16px rgba(47, 153, 151, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-light);
}

.btn-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 59, 48, 0.14);
}

.btn-success {
    background: var(--accent);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 7px 16px;
    font-size: 13px;
}

/* ===== PAGE LAYOUT ===== */

.page {
    max-width: 1600px;
    margin: 0 auto;
    padding: 48px 24px;
}

.page-header {
    margin-bottom: 40px;
}

.page-header h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 17px;
    margin-top: 8px;
    font-weight: 400;
}

/* ===== STATS ===== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
}

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

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 34px;
    font-weight: 700;
    margin-top: 2px;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}

/* --- Urgency Cards --- */
.urgency-row {
    margin-bottom: 24px;
}

.urgency-card {
    border-left: 4px solid var(--border-color);
    transition: all var(--transition-fast);
}

.urgency-card.active.h24 { border-left-color: #ffcc00; }
.urgency-card.active.h12 { border-left-color: #ff9500; }
.urgency-card.active.h8 { border-left-color: #ff3b30; }
.urgency-card.active.h3 { border-left-color: #ff2d55; animation: pulse-urgency 2s infinite; }

@keyframes pulse-urgency {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 0 15px rgba(255, 45, 85, 0.3); }
    100% { transform: scale(1); }
}

.urgency-card .stat-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
}

.dash-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0;
}

/* --- Compact Row --- */
.stats-row-compact {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.stat-card.compact {
    padding: 12px 16px;
}

.stat-card.compact .stat-value {
    font-size: 20px;
}

.stat-card.compact .stat-label {
    font-size: 10px;
}

.filters-panel.compact {
    padding: 12px;
    margin-bottom: 20px;
}

/* --- Checkbox Group --- */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0,0,0,0.05);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* ===== SECTION ===== */

.section {
    margin-bottom: 40px;
}

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

.section-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ===== CARDS ===== */

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ===== TABLE ===== */

.table-wrapper {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.data-table tr:first-child td {
    border-top: none;
}

.data-table tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

/* ===== DEMAND CARDS (department view) ===== */

.demands-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demand-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition);
    animation: fadeUp 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

.demand-card:hover {
    box-shadow: var(--shadow-md);
}

.demand-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    cursor: pointer;
    gap: 16px;
}

.demand-card-info {
    flex: 1;
    min-width: 0;
}

.demand-card-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.demand-card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 13px;
}

.demand-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.demand-card-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.booking-counter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.booking-counter-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
}

.booking-counter-pill.has-bookings {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.booking-counter-pill.empty {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.demand-expand-icon {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.demand-card.expanded .demand-expand-icon {
    transform: rotate(90deg);
}

.demand-card-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.demand-card.expanded .demand-card-detail {
    max-height: 600px;
}

.demand-detail-content {
    padding: 0 24px 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.booking-list {
    list-style: none;
}

.booking-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

.booking-list-name {
    font-weight: 500;
    color: var(--text-primary);
}

.booking-list-type {
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

/* ===== SLOT CARDS (individual / aggregator) ===== */

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.slot-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    animation: fadeUp 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

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

.slot-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.slot-position {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.slot-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.slot-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.slot-detail-icon {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    font-size: 13px;
}

.slot-rate {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.03em;
}

.slot-available-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* ===== BADGES ===== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-available { background: var(--accent-success-bg); color: var(--accent-success); }
.badge-booked { background: var(--accent-light); color: var(--accent); }
.badge-cancelled { background: var(--accent-danger-bg); color: var(--accent-danger); }
.badge-active { background: var(--accent-light); color: var(--accent); }
.badge-closed { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.badge-confirmed { background: var(--accent-success-bg); color: var(--accent-success); }
.badge-fulfilled { background: var(--accent-success-bg); color: var(--accent-success); }
.badge-expired { background: rgba(255,159,10,0.12); color: #ff9f0a; }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    background: var(--bg-primary);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ===== FILTERS ===== */

.filters-row {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filters-row .form-input {
    flex: 1;
    min-width: 150px;
    padding: 9px 14px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.filters-row .form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

/* ===== MODAL ===== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 460px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.03em;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

/* ===== CONFIRM DIALOG ===== */

.confirm-overlay {
    background: rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2500;
}

.confirm-dialog {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 28px 24px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
    animation: confirmIn 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

@keyframes confirmIn {
    from { opacity: 0; transform: scale(0.86) translateY(14px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-icon-wrap.type-danger  { background: var(--accent-danger-bg);              color: var(--accent-danger); }
.confirm-icon-wrap.type-warning { background: rgba(245, 158, 11, 0.12);             color: var(--accent-warning); }
.confirm-icon-wrap.type-default { background: var(--accent-light);                  color: var(--accent); }
.confirm-icon-wrap.type-success { background: var(--accent-success-bg);             color: var(--accent-success); }

.confirm-message {
    font-size: 14.5px;
    color: var(--text-secondary);
    margin-bottom: 22px;
    line-height: 1.6;
    font-weight: 400;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ===== TOAST ===== */

#toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    min-width: 260px;
    max-width: 380px;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.toast-success {
    border-left: 3px solid var(--accent-success);
}

.toast-error {
    border-left: 3px solid var(--accent-danger);
}

.toast-info {
    border-left: 3px solid var(--accent);
}

/* ===== EMPTY STATE ===== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state p {
    font-size: 17px;
    font-weight: 400;
}

/* ===== AUTH TOGGLE ===== */

.auth-toggle {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-toggle a {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    to { opacity: 0; transform: translateX(30px); }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 734px) {
    .nav { padding: 0 16px; }
    .nav-links { display: none; }
    .page { padding: 28px 16px; }
    .page-header h2 { font-size: 28px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .slots-grid { grid-template-columns: 1fr; }
    .filters-row { flex-direction: column; }
    .auth-card { padding: 32px 20px; }
    .demand-card-main { flex-direction: column; align-items: stretch; }
    .demand-card-right { justify-content: space-between; }
}

/* ===== LOADING ===== */

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

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

.loading-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 10px;
    color: var(--text-muted);
    font-size: 15px;
}

.loading-page .spinner {
    width: 28px;
    height: 28px;
}

/* No bookings badge */
.no-bookings {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* ===== FILTERS PANEL ===== */

.filters-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.filters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filters-grid .form-input,
.filters-grid .form-select {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.filters-grid .form-input:focus,
.filters-grid .form-select:focus {
    background: var(--bg-primary);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

/* ===== VIEW TOOLBAR ===== */

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

.view-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    padding: 3px;
}

.view-btn {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

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

.view-btn.active {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.total-label {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== DEMAND CARD BADGES ===== */

.demand-card-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* ===== SLA BADGES ===== */

.sla-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.sla-ok      { background: var(--accent-success-bg); color: var(--accent-success); }
.sla-warning { background: rgba(255,159,10,0.12); color: var(--accent-warning); }
.sla-overdue { background: var(--accent-danger-bg); color: var(--accent-danger); }
.sla-closed  { background: var(--bg-secondary); color: var(--text-muted); }

/* ===== METRIC BAR ===== */

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

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 48px;
}

.metric-bar-wrap {
    flex: 1;
    max-width: 120px;
    height: 5px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.metric-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 34px;
}

/* ===== SPEED BADGE ===== */

.speed-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.speed-fast { background: var(--accent-success-bg); color: var(--accent-success); }
.speed-med  { background: var(--accent-light); color: var(--accent); }
.speed-slow { background: var(--accent-danger-bg); color: var(--accent-danger); }
.speed-none { background: var(--bg-secondary); color: var(--text-muted); }

/* ===== PAGINATION ===== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    padding-bottom: 24px;
    flex-wrap: wrap;
}

.pag-info {
    font-size: 13px;
    color: var(--text-muted);
    padding: 0 8px;
}

.pag-pages {
    display: flex;
    gap: 3px;
}

.pag-btn {
    padding: 7px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
}

.pag-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.pag-btn:disabled {
    opacity: 0.38;
    cursor: default;
}

.pag-btn.pag-num.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pag-ellipsis {
    padding: 7px 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 2-COL FORM ROWS (modal) ===== */

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== CALENDAR (Outlook-style) ===== */

.calendar-wrap {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.cal-month {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    flex: 1;
    text-align: center;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 420px;
}

.cal-cell {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    min-height: 120px;
    transition: background var(--transition-fast);
}

.cal-cell:last-child {
    border-right: none;
}

.cal-cell:nth-child(n+8) {
    border-bottom: none;
}

.cal-cell.cal-past {
    background: rgba(0,0,0,0.01);
}

.cal-cell.cal-today {
    background: rgba(0, 113, 227, 0.03);
}

.cal-cell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border-color);
}

.cal-day-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.cal-day-num {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-today-num {
    background: var(--accent);
    color: white;
}

.cal-events {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-empty {
    font-size: 11px;
    color: var(--border-color);
    text-align: center;
    padding: 8px 0;
}

.cal-event {
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    line-height: 1.3;
}

.cal-event:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.cal-event-ok {
    background: rgba(0, 113, 227, 0.08);
    border-left-color: var(--accent);
    color: var(--accent);
}

.cal-event-warning {
    background: rgba(255, 159, 10, 0.10);
    border-left-color: var(--accent-warning);
    color: #c07a00;
}

.cal-event-overdue {
    background: var(--accent-danger-bg);
    border-left-color: var(--accent-danger);
    color: var(--accent-danger);
}

.cal-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

.cal-event-meta {
    font-size: 10px;
    opacity: 0.80;
    margin-top: 2px;
}

.cal-event-bar {
    height: 3px;
    background: rgba(0,0,0,0.10);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.cal-event-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: currentColor;
    transition: width 0.5s ease;
}

/* ===== RESPONSIVE: new elements ===== */

@media (max-width: 734px) {
    .cal-grid { grid-template-columns: repeat(3, 1fr); overflow-x: auto; }
    .form-row-2 { grid-template-columns: 1fr; }
    .filters-grid .form-input,
    .filters-grid .form-select { max-width: 100%; }
    .view-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .demand-card-badges { flex-wrap: wrap; }
}

/* ===========================
   RESOURCE CALENDAR (Outlook row-based)
   =========================== */

.rcal-wrap {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.rcal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.rcal-month {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Scrollable table area */
.rcal-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Each row is a flex container:
   fixed left cols + 7 equal day cols */
.rcal-row {
    display: grid;
    /* 3 fixed cols + 7 day cols */
    grid-template-columns: 140px 130px 90px repeat(7, minmax(90px, 1fr));
    min-width: 900px;
    border-bottom: 1px solid var(--border-color);
}

.rcal-row:last-child { border-bottom: none; }

/* Header row */
.rcal-header-row {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 2;
}

.rcal-head-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 10px;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* Day header cells */
.rcal-head-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-right: 1px solid var(--border-color);
    gap: 2px;
}

.rcal-head-cell:last-child { border-right: none; }

.rcal-head-day {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.rcal-head-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.rcal-today-num {
    background: var(--accent);
    color: white;
}

/* Fixed left columns */
.rcal-fixed {
    padding: 10px 10px;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.rcal-col-pos {
    gap: 6px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.rcal-pos-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.rcal-sla-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: help;
}

.rcal-sla-dot.sla-ok      { background: var(--accent-success); }
.rcal-sla-dot.sla-warning { background: var(--accent-warning); }
.rcal-sla-dot.sla-overdue { background: var(--accent-danger); }

.rcal-col-loc {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
    overflow: hidden;
}

.rcal-col-loc strong {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
}

.rcal-loc-label {
    font-size: 10px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rcal-col-shift {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    justify-content: center;
    white-space: nowrap;
}

/* Day cells */
.rcal-cell {
    padding: 6px;
    border-right: 1px solid var(--border-color);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.rcal-cell:last-child { border-right: none; }

.rcal-cell-empty {
    background: transparent;
    position: relative;
}

.rcal-cell-empty:hover {
    background: rgba(0, 150, 136, 0.06);
}

.rcal-add-icon {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.3;
    transition: all var(--transition-fast);
    line-height: 1;
}

.rcal-cell-empty:hover .rcal-add-icon {
    opacity: 1;
    color: var(--accent);
    transform: scale(1.2);
}

/* Copy / Move action buttons */
.rcal-cell {
    position: relative;
}

.rcal-cell-actions {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 3px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.rcal-cell:hover .rcal-cell-actions {
    opacity: 1;
}

.rcal-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    padding: 1px 5px;
    line-height: 1.2;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.rcal-action-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.rcal-today-col {
    background: rgba(0, 113, 227, 0.04);
}

.rcal-past-col {
    background: rgba(0,0,0,0.01);
}

/* Event block inside a cell */
.rcal-evt {
    width: 100%;
    border-radius: 7px;
    padding: 5px 7px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.rcal-evt:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.rcal-evt-ok {
    background: rgba(0, 113, 227, 0.09);
    border-left-color: var(--accent);
    color: var(--accent);
}

.rcal-evt-warning {
    background: rgba(255, 159, 10, 0.10);
    border-left-color: var(--accent-warning);
    color: #c07a00;
}

.rcal-evt-overdue {
    background: var(--accent-danger-bg);
    border-left-color: var(--accent-danger);
    color: var(--accent-danger);
}

.rcal-evt-counts {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
}

.rcal-icon { font-size: 10px; }
.rcal-fact { font-weight: 700; }
.rcal-sep  { opacity: 0.5; }
.rcal-plan { opacity: 0.65; }

.rcal-pct {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.75;
    margin-top: 2px;
}

.rcal-bar {
    height: 3px;
    background: rgba(0,0,0,0.10);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.rcal-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Empty state row */
.rcal-empty-row {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
}

/* Drag & Drop для сетки заявок (календарь) */
.rcal-evt[draggable="true"] {
    cursor: grab;
}
.rcal-evt[draggable="true"]:active {
    cursor: grabbing;
}
.rcal-cell.drag-over {
    background: rgba(47, 153, 151, 0.1);
    box-shadow: inset 0 0 0 2px var(--accent);
}

