/* School CMS — Modern Commercial-Grade Admin Dashboard & Login Stylesheet */

/* ---------- Design Tokens ---------- */
.admin-body,
.login-body {
    --adm-bg: #f1f5f9;
    --adm-surface: #ffffff;
    --adm-surface-soft: #f8fafc;
    --adm-border: #e2e8f0;
    --adm-border-strong: #cbd5e1;
    --adm-text: #0f172a;
    --adm-muted: #64748b;
    --adm-primary: #2563eb;
    --adm-primary-dark: #1d4ed8;
    --adm-primary-soft: #eff6ff;
    --adm-sidebar-bg: #0f172a;
    --adm-sidebar-bg2: #111827;
    --adm-sidebar-border: rgba(148, 163, 184, 0.14);
    --adm-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --adm-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
    --adm-radius: 14px;
    --adm-radius-sm: 9px;
}

/* ---------- Login Screen ---------- */
.login-body {
    background:
        radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.12), transparent 36%),
        radial-gradient(circle at 88% 82%, rgba(14, 165, 233, 0.12), transparent 40%),
        linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 20px;
    padding: 34px 32px;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.10);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--adm-shadow-sm);
}

.login-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.login-kicker {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--adm-primary-dark);
}

.login-header h1 {
    margin: 4px 0 6px;
    font-size: 22px;
    color: var(--adm-text);
    line-height: 1.3;
}

.login-header p {
    margin: 0;
    font-size: 14px;
    color: var(--adm-muted);
}

.login-foot {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--adm-border);
    font-size: 14px;
}

/* ---------- Shell Layout ---------- */
.admin-body {
    background: var(--adm-bg);
    color: var(--adm-text);
    overflow-x: hidden;
}

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

/* ---------- Modern Collapsible Sidebar ---------- */
.admin-sidebar {
    width: 276px;
    background: linear-gradient(180deg, var(--adm-sidebar-bg) 0%, var(--adm-sidebar-bg2) 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(15, 23, 42, 0.5);
    z-index: 45;
}

.admin-brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--adm-sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.admin-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

.admin-brand-text {
    min-width: 0;
    flex: 1;
}

.admin-brand-title {
    font-size: 11.5px;
    color: #93c5fd;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.admin-brand-school {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav-search-wrap {
    padding: 12px 12px 6px;
}

.admin-nav-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.admin-nav-search-icon {
    position: absolute;
    left: 11px;
    color: #94a3b8;
    pointer-events: none;
    display: inline-flex;
}

#admin-nav-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    background: rgba(255, 255, 255, 0.07);
    color: #f8fafc;
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#admin-nav-search::placeholder {
    color: #94a3b8;
}

#admin-nav-search:focus {
    outline: none;
    border-color: #60a5fa;
    background: rgba(255, 255, 255, 0.11);
}

.admin-nav {
    flex: 1;
    position: relative; /* keeps the hidden ".sr-only" link notes inside the scroll area; without it they stretched the page (2026-12-04) */
    overflow-y: auto;
    padding: 6px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.admin-nav::-webkit-scrollbar {
    width: 6px;
}

.admin-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 999px;
}

.adm-nav-group {
    margin-top: 4px;
}

.adm-nav-group-toggle {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 8px;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.adm-nav-group-toggle::-webkit-details-marker {
    display: none;
}

.adm-nav-group-toggle:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

.adm-nav-chevron {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.18s ease;
    opacity: 0.75;
}

.adm-nav-group[open] > .adm-nav-group-toggle .adm-nav-chevron {
    transform: rotate(90deg);
}

.adm-nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px;
}

.admin-nav-sep {
    font-size: 11.5px;
    color: #64748b;
    padding: 12px 12px 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8.5px 11px;
    border-radius: 9px;
    color: #cbd5e1;
    font-size: 13.8px;
    font-weight: 500;
    line-height: 1.35;
    transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.admin-nav-item .sc-icon {
    color: #94a3b8 !important;
    flex-shrink: 0;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
}

.admin-nav-item:hover .sc-icon {
    color: #e2e8f0 !important;
}

.admin-nav-item.is-active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.34), rgba(37, 99, 235, 0.16));
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #60a5fa;
    text-decoration: none;
}

.admin-nav-item.is-active .sc-icon {
    color: #93c5fd !important;
}

