@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --primary: #164e3b;
    --primary-rgb: 22, 78, 59;
    --secondary: #e7b44b;
    --accent: #eaf4f0;
    --ink: #16231e;
    --muted: #66756f;
    --surface: #ffffff;
    --canvas: #f5f8f7;
    --line: #dfe8e4;
    --radius: 18px;
    --shadow: 0 18px 45px rgba(18, 54, 42, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--canvas);
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4, h5, h6, .navbar-brand { font-family: 'Manrope', system-ui, sans-serif; letter-spacing: -.025em; }
a { color: var(--primary); }
.btn { border-radius: 12px; font-weight: 700; padding: .7rem 1rem; }
.btn-sm { border-radius: 9px; padding: .45rem .75rem; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: color-mix(in srgb, var(--primary), black 12%); --bs-btn-hover-border-color: color-mix(in srgb, var(--primary), black 12%); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); }
.form-control, .form-select {
    border-color: var(--line);
    border-radius: 12px;
    min-height: 46px;
    font-size: 1rem;
    padding: .65rem .85rem;
}
textarea.form-control { min-height: 108px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .22rem rgba(var(--primary-rgb), .12); }
.form-label { font-size: .9rem; font-weight: 700; margin-bottom: .38rem; }
.form-text { color: var(--muted); font-size: .8rem; }
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.modal-content { border: 0; border-radius: 22px; box-shadow: 0 25px 70px rgba(15, 37, 29, .22); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-form { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
#registerModal .modal-content { max-height: calc(100dvh - 2rem); overflow: hidden; }
#registerModal .modal-body { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
#registerModal .modal-body::-webkit-scrollbar { display: none; height: 0; width: 0; }
#registerModal .modal-header, #registerModal .modal-footer { flex: 0 0 auto; }
.eyebrow { color: var(--primary); font-size: .74rem; font-weight: 800; letter-spacing: .13em; margin-bottom: .55rem; text-transform: uppercase; }
.text-secondary { color: var(--muted) !important; }
.alert { border: 0; border-radius: 14px; }
.badge { border-radius: 999px; padding: .5em .75em; font-weight: 700; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table th { color: var(--muted); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.table td, .table th { border-color: var(--line); padding: .85rem .7rem; vertical-align: middle; }
.page-link { color: var(--primary); border-color: var(--line); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* Installer */
.install-page { background: radial-gradient(circle at 10% 20%, rgba(231,180,75,.16), transparent 32%), #eef4f1; }
.install-shell { max-width: 1060px; border-radius: 28px; box-shadow: 0 28px 80px rgba(17, 52, 40, .16); overflow: hidden; }
.install-aside { background: linear-gradient(150deg, #164e3b, #0e3126); min-height: 100%; }
.brand-mark, .success-icon { align-items: center; background: var(--secondary); border-radius: 16px; color: #1c382e; display: flex; font-size: 1.5rem; height: 52px; justify-content: center; width: 52px; }
.success-icon { background: var(--accent); border-radius: 999px; color: var(--primary); font-size: 2rem; height: 76px; width: 76px; }
.install-features li { align-items: center; display: flex; gap: .7rem; margin: 1rem 0; }
.install-features i { color: var(--secondary); }
.requirements-grid { display: grid; gap: .5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.requirement { background: var(--canvas); border-radius: 10px; font-size: .82rem; padding: .65rem .75rem; }
.requirement.ok i { color: #18825b; }
.requirement.fail i { color: #c64646; }
.form-section-title { align-items: center; display: flex; font-size: 1rem; gap: .65rem; }
.form-section-title span { align-items: center; background: var(--accent); border-radius: 9px; color: var(--primary); display: inline-flex; font-size: .8rem; height: 28px; justify-content: center; width: 28px; }

/* Public portal */
.public-body { background: #f7faf8; }
.public-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1020; }
.public-header .navbar { min-height: 84px; }
.site-logo { display: block; height: auto; max-height: 64px; max-width: 100%; object-fit: contain; }
.logo-text { align-items: center; color: var(--ink); display: flex; font-size: 1.05rem; font-weight: 800; gap: .7rem; text-decoration: none; }
.logo-text .logo-symbol { align-items: center; background: var(--primary); border-radius: 14px; color: var(--secondary); display: flex; height: 44px; justify-content: center; width: 44px; }
.account-link { align-items: center; color: var(--ink); display: inline-flex; font-size: .86rem; font-weight: 700; gap: .45rem; text-decoration: none; }
.account-link i { font-size: 1.35rem; }
.public-head-start, .public-head-actions { min-width: 100px; }
.menu-fab { align-items: center; background: var(--primary); border: 0; border-radius: 999px; bottom: 1.4rem; box-shadow: 0 12px 30px rgba(var(--primary-rgb), .3); color: white; display: flex; gap: .55rem; left: 1.4rem; padding: .8rem 1rem; position: fixed; z-index: 1010; }
.public-hero { background-color: var(--primary); background-image: linear-gradient(125deg, rgba(var(--primary-rgb), .95), rgba(var(--primary-rgb), .62)), var(--hero-background-image, linear-gradient(125deg, var(--primary), color-mix(in srgb, var(--primary), white 10%))); background-position: center; background-repeat: no-repeat; background-size: cover; color: white; overflow: hidden; padding: 4.6rem 0 6.8rem; position: relative; }
.public-hero::before { background: radial-gradient(circle, rgba(255,255,255,.14) 0 2px, transparent 3px); background-size: 28px 28px; content: ''; inset: 0; opacity: .3; position: absolute; }
.public-hero::after { background: var(--secondary); border-radius: 50%; content: ''; filter: blur(2px); height: 300px; opacity: .18; position: absolute; right: -100px; top: -130px; width: 300px; }
.public-hero .container { position: relative; z-index: 1; }
.hero-date { align-items: center; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; display: inline-flex; font-size: .82rem; font-weight: 700; gap: .5rem; padding: .45rem .8rem; }
.public-hero h1 { font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 800; line-height: .98; margin: 1.3rem 0; max-width: 780px; }
.public-hero p { color: rgba(255,255,255,.78); font-size: 1.08rem; max-width: 620px; }
.agenda-wrap { margin-top: -3.3rem; position: relative; z-index: 3; }
.agenda-toolbar { align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding: 1.2rem; }
.view-switch { background: var(--canvas); border-radius: 11px; display: inline-flex; padding: 3px; }
.view-switch button { background: none; border: 0; border-radius: 8px; color: var(--muted); height: 38px; width: 42px; }
.view-switch button.active { background: white; box-shadow: 0 3px 10px rgba(20,50,40,.08); color: var(--primary); }
.agenda-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.event-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 265px; overflow: hidden; padding: 1.25rem; position: relative; transition: transform .2s ease, box-shadow .2s ease; }
.event-card::before { background: var(--event-color, var(--primary)); content: ''; height: 5px; inset: 0 0 auto; position: absolute; }
.event-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.event-date { align-items: center; background: var(--accent); border-radius: 14px; color: var(--primary); display: inline-flex; flex-direction: column; height: 62px; justify-content: center; line-height: 1; width: 62px; }
.event-date strong { font-family: 'Manrope', sans-serif; font-size: 1.35rem; }
.event-date span { font-size: .68rem; font-weight: 800; margin-top: .25rem; text-transform: uppercase; }
.event-category { color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.event-card h3 { font-size: 1.08rem; font-weight: 800; margin: 1.1rem 0 .65rem; }
.event-meta { color: var(--muted); font-size: .85rem; }
.event-meta span { align-items: flex-start; display: flex; gap: .45rem; margin-top: .35rem; }
.agenda-list .agenda-grid { display: block; }
.agenda-list .event-card { align-items: center; display: grid; grid-template-columns: 74px minmax(0, 1.5fr) minmax(180px, 1fr); min-height: 0; margin-bottom: .8rem; }
.agenda-list .event-card h3 { margin: .2rem 0; }
.empty-state { background: white; border: 1px dashed #bfd0c9; border-radius: var(--radius); padding: 4rem 1.5rem; text-align: center; }
.empty-icon { align-items: center; background: var(--accent); border-radius: 999px; color: var(--primary); display: flex; font-size: 1.7rem; height: 64px; justify-content: center; margin: 0 auto 1rem; width: 64px; }
.public-footer { background: #0f2d23; color: rgba(255,255,255,.72); margin-top: 6rem; padding: 3rem 0 5rem; }
.public-footer h2 { color: white; font-size: 1.1rem; }
.public-footer a { color: var(--secondary); }
.footer-copyright { align-items: center; border-top: 1px solid rgba(255,255,255,.12); display: flex; font-size: .82rem; gap: .55rem; margin-top: 2rem; padding-top: 1.25rem; }
.footer-copyright i { color: var(--secondary); font-size: 1rem; }
.hero-background-preview { background-color: var(--primary); background-image: linear-gradient(125deg, rgba(var(--primary-rgb), .9), rgba(var(--primary-rgb), .5)), var(--preview-image, none); background-position: center; background-size: cover; border-radius: 14px; color: white; display: flex; min-height: 130px; overflow: hidden; padding: 1rem; position: relative; }
.hero-background-preview::before { background: radial-gradient(circle, rgba(255,255,255,.18) 0 2px, transparent 3px); background-size: 22px 22px; content: ''; inset: 0; opacity: .45; position: absolute; }
.hero-background-preview span { align-self: flex-end; font-family: 'Manrope', sans-serif; font-weight: 800; position: relative; z-index: 1; }

/* Authentication */
.auth-page { background: linear-gradient(125deg, #edf5f1 0 55%, #dcebe4 55%); }
.auth-shell { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); min-height: 100vh; }
.auth-art { align-items: flex-end; background: var(--primary); color: white; display: flex; overflow: hidden; padding: clamp(2rem, 6vw, 5rem); position: relative; }
.auth-art::before { background: radial-gradient(circle, rgba(255,255,255,.17) 0 2px, transparent 3px); background-size: 30px 30px; content: ''; inset: 0; opacity: .3; position: absolute; }
.auth-art::after { border: 85px solid rgba(231,180,75,.18); border-radius: 50%; content: ''; height: 420px; position: absolute; right: -170px; top: -120px; width: 420px; }
.auth-copy { max-width: 520px; position: relative; z-index: 1; }
.auth-copy h1 { font-size: clamp(2.2rem, 5vw, 4rem); font-weight: 800; line-height: 1; }
.auth-panel { align-items: center; background: white; display: flex; justify-content: center; padding: 2rem; }
.auth-card { max-width: 440px; width: 100%; }
.otp-inputs { display: grid; gap: .7rem; grid-template-columns: repeat(4, 1fr); }
.otp-inputs input { font-family: 'Manrope', sans-serif; font-size: 1.65rem; font-weight: 800; height: 64px; text-align: center; }

/* Admin */
.admin-body { background: #f3f6f5; }
.admin-shell { min-height: 100vh; }
.admin-sidebar { background: #103a2c; color: white; display: flex; flex-direction: column; inset: 0 auto 0 0; padding: 1.15rem; position: fixed; width: 260px; z-index: 1040; }
.admin-brand { align-items: center; color: white; display: flex; font-family: 'Manrope', sans-serif; font-weight: 800; gap: .75rem; padding: .65rem .6rem 1.45rem; text-decoration: none; }
.admin-brand span:first-child { align-items: center; background: var(--secondary); border-radius: 12px; color: #173c2e; display: flex; height: 40px; justify-content: center; width: 40px; }
.admin-nav { display: flex; flex: 1; flex-direction: column; gap: .22rem; overflow-y: auto; }
.admin-nav a { align-items: center; border-radius: 11px; color: rgba(255,255,255,.68); display: flex; font-size: .91rem; font-weight: 600; gap: .75rem; padding: .72rem .8rem; text-decoration: none; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.1); color: white; }
.admin-nav a.active { box-shadow: inset 3px 0 var(--secondary); }
.admin-user { border-top: 1px solid rgba(255,255,255,.12); padding: 1rem .45rem .2rem; }
.admin-user small { color: rgba(255,255,255,.55); display: block; }
.admin-main { margin-left: 260px; min-height: 100vh; }
.admin-topbar { align-items: center; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); display: flex; height: 72px; justify-content: space-between; padding: 0 2rem; position: sticky; top: 0; z-index: 1020; }
.admin-content { padding: 2rem; }
.page-heading { align-items: flex-start; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; margin-bottom: 1.5rem; }
.page-heading h1 { font-size: 1.7rem; font-weight: 800; margin: 0; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.stat-card .stat-icon { align-items: center; background: var(--accent); border-radius: 12px; color: var(--primary); display: flex; font-size: 1.2rem; height: 42px; justify-content: center; width: 42px; }
.stat-card strong { display: block; font-family: 'Manrope', sans-serif; font-size: 1.8rem; margin-top: .85rem; }
.stat-card span { color: var(--muted); font-size: .85rem; }
.content-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.content-card-header { align-items: center; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; padding: 1rem 1.25rem; }
.content-card-header h2 { font-size: 1rem; font-weight: 800; margin: 0; }
.content-card-body { padding: 1.25rem; }
.avatar { align-items: center; background: var(--accent); border-radius: 999px; color: var(--primary); display: inline-flex; font-size: .78rem; font-weight: 800; height: 36px; justify-content: center; text-transform: uppercase; width: 36px; }
.action-button { align-items: center; background: transparent; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); display: inline-flex; height: 34px; justify-content: center; width: 34px; }
.action-button:hover { background: var(--accent); color: var(--primary); }
.permission-grid { display: grid; gap: .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.permission-item { background: var(--canvas); border: 1px solid var(--line); border-radius: 11px; padding: .7rem .8rem; }
.color-input { height: 46px; padding: .3rem; }
.logo-preview-box { align-items: center; background: linear-gradient(45deg, #eef2f0 25%, transparent 25%), linear-gradient(-45deg, #eef2f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eef2f0 75%), linear-gradient(-45deg, transparent 75%, #eef2f0 75%); background-position: 0 0, 0 8px, 8px -8px, -8px 0; background-size: 16px 16px; border: 1px solid var(--line); border-radius: 14px; display: flex; justify-content: center; min-height: 120px; padding: 1rem; }
.logo-preview-box img { max-height: 90px; max-width: 100%; }
.notification-progress { height: 9px; }
.mobile-menu-toggle { display: none; }

/* Citizen */
.citizen-header { background: white; border-bottom: 1px solid var(--line); }
.citizen-hero { background: var(--primary); color: white; padding: 3rem 0 5rem; }
.citizen-content { margin-top: -2.5rem; }
.timeline-item { border-left: 2px solid var(--line); margin-left: .9rem; padding: 0 0 1.5rem 1.5rem; position: relative; }
.timeline-item::before { background: var(--status-color, var(--primary)); border: 4px solid white; border-radius: 999px; box-shadow: 0 0 0 1px var(--line); content: ''; height: 16px; left: -9px; position: absolute; top: .2rem; width: 16px; }

@media (max-width: 991.98px) {
    .agenda-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .admin-sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .admin-sidebar.show { box-shadow: 18px 0 50px rgba(8,31,23,.25); transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-topbar { padding: 0 1rem; }
    .admin-content { padding: 1.1rem; }
    .mobile-menu-toggle { display: inline-flex; }
}

@media (max-width: 767.98px) {
    .public-header .navbar { min-height: 70px; }
    .site-logo { max-height: 48px; }
    .public-hero { padding: 3.5rem 0 5.3rem; }
    .public-hero h1 { font-size: 2.45rem; }
    .agenda-grid { grid-template-columns: 1fr; }
    .agenda-list .event-card { align-items: start; display: grid; grid-template-columns: 66px 1fr; }
    .agenda-list .event-card .event-meta { grid-column: 2; }
    .requirements-grid, .permission-grid { grid-template-columns: 1fr; }
    .install-aside { min-height: auto; }
    .admin-content { padding: 1rem .75rem; }
    .admin-topbar { height: 64px; }
    .content-card-body { padding: 1rem; }
    .table-responsive { font-size: .9rem; }
    .account-link span { display: none; }
    .public-head-start { min-width: 46px; }
    .public-head-actions { min-width: auto; }
    .public-signup { font-size: .72rem; padding: .55rem .65rem; text-transform: uppercase; }
    .public-header .logo-text > span:last-child { display: none; }
    input, select, textarea { font-size: 16px !important; }
    #registerModal .modal-dialog { height: calc(100dvh - 1rem); margin: .5rem; max-width: none; }
    #registerModal .modal-content { height: 100%; max-height: 100%; }
    #registerModal .modal-body { padding: 1rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
