:root {
    --jags-blue: #0B2E5C;
    --jags-blue-light: #14407a;
    --jags-blue-pale: #EAF0FB;
    --jags-amber: #F2A900;
    --jags-black: #14161A;
    --jags-white: #FFFFFF;
    --grey-50: #FAFBFC;
    --grey-100: #F5F6F8;
    --grey-300: #D9DCE2;
    --grey-500: #8A94A6;
    --grey-600: #5B6472;
    --red: #B3261E;
    --red-pale: #FBE7E6;
    --green: #1E7B34;
    --green-pale: #E5F3E8;
    --amber-text: #8A5B00;
    --amber-pale: #FFF3DC;
    --shadow-sm: 0 1px 2px rgba(11,46,92,0.06), 0 1px 1px rgba(11,46,92,0.04);
    --shadow-md: 0 4px 14px rgba(11,46,92,0.08), 0 1px 3px rgba(11,46,92,0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--grey-100);
    color: var(--jags-black);
    line-height: 1.45;
}

/* ---------- Links: no more default underlined-blue-text look ---------- */
a {
    color: var(--jags-blue);
    text-decoration: none;
    font-weight: 600;
}
a:hover { color: var(--jags-blue-light); }

/* ---------- Top nav ---------- */
.topnav {
    background: var(--jags-blue);
    color: var(--jags-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.75rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}
.topnav .brand { font-weight: 800; letter-spacing: 0.01em; font-size: 1.02rem; }
.topnav .links { display: flex; align-items: center; gap: 0.35rem; }
.topnav .links a {
    color: rgba(255,255,255,0.82);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border-radius: 7px;
    transition: background 0.12s ease, color 0.12s ease;
}
.topnav .links a:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* ---------- Hamburger button (mobile only) ---------- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
    .hamburger { display: flex; }
    .topnav .links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.15rem;
        margin-top: 0.75rem;
        border-top: 1px solid rgba(255,255,255,0.15);
        padding-top: 0.6rem;
    }
    .topnav .links.open { display: flex; }
    .topnav .links a { padding: 0.6rem 0.75rem; }

    /* ---------- Tables stack into cards - no horizontal scroll on mobile ---------- */
    table, .report-table { box-shadow: none; border-radius: 0; }
    .report-table-wrap { overflow: visible; box-shadow: none; border-radius: 0; margin-bottom: 1rem; }
    table thead, .report-table thead { display: none; }
    table tr, .report-table tr {
        display: block;
        border: 1px solid var(--grey-300);
        border-radius: 10px;
        margin-bottom: 0.7rem;
        padding: 0.5rem 0.8rem;
        background: var(--jags-white);
        box-shadow: var(--shadow-sm);
    }
    table td, .report-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        text-align: right;
        border-bottom: 1px solid var(--grey-100);
        padding: 0.45rem 0;
        background: transparent !important;
        border-left: none !important;
    }
    table td:last-child, .report-table td:last-child { border-bottom: none; }
    table td::before, .report-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--grey-600);
        font-size: 0.76rem;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        text-align: left;
        flex-shrink: 0;
    }
    /* row status colour moves from the first cell's left border to the whole card's left border */
    .report-table tr.row-ready { border-left: 5px solid var(--green); }
    .report-table tr.row-blocking { border-left: 5px solid var(--red); }
    .report-table tr.row-notice { border-left: 5px solid var(--jags-amber); }
}

.container { max-width: 1120px; margin: 0 auto; padding: 2rem 1.5rem 3.5rem; }

h1 { font-size: 1.65rem; margin: 0 0 0.3rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin-top: 2.25rem; margin-bottom: 0.75rem; color: var(--jags-blue); }
h3 { font-size: 0.98rem; margin: 0 0 0.6rem; }
.subtitle { color: var(--grey-600); margin-top: 0; margin-bottom: 1.5rem; font-size: 0.95rem; }

/* ---------- Stat cards (dashboard) ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}
.card {
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
}
a.card {
    display: block;
    color: var(--jags-black);
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.card:hover {
    color: var(--jags-black);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card .value { font-size: 1.9rem; font-weight: 700; color: var(--jags-blue); line-height: 1.1; }
.card .label { font-size: 0.85rem; color: var(--grey-600); margin-top: 0.2rem; }

/* ---------- Team overview cards (Teams page) ---------- */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.team-card {
    display: block;
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-left: 5px solid var(--jags-amber);
    border-radius: 12px;
    padding: 1.2rem 1.3rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-left-color 0.12s ease;
}
.team-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--jags-blue);
}
.team-card.cleared { border-left-color: var(--green); }
.team-card.not-cleared { border-left-color: var(--red); }
.team-card h3 { font-size: 1.05rem; margin-bottom: 0.4rem; color: var(--jags-black); }
.team-card .team-count { font-size: 0.85rem; color: var(--grey-600); margin-bottom: 0.6rem; }
.team-card .team-missing { font-size: 0.8rem; color: var(--red); margin-top: 0.5rem; }

