/* Admin panel styles */
body { background: #f4f6f9; }

.admin-sidebar {
    background: #fff;
    border-right: 1px solid #dee2e6;
    min-height: calc(100vh - 56px);
}
.admin-sidebar .nav-link {
    color: #495057;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    margin: 0.15rem 0.5rem;
}
.admin-sidebar .nav-link:hover { background: #e9ecef; }
.admin-sidebar .nav-link.active {
    background: #1a7f4e;
    color: #fff;
}
.admin-sidebar .nav-link i { margin-right: 0.5rem; }

.admin-content { padding-left: 1rem; }

.stat-card-admin {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card-admin h2 { color: #1a7f4e; margin: 0; }

.cms-feed { display: flex; flex-direction: column; gap: 0.55rem; }
.cms-feed-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.95rem;
    border-radius: 0.9rem;
    background: #f8faf9;
    border: 1px solid #e6eee9;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.cms-feed-item:hover {
    background: #fff;
    border-color: #1a7f4e;
    color: inherit;
    transform: translateY(-1px);
}
.cms-feed-item.is-unread {
    background: #eef8f2;
    border-color: #cfe6d8;
}
.cms-feed-icon,
.cms-feed-avatar {
    width: 42px;
    height: 42px;
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f5ee;
    color: #1a7f4e;
    font-weight: 800;
    flex-shrink: 0;
}
.cms-feed-body { min-width: 0; flex: 1; }
.cms-feed-body strong,
.cms-feed-body small { display: block; }
.cms-feed-body strong {
    color: #145f3a;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cms-feed-body small { color: #6b7c74; font-size: 0.8rem; }
.cms-feed-meta {
    font-size: 0.78rem;
    color: #6b7c74;
    text-align: right;
    flex-shrink: 0;
}
.cms-feed-meta em {
    display: block;
    font-style: normal;
    font-weight: 800;
    color: #15803d;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cms-status {
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.22rem 0.65rem;
    flex-shrink: 0;
}
.cms-status.is-on { background: #e8f5ee; color: #15803d; }
.cms-status.is-off { background: #f3f4f6; color: #6b7280; }
.cms-empty {
    text-align: center;
    padding: 1.75rem 1rem;
    color: #6b7c74;
    background: #f8faf9;
    border-radius: 0.9rem;
}
.cms-empty i { font-size: 1.75rem; color: #1a7f4e; display: block; margin-bottom: 0.5rem; }
.cms-empty p { margin: 0; }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a7f4e, #145f3a);
}
.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.card-header a { font-size: 0.85rem; }

.madrasah-logo-preview {
    max-width: 120px;
    max-height: 120px;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    padding: 0.25rem;
    background: #fff;
}
.kamad-frame {
    width: 160px !important;
    height: 200px !important;
    max-width: 160px !important;
    max-height: 200px !important;
    box-sizing: border-box !important;
    padding: 8px;
    overflow: hidden !important;
    background: linear-gradient(145deg, #f3e2a0 0%, #c9a227 38%, #f8edc4 52%, #a67c00 100%);
    border: 2px solid #145f3a;
    border-radius: 4px;
    box-shadow: 0 2px 0 #145f3a, 0 8px 18px rgba(20, 95, 58, 0.16);
    flex-shrink: 0 !important;
}
.kamad-frame-inner {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    background: #e8f5ee;
    border: 1px solid #145f3a;
}
.kamad-frame img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
}
.kamad-frame--empty .kamad-frame-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a7f4e;
    font-size: 2.75rem;
}

.stat-auto-total {
    background-color: #f0f7f3 !important;
    font-weight: 600;
    color: #1a7f4e;
    cursor: default;
}
.stat-auto-total:focus {
    box-shadow: none;
    border-color: #dee2e6;
}

.madrasah-lokasi-map {
    width: 100%;
    height: 360px;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #e8f5ee;
}

.madrasah-navbar {
    background-color: #1a7f4e !important;
}
.madrasah-sidebar .small {
    line-height: 1.4;
}
.offcanvas .nav-link {
    color: #495057;
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    margin: 0.15rem 0.5rem;
}
.offcanvas .nav-link:hover { background: #e9ecef; }
.offcanvas .nav-link.active {
    background: #1a7f4e;
    color: #fff;
}
.offcanvas .nav-link i { margin-right: 0.5rem; }

/* CMS Madrasah dashboard */
.cms-dash-hero {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    background:
        radial-gradient(circle at top right, rgba(201, 162, 39, 0.28), transparent 42%),
        linear-gradient(135deg, #145f3a 0%, #1a7f4e 55%, #0f4a2e 100%);
    color: #fff;
    border-radius: 1.25rem;
    padding: 1.75rem 2rem;
    box-shadow: 0 16px 40px rgba(20, 95, 58, 0.22);
    overflow: hidden;
}
.cms-dash-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.85;
}
.cms-dash-title {
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    font-weight: 800;
    margin: 0;
    line-height: 1.25;
}
.cms-dash-meta {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 0.9rem;
}
.cms-dash-hero-aside {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.cms-dash-logo {
    width: 84px;
    height: 84px;
    border-radius: 1rem;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}
.cms-dash-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cms-dash-logo-empty {
    color: #1a7f4e;
    font-size: 2rem;
    background: #e8f5ee;
}
.cms-dash-ring {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(closest-side, #145f3a 68%, transparent 69% 100%),
        conic-gradient(#f3e2a0 calc(var(--pct) * 1%), rgba(255, 255, 255, 0.18) 0);
    color: #fff;
    text-align: center;
}
.cms-dash-ring strong {
    font-size: 1.05rem;
    line-height: 1;
}
.cms-dash-ring span {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
}
.cms-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.22rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
}
.cms-pill-light { background: rgba(255, 255, 255, 0.16); color: #fff; }
.cms-pill-negeri { background: #dbeafe; color: #1d4ed8; }
.cms-pill-swasta { background: #fef3c7; color: #b45309; }
.cms-pill-akred { background: #15803d; color: #fff; }

.cms-kpi {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: #fff;
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 24px rgba(15, 40, 28, 0.06);
    height: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cms-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 40, 28, 0.1);
}
.cms-kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.cms-kpi-siswa .cms-kpi-icon { background: #e8f5ee; color: #1a7f4e; }
.cms-kpi-guru .cms-kpi-icon { background: #eef2ff; color: #3730a3; }
.cms-kpi-tendik .cms-kpi-icon { background: #fff7ed; color: #c2410c; }
.cms-kpi-kelas .cms-kpi-icon { background: #fef9c3; color: #a16207; }
.cms-kpi-label {
    display: block;
    font-size: 0.78rem;
    color: #6c757d;
    font-weight: 600;
}
.cms-kpi-value {
    display: block;
    font-size: 1.45rem;
    line-height: 1.1;
    color: #145f3a;
}

.cms-panel {
    background: #fff;
    border-radius: 1.1rem;
    padding: 1.25rem 1.35rem 1.4rem;
    box-shadow: 0 8px 24px rgba(15, 40, 28, 0.06);
}
.cms-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.cms-panel-head h2 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
    color: #145f3a;
}
.cms-panel-head p {
    margin: 0.2rem 0 0;
    color: #6c757d;
    font-size: 0.85rem;
}
.cms-progress-wrap {
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.cms-progress {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: #e8f5ee;
}
.cms-progress .progress-bar {
    background: linear-gradient(90deg, #1a7f4e, #c9a227);
    border-radius: 999px;
}
.cms-progress-wrap span {
    font-weight: 800;
    color: #145f3a;
    font-size: 0.85rem;
}

.cms-check-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}
.cms-check-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #e6eee9;
    border-radius: 0.85rem;
    text-decoration: none;
    color: inherit;
    background: #f8faf9;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.cms-check-item:hover {
    border-color: #1a7f4e;
    background: #fff;
    color: inherit;
}
.cms-check-item strong,
.cms-check-item small { display: block; }
.cms-check-item small { color: #6c757d; font-size: 0.75rem; }
.cms-check-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #b45309;
    flex-shrink: 0;
}
.cms-check-item.is-done .cms-check-icon { color: #15803d; background: #e8f5ee; }

.cms-identity {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1.25rem;
    align-items: start;
}
.cms-identity-kamad { text-align: center; }
.cms-identity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}
.cms-identity-grid span {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7c74;
}
.cms-identity-grid strong,
.cms-identity-grid .cms-wa-link {
    display: block;
    color: #145f3a;
    font-size: 0.95rem;
}
.cms-identity-wide { grid-column: 1 / -1; }
.cms-wa-link {
    color: #15803d;
    text-decoration: none;
    font-weight: 700;
}
.cms-wa-link:hover { color: #145f3a; }

.cms-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}
.cms-quick-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem;
    border-radius: 0.9rem;
    background: #f8faf9;
    border: 1px solid #e6eee9;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.cms-quick-item:hover {
    transform: translateY(-2px);
    border-color: #1a7f4e;
    box-shadow: 0 8px 18px rgba(26, 127, 78, 0.08);
    color: inherit;
}
.cms-quick-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.7rem;
    background: #e8f5ee;
    color: #1a7f4e;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
}
.cms-quick-item strong { font-size: 0.92rem; }
.cms-quick-item small { color: #6c757d; font-size: 0.75rem; }

.cms-doc-status { display: flex; flex-direction: column; gap: 0.65rem; }
.cms-doc-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.85rem;
    background: #fff7ed;
    color: #9a3412;
}
.cms-doc-row.is-done { background: #e8f5ee; color: #145f3a; }
.cms-doc-row strong,
.cms-doc-row small { display: block; }
.cms-doc-row small { opacity: 0.8; font-size: 0.75rem; }
.cms-doc-row i { font-size: 1.2rem; }

@media (max-width: 991.98px) {
    .cms-dash-hero { flex-direction: column; align-items: flex-start; }
    .cms-identity,
    .cms-check-grid { grid-template-columns: 1fr; }
    .cms-identity-kamad { justify-self: center; }
}
@media (max-width: 575.98px) {
    .cms-dash-hero { padding: 1.25rem; }
    .cms-quick-grid { grid-template-columns: 1fr; }
    .cms-identity-grid { grid-template-columns: 1fr; }
}

/* ========== CMS Madrasah shell ========== */
.cms-shell {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(201, 162, 39, 0.12), transparent 36%),
        linear-gradient(180deg, #f3f7f4 0%, #eef4f0 100%);
    color: #1f2a26;
    min-height: 100vh;
}
.cms-app {
    min-height: 100vh;
    display: flex;
}
.cms-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(16px);
    border-right: 1px solid #e4eee8;
    padding: 1.25rem 0.9rem 1rem;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
}
.cms-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    padding: 0.2rem 0.4rem 1rem;
}
.cms-brand:hover { color: inherit; }
.cms-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, #1a7f4e, #145f3a);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 8px 18px rgba(26, 127, 78, 0.25);
}
.cms-brand strong,
.cms-brand small { display: block; }
.cms-brand strong { color: #145f3a; font-weight: 800; }
.cms-brand small { color: #6b7c74; font-size: 0.75rem; }
.cms-school-card {
    background: linear-gradient(180deg, #f8fbf9, #eef6f1);
    border: 1px solid #e4eee8;
    border-radius: 1rem;
    padding: 0.85rem 0.95rem;
    margin: 0 0.25rem 1rem;
}
.cms-school-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7c74;
}
.cms-school-card strong {
    display: block;
    color: #145f3a;
    font-size: 0.92rem;
    line-height: 1.35;
}
.cms-school-card small {
    color: #6b7c74;
}
.cms-nav-wrap {
    flex: 1;
    overflow-y: auto;
    display: flex;
}
.cms-nav {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cms-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a9a93;
    padding: 0.85rem 0.9rem 0.25rem;
    list-style: none;
}
.cms-shell .cms-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #3f4a45;
    padding: 0.62rem 0.9rem;
    border-radius: 0.85rem;
    margin: 0;
    font-weight: 600;
}
.cms-shell .cms-nav .nav-link i {
    width: 1.1rem;
    text-align: center;
    margin-right: 0;
    color: #1a7f4e;
}
.cms-shell .cms-nav .nav-link:hover {
    background: #e8f5ee;
    color: #145f3a;
}
.cms-shell .cms-nav .nav-link.active {
    background: linear-gradient(135deg, #1a7f4e, #145f3a);
    color: #fff;
    box-shadow: 0 8px 18px rgba(26, 127, 78, 0.22);
}
.cms-shell .cms-nav .nav-link.active i { color: #fff; }
.cms-nav-public {
    background: #fff7e6 !important;
    color: #8a6d12 !important;
    margin-top: 0.75rem !important;
}
.cms-nav-public i { color: #c9a227 !important; }
.cms-nav-public:hover { background: #f3e2a0 !important; color: #6b5410 !important; }

.cms-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.cms-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(243, 247, 244, 0.88);
    backdrop-filter: blur(14px);
}
.cms-topbar-kicker {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7c74;
}
.cms-topbar-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #145f3a;
    margin: 0;
    letter-spacing: -0.02em;
}
.cms-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.cms-topbar-school {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3f4a45;
    background: #fff;
    border: 1px solid #e4eee8;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
}
.cms-menu-btn,
.cms-logout-btn {
    border-radius: 0.8rem;
    font-weight: 600;
}
.cms-menu-btn {
    background: #fff;
    border: 1px solid #e4eee8;
    color: #145f3a;
}
.cms-logout-btn {
    background: #fff;
    border: 1px solid #f1d5d5;
    color: #b42318;
}
.cms-logout-btn:hover {
    background: #fef2f2;
    color: #912018;
    border-color: #f1d5d5;
}
.cms-body {
    padding: 0.5rem 1.5rem 2rem;
    flex: 1;
}
.cms-shell .cms-body > h1.h3 {
    display: none;
}
.cms-shell .cms-body > .text-muted.mb-4 {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #e4eee8;
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
}

.cms-shell .card {
    border: 0;
    border-radius: 1.1rem;
    box-shadow: 0 10px 30px rgba(20, 60, 40, 0.06);
    background: rgba(255, 255, 255, 0.96);
}
.cms-shell .card-header {
    background: transparent;
    border-bottom: 1px solid #eef3f0;
    color: #145f3a;
    font-weight: 700;
    padding: 1rem 1.25rem;
}
.cms-shell .card-body { padding: 1.15rem 1.25rem 1.35rem; }
.cms-shell .form-label { font-weight: 600; color: #3f4a45; }
.cms-shell .form-control,
.cms-shell .form-select {
    border-radius: 0.8rem;
    border-color: #d7e4dc;
    padding: 0.62rem 0.85rem;
}
.cms-shell .form-control:focus,
.cms-shell .form-select:focus {
    border-color: #1a7f4e;
    box-shadow: 0 0 0 0.2rem rgba(26, 127, 78, 0.12);
}
.cms-shell .btn {
    border-radius: 0.8rem;
    font-weight: 600;
}
.cms-shell .btn-primary,
.cms-shell .btn-success {
    background: linear-gradient(135deg, #1a7f4e, #145f3a);
    border: 0;
    box-shadow: 0 8px 18px rgba(26, 127, 78, 0.18);
}
.cms-shell .btn-primary:hover,
.cms-shell .btn-success:hover {
    background: linear-gradient(135deg, #187448, #114f31);
}
.cms-shell .btn-outline-success {
    color: #145f3a;
    border-color: #b7d8c6;
}
.cms-shell .btn-outline-success:hover {
    background: #e8f5ee;
    color: #145f3a;
    border-color: #1a7f4e;
}
.cms-shell .alert {
    border: 0;
    border-radius: 0.95rem;
}
.cms-shell .table {
    border-color: #e8efe9;
}
.cms-shell .table thead th {
    background: #f4faf6;
    color: #145f3a;
    font-weight: 700;
}

.cms-offcanvas { background: #f7fbf8; }
.cms-offcanvas .offcanvas-title {
    color: #145f3a;
    font-weight: 800;
}

.cms-shell-auth {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(201, 162, 39, 0.22), transparent 40%),
        linear-gradient(160deg, #145f3a 0%, #1a7f4e 45%, #0f4a2e 100%);
}
.cms-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.cms-login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 1.4rem;
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 24px 60px rgba(10, 40, 24, 0.28);
}
.cms-login-brand { text-align: center; margin-bottom: 1.5rem; }
.cms-login-brand .cms-brand-icon {
    margin: 0 auto 0.85rem;
    width: 52px;
    height: 52px;
    font-size: 1.45rem;
}
.cms-login-brand h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #145f3a;
    margin-bottom: 0.35rem;
}
.cms-login-brand p {
    color: #6b7c74;
    margin: 0;
}
.cms-login-back {
    color: #145f3a;
    font-weight: 700;
    text-decoration: none;
}
.cms-login-back:hover { text-decoration: underline; }

@media (max-width: 767.98px) {
    .cms-topbar,
    .cms-body { padding-left: 1rem; padding-right: 1rem; }
}
