@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    background: #f5f5f7;
    color: #1a1a1a;
}

a { color: #4A1478; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav bar ─────────────────────────────────────────────────────────────── */
.portal-nav {
    background: #4A1478;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    height: 36px;
    object-fit: contain;
}

.nav-title {
    color: #F4D88A;
    font-weight: 700;
    font-size: 16px;
    flex: 1;
}

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s;
    text-decoration: none;
}

.nav-links a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-links a.active { background: rgba(244,216,138,0.2); color: #F4D88A; }

/* ── Main content area ───────────────────────────────────────────────────── */
.portal-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ── Login — split screen ────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
}

.login-left {
    width: 46%;
    max-width: 520px;
    background: linear-gradient(160deg, #4A1478 0%, #2d0d4a 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 40px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.login-left::after {
    content: '';
    position: absolute;
    bottom: -60px; left: -60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.login-brand { position: relative; z-index: 1; }

.login-logo {
    display: block;
    height: 36px;
    object-fit: contain;
    margin-bottom: 32px;
}

.login-tagline {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    margin-bottom: 10px;
}

.login-copy {
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    line-height: 1.65;
}

.login-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.login-stat {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    padding: 14px 12px;
}

.login-stat-num {
    font-size: 19px;
    font-weight: 700;
    color: #F4D88A;
}

.login-stat-label {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-right {
    flex: 1;
    background: #f7f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-box {
    width: 100%;
    max-width: 280px;
}

.login-form-box h1 {
    font-size: 21px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: #999;
    margin-bottom: 28px;
}

.login-form-box label {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.login-forgot {
    text-align: center;
    margin-top: 14px;
    font-size: 12px;
    color: #bbb;
}

.login-forgot a { color: #4A1478; text-decoration: none; }
.login-forgot a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    .login-left { display: none; }
    .login-right { background: #4A1478; }
    .login-form-box h1 { color: #fff; }
    .login-subtitle { color: rgba(255,255,255,0.6); }
    .login-form-box label { color: rgba(255,255,255,0.7); }
    .login-form-box input[type="email"],
    .login-form-box input[type="password"] {
        background: rgba(255,255,255,0.1);
        border-color: rgba(255,255,255,0.2);
        color: #fff;
    }
    .login-form-box input[type="email"]::placeholder,
    .login-form-box input[type="password"]::placeholder {
        color: rgba(255,255,255,0.7);
    }
    .login-forgot { color: rgba(255,255,255,0.5); }
    .login-forgot a { color: #F4D88A; }
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: #444;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 15px;
    margin-bottom: 16px;
    font-family: inherit;
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #4A1478;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button, .btn {
    display: inline-block;
    background: #4A1478;
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    text-decoration: none;
}

button:hover, .btn:hover { background: #3a0f5e; color: #fff; text-decoration: none; }

.login-form-box button[type="submit"] {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 4px;
}

.btn-secondary {
    background: #fff;
    color: #4A1478;
    border: 1.5px solid #4A1478;
}
.btn-secondary:hover { background: #f0e8f8; color: #4A1478; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #b02a37; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.form-error {
    background: #fee;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.form-success {
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #4A1478;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #666;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 { margin: 0; font-size: 20px; font-weight: 700; }

/* ── Audit table ─────────────────────────────────────────────────────────── */
.audit-table-wrap {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    overflow: hidden;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
}

.audit-table th {
    background: #f8f6fb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #eee;
}

.audit-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    vertical-align: middle;
}

.audit-table tr:last-child td { border-bottom: none; }
.audit-table tr:hover td { background: #faf8fd; }

/* ── Score badge ─────────────────────────────────────────────────────────── */
.score-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.score-green { background: #d4edda; color: #155724; }
.score-amber { background: #fff3cd; color: #856404; }
.score-red   { background: #f8d7da; color: #721c24; }
.score-grey  { background: #e9ecef; color: #495057; }

/* ── Status badge ────────────────────────────────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-draft    { background: #e9ecef; color: #495057; }
.status-complete { background: #cce5ff; color: #004085; }
.status-sent     { background: #d4edda; color: #155724; }

/* ── Inline status select ────────────────────────────────────────────────── */
.status-select {
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    background: #fff;
}

/* ── Audit wrapper page ──────────────────────────────────────────────────── */
.audit-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.audit-topbar .school-name {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
}

.audit-frame {
    width: 100%;
    border: none;
    /* viewport minus nav (56px) minus topbar (~53px) */
    height: calc(100vh - 109px);
}

/* ── Cards (admin page) ──────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-bottom: 24px;
}

.card h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }

/* ── User table (admin page) ─────────────────────────────────────────────── */
.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    padding: 10px 12px;
    border-bottom: 2px solid #eee;
}

.user-table td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.badge-active   { color: #155724; font-weight: 600; }
.badge-inactive { color: #721c24; font-weight: 600; }

/* ── Add-engineer form row ───────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.form-row label { margin-bottom: 4px; }
.form-row input { margin-bottom: 0; }

/* ── Client nav dropdown ─────────────────────────────────────────────────── */
.nav-dropdown { position: relative; display: flex; align-items: center; }

.nav-dropdown-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s;
    line-height: 1;
}

.nav-dropdown-toggle:hover,
.nav-dropdown:focus-within .nav-dropdown-toggle { background: rgba(255,255,255,0.12); color: #fff; }

.nav-dropdown-toggle:focus-visible { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 2px; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #3a0f60;
    border-radius: 8px;
    min-width: 185px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.28);
    z-index: 200;
    padding: 6px 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.1s;
}

.nav-dropdown-menu a:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }

.nav-dropdown-menu a:focus-visible { background: rgba(255,255,255,0.1); color: #fff; outline: none; }

/* ── Client portal redesign ──────────────────────────────────────────────── */

/* Hero banner (dashboard only) */
.client-hero {
    background: linear-gradient(135deg, #4A1478 0%, #2d0d4a 100%);
    padding: 32px 32px 52px;
    position: relative;
    overflow: hidden;
}

.client-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.client-hero-greeting {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.client-hero-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.70);
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.client-hero-stats {
    display: flex;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.client-hero-stat {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 14px 20px;
    min-width: 110px;
}

.client-stat-num {
    font-size: 24px;
    font-weight: 700;
    color: #F4D88A;
    line-height: 1;
    margin-bottom: 4px;
}

.client-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Main content area below hero */
.client-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 32px 40px;
}

/* Audit cards */
.client-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 14px;
}

.client-audit-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
}

.client-audit-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}

.client-audit-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    text-decoration: none;
}

.client-audit-card:focus-visible {
    outline: 2px solid #4A1478;
    outline-offset: 2px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.client-score-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    border-width: 2.5px;
    border-style: solid;
}

.ring-green { background: #dcfce7; border-color: #22c55e; color: #16a34a; }
.ring-amber { background: #fef9c3; border-color: #f59e0b; color: #b45309; }
.ring-red   { background: #fee2e2; border-color: #ef4444; color: #b91c1c; }
.ring-grey  { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }

.client-audit-info { flex: 1; }

.client-audit-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.client-audit-meta {
    font-size: 13px;
    color: #aaa;
}

.client-audit-chevron {
    font-size: 20px;
    color: #ddd;
    line-height: 1;
}

/* Quick links */
.client-quick-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

@media (max-width: 640px) {
    .client-quick-grid { grid-template-columns: repeat(2, 1fr); }
}

.client-quick-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s;
}

.client-quick-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    text-decoration: none;
}

.client-quick-card:focus-visible {
    outline: 2px solid #4A1478;
    outline-offset: 2px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.client-quick-icon { font-size: 22px; flex-shrink: 0; }

.client-quick-label {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.client-quick-sub {
    font-size: 12px;
    color: #aaa;
    margin-top: 2px;
}

/* Inner page header (support, templates, KCSIE) */
.client-page-header { margin-bottom: 28px; }

.client-back-link {
    font-size: 13px;
    color: #4A1478;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}

.client-back-link:hover { text-decoration: underline; }

.client-back-link:focus-visible {
    outline: 2px solid #4A1478;
    outline-offset: 2px;
    border-radius: 2px;
}

.client-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
}

.client-page-subtitle {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* Support two-column layout */
.client-support-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

.client-form-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.client-form-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
}

.client-form-card .client-form-sub {
    font-size: 13px;
    color: #888;
    margin: 0 0 24px;
}

.client-info-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 12px;
}

.client-info-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px;
}

.client-contact-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 13px;
    color: #333;
}

.client-contact-item:last-child { margin-bottom: 0; }

.client-contact-icon { font-size: 15px; margin-top: 1px; flex-shrink: 0; }

.client-contact-detail span {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}

.client-info-card p {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* Template cards */
.client-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.client-template-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.15s;
}

.client-template-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    text-decoration: none;
}

.client-template-card:focus-visible {
    outline: 2px solid #4A1478;
    outline-offset: 2px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}

.client-template-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.client-template-name {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.client-template-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.55;
    margin-bottom: 16px;
}

.client-template-link {
    font-size: 13px;
    font-weight: 700;
    color: #4A1478;
}

/* Empty state card */
.client-empty {
    background: #fff;
    border-radius: 12px;
    padding: 48px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    color: #666;
}

.client-empty p:first-child { font-size: 18px; margin-bottom: 8px; }
.client-empty p { font-size: 14px; margin: 0; }