.admin-nav-empty {
    margin: 10px 6px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

.admin-sidebar-foot {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--adm-sidebar-border);
    background: rgba(2, 6, 23, 0.35);
    font-size: 13.5px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.admin-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-user-meta {
    min-width: 0;
    flex: 1;
}

.admin-user-name {
    font-weight: 700;
    color: #f8fafc;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-role-pill {
    display: inline-block;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.22);
    color: #bfdbfe;
    padding: 1px 8px;
    border-radius: 999px;
}

.adm-logout-btn {
    width: 100%;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(220, 38, 38, 0.14);
    color: #fecaca;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.adm-logout-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 40;
}

.admin-sidebar-backdrop.is-open {
    display: block;
}

/* ---------- Sticky Glass Topbar & Centered Workspace ---------- */
.admin-main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--adm-border);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-topbar-crumb {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--adm-muted);
    line-height: 1.2;
}

.admin-topbar-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--adm-text);
    line-height: 1.25;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.adm-visit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--adm-primary-soft);
    color: var(--adm-primary-dark);
    border: 1px solid #bfdbfe;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.adm-visit-btn:hover {
    background: #dbeafe;
    text-decoration: none;
    transform: translateY(-1px);
}

.admin-version-pill {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid var(--adm-border);
    padding: 4px 10px;
    border-radius: 999px;
}

