/* ===== Avi Roster™ - Main Stylesheet ===== */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #0d47a1;
    --accent: #ff6b35;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    direction: ltr;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.matrix-page {
    max-width: none;
    padding-left: 12px;
    padding-right: 12px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.5);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-lg {
    padding: 16px 40px;
    font-size: 1.1rem;
}

/* ===== Navbar ===== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 70px;
}

.session-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.session-user button {
    padding: 8px 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

.logo i {
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-menu a {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary);
    background: rgba(26, 115, 232, 0.08);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, #0d47a1 0%, #1a73e8 50%, #42a5f5 100%);
    color: var(--white);
    padding: 80px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.hero-content {
    max-width: 600px;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.hero-image {
    max-width: 500px;
    z-index: 1;
}

.hero-image img {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* ===== Features Section ===== */
.features {
    padding: 80px 0;
    background: var(--white);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 50px;
    color: var(--dark);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    margin: 15px auto 0;
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--light);
    padding: 35px 25px;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--gray-light);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 1.8rem;
    color: var(--white);
}

.feature-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark);
}

.feature-card p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* ===== Stats Section ===== */
.stats {
    background: linear-gradient(135deg, var(--dark), #16213e);
    padding: 60px 0;
    color: var(--white);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent);
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* ===== CTA Section ===== */
.cta {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8f9fa, #e3f2fd);
    text-align: center;
}

.cta h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 15px;
}

.cta p {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 30px;
}

/* ===== Footer ===== */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 60px 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    padding-bottom: 40px;
}

.footer-section h4 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--accent);
}

.footer-section p {
    opacity: 0.8;
    line-height: 1.8;
}

.footer-section ul li {
    margin-bottom: 12px;
    opacity: 0.8;
    transition: var(--transition);
}

.footer-section ul li:hover {
    opacity: 1;
    color: var(--accent);
}

.footer-section ul li i {
    margin-right: 8px;
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 0;
    text-align: center;
    opacity: 0.7;
}

/* ===== Page Header ===== */
.page-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 60px 20px;
    text-align: center;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== Dashboard Cards ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 40px 0;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.dashboard-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-card h3 i {
    color: var(--primary);
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 20px 0;
}

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

thead {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

th, td {
    padding: 15px;
    text-align: left;
}

th {
    font-weight: 700;
    font-size: 0.95rem;
}

tbody tr {
    border-bottom: 1px solid var(--gray-light);
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(26, 115, 232, 0.05);
}

/* ===== Status Badges ===== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(40, 167, 69, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(26, 115, 232, 0.15);
    color: var(--primary);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* ===== Charts Placeholder ===== */
.chart-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin: 20px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        right: 0;
        left: 0;
        background: var(--white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        display: flex;
    }

    .mobile-toggle {
        display: block;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        padding: 60px 20px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-image {
        max-width: 100%;
    }

    .hero-buttons {
        justify-content: center;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}

/* ===== Public home ===== */
.landing-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 0 28px;
    background: var(--white);
    box-shadow: var(--shadow);
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.landing-nav a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--gray);
}

.landing-nav a:hover {
    color: var(--primary);
    background: rgba(26, 115, 232, 0.08);
}

.landing-header .open-signin {
    padding: 8px 18px;
}

.landing-menu-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--dark);
    cursor: pointer;
}

#home,
#features,
#shifts,
#units {
    scroll-margin-top: 84px;
}

.landing-hero {
    padding: 88px 28px 72px;
    background:
        linear-gradient(180deg, rgba(8, 20, 48, 0.82), rgba(8, 20, 48, 0.58)),
        url('/images/tower.jpg') center 30%/cover no-repeat;
    color: var(--white);
    animation: landing-in 0.6s ease;
}

.landing-kicker {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.82rem;
    color: #dbeafe;
}

.landing-hero h1 {
    margin: 12px 0 16px;
    max-width: 16ch;
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    line-height: 1.12;
}

