:root {
    --ink: #172033;
    --muted: #667085;
    --line: #e6eaf0;
    --brand: #0f766e;
    --brand-2: #2563eb;
    --surface: #ffffff;
    --bg: #f4f7fb;
}

body {
    background: var(--bg);
    color: var(--ink);
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 278px;
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    background: #101828;
    color: #fff;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
    margin: 4px 8px 24px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar .brand > img.brand-photo {
    width: 96px;
    height: 96px;
    max-width: 96px;
    min-width: 96px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 96px;
    border: 3px solid rgba(255, 255, 255, .75);
    background: rgba(255, 255, 255, .12);
    display: block;
}

.sidebar nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 3px 0;
    color: #d0d5dd;
    text-decoration: none;
    border-radius: 8px;
}

.sidebar nav a:hover,
.sidebar nav a:focus {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.sidebar nav a[aria-current="page"]{color:#fff;background:rgba(69,147,223,.22)}
.sidebar-group{margin-top:8px;border-top:1px solid rgba(255,255,255,.1)}
.sidebar-group-title{display:flex;align-items:center;gap:9px;min-height:44px;padding:12px;color:#dce8f8;font-size:.78rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;cursor:pointer;list-style:none;border-radius:8px}
.sidebar-group-title::-webkit-details-marker{display:none}
.sidebar-group-title:hover,.sidebar-group-title:focus-visible{color:#fff;background:rgba(255,255,255,.08)}
.sidebar-group-title:focus-visible{outline:2px solid #89bfff;outline-offset:2px}
.sidebar-group-chevron{margin-left:auto;font-size:.75rem;transition:transform .2s ease}
.sidebar-group-title .badge+.sidebar-group-chevron{margin-left:0}
.sidebar-group[open] .sidebar-group-chevron{transform:rotate(180deg)}
.sidebar-group-links{margin:0 0 8px 11px;padding-left:8px;border-left:1px solid rgba(137,191,255,.32)}
.sidebar-group-links a{min-height:39px}
.admin-profile-photo-field{display:flex;align-items:center;gap:18px}
.admin-profile-photo{width:104px;height:104px;flex:0 0 104px;display:block;object-fit:cover;border:3px solid #dce8f6;border-radius:50%;background:#edf4fc}
.admin-profile-photo-empty{display:grid;place-items:center;color:#5477a0;font-size:2.6rem}
@media(max-width:575px){.admin-profile-photo-field{align-items:flex-start;flex-direction:column}}

.content {
    flex: 1;
    padding: 22px;
    min-width: 0;
}

.topbar,
.panel,
.stat-card,
.table-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar {
    min-height: 66px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.panel,
.table-panel {
    padding: 18px;
    margin-bottom: 18px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    padding: 16px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
}

.hero {
    min-height: 68vh;
    display: flex;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(16,24,40,.88), rgba(16,24,40,.46)),
        url('https://images.unsplash.com/photo-1523050854058-8df90110c9f1?auto=format&fit=crop&w=1600&q=80') center/cover;
    color: #fff;
}

.hero h1 {
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    font-weight: 900;
    letter-spacing: 0;
}

.public-section {
    padding: 58px 0;
}

.form-control,
.form-select,
.btn {
    border-radius: 8px;
}

.table td,
.table th {
    vertical-align: middle;
}

.readonly-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.readonly-profile img {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #d8e2ef;
    background: #f8fafc;
    flex: 0 0 92px;
}

.readonly-profile-mark {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef6f5;
    color: var(--brand);
    font-weight: 800;
    font-size: 2rem;
    border: 3px solid #d8e2ef;
    flex: 0 0 92px;
}

.readonly-form .form-control:disabled,
.readonly-form textarea.form-control:disabled {
    background: #f8fafc;
    color: var(--ink);
    opacity: 1;
    border-color: #d8e2ef;
}

.readonly-form .form-label {
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 4px;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1040;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .content {
        padding: 14px;
    }
}

/* School card layout */
.badge-page-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}
.badge-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.badge-actions .btn-primary{background:#174c8c;border-color:#174c8c}
.badge-actions .btn-primary:hover{background:#10366f;border-color:#10366f}
.badge-count{color:#475467;font-weight:700}
.student-badge-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(5.25in,max-content));gap:28px;align-items:start}
.student-badge-pair{display:grid;grid-template-columns:repeat(2,2.5in);gap:.25in;align-items:stretch}
.student-badge-card{box-sizing:border-box;position:relative;display:flex;width:2.5in;height:3.15in;min-height:3.15in;overflow:hidden;flex-direction:column;border:1px solid #c8d7e8;border-radius:.12in;box-shadow:0 12px 28px rgba(16,46,88,.15);color:#17304f;font-family:'Segoe UI',Arial,sans-serif}
.student-badge-card:not(.badge-preview-active){cursor:zoom-in}
.student-badge-card:focus-visible{outline:3px solid #2467ae;outline-offset:4px}
.badge-preview-placeholder{width:2.5in;height:3.15in}
.badge-preview-open{overflow:hidden}
.badge-preview[hidden]{display:none!important}
.badge-preview{position:fixed;inset:0;z-index:2000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(12,24,43,.78)}
.badge-preview-dialog{position:relative}
.badge-preview-holder{position:relative}
.badge-preview-active{position:absolute;top:0;left:0;transform-origin:top left;box-shadow:0 20px 60px rgba(0,0,0,.42)}
.badge-preview-close{position:absolute;top:-42px;right:0;z-index:1;width:36px;height:36px;border:0;border-radius:50%;background:#fff;color:#15233a;font-size:27px;line-height:1;cursor:pointer}
.badge-preview-close:focus-visible{outline:3px solid #82bbff;outline-offset:3px}
.student-badge-front{background:linear-gradient(160deg,#ffffff 0%,#f6faff 68%,#edf5fd 100%)}
.student-badge-front-header{min-height:.76in;display:flex;align-items:center;gap:.12in;padding:.11in .14in;background:linear-gradient(115deg,#10366f,#17529b);border-bottom:.035in solid #6ab5e8;color:#fff}
.student-badge-school{min-width:0}
.student-badge-school strong{display:block;font-size:.123in;line-height:1.14;font-weight:800;text-transform:uppercase;letter-spacing:.015em;overflow-wrap:anywhere}
.student-badge-school span{display:block;margin-top:.045in;color:#bedaf4;font-size:.073in;font-weight:700;letter-spacing:.16em;text-transform:uppercase}
.student-badge-emblem{width:.43in;height:.43in;flex:0 0 .43in;display:grid;place-items:center;border:.025in solid #a9d4f5;border-radius:50%;background:#fff;box-shadow:0 0 0 .025in rgba(255,255,255,.18);color:#174c8c;font-size:.21in}
.student-badge-front-body{flex:1;display:flex;flex-direction:column;padding:.16in .14in .12in}
.student-badge-identity{display:grid;grid-template-columns:.88in minmax(0,1fr);gap:.11in;align-items:start}
.student-badge-photo-wrap{width:.88in;height:1.12in;margin:0;padding:0;overflow:hidden;border:.018in solid #d1deec;border-radius:.07in;background:#e4edf7;box-shadow:0 3px 9px rgba(30,64,111,.12)}
.student-badge-photo{width:100%;height:100%;object-fit:cover;display:block;border-radius:0}
.student-badge-photo-empty{display:grid;place-items:center;background:#d7e8f5;color:#174472;font-size:.38in;font-weight:900}
.student-badge-facts{display:grid;gap:.095in;padding-top:.02in}
.student-badge-fact{display:flex;align-items:center;gap:.065in;min-width:0}
.student-badge-fact-icon{width:.28in;height:.28in;flex:0 0 .28in;display:grid;place-items:center;border-radius:.065in;background:#e6f0fa;color:#17529b;font-size:.13in}
.student-badge-fact div{min-width:0}
.student-badge-fact small{display:block;color:#69809b;font-size:.068in;line-height:1.15;font-weight:800;letter-spacing:.055em;text-transform:uppercase}
.student-badge-fact strong{display:block;font-size:.104in;line-height:1.18;font-weight:800;overflow-wrap:anywhere}
.student-badge-nameplate{display:grid;place-items:center;min-height:.40in;margin-top:auto;padding:.045in .08in;border-radius:.055in;background:#174c8c;color:#fff;text-align:center;font-size:.125in;line-height:1.1;font-weight:800;letter-spacing:.015em;overflow-wrap:anywhere}
.student-badge-unique{margin-top:.075in;color:#54708f;text-align:center;font-size:.072in;font-weight:800;letter-spacing:.035em;text-transform:uppercase;overflow-wrap:anywhere}
.student-badge-unique span{display:inline-block;width:.06in;height:.06in;margin-right:.025in;border-radius:50%;background:#3d9bd4}
.student-badge-back{display:flex;flex-direction:column;align-items:center;min-height:3.15in;padding:.20in .15in .13in;text-align:center;background:linear-gradient(155deg,#f3f9fe,#dceefa 73%,#c9e2f4);border-bottom:.075in solid #174c8c}
.student-badge-back h2{margin:0;color:#173f78;font-size:.13in;letter-spacing:.12em;font-weight:900;text-transform:uppercase}
.student-badge-back-accent{width:.28in;height:.025in;margin:.085in 0 .09in;border-radius:.02in;background:#4ca3d7}
.student-badge-back p{margin:0 0 .10in;max-width:2.1in;color:#385673;font-size:.065in;line-height:1.42;font-weight:600}
.student-badge-back p strong{font-weight:900;text-transform:uppercase}
.student-badge-qr-link{display:block;padding:.07in;background:#fff;border:1px solid #b7d1e8;border-radius:.075in;box-shadow:0 4px 12px rgba(23,76,140,.12);text-decoration:none}
.student-badge-qr{display:grid;place-items:center;width:.88in;height:.88in;color:#15223a;font-size:.67in;background:#fff;border:0;outline:0}
.student-badge-qr img,.student-badge-qr canvas{display:block;width:100%!important;height:100%!important}
.student-badge-secure{margin:.09in 0 .08in;color:#285687;font-size:.075in;font-weight:900;letter-spacing:.045em;text-transform:uppercase}
.student-badge-barcode{display:grid;place-items:center;width:1.85in;min-height:.52in;margin-top:auto;padding:.05in;background:#fff;border:1px solid #b7d1e8;border-radius:.065in}
.student-badge-barcode svg{width:100%;height:.39in}
@media(max-width:650px){.badge-page-heading{align-items:flex-start;flex-direction:column}.student-badge-grid{display:block;overflow-x:auto}.student-badge-pair{margin-bottom:22px}}
@media print{
    @page{size:63.5mm 80.01mm;margin:0}
    html,body{margin:0!important;padding:0!important;background:#fff!important}
    .app-shell{display:block;min-height:0}
    .topbar,.sidebar,.badge-page-heading,.badge-search,.badge-preview{display:none!important}
    .content{display:block;width:63.5mm;margin:0!important;padding:0!important}
    .student-badge-grid{display:block;margin:0;padding:0;overflow:visible}
    .student-badge-pair{display:block;width:63.5mm;margin:0;break-inside:auto;page-break-inside:auto}
    .student-badge-card{width:63.5mm;height:80.01mm;min-height:80.01mm;margin:0;box-shadow:none;break-after:page;page-break-after:always;print-color-adjust:exact;-webkit-print-color-adjust:exact}
    .student-badge-pair:last-child .student-badge-card:last-child{break-after:auto;page-break-after:auto}
}
