/* ==========================================================================
   SIDENA - Stylesheet utama
   Tema: neumorphic navy & gold (selaras dengan aplikasi CBT sekolah).

   DAFTAR ISI
   1. Design tokens (warna, bayangan, radius)
   2. Reset & elemen dasar
   3. Layout: sidebar, konten, topbar, navigasi HP
   4. Komponen: tombol, kartu, statistik, form, chip, tabel, alert, pager
   5. Komponen: modal & dialog konfirmasi
   6. Halaman login
   7. Halaman Setting Ruang & editor denah
   8. Halaman cetak (daftar hadir & denah)
   9. Responsive (tablet & HP)
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* Warna utama */
    --bg:          #e9edf3;
    --navy:        #141b4d;
    --navy-2:      #20296e;
    --navy-soft:   #3846a3;
    --gold:        #f0a93a;
    --gold-2:      #ffcf6b;

    /* Warna status */
    --success:       #17915a;
    --success-light: #dcf3e7;
    --warning:       #c97a12;
    --warning-light: #faecd7;
    --danger:        #d8434f;
    --danger-light:  #fbe0e2;
    --info:          #1f7fae;

    /* Netral */
    --text:      #1c2140;
    --gray:      #6b7280;
    --light:     #eef1f6;
    --border:    #d7dce6;

    /* Bentuk */
    --radius-sm: 14px;
    --radius:    20px;
    --radius-lg: 28px;

    /* Bayangan neumorphic */
    --shadow-dark:  #c6cbd6;
    --shadow-light: #ffffff;
    --raised:    6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    --raised-sm: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
    --inset:     inset 3px 3px 7px var(--shadow-dark), inset -3px -3px 7px var(--shadow-light);
    --glow-gold: 0 8px 18px rgba(240, 169, 58, .35), inset 0 1px 0 rgba(255, 255, 255, .25);

    /* Gradien */
    --grad-navy:  linear-gradient(135deg, var(--navy-soft), var(--navy-2));
    --grad-gold:  linear-gradient(135deg, var(--gold-2), var(--gold));
    --grad-green: linear-gradient(135deg, #4bcf94, var(--success));
    --grad-red:   linear-gradient(135deg, #ef7e88, var(--danger));
    --grad-blue:  linear-gradient(135deg, #5db9e6, var(--info));

    --sidebar-width:     260px;
    --sidebar-collapsed: 84px;
}


/* ==========================================================================
   2. RESET & ELEMEN DASAR
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    max-width: 100%;
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, h4 {
    margin: 0 0 .5rem;
    line-height: 1.25;
    color: var(--navy);
}

p            { margin: 0 0 .6rem; }
a            { color: var(--navy-soft); text-decoration: none; }
img          { max-width: 100%; }
small        { font-size: .8em; }
ol, ul       { margin: 0; }

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; }


/* ==========================================================================
   3. LAYOUT
   ========================================================================== */

/* ---- 3.1 Sidebar (desktop) ---- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: var(--bg);
    box-shadow: var(--raised-sm);
    transition: width .25s ease;
}

.sidebar-toggle {
    position: absolute;
    top: 28px;
    right: -14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font-size: .75rem;
    color: var(--navy);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.sidebar-toggle:hover { box-shadow: var(--inset); }
.sidebar-toggle i     { transition: transform .25s; }

.sidebar-header {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: 1.4rem 1.2rem 1rem;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.sidebar-header p {
    margin: 0;
    font-size: .74rem;
    font-weight: 600;
    color: var(--gold);
}

.brand-logo {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    font-size: 1.6rem;
    color: var(--navy-2);
}

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: .6rem 1rem;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar       { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--navy-2); border-radius: 4px; }

.nav-section {
    padding: .6rem .8rem .4rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gray);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: .35rem;
    padding: .75rem 1rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--gray);
    transition: all .2s;
}

.nav-item i       { flex: none; width: 20px; text-align: center; }
.nav-item:hover   { color: var(--navy-2); box-shadow: var(--inset); }

.nav-item.active,
.nav-item.active:hover {
    color: var(--navy);
    background: var(--grad-gold);
    box-shadow: var(--glow-gold);
}

.sidebar-footer { padding: 1rem 1.2rem 1.3rem; }

.user-info {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .8rem;
}

.user-avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    background: var(--grad-navy);
}

.user-details p    { margin: 0; font-size: .85rem; font-weight: 600; color: var(--navy); }
.user-details span { font-size: .72rem; color: var(--gray); }

.sidebar-footer .btn { width: 100%; }

/* Sidebar dilipat */
.sidebar.collapsed                              { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-toggle i            { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-header              { justify-content: center; padding-right: 0; padding-left: 0; }
.sidebar.collapsed .sidebar-header > div:last-child,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-footer .btn span    { display: none; }
.sidebar.collapsed .nav-item                    { justify-content: center; padding: .8rem 0; }
.sidebar.collapsed .user-info                   { justify-content: center; }
.sidebar.collapsed .sidebar-footer .btn         { padding: .65rem 0; }

/* ---- 3.2 Konten utama ---- */
.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: 1.8rem 2rem 2.5rem;
    transition: margin-left .25s ease;
}

body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: 1.5rem;
}

.topbar h1 {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    font-size: 1.5rem;
}

.topbar h1 i { font-size: 1.2rem; color: var(--gold); }

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

/* ---- 3.3 Navigasi khusus HP (disembunyikan di desktop) ---- */
.mobile-header,
.bottom-nav { display: none; }


/* ==========================================================================
   4. KOMPONEN
   ========================================================================== */

/* ---- 4.1 Tombol ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .65rem 1.3rem;
    border: 0;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
    background: var(--navy-2);
    transition: all .2s;
}

.btn:hover    { transform: translateY(-1px); box-shadow: var(--raised-sm); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm       { padding: .4rem .85rem; font-size: .76rem; }

.btn-primary { background: var(--grad-navy); }
.btn-success { background: var(--grad-green); }
.btn-danger  { background: var(--grad-red); }
.btn-info    { background: var(--grad-blue); }

.btn-outline {
    color: var(--navy-2);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.btn-outline:hover { box-shadow: var(--inset); transform: none; }

/* Tombol aksi di dalam tabel: edit & hapus berdampingan */
.actions            { white-space: nowrap; }
.actions form       { display: inline; }
.actions .btn + form,
.actions form + form { margin-left: .3rem; }

/* ---- 4.2 Kartu ---- */
.card {
    margin-bottom: 1.3rem;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.card-header {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: 1rem 1.4rem 1rem 1.6rem;
}

.card-header::before {
    content: '';
    position: absolute;
    top: .8rem;
    bottom: .8rem;
    left: .6rem;
    width: 4px;
    border-radius: 3px;
    background: var(--navy-2);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 1rem;
}

.card-header h3 i   { color: var(--navy-2); }
.card-header small  { font-weight: 400; color: var(--gray); }
.card-body          { padding: .4rem 1.4rem 1.4rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.3rem;
    align-items: start;
}

/* ---- 4.3 Kartu statistik (dashboard) ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--raised-sm);
    transition: box-shadow .2s;
}

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

.stat-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
    color: #fff;
    box-shadow: var(--raised-sm);
}

.stat-icon.blue   { background: var(--grad-navy); }
.stat-icon.green  { background: var(--grad-green); }
.stat-icon.orange { background: var(--grad-gold); color: var(--navy); }
.stat-icon.red    { background: var(--grad-red); }

.stat-info h3 { margin: 0; font-size: 1.7rem; font-weight: 700; }
.stat-info p  { margin: 0; font-size: .8rem; color: var(--gray); }

.steps         { padding-left: 1.2rem; line-height: 2; }
.steps li      { list-style: decimal; }

/* ---- 4.4 Form ---- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--navy-2);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .8rem;
}

input[type=text],
input[type=password],
input[type=number],
input[type=email],
input[type=file],
select,
textarea {
    width: 100%;
    padding: .7rem 1rem;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    outline: none;
    background: var(--bg);
    box-shadow: var(--inset);
}

input:focus,
select:focus,
textarea:focus {
    box-shadow: var(--inset), 0 0 0 3px rgba(32, 41, 110, .18);
}

textarea { resize: vertical; }

input[type=checkbox],
input[type=radio] {
    width: auto;
    accent-color: var(--navy-2);
}

input.num { width: 90px; }

.hint {
    margin-bottom: .6rem;
    font-size: .8rem;
    color: var(--gray);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .8rem;
    margin-bottom: 1.2rem;
}

.filter-bar .form-group       { margin-bottom: 0; }
.filter-bar .form-group.grow  { flex: 1; min-width: 180px; }

/* ---- 4.5 Chip pilihan kelas ---- */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.chip {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip span {
    padding: .3rem .8rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.chip small                    { font-weight: 400; opacity: .8; }
.chip input:checked + span     { color: var(--navy); background: var(--grad-gold); }
.chip input:focus-visible + span { outline: 2px solid var(--navy-soft); }
.chip.disabled                 { opacity: .3; pointer-events: none; }

/* ---- 4.6 Tabel ---- */
.table-container {
    padding: 0 .8rem .8rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    text-align: left;
    vertical-align: middle;
}

th {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--navy-2);
    background: var(--light);
}

tbody tr:hover { background: #f2f4f9; }

/* ---- 4.7 Alert ---- */
.alert {
    margin-bottom: 1rem;
    padding: .7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
}

.alert-success { color: #0f6b43; background: var(--success-light); }
.alert-warning { color: #8a5209; background: var(--warning-light); }
.alert-danger  { color: #a1303a; background: var(--danger-light); }

/* ---- 4.8 Pagination ---- */
.pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
    margin: .6rem 0 1rem;
}

.pager a {
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.pager a.current { color: var(--navy); background: var(--grad-gold); }


/* ==========================================================================
   5. MODAL & DIALOG KONFIRMASI
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(20, 27, 77, .45);
}

.modal.show {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    margin: 4vh auto;
    padding: 1.6rem 1.6rem 1.4rem;
    overflow-y: auto;
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.modal-content h2 {
    margin: 0 2rem 1rem 0;
    font-size: 1.15rem;
}

.modal-close {
    position: absolute;
    top: .8rem;
    right: 1.1rem;
    padding: 0;
    border: 0;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gray);
    background: none;
}

.modal-close:hover { color: var(--danger); }

/* Dialog konfirmasi / pemberitahuan (dibuat oleh app.js) */
.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(20, 27, 77, .5);
}

.dialog-box {
    width: 100%;
    max-width: 380px;
    padding: 1.6rem;
    border-radius: 24px;
    text-align: center;
    background: var(--bg);
    box-shadow: 12px 12px 26px rgba(0, 0, 0, .25);
}

.dialog-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0 auto .8rem;
    border-radius: 50%;
    font-size: 1.5rem;
    color: var(--warning);
    background: var(--warning-light);
}

.dialog-danger  .dialog-icon { color: var(--danger);  background: var(--danger-light); }
.dialog-success .dialog-icon { color: var(--success); background: var(--success-light); }

.dialog-title   { margin-bottom: .3rem; font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.dialog-message { margin-bottom: 1.2rem; font-size: .88rem; color: var(--gray); }

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .6rem;
}


/* ==========================================================================
   6. HALAMAN LOGIN
   ========================================================================== */
.login-container {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

/* Sisi kiri: merek + bola dekoratif */
.login-left {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    text-align: center;
}

.login-orbs span {
    position: absolute;
    border-radius: 50%;
    opacity: .9;
    animation: float 9s ease-in-out infinite;
}

.login-orbs span:nth-child(odd) {
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 42%),
        linear-gradient(150deg, var(--gold-2), var(--gold));
}

.login-orbs span:nth-child(even) {
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 42%),
        linear-gradient(150deg, var(--navy-soft), var(--navy));
}

.login-orbs span:nth-child(1) { top: 10%;    left: 8%;     width: 150px; height: 150px; }
.login-orbs span:nth-child(2) { top: 18%;    right: 12%;   width: 90px;  height: 90px;  animation-delay: -2s; }
.login-orbs span:nth-child(3) { bottom: 6%;  left: -50px;  width: 200px; height: 200px; animation-delay: -4s; }
.login-orbs span:nth-child(4) { bottom: 20%; right: 20%;   width: 70px;  height: 70px;  animation-delay: -6s; }
.login-orbs span:nth-child(5) { bottom: -30px; right: -30px; width: 120px; height: 120px; animation-delay: -3s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-18px); }
}

.login-brand        { position: relative; z-index: 1; }
.login-brand h1     { margin: .6rem 0 .3rem; font-size: 2.6rem; font-weight: 700; }
.login-brand p      { margin: 0 0 .3rem; color: var(--gold); }
.login-brand strong { font-weight: 700; }

.login-logo {
    width: 130px;
    height: 130px;
    margin: 0 auto;
    font-size: 4rem;
    color: var(--navy-2);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(20, 27, 77, .18));
}

/* Sisi kanan: kartu form */
.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: var(--radius-lg);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.login-card .login-logo  { display: none; }
.login-card h1           { margin-bottom: .2rem; font-size: 1.9rem; text-align: center; }
.login-subtitle          { margin-bottom: 1.4rem; font-size: .85rem; text-align: center; color: var(--gray); }

.password-wrapper        { position: relative; }
.password-wrapper input  { padding-right: 3rem; }

.toggle-password {
    position: absolute;
    top: 50%;
    right: .5rem;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: var(--gray);
    background: none;
    transform: translateY(-50%);
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    margin-top: .6rem;
    padding: .85rem;
    border: 0;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    background: var(--grad-navy);
    box-shadow: var(--raised-sm);
}

.btn-login:hover { background: linear-gradient(135deg, var(--navy-2), var(--navy)); }

.login-footer { margin-top: 1.4rem; text-align: center; }
.version      { margin: 0; font-size: .74rem; color: var(--gray); }


/* ==========================================================================
   7. SETTING RUANG & EDITOR DENAH
   ========================================================================== */

/* ---- 7.1 Pembagian siswa per ruang ---- */
.room-item {
    margin-bottom: .8rem;
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--inset);
}

.room-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1rem;
    margin-bottom: .5rem;
}