.landing-lead {
    max-width: 46ch;
    margin-bottom: 24px;
    font-size: 1.08rem;
    color: rgba(255, 255, 255, 0.92);
}

.landing-band {
    background: var(--white);
    padding: 36px 0;
}

.landing-band h2,
.landing-section h2 {
    text-align: center;
    margin-bottom: 8px;
}

.landing-steps {
    display: flex;
    justify-content: center;
    gap: 18px;
    list-style: none;
    margin-top: 22px;
    flex-wrap: wrap;
}

.landing-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.landing-steps span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: var(--white);
}

.landing-section {
    padding: 56px 0;
}

.landing-note {
    text-align: center;
    color: var(--gray);
    margin-bottom: 24px;
}

.landing-facilities,
.landing-features {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.landing-facility {
    width: 100%;
}

.landing-facility,
.landing-feature {
    text-align: left;
    background: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.landing-feature {
    cursor: default;
}

.landing-facility:hover,
.landing-feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.landing-facility i,
.landing-feature i {
    color: var(--primary);
    font-size: 1.3rem;
}

.landing-facility h3,
.landing-feature h3 {
    margin: 10px 0 6px;
    font-size: 1.15rem;
}

.landing-facility p,
.landing-feature p {
    color: var(--gray);
}

.landing-photos {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.landing-photos img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: var(--radius);
}

.landing-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.landing-legend .duty {
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
}

.footer .logo {
    color: var(--white);
    margin-bottom: 12px;
}

.footer a {
    color: inherit;
}

.signin-layer {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(26, 26, 46, 0.55);
}

.signin-close {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--gray);
    cursor: pointer;
}

@keyframes landing-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 800px) {
    .landing-menu-toggle {
        display: block;
    }

    .landing-nav {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        margin: 0;
        padding: 12px;
        background: var(--white);
        box-shadow: var(--shadow-lg);
    }

    .landing-nav.open {
        display: flex;
    }

    .landing-facilities,
    .landing-features,
    .landing-photos {
        grid-template-columns: 1fr;
    }
}

.login-card {
    width: min(420px, 100%);
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.4rem;
}

.login-card h2 {
    margin-top: 12px;
    font-size: 1.8rem;
}

.login-card p {
    color: var(--gray);
    margin-bottom: 8px;
}

.login-card label {
    font-weight: 600;
    margin-top: 8px;
}

.login-card button {
    margin-top: 16px;
    justify-content: center;
}

.login-error {
    color: var(--danger);
    min-height: 1.2em;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    padding: 40px 0 80px;
}

.program-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.program-card h2 {
    font-size: 1.4rem;
}

.program-card p,
.program-card span {
    color: var(--gray);
}

.matrix-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: end;
    margin: 24px 0;
}

.roster-setup {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 1fr);
    gap: 16px;
    align-items: start;
    margin: 16px 0 28px;
}

.duty-rules,
.shift-board {
    display: grid;
    gap: 12px 16px;
    margin: 0;
    padding: 16px 18px;
    border: 1px solid rgba(15, 39, 68, 0.12);
    border-radius: 18px;
    background: #fff;
}

.duty-rules {
    grid-template-columns: 1fr 1fr;
    align-items: end;
}

.duty-rules > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 0.88rem;
}

.duty-rules h2,
.duty-rules .btn,
.shift-board h2 {
    grid-column: 1 / -1;
    margin: 0;
}

.duty-rules h2,
.shift-board h2 {
    font-size: 1.15rem;
}

.rule-checks {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

.duty-rules .btn {
    justify-self: start;
    padding: 10px 18px;
}

.shift-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
}

.matrix-toolbar label,
.shift-card label,
.check-line {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.shift-card label {
    font-size: 0.78rem;
    gap: 4px;
}

.check-line {
    flex-direction: row;
    align-items: center;
    font-size: 0.88rem;
}

.shift-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 800px) {
    .roster-setup,
    .duty-rules,
    .rule-checks,
    .shift-board {
        grid-template-columns: 1fr;
    }
}