/* ---------- Role management cards (Settings) ---------- */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1rem;
    align-items: start;
}
.role-card {
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}
.role-card .req-list label {
    display: inline-flex; align-items: center; gap: 0.35rem;
    margin: 0 0.8rem 0.5rem 0; font-weight: normal; font-size: 0.85rem;
    color: var(--grey-600);
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--grey-300); font-size: 0.9rem; vertical-align: top; }
th { background: var(--grey-50); color: var(--grey-600); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--grey-50); }
td a { font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.badge.ok { background: var(--green-pale); color: var(--green); }
.badge.warn { background: var(--amber-pale); color: var(--amber-text); }
.badge.expired { background: var(--red-pale); color: var(--red); }
.badge.info { background: var(--jags-blue-pale); color: var(--jags-blue); }

/* ---------- Login ---------- */
.login-wrap {
    max-width: 340px;
    margin: 4rem auto;
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-radius: 14px;
    padding: 2.2rem;
    box-shadow: var(--shadow-md);
}
.login-wrap h1 { text-align: center; color: var(--jags-blue); }

/* ---------- Forms ---------- */
label { display: block; font-size: 0.82rem; margin: 0.75rem 0 0.3rem; color: var(--grey-600); font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=date], select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--grey-300);
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--jags-white);
}
input:focus, select:focus { outline: 2px solid var(--jags-blue-pale); border-color: var(--jags-blue); }

button, .btn {
    background: var(--jags-blue);
    color: var(--jags-white);
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.15rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 1rem;
    transition: background 0.12s ease, transform 0.05s ease;
}
button:hover, .btn:hover { background: var(--jags-blue-light); color: #fff; }
button:active, .btn:active { transform: translateY(1px); }

.btn-ghost {
    background: var(--jags-white);
    color: var(--jags-blue);
    border: 1px solid var(--grey-300);
}
.btn-ghost:hover { background: var(--jags-blue-pale); color: var(--jags-blue); }

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #93201a; }

.btn-warn { background: var(--amber-text); }
.btn-warn:hover { background: #6e4700; }

.error { color: var(--red); font-size: 0.88rem; margin-top: 0.5rem; font-weight: 600; }

/* ---------- Small inline forms (rename/toggle rows) ---------- */
.inline-form { display: flex; gap: 0.4rem; align-items: center; margin: 0; }
.inline-form button { margin: 0; padding: 0.4rem 0.8rem; font-size: 0.82rem; }
.inline-form input[type=text] { width: auto; flex: 1; }

.row-actions { display: flex; align-items: center; gap: 0.5rem; }

.section-box {
    background: var(--jags-white);
    border: 1px solid var(--grey-300);
    border-radius: 12px;
    padding: 1.3rem 1.4rem;
    box-shadow: var(--shadow-sm);
    max-width: 560px;
    margin-bottom: 1.25rem;
}
.section-box.danger { border-color: #f0c3bf; }
.section-box p { margin-top: 0; font-size: 0.88rem; color: var(--grey-600); }

.checkbox-row {
    display: inline-flex; align-items: center; gap: 0.4rem;
    margin: 0 1rem 0.6rem 0; font-weight: normal;
}
.checkbox-row input[type=checkbox] { width: auto; }

/* ---------- Responsive multi-column layout for report person-cards ---------- */
.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    align-items: start;
}
.person-grid .section-box { max-width: none; margin-bottom: 0; }

/* ---------- Prominent alert boxes for Gaps (red) / Notices (amber) ---------- */
.alert-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.alert-item {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-left: 5px solid transparent;
}
.alert-item .alert-role { font-weight: 700; margin-right: 0.4rem; }
.alert-item.red { background: var(--red-pale); border-left-color: var(--red); color: #6b1512; }
.alert-item.amber { background: var(--amber-pale); border-left-color: var(--jags-amber); color: #6e4700; }

/* ---------- Report tables: one row per person, one column per requirement ---------- */
.report-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.report-table th {
    background: var(--jags-blue); color: var(--jags-white);
    text-transform: none; letter-spacing: 0; font-size: 0.8rem;
    padding: 0.6rem 0.8rem; text-align: left;
}
.report-table th:first-child { border-top-left-radius: 10px; }
.report-table th:last-child { border-top-right-radius: 10px; }
.report-table td { padding: 0.55rem 0.8rem; font-size: 0.87rem; border-bottom: 1px solid var(--grey-300); background: var(--jags-white); }
.report-table tr:last-child td { border-bottom: none; }
.report-table tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.report-table tr:last-child td:last-child { border-bottom-right-radius: 10px; }
.report-table tbody tr:nth-child(even) td { background: var(--grey-50); }
.report-table td:first-child { font-weight: 700; border-left: 4px solid var(--grey-300); }
.report-table tr.row-ready td:first-child { border-left-color: var(--green); }
.report-table tr.row-blocking td:first-child { border-left-color: var(--red); }
.report-table tr.row-notice td:first-child { border-left-color: var(--jags-amber); }
.report-table .extra-note { display: block; font-size: 0.76rem; font-weight: 400; color: var(--amber-text); margin-top: 0.15rem; }

.status-cell { border-radius: 6px; padding: 0.25rem 0.5rem; font-size: 0.8rem; font-weight: 600; display: inline-block; }
.status-cell.ok { background: var(--green-pale); color: var(--green); }
.status-cell.info { background: var(--jags-blue-pale); color: var(--jags-blue); }
.status-cell.expiring_soon { background: var(--amber-pale); color: var(--amber-text); }
.status-cell.expired, .status-cell.missing { background: var(--red-pale); color: var(--red); }

.report-table-wrap { border-radius: 10px; box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 1.5rem; }
