/* BlueGrammar — Account / Portal pages
   Pattern: page wrapper, blue #1361C8 / red #be434b palette,
   page-header, account-card/-table/-form, btn-account-*          */

.account-page {
    font-size: 14px;
    color: #1f2a37;
}

.account-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.account-page .page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1361C8;
    margin: 0;
}

.account-page .page-subtitle {
    margin: 2px 0 0;
    color: #5b6b7c;
    font-size: 12.5px;
}

.account-card {
    background: #fff;
    border: 1px solid #d7e3f2;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(19, 97, 200, .08);
    margin-bottom: 14px;
}

.account-card-header {
    background: linear-gradient(90deg, #1361C8, #0E4FA8);
    color: #fff;
    padding: 9px 14px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
}

.account-card-header h3 { margin: 0; font-size: 16px; color: #fff; }

.account-card-body { padding: 14px; }

.account-form-group { margin-bottom: 12px; }

.account-form-label {
    display: block;
    font-weight: 600;
    font-size: 12.5px;
    margin-bottom: 4px;
    color: #33475c;
}

.account-form-control {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #b9c9dd;
    border-radius: 6px;
    font-size: 13.5px;
}

.account-form-control:focus {
    outline: none;
    border-color: #1361C8;
    box-shadow: 0 0 0 3px rgba(19, 97, 200, .15);
}

.account-form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.btn-account {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
}

.btn-account-primary { background: #1361C8; color: #fff; }
.btn-account-primary:hover { background: #0E4FA8; color: #fff; }

.btn-account-secondary { background: #eef3fa; color: #1361C8; border-color: #b9c9dd; }
.btn-account-secondary:hover { background: #dfeaf8; color: #0E4FA8; }

.btn-account-edit { background: #fff4e0; color: #8a5a00; border-color: #ecd9a8; padding: 3px 10px; }
.btn-account-view { background: #e8f4ea; color: #1e6b2e; border-color: #bfe0c6; padding: 3px 10px; }

.account-validation { color: #be434b; font-size: 12px; }
.account-validation-summary { color: #be434b; font-size: 12.5px; margin-bottom: 8px; }
.account-validation-summary ul { margin: 0; padding-left: 18px; }

.account-note {
    margin-top: 12px;
    background: #f2f7fd;
    border: 1px solid #d7e3f2;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: #43566b;
    text-align: center;
}

.account-actions { display: flex; gap: 6px; flex-wrap: nowrap; }

.account-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.account-table th {
    background: #1361C8; color: #fff; text-align: left;
    padding: 7px 9px; font-size: 12px; white-space: nowrap;
}
.account-table td { padding: 6px 9px; border-bottom: 1px solid #e3ebf5; vertical-align: middle; }
.account-table tbody tr:nth-child(even) { background: #f6f9fd; }

.account-badge {
    display: inline-block; padding: 1px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.role-admin { background: #fbe3e5; color: #be434b; }
.role-principal { background: #e4defc; color: #4b2fb8; }
.role-accountant { background: #dff3e4; color: #1e6b2e; }
.role-parent { background: #dbeafe; color: #1361C8; }
.role-teacher, .role-staff { background: #eef3fa; color: #43566b; }
.role-none { background: #f1f1f1; color: #777; }

.account-empty { text-align: center; padding: 22px 10px; color: #5b6b7c; }

/* Parent portal — children cards + page menu */
.child-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}

.child-card {
    display: flex; gap: 12px; align-items: center;
    background: #fff; border: 1px solid #d7e3f2; border-radius: 10px;
    padding: 12px; box-shadow: 0 1px 3px rgba(19, 97, 200, .08);
}

.child-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 50%; border: 2px solid #1361C8; }
.child-name { font-weight: 700; font-size: 15px; color: #1361C8; }
.child-meta { font-size: 12px; color: #5b6b7c; }

.portal-menu { margin: 0; padding-left: 18px; font-size: 13.5px; }
.portal-menu li { margin: 4px 0; }

@media (max-width: 767px) {
    .account-page .page-header { align-items: flex-start; }
    .account-table { display: block; overflow-x: auto; }
}

/* ---- Phase B portal additions ---- */
.picker-form { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.picker-form label { font-weight: 600; font-size: 12.5px; color: #33475c; }

.portal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 767px) { .portal-cols { grid-template-columns: 1fr; } }

.portal-dl { display: grid; grid-template-columns: 130px 1fr; row-gap: 6px; margin: 0; font-size: 13.5px; }
.portal-dl dt { color: #5b6b7c; font-weight: 600; }
.portal-dl dd { margin: 0; }

.stat-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-box {
    flex: 1 1 110px; text-align: center; background: #f6f9fd;
    border: 1px solid #d7e3f2; border-radius: 8px; padding: 10px 6px;
}
.stat-box span { display: block; font-size: 11.5px; color: #5b6b7c; font-weight: 600; }
.stat-box strong { font-size: 20px; color: #1f2a37; }
.stat-box-blue { background: #1361C8; border-color: #1361C8; }
.stat-box-blue span { color: #cfe2fb; }
.stat-box-blue strong { color: #fff; }

.tt-table td { font-size: 12.5px; min-width: 92px; }

@media print {
    .no-print, .page-header .btn-account { display: none !important; }
}

/* ================================================================
   MOBILE PASS (2026-10-31) — parents and staff mostly open these
   pages on phones, and later inside the app container (WebView).
   Rules: nothing squeezes, tables scroll sideways, tap targets are
   thumb-sized, cards/forms stack in a single column.
   ================================================================ */
@media (max-width: 767px) {
    .account-page { font-size: 13.5px; }

    .account-page .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .account-page .page-title { font-size: 19px; }
    .account-page .page-subtitle { font-size: 12px; }

    /* header action buttons become full-width rows */
    .account-form-actions { width: 100%; }
    .account-form-actions .btn-account,
    .account-page .page-header .btn-account {
        flex: 1 1 auto;
        text-align: center;
    }

    /* thumb-sized taps everywhere */
    .btn-account { min-height: 38px; padding: 8px 14px; font-size: 13px; }
    .btn-account-edit, .btn-account-view { min-height: 32px; padding: 6px 10px; }
    /* tables: scroll sideways, never crush columns */
    .account-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .tt-table td { min-width: 74px; }

    /* cards + pickers stack full width */
    .account-card-body { padding: 10px; }
    .child-grid { grid-template-columns: 1fr; }
    .picker-form { flex-direction: column; align-items: stretch; gap: 6px; }
    .picker-form .account-form-control { max-width: none !important; width: 100%; }

    /* profile label/value pairs stack */
    .portal-dl { grid-template-columns: 1fr; row-gap: 2px; }
    .portal-dl dt { margin-top: 6px; }

    /* attendance stat boxes: two per row */
    .stat-box { flex: 1 1 40%; }
    .stat-box strong { font-size: 18px; }

    /* row action buttons may wrap on narrow screens */
    .account-actions { flex-wrap: wrap; }

    /* login / centered cards breathe less on a phone */
    .account-card { border-radius: 8px; }
}

@media (max-width: 380px) {
    .stat-box { flex: 1 1 100%; }
    .child-card { flex-direction: column; text-align: center; }
}

/* ================================================================
   PHASE B PART 2 — parent Diary + Notice Board
   Diary table: desktop = two columns (Subject | Diary).
   Mobile = one column: the subject cell becomes a full-width
   header row and the diary text sits on the row beneath it,
   then the next subject, and so on.
   ================================================================ */
.pdiary-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.pdiary-table th { background: #eef3fa; color: #0E4FA8; text-align: left; padding: 8px 10px; font-size: 12.5px; border: 1px solid #c9d6ea; }
.pdiary-table td { border: 1px solid #dbe4f0; padding: 8px 10px; vertical-align: top; }
.pdiary-subject { font-weight: 700; color: #0E4FA8; width: 180px; background: #f7fafd; }
.pdiary-text { white-space: pre-line; }
.pdiary-none { color: #98a2b3; font-style: italic; }
.pdiary-by { display: block; color: #6c757d; font-size: 11.5px; margin-top: 4px; }

.pnotice-card { background: #fff; border: 1px solid #dbe4f0; border-left: 4px solid #1361C8; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(14,79,168,.06); }
.pnotice-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: #0E4FA8; font-size: 15px; }
.pnotice-head span { color: #6c757d; font-size: 12px; font-weight: 400; }
.pnotice-body { margin: 6px 0 0; white-space: pre-line; }

@media (max-width: 767px) {
    /* subject row, diary row, subject row, diary row ... */
    .pdiary-table, .pdiary-table tbody, .pdiary-table tr, .pdiary-table td { display: block; width: 100%; }
    .pdiary-table thead { display: none; }
    .pdiary-table tr { margin-bottom: 12px; }
    .pdiary-subject { background: #1361C8; color: #fff; border-radius: 7px 7px 0 0; border: none; padding: 7px 10px; }
    .pdiary-text { border: 1px solid #dbe4f0; border-top: none; border-radius: 0 0 7px 7px; }
}

/* Phase B2 additions: urgent notices + diary day navigation */
.pnotice-urgent { border-color: #f0b7bc; border-left-color: #be434b; background: #fff7f7; }
.pnotice-urgent .pnotice-head { color: #be434b; }
.pnotice-badge { background: #be434b; color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 2px 7px; vertical-align: middle; }
.diary-day-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; color: #0E4FA8; font-size: 13px; flex-wrap: wrap; }

/* ================================================================
   PHASE C — portal Submit Leave (compact: small fonts, tight
   padding, small buttons, colourful status pills)
   ================================================================ */
.pleave-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pleave-form .full { grid-column: 1 / -1; }
.pleave-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.pleave-table th { background: #eef3fa; color: #0E4FA8; text-align: left; padding: 5px 8px; font-size: 11.5px; border-bottom: 2px solid #c9d6ea; }
.pleave-table td { padding: 5px 8px; border-bottom: 1px solid #e6edf7; vertical-align: top; font-size: 12.5px; }
.leave-pill { border-radius: 9px; padding: 1px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.leave-pill-pending-class-teacher { background: #fff1d6; color: #9a6206; }
.leave-pill-pending-principal { background: #dbe9ff; color: #0E4FA8; }
.leave-pill-pending { background: #fff1d6; color: #9a6206; }
.leave-pill-approved { background: #d9f2e4; color: #14663a; }
.leave-pill-rejected { background: #fbdfe1; color: #8f2d34; }
.account-alert-error { background: #fdeeee; border: 1px solid #f3c2c6; color: #8f2d34; border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; font-size: 12.5px; }
@media (max-width: 767px) {
    .pleave-form { grid-template-columns: 1fr; }
    .pleave-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}
.account-alert-success { background: #e7f6ee; border: 1px solid #bfe6cf; color: #14663a; border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; font-size: 12.5px; }
.btn-account-delete { background: #be434b; color: #fff !important; border: none; border-radius: 6px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; }

/* ================================================================
   LOGIN — split screen (reference design, 2026-11-01): blue
   branding panel with REAL counts, role tiles on the form side.
   ================================================================ */
.login-split { display: flex; min-height: 100vh; font-size: 14px; }
.login-brand { flex: 0 0 42%; background: linear-gradient(160deg, #1361C8, #0E4FA8 60%, #093a7d); color: #fff; padding: 34px 38px; display: flex; flex-direction: column; }
.login-brand-top { display: flex; align-items: center; gap: 10px; }
.login-brand-top strong { font-size: 18px; display: block; line-height: 1.1; }
.login-brand-top small { opacity: .85; font-size: 11.5px; }
.login-logo { width: 44px; height: 44px; border-radius: 10px; background: #fff; object-fit: contain; }
.login-brand h1 { font-size: 34px; font-weight: 700; line-height: 1.2; margin: auto 0 10px; }
.login-brand p { opacity: .88; max-width: 340px; }
.login-stats { display: flex; gap: 10px; margin-top: 22px; }
.login-stat { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.login-stat strong { font-size: 19px; }
.login-stat span { font-size: 11px; opacity: .85; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 26px 18px; background: #fffdf9; }
.login-form-wrap { width: 100%; max-width: 420px; }
.login-form-wrap h2 { margin: 0 0 2px; font-size: 24px; color: #1d2733; }
.login-sub { color: #6c757d; margin-bottom: 16px; }
.login-pass-wrap { position: relative; }
.login-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 15px; }
.login-signing { background: #eef3fa; color: #0E4FA8; border-radius: 8px; padding: 7px 11px; font-size: 12.5px; margin: 12px 0 8px; }
.login-submit { width: 100%; background: linear-gradient(135deg, #1361C8, #0E4FA8); color: #fff; border: none; border-radius: 9px; padding: 11px; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.login-submit:hover { filter: brightness(1.07); }
.login-roles-label { color: #6c757d; font-size: 11px; letter-spacing: .07em; margin: 18px 0 7px; }
.login-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login-role { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid #dbe4f0; border-radius: 9px; padding: 9px 12px; font-size: 13.5px; font-weight: 600; color: #33475e; cursor: pointer; }
.login-role:hover { border-color: #1361C8; }
.login-role.selected { background: #eef3fa; border-color: #1361C8; color: #0E4FA8; }
.login-role-icon { font-size: 16px; }
@media (max-width: 860px) {
    .login-split { flex-direction: column; }
    .login-brand { flex: none; padding: 20px; }
    .login-brand h1 { font-size: 24px; margin-top: 18px; }
    .login-panel { padding: 18px 14px 26px; }
}