.profile-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin: 28px 0 8px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.profile-layout.no-photo {
    grid-template-columns: minmax(0, 1fr);
}

.profile-photo {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--gray-light);
}

.profile-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    min-width: 0;
}

.profile-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    font-size: 0.92rem;
    min-width: 0;
}

.profile-form .profile-span {
    grid-column: 1 / -1;
}

.profile-form .btn {
    justify-self: start;
}

@media (max-width: 720px) {
    .profile-layout,
    .profile-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-photo {
        width: 120px;
        height: 120px;
    }

    .nav-container {
        flex-wrap: wrap;
    }

    .session-user {
        order: 4;
        width: 100%;
        margin: 0 0 10px;
        justify-content: space-between;
        min-width: 0;
    }

    .session-user span:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 9rem;
    }

    .page-header {
        padding: 32px 16px;
    }

    .page-header h1 {
        font-size: 1.6rem;
    }

    .dashboard-grid,
    .program-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .matrix-toolbar .btn,
    .matrix-toolbar label {
        flex: 1 1 140px;
    }
}

.matrix-scroll {
    overflow: auto;
    height: min(68vh, calc(100vh - 240px));
    max-height: calc(100vh - 240px);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.matrix-roster {
    --name-col: 168px;
    --title-col: 152px;
    --day-col: 44px;
    width: max-content;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.matrix-roster col.name-col { width: var(--name-col); }
.matrix-roster col.title-col { width: var(--title-col); }
.matrix-roster col.day-col { width: var(--day-col); }

.matrix-roster thead {
    background: #fff;
    color: var(--dark);
}

.matrix-table th,
.matrix-table td {
    text-align: center;
    padding: 8px 4px;
    white-space: nowrap;
}

.matrix-roster td:first-child,
.matrix-roster th:first-child,
.matrix-roster td:nth-child(2),
.matrix-roster th:nth-child(2) {
    text-align: left;
    position: sticky;
    background: #fff;
}

.matrix-roster thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    box-shadow: inset 0 -1px 0 #e5e7eb;
}

.matrix-roster thead th:first-child,
.matrix-roster thead th:nth-child(2) {
    z-index: 4;
}

.matrix-roster td:first-child,
.matrix-roster td:nth-child(2) {
    z-index: 1;
}

.matrix-roster th:first-child,
.matrix-roster td:first-child {
    left: 0;
    width: var(--name-col);
    min-width: var(--name-col);
    max-width: var(--name-col);
}

.matrix-roster td:first-child .name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.matrix-roster td:first-child a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.matrix-roster th:nth-child(2),
.matrix-roster td:nth-child(2) {
    left: var(--name-col);
    width: var(--title-col);
    min-width: var(--title-col);
    max-width: var(--title-col);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.82rem;
}

.matrix-roster th.day-head,
.matrix-roster td:nth-child(n+3) {
    width: var(--day-col);
    min-width: var(--day-col);
    max-width: var(--day-col);
    padding: 4px 0;
    font-size: 12px;
}

.day-num,
.day-name {
    display: block;
    line-height: 1.15;
}

.day-num {
    font-weight: 800;
}

.day-name {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
}

.night-group {
    display: inline-block;
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: #4c1d95;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.matrix-roster tr.band-female-supervisor td:first-child,
.matrix-roster tr.band-female-supervisor td:nth-child(2) {
    background: #fce7f3;
}

.matrix-roster tr.band-female-atco td:first-child,
.matrix-roster tr.band-female-atco td:nth-child(2) {
    background: #e0f2fe;
}

.matrix-roster tr.band-male-supervisor td:first-child,
.matrix-roster tr.band-male-supervisor td:nth-child(2) {
    background: #fef3c7;
}

.matrix-roster tr.band-male-atco td:first-child,
.matrix-roster tr.band-male-atco td:nth-child(2),
.matrix-roster tr.band-female-trainee td:first-child,
.matrix-roster tr.band-female-trainee td:nth-child(2),
.matrix-roster tr.band-male-trainee td:first-child,
.matrix-roster tr.band-male-trainee td:nth-child(2) {
    background: #f1f5f9;
}

.matrix-roster tr.band-female-supervisor td:first-child { box-shadow: inset 4px 0 0 #db2777; }
.matrix-roster tr.band-female-atco td:first-child { box-shadow: inset 4px 0 0 #0284c7; }
.matrix-roster tr.band-male-supervisor td:first-child { box-shadow: inset 4px 0 0 #d97706; }
.matrix-roster tr.band-male-atco td:first-child { box-shadow: inset 4px 0 0 #64748b; }
.matrix-roster tr.band-female-trainee td:first-child,
.matrix-roster tr.band-male-trainee td:first-child { box-shadow: inset 4px 0 0 #7c3aed; }

.duty-editable {
    cursor: context-menu;
}

.duty-menu {
    position: fixed;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 168px;
    padding: 8px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(7, 16, 32, 0.22);
}

.duty-menu button {
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    cursor: pointer;
}

.duty-menu button.is-current {
    outline: 2px solid #0f2744;
}

.duty-m { background: #dbeafe; color: #1d4ed8; }
.duty-e { background: #ffedd5; color: #c2410c; }
.duty-n { background: #4c1d95; color: #ffffff; }
.duty-x { background: #e5e7eb; color: #374151; }
.duty-l { background: #dcfce7; color: #166534; }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.legend .duty {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
}

.shift-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 12px;
    background: #f8fafc;
    border-radius: 14px;
    border-top: 4px solid #94a3b8;
    box-shadow: none;
}

.shift-card strong {
    font-size: 0.95rem;
}

.shift-card .btn {
    align-self: start;
    padding: 8px 14px;
}

.shift-card.shift-m { border-top-color: #1d4ed8; }
.shift-card.shift-e { border-top-color: #c2410c; }
.shift-card.shift-n { border-top-color: #4c1d95; }

.generate-result {
    margin: 0 0 16px;
    padding: 16px 18px;
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: var(--radius);
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Inter', sans-serif;
    color: var(--dark);
}

.generate-result h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.generate-result p,
.generate-result li {
    margin: 4px 0;
}

.generate-result ul {
    margin: 8px 0 0;
    padding-inline-start: 1.2rem;
}

.generate-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.matrix-message,
.publish-result {
    margin: 12px 0;
}

.publish-result {
    color: var(--danger);
}

.shift-card input {
    font: inherit;
    padding: 8px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card {
    animation: fadeInUp 0.6s ease forwards;
}

.feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-card:nth-child(2) { animation-delay: 0.2s; }
.feature-card:nth-child(3) { animation-delay: 0.3s; }
.feature-card:nth-child(4) { animation-delay: 0.4s; }
.feature-card:nth-child(5) { animation-delay: 0.5s; }
.feature-card:nth-child(6) { animation-delay: 0.6s; }
.feature-card:nth-child(7) { animation-delay: 0.7s; }
.feature-card:nth-child(8) { animation-delay: 0.8s; }
.feature-card:nth-child(9) { animation-delay: 0.9s; }
.feature-card:nth-child(10) { animation-delay: 1s; }

/* ===== Toast Notifications ===== */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--dark);
    color: var(--white);
    padding: 14px 22px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.notification.show {
    opacity: 1;
    transform: translateY(0);
}
.notification-success { background: #1e7e34; }
.notification-error   { background: #c0392b; }
.notification-warning { background: #d68910; }
.notification-info    { background: var(--primary); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.badge-success  { background: #d4edda; color: #155724; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-danger   { background: #f8d7da; color: #721c24; }
.badge-info     { background: #d1ecf1; color: #0c5460; }
.badge-primary  { background: #cce5ff; color: #004085; }