.room-top .room-name   { flex: 1; min-width: 110px; font-weight: 600; color: var(--navy); }
.room-top .room-use    { display: flex; align-items: center; gap: .4rem; }
.room-top .room-cap    { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--gray); }
.room-summary          { margin-top: .4rem; font-size: .78rem; color: var(--gray); }

/* ---- 7.2 Toolbar editor denah ---- */
.row-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: .6rem 0;
}

.row-bar label  { display: flex; align-items: center; gap: .35rem; font-size: .8rem; }
.row-bar select { width: auto; min-width: 110px; }

.tools {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: .6rem 0;
}

.tool {
    position: relative;
    cursor: pointer;
}

.tool input {
    position: absolute;
    opacity: 0;
}

.tool span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--gray);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.tool input:checked + span { color: #fff; background: var(--grad-navy); }

.legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .9rem;
    margin: .4rem 0;
    font-size: .78rem;
}

.legend i {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    border: 1px solid #999;
    border-radius: 4px;
    vertical-align: -2px;
}

.front {
    margin: .5rem 0;
    padding: .25rem;
    border-radius: 8px;
    font-size: .72rem;
    letter-spacing: .1em;
    text-align: center;
    color: #fff;
    background: var(--navy-2);
}

/* Siswa yang belum mendapat bangku */
.unseated-btn {
    margin: .15rem;
    padding: .3rem .7rem;
    border: 0;
    border-radius: 999px;
    font-size: .75rem;
    color: var(--navy);
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.unseated-btn.on { color: #fff; background: var(--navy-2); }

/* ---- 7.3 Grid denah ---- */
.denah-wrap {
    padding: .3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.denah {
    display: grid;
    gap: 6px;
}

.denah-wrap .denah { min-width: calc(var(--cols, 4) * 84px); }

.cell {
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-width: 0;
    min-height: 60px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    font-size: .62rem;
    text-align: center;
}

.cell.seat,
.cell.bench {
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--navy-soft);
    background: #fff;
}

.cell.bench .slot + .slot { border-left: 2px solid var(--navy-soft); }

.cell.supervisor,
.cell.door {
    align-items: center;
    font-weight: 700;
    color: var(--navy);
}

.cell.supervisor { border: 1px solid var(--gold); background: #fff3c4; }
.cell.door       { background: #e2e8f0; }

.slot {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 11px 2px 2px;
    overflow: hidden;
    border-radius: 7px;
    background: #f8fafc;
}

.slot.selected { outline: 3px solid var(--danger); }

.slot i {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: .58rem;
    font-style: normal;
    font-weight: 700;
    color: var(--navy-soft);
}

.slot b {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-weight: 600;
    line-height: 1.1;
    word-break: break-word;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.slot u {
    font-size: .56rem;
    text-decoration: none;
    color: #556;
}


/* ==========================================================================
   8. HALAMAN CETAK
   ========================================================================== */
body.print-page {
    font-size: 12px;
    background: #dfe3ec;
}

.print-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    background: var(--bg);
    box-shadow: var(--raised-sm);
}

.sheet-scroll {
    padding: 12px 0;
    overflow-x: auto;
}

/* Satu lembar kertas */
.sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 14px;
    padding: 12mm;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    line-height: 1.25;
    color: #000;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .25);
    page: portrait-page;
}

.sheet.landscape {
    width: 297mm;
    min-height: 210mm;
    page: landscape-page;
}

/* Kop surat */
.kop {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 5px;
}

.kop-logo               { flex: none; width: 78px; text-align: center; }
.kop-logo img           { max-width: 78px; max-height: 80px; }
.kop-text               { flex: 1; line-height: 1.3; text-align: center; }
.kop-yayasan            { font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.kop-sekolah            { font-size: 19px; font-weight: 800; }
.kop-alamat             { font-size: 10.5px; }
.kop-kontak             { font-size: 10px; }

.kop-line {
    height: 5px;
    margin-bottom: 7px;
    border-top: 3px solid #000;
    border-bottom: 1px solid #000;
}

.judul                  { margin: 5px 0 8px; text-align: center; }
.judul h3               { margin: 0; font-size: 14px; color: #000; text-decoration: underline; }
.judul p                { margin: 2px 0 0; font-size: 11px; }

/* Keterangan ruang */
.sheet .meta            { width: 100%; margin: 4px 0 7px; }
.sheet .meta td         { padding: 1px 6px; border: 0; font-size: 11px; vertical-align: top; }
.sheet .meta td.label   { width: 105px; }
.sheet .meta td.colon   { width: 8px; }

/* Tabel daftar hadir */
.sheet .tb th,
.sheet .tb td {
    padding: 2px 5px;
    border: 1px solid #000;
    font-size: 10.5px;
    line-height: 1.2;
    color: #000;
    white-space: normal;
}

.sheet .tb th {
    text-align: center;
    text-transform: none;
    background: #e5e7eb;
}

.sheet .tb td.center     { text-align: center; }
.sheet .tb td.sign       { width: 75px; height: 21px; }
.sheet .tb thead         { display: table-header-group; }
.sheet .tb tr            { page-break-inside: avoid; }
.sheet tbody tr:hover    { background: transparent; }

/* Rekap kehadiran */
.sheet .rekap            { margin-top: 8px; }
.sheet .rekap th,
.sheet .rekap td {
    padding: 3px 6px;
    border: 1px solid #000;
    font-size: 10.5px;
    color: #000;
    white-space: normal;
}

.sheet .rekap th         { text-transform: none; background: #e5e7eb; }

.notes {
    min-height: 34px;
    margin-top: 8px;
    padding: 3px 6px;
    border: 1px solid #000;
    font-size: 10.5px;
}

/* Tanda tangan */
.signatures {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    page-break-inside: avoid;
}

.signatures > div       { flex: 1; font-size: 11px; text-align: center; }
.signatures .space      { height: 46px; }
.signatures .name       { font-weight: 700; text-decoration: underline; }
.sign-date              { margin-top: 10px; text-align: right; }

/* Denah di lembar cetak */
.sheet .legend          { font-size: 10.5px; }
.sheet .denah           { gap: 5px; align-content: start; grid-auto-rows: minmax(50px, auto); }
.sheet .cell            { height: auto; min-height: 50px; font-size: .58rem; }
.sheet .front           { background: #000; }

/* Daftar hadir padat (> 28 siswa) agar muat satu halaman */
.sheet.dense .tb th,
.sheet.dense .tb td     { padding: 1px 4px; font-size: 9.5px; }
.sheet.dense .tb td.sign { height: 15px; }
.sheet.dense .kop-logo  { width: 62px; }
.sheet.dense .kop-logo img { max-width: 62px; max-height: 64px; }
.sheet.dense .kop-sekolah  { font-size: 17px; }
.sheet.dense .meta td   { font-size: 10px; }
.sheet.dense .signatures .space { height: 30px; }
.sheet.dense .notes     { min-height: 24px; }

@page portrait-page  { size: A4 portrait;  margin: 10mm; }
@page landscape-page { size: A4 landscape; margin: 8mm; }

@media print {
    html,
    body,
    body.print-page {
        display: block;
        min-height: 0;
        background: #fff;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print { display: none; }

    .sheet-scroll { padding: 0; overflow: visible; }

    .sheet,
    .sheet.landscape {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
        box-shadow: none;
        page-break-after: auto;
    }

    .sheet + .sheet {
        page-break-before: always;
        break-before: page;
    }

    .slot b {
        display: block;
        overflow: visible;
        -webkit-line-clamp: unset;
    }

    .cell,
    .slot { break-inside: avoid; }
}


/* ==========================================================================
   9. RESPONSIVE
   ========================================================================== */

/* ---- Tablet ---- */
@media (min-width: 901px) and (max-width: 1100px) {
    .main-content { padding: 1.5rem 1.3rem 2rem; }
    .grid-2       { grid-template-columns: 1fr; }
}

/* ---- HP & layar sempit ---- */
@media (max-width: 900px) {
    /* Sidebar diganti header atas + menu bawah */
    .sidebar { display: none; }

    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
        padding: 74px .9rem calc(86px + env(safe-area-inset-bottom));
    }

    .mobile-header {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        z-index: 90;
        display: flex;
        align-items: center;
        gap: .7rem;
        height: 58px;
        padding: 0 1rem;
        background: var(--bg);
        box-shadow: var(--raised-sm);
    }

    .mobile-header .brand-logo { width: 30px; height: 30px; font-size: 1.2rem; }
    .mobile-title              { flex: 1; font-size: 1.05rem; font-weight: 700; color: var(--navy); }

    .mobile-logout {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        color: var(--danger);
    }

    .bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 90;
        display: block;
        padding: .4rem .5rem calc(.4rem + env(safe-area-inset-bottom));
        background: var(--bg);
        box-shadow: 0 -8px 22px -6px rgba(20, 27, 77, .22);
    }

    .bottom-nav-inner { display: flex; justify-content: space-between; gap: .2rem; }

    .bottom-nav-item {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        gap: .15rem;
        min-width: 0;
        padding: .4rem .2rem;
        border-radius: 999px;
        font-size: .62rem;
        font-weight: 600;
        color: var(--gray);
    }

    .bottom-nav-item i      { font-size: 1.05rem; }
    .bottom-nav-item.active { color: var(--navy); background: var(--grad-gold); box-shadow: var(--glow-gold); }

    /* Isi halaman */
    .topbar                  { margin-bottom: 1rem; }
    .topbar h1               { font-size: 1.15rem; }
    .grid-2                  { grid-template-columns: 1fr; }
    .stats-grid              { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
    .stat-card               { gap: .7rem; padding: .9rem; }
    .stat-icon               { width: 44px; height: 44px; font-size: 1.05rem; }
    .stat-info h3            { font-size: 1.35rem; }
    .card-header             { padding: .85rem 1rem .85rem 1.5rem; }
    .card-body               { padding: .3rem 1rem 1rem; }
    .table-container         { padding: 0 .4rem .6rem; }
    th, td                   { padding: .55rem .6rem; }
    .modal-content           { margin: 2vh auto; padding: 1.3rem 1.1rem; }

    /* Login: hanya kartu, logo pindah ke dalam kartu */
    .login-container         { grid-template-columns: 1fr; }
    .login-left              { display: none; }
    .login-right             { min-height: 100vh; padding: 1.2rem; }
    .login-card              { padding: 26px 20px; }
    .login-card .login-logo  { display: block; width: 90px; height: 90px; font-size: 3rem; }
}

@media (max-width: 600px) {
    .hide-sm                    { display: none; }
    .topbar-actions .btn        { padding: .5rem .8rem; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
}