.admin-sidebar-toggle {
    display: none;
    background: #f1f5f9;
    color: var(--adm-text);
    border: 1px solid var(--adm-border-strong);
    border-radius: 8px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.admin-content {
    padding: 24px 28px 96px;
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
}

/* ---------- Modernized Form Controls & Buttons inside Admin ---------- */
.admin-body input[type="text"],
.admin-body input[type="email"],
.admin-body input[type="url"],
.admin-body input[type="password"],
.admin-body input[type="number"],
.admin-body input[type="date"],
.admin-body input[type="datetime-local"],
.admin-body input[type="search"]:not(#admin-nav-search),
.admin-body select,
.admin-body textarea {
    border: 1px solid var(--adm-border-strong);
    border-radius: var(--adm-radius-sm);
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14.5px;
    background: #ffffff;
    color: var(--adm-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.admin-body input[type="text"]:focus,
.admin-body input[type="email"]:focus,
.admin-body input[type="url"]:focus,
.admin-body input[type="password"]:focus,
.admin-body input[type="number"]:focus,
.admin-body input[type="date"]:focus,
.admin-body input[type="datetime-local"]:focus,
.admin-body input[type="search"]:not(#admin-nav-search):focus,
.admin-body select:focus,
.admin-body textarea:focus {
    outline: none;
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.admin-body input[type="file"] {
    font-family: inherit;
    font-size: 13.5px;
    color: var(--adm-muted);
}

.admin-body input[type="file"]::file-selector-button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--adm-primary-dark);
    background: var(--adm-primary-soft);
    border: 1px solid #bfdbfe;
    border-radius: 7px;
    padding: 6px 12px;
    margin-right: 10px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.admin-body input[type="file"]::file-selector-button:hover {
    background: #dbeafe;
}

.admin-body .btn {
    border-radius: var(--adm-radius-sm);
}

.admin-body .btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.24);
}

.admin-body .btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.admin-body .select-card {
    border: 1.5px solid var(--adm-border);
    border-radius: 12px;
    padding: 14px 16px;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.admin-body .select-card:hover {
    border-color: #93c5fd;
}

.admin-body .select-card.is-selected,
.admin-body .select-card:has(input:checked) {
    border-color: var(--adm-primary);
    background: #f8fbff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ---------- Modern Toggle Switch (.sc-switch) ---------- */
.sc-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.sc-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.sc-switch-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.sc-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    transition: transform 0.18s ease;
}

.sc-switch input:checked + .sc-switch-track {
    background: var(--adm-primary);
}

.sc-switch input:checked + .sc-switch-track::after {
    transform: translateX(20px);
}

.sc-switch input:focus-visible + .sc-switch-track {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* ---------- Admin Tabs & Sticky Save Bar ---------- */
.adm-tabs-bar {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    box-shadow: var(--adm-shadow-sm);
}

.adm-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--adm-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.adm-tab-btn:hover {
    background: #f1f5f9;
    color: var(--adm-text);
}

.adm-tab-btn.is-active {
    background: var(--adm-primary-soft);
    color: var(--adm-primary-dark);
    border-color: #bfdbfe;
}

.adm-tab-btn.is-active .sc-icon {
    color: var(--adm-primary-dark) !important;
}

.adm-tab-count {
    font-size: 12px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}

.adm-tab-btn.is-active .adm-tab-count {
    background: var(--adm-primary);
    color: #ffffff;
}

.adm-tab-panel[hidden] {
    display: none !important;
}

.adm-sticky-save {
    position: sticky;
    bottom: 14px;
    z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--adm-border-strong);
    border-radius: var(--adm-radius);
    padding: 12px 20px;
    margin-top: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.adm-sticky-hint {
    font-size: 13.5px;
    color: var(--adm-muted);
}

.adm-sticky-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Settings: Grouped Module Toggle Cards ---------- */
.adm-module-group {
    margin-bottom: 22px;
}

.adm-module-group:last-child {
    margin-bottom: 0;
}

.adm-module-group-title {
    margin: 0 0 10px;
    font-size: 14.5px;
    font-weight: 700;
    color: #334155;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--adm-border);
}

.adm-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.adm-module-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.adm-module-card:hover {
    border-color: #93c5fd;
    box-shadow: var(--adm-shadow-sm);
}

.adm-module-card.is-enabled {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.adm-module-info {
    min-width: 0;
    flex: 1;
}

/* ---------- Blocks: Zone Color Pills ---------- */
.adm-zone-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 4px;
}

.adm-zone-pill.zone-top { background: #dbeafe; color: #1e40af; }
.adm-zone-pill.zone-left { background: #e0e7ff; color: #3730a3; }
.adm-zone-pill.zone-main { background: #dcfce7; color: #166534; }
.adm-zone-pill.zone-right { background: #fef3c7; color: #92400e; }
.adm-zone-pill.zone-bottom { background: #f1f5f9; color: #334155; }

/* ---------- Dashboard: Welcome Hero, KPI Cards & Grouped Menu Cards ---------- */
.welcome-banner {
    background: linear-gradient(125deg, #0f172a 0%, #1e3a8a 52%, #2563eb 100%);
    color: #ffffff;
    padding: 24px 26px;
    border-radius: 18px;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    box-shadow: var(--adm-shadow-md);
}

.welcome-banner h2 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #ffffff;
}

.welcome-banner p {
    margin: 0;
    color: #dbeafe;
    font-size: 14px;
}

.welcome-role {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.adm-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.adm-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.adm-quick-btn:hover {
    background: rgba(255, 255, 255, 0.26);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.adm-quick-btn.is-primary {
    background: #ffffff;
    color: #1d4ed8;
    border-color: #ffffff;
}

.adm-quick-btn.is-primary:hover {
    background: #eff6ff;
    color: #1e40af;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    color: var(--adm-text);
    box-shadow: var(--adm-shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--adm-shadow-md);
    border-color: #93c5fd;
    text-decoration: none;
}

.stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--adm-text);
    line-height: 1.15;
}

.stat-label {
    font-size: 12.8px;
    color: var(--adm-muted);
    margin-top: 2px;
}

.admin-group-box {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    margin-bottom: 20px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    box-shadow: var(--adm-shadow-sm);
}

.admin-group-head {
    background: var(--adm-surface-soft);
    border-bottom: 1px solid var(--adm-border);
    padding: 14px 20px;
}

.admin-group-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--adm-text);
}

.admin-group-head span {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--adm-muted);
}

.admin-form-pad {
    padding: 20px 22px;
}

.admin-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 20px;
}

.admin-menu-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--adm-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.admin-menu-card:hover {
    border-color: var(--adm-primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
    transform: translateY(-2px);
    text-decoration: none;
}

.admin-menu-card.is-disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.78;
}

.amc-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.amc-body {
    min-width: 0;
    flex: 1;
}

.amc-title {
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.3;
    margin-bottom: 4px;
}

.amc-badge {
    display: inline-block;
    font-size: 11.5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.amc-badge.is-on {
    background: #dcfce7;
    color: #166534;
}

.amc-badge.is-off {
    background: #e2e8f0;
    color: #64748b;
}

.amc-arrow {
    color: #94a3b8;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}

.admin-menu-card:hover .amc-arrow {
    color: var(--adm-primary);
    transform: translateX(3px);
}

.audit-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.audit-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 4px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13.8px;
}

.audit-list li:last-child {
    border-bottom: none;
}

.audit-list-main {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.audit-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--adm-primary);
    flex-shrink: 0;
}

/* ---------- Tables, Toolbar & Media Library ---------- */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.admin-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--adm-border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
    font-size: 13px;
    white-space: nowrap;
}

.admin-table tr:hover td {
    background: #f8fbff;
}

.adm-nowrap {
    white-space: nowrap;
}

.status-pill,
.admin-body .badge,
.admin-body .btn-sm,
.amc-badge {
    white-space: nowrap;
}

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-published {
    background: #dcfce7;
    color: #166534;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.media-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
    gap: 14px;
}

.media-admin-card {
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: var(--adm-shadow-sm);
}

.media-admin-thumb {
    height: 130px;
    background: #f1f5f9;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.media-admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-doc-badge {
    font-weight: 700;
    color: #475569;
}

.media-admin-meta {
    padding: 10px 12px;
}

.media-admin-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Rich Text Editor ---------- */
.sc-rte-wrap {
    border: 1px solid var(--adm-border-strong);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.sc-rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--adm-border);
    align-items: center;
}

.sc-rte-btn {
    border: 1px solid var(--adm-border);
    background: #ffffff;
    color: #1e293b;
    padding: 5px 9px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.sc-rte-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.sc-rte-sep {
    width: 1px;
    height: 20px;
    background: #cbd5e1;
    margin: 0 3px;
}

.sc-rte-editor {
    min-height: 260px;
    max-height: 520px;
    overflow-y: auto;
    padding: 14px;
    line-height: 1.75;
    font-size: 15px;
    outline: none;
}

.sc-rte-editor img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

/* ---------- Media Picker Modal ---------- */
.sc-media-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.sc-media-modal {
    background: #ffffff;
    border-radius: 16px;
    max-width: 780px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.35);
}

.sc-media-modal-head {
    padding: 14px 18px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sc-media-close {
    background: rgba(255, 255, 255, 0.2);
    border: 0;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
}

.sc-media-modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.sc-media-modal-foot {
    padding: 12px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sc-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 10px;
}

.sc-picker-item {
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.sc-picker-item:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.sc-picker-item img {
    width: 100%;
    height: 92px;
    object-fit: cover;
    display: block;
}

.sc-picker-item span {
    display: block;
    padding: 6px 8px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Admin Visual Multi-Style Icon Picker ---------- */
.sc-icon-picker-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.sc-icon-preview-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-icon-empty-dot {
    color: #94a3b8;
    font-weight: 700;
}

.sc-icon-meta {
    flex: 1;
    min-width: 0;
}

.sc-icon-desc {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.sc-icon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.sc-icon-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sc-icon-modal {
    background: #ffffff;
    border-radius: 16px;
    width: min(860px, 100%);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.35);
}

.sc-icon-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sc-icon-modal-sub {
    font-size: 12.5px;
    color: #64748b;
    margin-top: 2px;
}

.sc-icon-close {
    border: none;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    padding: 0 4px;
}

.sc-icon-modal-controls {
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #ffffff;
}

.sc-icon-ctrl-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sc-icon-ctrl-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    min-width: 52px;
}

.sc-icon-style-tabs,
.sc-icon-swatches,
.sc-icon-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sc-icon-pill,
.sc-icon-cat {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.sc-icon-pill.is-active,
.sc-icon-cat.is-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.sc-icon-swatch {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.sc-icon-swatch.is-active {
    border-color: #0f172a;
    background: #f1f5f9;
    font-weight: 700;
}

.sc-swatch-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    display: inline-block;
}

.sc-icon-search-row {
    justify-content: space-between;
}

#sc-icon-search {
    min-width: 220px;
    flex: 1 1 220px;
    max-width: 300px;
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
}

.sc-icon-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}

.sc-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}

.sc-icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 12px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}

.sc-icon-tile:hover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
}

.sc-icon-tile-art {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sc-icon-tile-label {
    font-size: 12px;
    color: #1e293b;
    line-height: 1.3;
    word-break: break-word;
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 1120px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .admin-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .admin-content .form-grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
    .admin-content .form-span-2 {
        grid-column: auto;
    }
}

@media (max-width: 900px) {
    .admin-sidebar {
        display: none;
        position: fixed;
        inset: 0 auto 0 0;
        height: 100vh;
        z-index: 50;
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.35);
    }
    .admin-sidebar.is-open {
        display: flex;
    }
    .admin-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .admin-topbar {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .admin-content {
        padding: 18px 16px 96px;
    }
    .adm-module-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid,
    .admin-cards-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .admin-version-pill {
        display: none;
    }
    .adm-tabs-bar {
        gap: 4px;
    }
    .adm-tab-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 10px;
        font-size: 13px;
    }
    .admin-group-head,
    .adm-sticky-save,
    .adm-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ---------- Drag-and-Drop Rows, Inline Toggles, Confirm Modal & Blocks Board ---------- */
.adm-drag-handle {
    display: inline-block;
    cursor: grab;
    color: #94a3b8;
    font-weight: 700;
    margin-right: 6px;
    user-select: none;
    letter-spacing: -1px;
}
.adm-drag-handle:active {
    cursor: grabbing;
}
.adm-row-num {
    display: inline-flex;
    min-width: 22px;
    justify-content: center;
    font-weight: 700;
    color: #475569;
    font-size: 13px;
}
.adm-toggle-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.adm-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.admin-table tr.is-dragging {
    opacity: 0.45;
    background: #eff6ff;
}
.admin-table tr.is-drag-over td {
    border-top: 2.5px solid #2563eb;
}

.sc-confirm-backdrop[hidden] {
    display: none !important;
}
.sc-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.sc-confirm-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    max-width: 440px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 24px 54px rgba(15, 23, 42, 0.28);
}
.sc-confirm-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 20px 14px;
}
.sc-confirm-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #fef3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.sc-confirm-head h3 {
    margin: 0 0 4px;
    font-size: 16.5px;
    color: #0f172a;
}
.sc-confirm-head p {
    margin: 0;
    font-size: 13.8px;
    color: #475569;
    line-height: 1.5;
}
.sc-confirm-foot {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 12px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.adm-toast[hidden] {
    display: none !important;
}
.adm-toast {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 9999;
    background: #0f172a;
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
}
.adm-toast.is-error {
    background: #b91c1c;
}

.adm-zone-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.adm-zone-3col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 12px;
}
@media (max-width: 1180px) {
    .adm-zone-3col {
        grid-template-columns: minmax(0, 1fr);
    }
}
.adm-zone-col {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}
.adm-zone-col-head {
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}
.adm-zone-drop {
    min-height: 52px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 4px;
    border-radius: 8px;
    border: 1.5px dashed #cbd5e1;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.adm-zone-drop.is-drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.adm-block-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    cursor: grab;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.adm-block-chip .status-pill {
    flex-shrink: 0;
}
.adm-block-chip:active {
    cursor: grabbing;
}
.adm-block-chip.is-off {
    opacity: 0.6;
    background: #f1f5f9;
}
.adm-block-chip.is-dragging {
    opacity: 0.4;
}
.adm-block-chip-body {
    flex: 1;
    min-width: 0;
}
.adm-block-chip-body strong {
    display: block;
    font-size: 13px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.adm-block-chip-body small {
    display: block;
    font-size: 11px;
    color: #64748b;
}

/* Interactive Image Cropper Modal */
.sc-crop-trigger-btn {
    margin-left: 6px;
    white-space: nowrap;
}
.sc-crop-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2200;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.sc-crop-backdrop[hidden] {
    display: none !important;
}
.sc-crop-card {
    width: 100%;
    max-width: 760px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.sc-crop-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
}
.sc-crop-head h3 {
    margin: 0 0 2px;
    font-size: 16px;
    color: #0f172a;
}
.sc-crop-sub {
    font-size: 12.5px;
    color: #64748b;
}
.sc-crop-close {
    border: 0;
    background: #f1f5f9;
    color: #334155;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.sc-crop-close:hover {
    background: #e2e8f0;
}
.sc-crop-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.sc-crop-preset-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.sc-crop-preset-btn:hover {
    border-color: #2563eb;
    color: #1d4ed8;
}
.sc-crop-preset-btn.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
.sc-crop-stage {
    position: relative;
    width: 100%;
    height: 360px;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    touch-action: none;
    cursor: grab;
}
.sc-crop-stage:active {
    cursor: grabbing;
}
.sc-crop-controls {
    padding: 10px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}
.sc-crop-zoom-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.sc-crop-ctrl-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
}
.sc-crop-zoom-row input[type="range"] {
    width: 140px;
    accent-color: #2563eb;
}
.sc-crop-meta {
    font-size: 12.5px;
    color: #475569;
    font-weight: 600;
}
.sc-crop-foot {
    padding: 12px 18px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
@media (max-width: 640px) {
    .sc-crop-stage { height: 270px; }
    .sc-crop-zoom-row input[type="range"] { width: 105px; }
}

/* District Edition: HTML source view of the rich text editor, embeds inside the editor, visible focus */
.sc-rte-source { display: block; width: 100%; min-height: 260px; box-sizing: border-box; margin: 0; padding: 14px; border: 0; resize: vertical;
    font-family: Consolas, "Courier New", monospace; font-size: 13.5px; line-height: 1.6; color: #0f172a; background: #f8fafc; white-space: pre-wrap; }
.sc-rte-editor:focus-visible, .sc-rte-source:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: -3px; }
.sc-rte-btn[aria-pressed="true"] { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.sc-rte-btn:disabled { opacity: .45; cursor: not-allowed; }
.sc-rte-editor iframe { display: block; width: 100%; height: 320px; margin: 8px 0; border: 1px dashed #94a3b8; border-radius: 8px; pointer-events: none; }

/* District Edition: the school's own website in จัดการเว็บไซต์ในสังกัด */
.site-link-box { margin-top: 8px; font-size: 13px; }
.site-link-box summary { cursor: pointer; color: var(--adm-text-muted, #475569); padding: 4px 0; min-height: 24px; }
.site-link-box summary:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; border-radius: 4px; }
.site-link-form { display: grid; gap: 4px; margin-top: 6px; max-width: 560px; }
.site-link-form label { font-weight: 600; color: #1e293b; }
.site-link-row { display: flex; gap: 6px; }
.site-link-row input { flex: 1 1 auto; min-width: 0; padding: 6px 9px; border: 1px solid #94a3b8; border-radius: 8px; font: inherit; }

/* District Edition: links to other systems in the back-office menu */
.admin-nav-external .admin-nav-ext { margin-left: auto; padding-left: 6px; opacity: .75; font-weight: 700; }

/* District Edition: block settings as one card per block, grouped by position (owner 2026-12-02) */
.blk-list { padding: 6px 18px 18px; }
.blk-zone-head { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 15px; color: #0f172a; }
.blk-zone-head small { color: #64748b; font-weight: 500; }
.blk-card { border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.blk-card.is-off { background: #f8fafc; }
.blk-card.is-off .blk-card-name strong { color: #64748b; }
.blk-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.blk-card-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.blk-card-name strong { font-size: 15.5px; color: #0f172a; }
.blk-card-type { font-size: 13px; color: #475569; }
.blk-card-show { display: inline-flex; align-items: center; gap: 8px; flex: none; font-size: 13.5px; color: #334155; cursor: pointer; }
.blk-card-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) 96px; gap: 12px; }
.blk-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.blk-field label, .blk-img-label { font-size: 13px; font-weight: 600; color: #334155; }
.blk-field input, .blk-field select, .blk-field textarea { width: 100%; box-sizing: border-box; }
.blk-field small { font-size: 12.5px; color: #64748b; }
.blk-field-wide { margin-top: 12px; max-width: 460px; }
.blk-note { margin: 10px 0 0; font-size: 13px; color: #475569; }
.blk-content { margin: 12px 0 0; padding: 10px 12px 12px; border: 1px solid #e2e8f0; border-radius: 10px; display: grid; gap: 10px; }
.blk-content legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: #0f172a; }
.blk-content .blk-field-sort { max-width: 160px; }
.blk-card-more { margin-top: 12px; border-top: 1px dashed #e2e8f0; padding-top: 8px; }
.blk-card-more summary { cursor: pointer; font-size: 13px; color: #475569; padding: 4px 0; }
.blk-card-more summary:focus-visible { outline: 3px solid rgba(37, 99, 235, .45); outline-offset: 2px; border-radius: 4px; }
.blk-img-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.blk-img-label { min-width: 92px; }
.blk-img-thumb { height: 28px; border-radius: 4px; vertical-align: middle; }
.blk-card-foot { display: flex; justify-content: flex-end; margin-top: 12px; padding-top: 10px; border-top: 1px solid #f1f5f9; }
@media (max-width: 720px) {
    .blk-card-grid { grid-template-columns: 1fr; }
    .blk-card-head { flex-direction: column; }
}

/* District Edition: rich text editor - the HTML source box only shows after "โค้ด HTML" is pressed */
.sc-rte-source[hidden], .sc-rte-editor[hidden] { display: none !important; }
.sc-rte-source-note { padding: 8px 14px; background: #eff6ff; border-bottom: 1px solid #bfdbfe; color: #1e3a8a; font-size: 13px; }
.sc-rte-source-note[hidden] { display: none !important; }

/* notice after a พ.ศ. year was changed to ค.ศ. in a date field (app.js) */
.be-year-note { display: block; margin-top: 4px; color: #92400e; font-size: 13px; }

/* ข้อมูลพื้นฐาน (admin/master_data.php) */
.md-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px 16px; }
.md-tabs a { padding: 6px 12px; border: 1px solid var(--border-color, #cbd5e1); border-radius: 8px; font-size: 13.5px; text-decoration: none; min-height: 24px; }
.md-tabs a:hover, .md-tabs a:focus-visible { background: #eff6ff; }
.md-table td { vertical-align: top; }
.md-table .col-num { text-align: center; width: 72px; }
.md-order { width: 64px; text-align: center; }
.md-label { width: 100%; min-width: 180px; }
.md-note { display: block; font-size: 12.5px; color: #64748b; margin-top: 4px; }
.md-actions { white-space: nowrap; }
.md-actions form { display: inline-block; margin: 0 4px 4px 0; }
.md-actions .md-note { display: inline-block; margin: 0; }
.md-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.md-status.is-on { background: #dcfce7; color: #166534; }
.md-status.is-off { background: #f1f5f9; color: #475569; }
.md-table tr.is-off .md-label { color: #64748b; }
.md-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px 18px; }
.md-add label { font-weight: 600; font-size: 14px; }
.md-add input { flex: 1; min-width: 200px; max-width: 420px; }
.md-links { margin: 0; padding: 8px 18px 18px 36px; line-height: 2; }
.admin-body .btn-warning { background: #b45309; color: #fff; }
.admin-body .btn-warning:hover { background: #92400e; }
.admin-body .btn-success { background: #15803d; color: #fff; }
.admin-body .btn-success:hover { background: #166534; }

/* audit log: who / what on the first line, then when / where / from / how (AuditView) */
.audit-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; margin: 4px 0 0 18px; font-size: 12.5px; color: #475569; }
.audit-meta div { display: flex; gap: 4px; }
.audit-meta dt { font-weight: 600; color: #334155; }
.audit-meta dt::after { content: ":"; }
.audit-meta dd { margin: 0; }
.audit-list li .audit-meta { flex-basis: 100%; }

/* audit entries (partials/audit_items.php): avatar, who + role, time on the right, what, then labelled tags */
.audit-wrap { padding: 4px 18px 8px; }
.audit-items { list-style: none; margin: 0; padding: 0; }
.audit-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef2f7; }
.audit-item:last-child { border-bottom: 0; }
.audit-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #e0ecff; color: #1e40af; font-weight: 700; font-size: 15px; }
.audit-body { flex: 1; min-width: 0; }
.audit-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; align-items: baseline; }
.audit-who { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 14.5px; }
.audit-role { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #f1f5f9; color: #334155; font-weight: 600; }
.audit-role.is-district { background: #fef3c7; color: #92400e; }
.audit-when { font-size: 12.5px; color: #475569; white-space: nowrap; }
.audit-what { margin: 3px 0 6px; font-size: 14px; color: #0f172a; overflow-wrap: anywhere; }
.audit-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.audit-tags li { font-size: 12.5px; color: #334155; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 2px 8px; }
.audit-k { color: #64748b; font-weight: 600; margin-right: 2px; }
.audit-foot { margin: 0 18px 14px; }
.audit-filter { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 12px 18px; border-bottom: 1px solid #eef2f7; }
.audit-filter .form-group { margin: 0; min-width: 180px; flex: 1; }
.audit-filter-actions { display: flex; gap: 8px; }
.audit-pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; padding: 10px 18px 18px; }
.audit-pager a, .audit-pager .is-current { min-width: 36px; min-height: 36px; padding: 6px 10px; border-radius: 8px; border: 1px solid #cbd5e1; text-align: center; text-decoration: none; font-size: 14px; }
.audit-pager .is-current { background: var(--brand-primary, #1d4ed8); border-color: var(--brand-primary, #1d4ed8); color: #fff; font-weight: 700; }
.audit-pager a:hover, .audit-pager a:focus-visible { background: #eff6ff; }
.audit-pager-gap { padding: 0 2px; color: #64748b; }
.audit-pager-info { width: 100%; text-align: center; font-size: 12.5px; color: #475569; }

/* sidebar group headings: a light band so they stand apart from the menu items (owner 2026-12-04) */
.adm-nav-group { margin-top: 8px; }
.adm-nav-group-toggle { background: rgba(255, 255, 255, 0.07); color: #cbd5e1; font-size: 12.5px; padding: 8px 10px; }
.adm-nav-group-toggle:hover { background: rgba(255, 255, 255, 0.12); color: #f1f5f9; }
.adm-nav-group[open] > .adm-nav-group-toggle { background: rgba(255, 255, 255, 0.1); color: #f1f5f9; }
.adm-nav-group-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }

/* เอกสารโรงเรียน (admin/school_docs/*) */
.sd-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px 16px; }
.sd-tabs a { padding: 6px 14px; border: 1px solid var(--border-color, #cbd5e1); border-radius: 8px; font-size: 14px; text-decoration: none; min-height: 24px; }
.sd-tabs a:hover, .sd-tabs a:focus-visible { background: #eff6ff; }
.sd-tabs a.is-current { background: var(--brand-primary, #1d4ed8); border-color: var(--brand-primary, #1d4ed8); color: #fff; font-weight: 700; }
.sd-table td { vertical-align: top; }
.sd-table .col-num { text-align: center; width: 72px; }
.sd-table input[type="text"] { width: 100%; min-width: 180px; margin-bottom: 4px; }
.sd-table select { max-width: 100%; }
.sd-actions { white-space: nowrap; }
.sd-actions form { display: inline-block; margin: 0 4px 4px 0; }
.sd-note { display: block; font-size: 12.5px; color: #64748b; margin-top: 4px; }
.sd-empty { color: #475569; text-align: center; padding: 18px; }
.sd-pad { margin: 0; }
.sd-add { padding: 12px 18px 18px; border-top: 1px solid #eef2f7; }
.sd-add h4 { margin: 0 0 8px; font-size: 15px; }
.sd-add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.sd-add-grid .form-group { margin: 0; }
.sd-add-grid select, .sd-add-grid input[type="text"] { width: 100%; }
.sd-inline { border-top: 0; }
.sd-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px 18px 0; font-size: 13.5px; color: #475569; }
.sd-folder { padding: 4px 18px 14px; }
.sd-folder h4 { margin: 8px 0; font-size: 15px; }
.sd-table { min-width: 720px; }
.sd-table .sd-nowrap { white-space: nowrap; }

/* signed-in account, top right of the top bar (2026-12-04) */
.adm-account { position: relative; }
.adm-account-btn { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 3px 10px 3px 3px; border: 1px solid var(--adm-border); border-radius: 999px; background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--adm-text); max-width: 260px; }
.adm-account-btn::-webkit-details-marker { display: none; }
.adm-account-btn:hover { background: #f8fafc; }
.adm-account-btn:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.adm-account-btn .admin-user-avatar { width: 32px; height: 32px; font-size: 13px; }
.adm-account-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.adm-account-caret { color: #475569; font-size: 12px; }
.adm-account[open] .adm-account-caret { transform: rotate(180deg); }
.adm-account-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 260px; background: #fff; border: 1px solid var(--adm-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); padding: 12px; }
.adm-account-who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #eef2f7; color: var(--adm-text); font-size: 14px; overflow-wrap: anywhere; }
.adm-account-who .admin-role-pill { background: #dbeafe; color: #1e3a8a; }
.adm-account-logout { width: 100%; min-height: 36px; padding: 7px 12px; border-radius: 8px; border: 1px solid #fecaca; background: #fef2f2; color: #b91c1c; font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.adm-account-logout:hover, .adm-account-logout:focus-visible { background: #dc2626; border-color: #dc2626; color: #fff; }
@media (max-width: 640px) {
    .adm-account-name, .adm-account-caret { display: none; }
    .adm-account-btn { padding: 3px; }
    /* the menu opens across the width of the top bar, so it never runs off the screen */
    .adm-account { position: static; }
    .adm-account-menu { left: 12px; right: 12px; width: auto; top: calc(100% - 4px); }
}
.sd-public { padding: 12px 18px 16px; display: grid; gap: 12px; }
.sd-public .form-group { margin: 0; }
.sd-copy-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.sd-copy-row input, .sd-copy-row textarea { flex: 1 1 360px; min-width: 0; font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.sd-copy-status { margin: 0; font-size: 13px; color: #166534; min-height: 1em; }
.plan-confirm { margin-top: 14px; padding: 14px 16px; border-radius: 10px; background: #fffbeb; border: 1px solid #fcd34d; }
.plan-confirm h4 { margin: 0 0 6px; font-size: 15px; color: #92400e; }
.plan-confirm p { margin: 0 0 10px; font-size: 13.5px; color: #78350f; }
.plan-confirm input { max-width: 360px; }
.plan-confirm small { display: block; margin-top: 4px; color: #78350f; }
.dl-set-files { margin: 10px 0 0; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; display: grid; gap: 6px; }
.dl-set-files legend { font-size: 13.5px; font-weight: 700; color: #334155; padding: 0 4px; }
.dl-set-files small { color: #64748b; }
.sd-add-top { border-top: 0; border-bottom: 1px solid #eef2f7; }
