:root {
    --primary: #b94f00;
    --primary-strong: #963e00;
    --primary-soft: #fff0e5;
    --primary-glow: rgba(185, 79, 0, .22);
    --on-primary: #ffffff;
    --green: #36a852;
    --green-soft: #eaf7ed;
    --yellow: #f1c40f;
    --yellow-soft: #fff8d9;
    --danger: #ce3f4f;
    --danger-soft: #fff0f2;
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-soft: #f7f9fa;
    --text: #17242d;
    --text-soft: #62727d;
    --muted: #8b9aa3;
    --border: #dde6eb;
    --sidebar: #b94f00;
    --sidebar-strong: #8e3600;
    --sidebar-text: #ffffff;
    --shadow-sm: 0 1px 2px rgba(24, 47, 61, .05), 0 6px 16px rgba(24, 47, 61, .04);
    --shadow-md: 0 14px 40px rgba(24, 47, 61, .10);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --sidebar-width: 264px;
    --transition: 180ms ease;
}

html[data-theme="dark"] {
    --primary: #ff9a4d;
    --primary-strong: #ffb77f;
    --primary-soft: #4b2c1c;
    --primary-glow: rgba(255, 154, 77, .2);
    --on-primary: #281104;
    --green: #59c875;
    --green-soft: #153b25;
    --yellow: #f2cf3d;
    --yellow-soft: #443b16;
    --danger: #ff7b88;
    --danger-soft: #45232a;
    --bg: #10191f;
    --surface: #18242b;
    --surface-raised: #1d2a32;
    --surface-soft: #142027;
    --text: #f0f6f8;
    --text-soft: #aebdc5;
    --muted: #81929d;
    --border: #2c3d46;
    --sidebar: #783105;
    --sidebar-strong: #572300;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 24px rgba(0, 0, 0, .12);
    --shadow-md: 0 18px 48px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
body.sidebar-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { fill: currentColor; }

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.skip-link { position: fixed; z-index: 999; top: 12px; left: 12px; padding: 10px 14px; color: #fff; background: #111; border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow-y: auto;
    color: var(--sidebar-text);
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-strong));
    box-shadow: 6px 0 28px rgba(98, 37, 0, .14);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 96px; padding: 17px 20px; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.brand-logo { width: 61px; height: 61px; flex: 0 0 auto; overflow: hidden; background: #fff; border: 3px solid rgba(255,255,255,.75); border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 19px; letter-spacing: -.35px; }
.brand-copy small { display: block; margin-top: 1px; overflow: hidden; color: rgba(255,255,255,.75); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.main-nav { padding: 23px 14px; }
.nav-label { margin: 0 12px 10px; color: rgba(255,255,255,.59); font-size: 10px; font-weight: 800; letter-spacing: 1.25px; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 13px; min-height: 48px; margin: 4px 0; padding: 0 13px; color: rgba(255,255,255,.82); font-size: 14px; font-weight: 650; border-radius: 12px; transition: background var(--transition), color var(--transition), transform var(--transition); }
.nav-link svg { width: 20px; height: 20px; flex: 0 0 auto; opacity: .9; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.10); transform: translateX(2px); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.18); box-shadow: inset 3px 0 0 #ffdf2d; }
.sidebar-footer { margin-top: auto; padding: 16px 18px 20px; background: rgba(0,0,0,.06); border-top: 1px solid rgba(255,255,255,.12); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 12px; }
.user-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; color: var(--sidebar); background: #fff; font-size: 14px; font-weight: 850; border-radius: 50%; }
.user-chip > span:last-child { min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: rgba(255,255,255,.66); font-size: 10px; }
.sidebar-footer form { margin: 0; }
.sidebar-logout { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 5px; color: rgba(255,255,255,.76); background: transparent; border: 0; cursor: pointer; font-size: 13px; font-weight: 650; }
.sidebar-logout:hover { color: #fff; }
.sidebar-logout svg { width: 18px; height: 18px; }
.sidebar-backdrop { display: none; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.main-content { width: min(1180px, 100%); min-height: 100vh; margin: 0 auto; padding: 42px 36px 64px; outline: 0; }
.mobile-header, .bottom-nav { display: none; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.page-header h1 { margin: 2px 0 5px; font-size: clamp(28px, 3vw, 36px); line-height: 1.15; letter-spacing: -1px; }
.page-header p:not(.eyebrow) { margin: 0; color: var(--text-soft); font-size: 15px; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: 11px; font-weight: 850; letter-spacing: 1.35px; text-transform: uppercase; }
.eyebrow.light { color: #ffec69; }
.muted { color: var(--text-soft); }
.back-link { display: inline-flex; margin-bottom: 20px; color: var(--text-soft); font-size: 13px; font-weight: 700; }
.back-link:hover { color: var(--primary); }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 750; line-height: 1.2; transition: background var(--transition), color var(--transition), border var(--transition), transform var(--transition), box-shadow var(--transition); }
.button svg { width: 19px; height: 19px; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: var(--on-primary); background: var(--primary); box-shadow: 0 8px 20px var(--primary-glow); }
.button.primary:hover { background: var(--primary-strong); box-shadow: 0 10px 24px var(--primary-glow); }
.button.secondary { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.button.secondary:hover { background: color-mix(in srgb, var(--primary-soft) 76%, var(--primary) 24%); }
.button.ghost { color: var(--text-soft); background: var(--surface); border-color: var(--border); }
.button.ghost:hover { color: var(--text); background: var(--surface-soft); }
.button.danger { color: #fff; background: #c93949; }
.button.danger-soft { color: var(--danger); background: var(--danger-soft); }
.button.wide { width: 100%; }
.theme-switch { display: grid; width: 56px; min-height: 44px; place-items: center; padding: 0; color: var(--text-soft); background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.theme-switch:focus-visible { outline: 3px solid var(--primary-glow); outline-offset: 2px; }
.theme-switch-track { position: relative; width: 52px; height: 29px; flex: 0 0 auto; background: var(--border); border-radius: 999px; transition: background var(--transition), box-shadow var(--transition); }
.theme-switch-thumb { position: absolute; top: 3px; left: 3px; display: grid; width: 23px; height: 23px; place-items: center; color: #a86a00; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform var(--transition), color var(--transition); }
.theme-switch-icon { display: none; width: 13px; height: 13px; }
html[data-theme="light"] .theme-switch-icon.sun, html[data-theme="dark"] .theme-switch-icon.moon { display: block; }
.theme-switch[aria-checked="true"] .theme-switch-track { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.theme-switch[aria-checked="true"] .theme-switch-thumb { color: var(--primary); transform: translateX(23px); }
.theme-icon { display: none; }
html[data-theme="light"] .theme-icon.moon, html[data-theme="dark"] .theme-icon.sun { display: block; }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); font-size: 13px; font-weight: 750; }
.text-link:hover { text-decoration: underline; }

.content-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.35px; }

.hero-stat { position: relative; display: flex; min-height: 184px; align-items: center; justify-content: space-between; overflow: hidden; margin-bottom: 18px; padding: 30px 37px; color: #fff; background: linear-gradient(120deg, #a94300 0%, #d85d08 68%, #ee8c2c 100%); border-radius: var(--radius-lg); box-shadow: 0 15px 38px rgba(133, 52, 0, .22); }
.hero-stat::before { position: absolute; z-index: 0; inset: 0; content: ""; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg width='360' height='220' viewBox='0 0 360 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ctext x='30' y='88' fill='none' stroke='%23fff' stroke-opacity='.2' stroke-width='1.5' font-family='Arial,sans-serif' font-size='70'%3E%E2%88%9E%3C/text%3E%3Cg transform='translate(257 62)'%3E%3Cellipse cx='0' cy='-21' rx='7' ry='13'/%3E%3Cellipse cx='0' cy='21' rx='7' ry='13'/%3E%3Cellipse cx='21' cy='0' rx='13' ry='7'/%3E%3Cellipse cx='-21' cy='0' rx='13' ry='7'/%3E%3Cellipse transform='rotate(45)' cx='0' cy='-21' rx='7' ry='13'/%3E%3Cellipse transform='rotate(45)' cx='0' cy='21' rx='7' ry='13'/%3E%3Cellipse transform='rotate(-45)' cx='0' cy='-21' rx='7' ry='13'/%3E%3Cellipse transform='rotate(-45)' cx='0' cy='21' rx='7' ry='13'/%3E%3Ccircle r='8'/%3E%3Cpath d='M0 34v34m0-15-12-9m12 9 12-9'/%3E%3C/g%3E%3Cg transform='translate(144 150)'%3E%3Ccircle cx='-7' cy='-26' r='6'/%3E%3Ccircle cx='0' cy='8' r='27'/%3E%3Cpath d='M-9-17h15l9 20h28M6 3l-11 23M-5 26h31'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); background-repeat: repeat; background-size: 360px 220px; }
.hero-stat-copy { position: relative; z-index: 2; display: flex; align-items: center; gap: 23px; }
.stat-icon { display: grid; width: 70px; height: 70px; place-items: center; background: rgba(255,255,255,.17); border: 1px solid rgba(255,255,255,.2); border-radius: 19px; backdrop-filter: blur(5px); }
.stat-icon svg { width: 36px; height: 36px; }
.hero-stat-copy p { margin: 0; color: rgba(255,255,255,.83); font-size: 14px; font-weight: 650; }
.hero-stat-copy strong { display: block; margin: -3px 0 -5px; font-size: 60px; line-height: 1.15; letter-spacing: -3px; }
.hero-stat-copy > div > span { color: rgba(255,255,255,.76); font-size: 12px; }
.hero-decoration { position: absolute; z-index: 1; inset: 0 0 0 auto; width: 42%; }
.hero-decoration span { position: absolute; display: block; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; }
.hero-decoration span:nth-child(1) { width: 235px; height: 235px; top: -90px; right: -25px; background: rgba(255,255,255,.06); }
.hero-decoration span:nth-child(2) { width: 125px; height: 125px; right: 125px; bottom: -65px; background: rgba(255,223,45,.12); }
.hero-decoration span:nth-child(3) { width: 18px; height: 18px; right: 78px; bottom: 33px; background: #ffdf2d; border: 0; opacity: .86; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; min-width: 0; align-items: center; gap: 13px; padding: 19px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.mini-icon { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 12px; }
.mini-icon.green { color: var(--green); background: var(--green-soft); }
.mini-icon.yellow { color: #aa8700; background: var(--yellow-soft); }
html[data-theme="dark"] .mini-icon.yellow { color: var(--yellow); }
.mini-icon svg { width: 22px; height: 22px; }
.stat-card div { min-width: 0; }
.stat-card small, .stat-card strong { display: block; }
.stat-card small { margin-bottom: 2px; color: var(--text-soft); font-size: 11px; font-weight: 650; }
.stat-card strong { font-size: 24px; line-height: 1.2; letter-spacing: -.5px; }
.stat-card .date-value { font-size: 18px; }

.recent-section { padding: 23px 25px 7px; }
.recent-section .section-heading { margin-bottom: 12px; }
.recent-list { margin: 0 -10px; }
.recent-item { display: flex; align-items: center; gap: 13px; padding: 12px 10px; border-top: 1px solid var(--border); border-radius: 10px; transition: background var(--transition); }
.recent-item:first-child { border-top: 0; }
.recent-item:hover { background: var(--surface-soft); }
.recent-item img { width: 44px; height: 44px; flex: 0 0 auto; object-fit: cover; border: 2px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.recent-main { min-width: 0; flex: 1; }
.recent-main strong, .recent-main small, .recent-date small, .recent-date strong { display: block; }
.recent-main strong { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.recent-main small { overflow: hidden; color: var(--text-soft); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.recent-date { margin-left: auto; text-align: right; }
.recent-date small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .5px; text-transform: uppercase; }
.recent-date strong { font-size: 12px; }
.chevron { width: 20px; height: 20px; color: var(--muted); }

.filters-card { margin-bottom: 17px; padding: 16px; }
.filters-form { display: flex; align-items: center; gap: 10px; }
.search-field { position: relative; flex: 1; }
.search-field svg { position: absolute; top: 50%; left: 14px; width: 19px; height: 19px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search-field input, .select-field select { width: 100%; height: 45px; color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; outline: 0; }
.search-field input { padding: 0 15px 0 43px; }
.search-field input:focus, .select-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-field input::placeholder { color: var(--muted); }
.select-field { width: 190px; }
.select-field select { padding: 0 35px 0 12px; cursor: pointer; }
.filter-button { min-width: 84px; }
.clear-filter { padding: 8px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.clear-filter:hover { color: var(--primary); }
.results-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 3px 10px; color: var(--text-soft); }
.results-heading p { margin: 0; font-size: 12px; }
.results-heading strong { color: var(--text); }
.table-card { overflow: hidden; }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 17px; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 800; letter-spacing: .65px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px 17px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table td > strong, .data-table td > small { display: block; }
.data-table td > small { margin-top: 2px; color: var(--text-soft); font-size: 10px; }
.person-cell { display: flex; min-width: 185px; align-items: center; gap: 11px; }
.person-cell img { width: 40px; height: 40px; flex: 0 0 auto; object-fit: cover; border-radius: 50%; }
.person-cell span { min-width: 0; }
.person-cell strong, .person-cell small { display: block; }
.person-cell strong { font-size: 13px; }
.person-cell small { color: var(--text-soft); font-size: 10px; }
.row-action { display: grid; width: 34px; height: 34px; place-items: center; color: var(--text-soft); border-radius: 9px; }
.row-action:hover { color: var(--primary); background: var(--primary-soft); }
.row-action svg { width: 19px; height: 19px; }
.mobile-person-list { display: none; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 25px; padding: 22px 0 0; }
.pagination p { margin: 0; color: var(--text-soft); font-size: 12px; }
.pagination a, .pagination > span { padding: 8px; font-size: 12px; font-weight: 750; }
.pagination a { color: var(--primary); }
.pagination > span { color: var(--muted); opacity: .6; }

.empty-state { display: flex; min-height: 330px; align-items: center; justify-content: center; flex-direction: column; padding: 38px; text-align: center; }
.empty-state.compact { min-height: 180px; flex-direction: row; gap: 16px; padding: 25px 10px; text-align: left; }
.empty-illustration { display: grid; width: 66px; height: 66px; flex: 0 0 auto; place-items: center; margin-bottom: 15px; color: var(--primary); background: var(--primary-soft); border-radius: 50%; }
.empty-illustration svg { width: 32px; height: 32px; }
.empty-state.compact .empty-illustration { width: 52px; height: 52px; margin: 0; }
.empty-state h2, .empty-state h3 { margin: 0 0 4px; font-size: 19px; }
.empty-state.compact h3 { font-size: 15px; }
.empty-state p { max-width: 420px; margin: 0 0 18px; color: var(--text-soft); }
.empty-state.compact p { margin: 0; font-size: 12px; }
.empty-state.compact .button { margin-left: auto; }

.registration-form { display: grid; gap: 18px; }
.form-section { padding: 26px; }
.form-section-title { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 24px; }
.form-section-title > span { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 850; border-radius: 9px; }
.form-section-title h2 { margin: 1px 0 2px; font-size: 18px; }
.form-section-title p { margin: 0; color: var(--text-soft); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 19px; }
.span-2 { grid-column: span 2; }
.field-group { min-width: 0; }
.field-group label { display: block; margin: 0 0 7px; color: var(--text); font-size: 12px; font-weight: 750; }
.form-control { width: 100%; min-height: 46px; padding: 10px 13px; color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; outline: 0; transition: border var(--transition), box-shadow var(--transition), background var(--transition); }
.form-control:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-control[aria-invalid="true"] { border-color: var(--danger); }
.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.field-error { display: block; margin-top: 6px; color: var(--danger); font-size: 11px; font-weight: 650; }
.form-alert { margin-bottom: 17px; padding: 11px 13px; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: 10px; font-size: 12px; }
.form-alert ul { margin: 0; padding-left: 18px; }
.form-alert.success { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.upload-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 19px; }
.upload-box { position: relative; display: grid !important; min-height: 222px; place-items: center; overflow: hidden; margin: 0 !important; padding: 20px; cursor: pointer; background: var(--surface-soft); border: 1.5px dashed color-mix(in srgb, var(--primary) 50%, var(--border)); border-radius: 13px; transition: background var(--transition), border var(--transition), transform var(--transition); }
.upload-box:hover, .upload-box.dragging { background: var(--primary-soft); border-color: var(--primary); transform: translateY(-1px); }
.upload-placeholder { position: relative; z-index: 1; display: flex; align-items: center; flex-direction: column; color: var(--text-soft); text-align: center; }
.upload-placeholder strong { margin: 9px 0 2px; color: var(--text); font-size: 12px; }
.upload-placeholder small { color: var(--muted); font-size: 10px; }
.upload-icon { display: grid; width: 45px; height: 45px; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 12px; }
.upload-icon svg { width: 24px; height: 24px; }
.upload-preview { position: absolute; z-index: 2; inset: 0; display: none; width: 100%; height: 100%; object-fit: cover; }
.upload-box.document .upload-preview { object-fit: contain; background: var(--surface-soft); }
.upload-preview.visible { display: block; }
.upload-box:has(.upload-preview.visible)::after { position: absolute; z-index: 3; right: 9px; bottom: 9px; content: "Trocar imagem"; padding: 6px 9px; color: #fff; background: rgba(7, 31, 44, .75); border-radius: 8px; font-size: 9px; font-weight: 750; backdrop-filter: blur(4px); }
.file-control { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.upload-field > input[type="checkbox"], .upload-field > label[for$="-clear_id"] { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 5px 0 15px; }

.header-actions { display: flex; gap: 9px; }
.detail-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 19px; }
.profile-card { position: sticky; top: 25px; padding: 23px; text-align: center; }
.profile-photo-wrap { position: relative; margin-bottom: 17px; }
.profile-photo-wrap img { width: 164px; height: 164px; margin: 0 auto; object-fit: cover; border: 5px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--border), 0 12px 32px rgba(75, 40, 19, .12); }
.profile-badge { position: absolute; right: 50%; bottom: -5px; padding: 5px 9px; color: #247a3c; background: #eaf7ed; border: 2px solid var(--surface); border-radius: 999px; font-size: 9px; font-weight: 850; white-space: nowrap; transform: translateX(50%); }
html[data-theme="dark"] .profile-badge { color: #8be29e; background: #17482a; }
.profile-card h2 { margin: 3px 0 0; font-size: 20px; }
.profile-card > p { margin: 2px 0 20px; color: var(--text-soft); font-size: 12px; }
.entry-highlight { display: flex; align-items: center; gap: 10px; padding: 13px; text-align: left; background: var(--primary-soft); border-radius: 11px; }
.entry-highlight > span { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; color: var(--primary); background: var(--surface); border-radius: 9px; }
.entry-highlight svg { width: 19px; height: 19px; }
.entry-highlight small, .entry-highlight strong { display: block; }
.entry-highlight small { color: var(--text-soft); font-size: 9px; }
.entry-highlight strong { font-size: 13px; }
.detail-main { display: grid; gap: 19px; }
.info-card, .document-card { padding: 24px; }
.info-card .section-heading, .document-card .section-heading { margin-bottom: 20px; }
.info-grid { display: grid; grid-template-columns: 1.4fr .8fr 1fr; gap: 15px; margin: 0; }
.info-grid > div { padding: 14px; background: var(--surface-soft); border-radius: 10px; }
.info-grid dt { margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .45px; text-transform: uppercase; }
.info-grid dd { margin: 0; font-size: 12px; font-weight: 700; }
.info-grid a { color: var(--primary); }
.care-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.care-grid > div { padding: 14px; background: var(--surface-soft); border-radius: 10px; }
.care-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .45px; text-transform: uppercase; }
.care-grid dd { margin: 0; color: var(--text); font-size: 12px; line-height: 1.55; }
.care-grid a { color: var(--primary); }
.attendance-form { display: grid; grid-template-columns: 150px 1fr auto; align-items: end; gap: 12px; margin: 18px 0 22px; }
.attendance-form .field-group { margin: 0; }
.attendance-form .button { min-height: 42px; white-space: nowrap; }
.history-list { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.history-list li { display: grid; grid-template-columns: 78px 1fr; gap: 13px; padding-top: 16px; border-top: 1px solid var(--border); }
.history-list time { color: var(--primary); font-size: 12px; font-weight: 850; }
.history-list p { margin: 0 0 6px; color: var(--text); font-size: 13px; line-height: 1.55; }
.history-list small, .history-empty { color: var(--muted); font-size: 11px; }
.history-empty { margin: 0; }
.report-preview { position: relative; display: block; min-height: 300px; overflow: hidden; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; }
.report-preview img { width: 100%; max-height: 480px; object-fit: contain; }
.report-preview span { position: absolute; right: 10px; bottom: 10px; padding: 6px 10px; color: #fff; background: rgba(7, 31, 44, .76); border-radius: 8px; font-size: 10px; font-weight: 750; backdrop-filter: blur(4px); }
.audit-line { margin: -6px 4px 0; color: var(--muted); font-size: 10px; text-align: right; }

.confirm-dialog { width: min(430px, calc(100% - 30px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); }
.confirm-dialog::backdrop { background: rgba(6, 20, 28, .62); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 29px; text-align: center; }
.dialog-icon { display: grid; width: 54px; height: 54px; place-items: center; margin: 0 auto 14px; color: var(--danger); background: var(--danger-soft); border-radius: 50%; }
.dialog-icon svg { width: 28px; height: 28px; }
.confirm-dialog h2 { margin: 0 0 7px; font-size: 21px; }
.confirm-dialog p { margin: 0; color: var(--text-soft); font-size: 13px; }
.dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 23px; }

.settings-layout { display: grid; max-width: 820px; gap: 18px; }
.settings-section { padding: 25px; }
.settings-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 20px; }
.settings-heading h2 { margin: 0 0 3px; font-size: 18px; }
.settings-heading p { margin: 0; color: var(--text-soft); font-size: 12px; }
.theme-settings-section { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.theme-settings-section .settings-heading { margin: 0; }
.settings-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 11px; }
.settings-icon.green { color: var(--green); background: var(--green-soft); }
.settings-icon.yellow { color: #9b7d00; background: var(--yellow-soft); }
html[data-theme="dark"] .settings-icon.yellow { color: var(--yellow); }
.settings-icon svg { width: 21px; height: 21px; }
.theme-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.theme-option { position: relative; display: grid; grid-template-columns: 98px 1fr 24px; align-items: center; gap: 14px; padding: 13px; color: var(--text); background: var(--surface-soft); border: 1.5px solid var(--border); border-radius: 13px; cursor: pointer; text-align: left; transition: border var(--transition), background var(--transition), transform var(--transition); }
.theme-option:hover { transform: translateY(-1px); border-color: var(--primary); }
.theme-option.selected { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.theme-option > span:nth-child(2) strong, .theme-option > span:nth-child(2) small { display: block; }
.theme-option > span:nth-child(2) strong { font-size: 12px; }
.theme-option > span:nth-child(2) small { margin-top: 2px; color: var(--text-soft); font-size: 9px; }
.theme-preview { position: relative; display: block; width: 98px; height: 62px; overflow: hidden; background: #f5f7fa; border: 1px solid #dce5ea; border-radius: 8px; }
.theme-preview::before { position: absolute; inset: 0 auto 0 0; width: 22px; content: ""; background: #b94f00; }
.theme-preview i { position: absolute; top: 10px; right: 9px; width: 56px; height: 12px; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.theme-preview b, .theme-preview em { position: absolute; right: 38px; bottom: 10px; width: 27px; height: 24px; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.theme-preview em { right: 8px; }
.dark-preview { background: #10191f; border-color: #32434c; }
.dark-preview::before { background: #783105; }
.dark-preview i, .dark-preview b, .dark-preview em { background: #1d2a32; }
.check-mark { width: 20px; height: 20px; color: var(--primary); opacity: 0; transform: scale(.7); transition: opacity var(--transition), transform var(--transition); }
.theme-option.selected .check-mark { opacity: 1; transform: scale(1); }
.settings-note { margin: 13px 0 0; color: var(--muted); font-size: 10px; text-align: right; }
.privacy-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.privacy-list > div { display: flex; align-items: flex-start; gap: 9px; padding: 13px; background: var(--surface-soft); border-radius: 10px; }
.privacy-list svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; color: var(--green); }
.privacy-list strong, .privacy-list small { display: block; }
.privacy-list strong { font-size: 11px; }
.privacy-list small { margin-top: 2px; color: var(--text-soft); font-size: 9px; }
.account-section { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.account-section .settings-heading { margin: 0; }
.name-onboarding { display: grid; min-height: calc(100vh - 150px); place-items: center; }
.name-onboarding-card { width: min(460px, 100%); padding: 36px; text-align: center; }
.name-onboarding-icon { display: grid; width: 58px; height: 58px; place-items: center; margin: 0 auto 18px; color: var(--primary); background: var(--primary-soft); border-radius: 18px; }
.name-onboarding-icon svg { width: 29px; height: 29px; }
.name-onboarding-card h1 { margin: 4px 0 8px; font-size: 27px; letter-spacing: -.7px; }
.name-onboarding-card > p:not(.eyebrow) { margin: 0 auto 24px; color: var(--text-soft); font-size: 13px; }
.name-onboarding-form { display: grid; gap: 16px; text-align: left; }

.messages { position: fixed; z-index: 80; top: 20px; right: 22px; display: grid; max-width: min(390px, calc(100% - 35px)); gap: 8px; }
.message { display: flex; align-items: center; gap: 9px; padding: 11px 12px; color: #246f39; background: #edf9f0; border: 1px solid #c9ebd1; border-radius: 11px; box-shadow: var(--shadow-md); font-size: 12px; font-weight: 650; }
.message.error { color: #9c2d3a; background: #fff0f2; border-color: #f3c7cc; }
.message svg { width: 19px; height: 19px; flex: 0 0 auto; }
.message button { margin-left: auto; padding: 0 4px; color: inherit; background: transparent; border: 0; cursor: pointer; font-size: 20px; line-height: 1; opacity: .6; }

.login-page { overflow: hidden; background: var(--surface); }
.login-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(360px, .95fr) minmax(480px, 1.05fr); }
.login-brand-panel { position: relative; display: flex; align-items: center; overflow: hidden; padding: 70px; color: #fff; background: linear-gradient(145deg, #913600, #c95105 62%, #e78325); }
.login-brand-content { position: relative; z-index: 2; max-width: 520px; }
.login-brand-content > img { width: 180px; height: 180px; margin-bottom: 35px; object-fit: cover; background: #fff; border: 8px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 18px 45px rgba(70, 29, 1, .22); }
.login-brand-content h1 { max-width: 500px; margin: 8px 0 14px; font-size: clamp(38px, 4.6vw, 62px); line-height: 1.04; letter-spacing: -2.5px; }
.login-brand-content > p:last-child { max-width: 470px; margin: 0; color: rgba(255,255,255,.78); font-size: 16px; }
.login-orb { position: absolute; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.orb-one { width: 430px; height: 430px; top: -160px; right: -180px; background: rgba(255,255,255,.06); }
.orb-two { width: 290px; height: 290px; right: -80px; bottom: -120px; background: rgba(255,226,40,.10); }
.login-form-panel { display: grid; place-items: center; padding: 45px; background: var(--surface); }
.login-card { width: min(420px, 100%); }
.login-card h2 { margin: 2px 0 6px; font-size: 31px; letter-spacing: -1px; }
.login-card > .muted { margin: 0 0 28px; font-size: 13px; }
.login-mobile-brand { display: none; }
.login-form { display: grid; gap: 18px; }
.input-with-icon { position: relative; }
.input-with-icon > svg { position: absolute; top: 50%; left: 14px; width: 19px; height: 19px; color: var(--muted); transform: translateY(-50%); }
.input-with-icon > input { width: 100%; height: 49px; padding: 0 72px 0 43px; color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 11px; outline: 0; }
.input-with-icon > input:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.password-toggle { position: absolute; top: 50%; right: 9px; padding: 5px; color: var(--primary); background: transparent; border: 0; cursor: pointer; font-size: 10px; font-weight: 750; transform: translateY(-50%); }
.login-help { margin: 23px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

@media (max-width: 1050px) {
    .main-content { padding-inline: 26px; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .info-grid > div:first-child { grid-column: span 2; }
    .attendance-form { grid-template-columns: 1fr; }
    .attendance-form .button { width: 100%; }
    .theme-option { grid-template-columns: 80px 1fr 20px; }
    .theme-preview { width: 80px; }
}

@media (max-width: 820px) {
    .sidebar { width: min(290px, 85vw); transform: translateX(-105%); transition: transform 230ms ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 45; inset: 0; display: block; visibility: hidden; background: rgba(5, 20, 28, .56); opacity: 0; backdrop-filter: blur(2px); transition: opacity 230ms ease, visibility 230ms; }
    body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .app-shell { margin-left: 0; }
    .mobile-header { position: sticky; z-index: 35; top: 0; display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 8px 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
    .icon-button { display: grid; width: 40px; height: 40px; place-items: center; color: var(--text); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
    .icon-button svg { width: 21px; height: 21px; }
    .mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 14px; }
    .mobile-brand img { width: 38px; height: 38px; object-fit: cover; background: #fff; border: 1px solid var(--border); border-radius: 50%; }
    .main-content { min-height: calc(100vh - 64px); padding: 26px 19px 104px; }
    .bottom-nav { position: fixed; z-index: 34; right: 0; bottom: 0; left: 0; display: grid; height: 72px; grid-template-columns: repeat(4, 1fr); padding: 6px max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 95%, transparent); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(24,47,61,.06); backdrop-filter: blur(14px); }
    .bottom-nav > a { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; color: var(--muted); font-size: 9px; font-weight: 750; }
    .bottom-nav > a > svg { width: 21px; height: 21px; }
    .bottom-nav > a.active { color: var(--primary); }
    .bottom-nav .bottom-add { position: relative; }
    .bottom-add > span { display: grid; width: 48px; height: 48px; place-items: center; margin-top: -29px; color: var(--on-primary); background: var(--primary); border: 5px solid var(--surface); border-radius: 50%; box-shadow: 0 6px 17px var(--primary-glow); }
    .bottom-add > span svg { width: 23px; height: 23px; }
    .bottom-add small { margin-top: 1px; font-size: 9px; }
    .page-header { align-items: flex-start; }
    .detail-layout { grid-template-columns: 230px minmax(0, 1fr); }
    .profile-photo-wrap img { width: 135px; height: 135px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-form-panel { min-height: 100vh; padding: 30px 22px; }
    .login-mobile-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 35px; color: var(--primary); font-size: 18px; font-weight: 850; }
    .login-mobile-brand img { width: 85px; height: 85px; object-fit: cover; background: #fff; border: 4px solid #fff; border-radius: 50%; box-shadow: 0 8px 23px rgba(185,79,0,.2); }
    .login-mobile-brand span { display: none; }
}

@media (max-width: 640px) {
    .main-content { padding-inline: 15px; }
    .page-header { display: block; margin-bottom: 21px; }
    .page-header h1 { font-size: 29px; }
    .page-header > .button { width: 100%; margin-top: 17px; }
    .detail-heading .header-actions { margin-top: 17px; }
    .detail-heading .header-actions .button { flex: 1; }
    .hero-stat { min-height: 164px; padding: 25px 23px; }
    .hero-stat-copy { gap: 15px; }
    .stat-icon { width: 55px; height: 55px; border-radius: 15px; }
    .stat-icon svg { width: 29px; height: 29px; }
    .hero-stat-copy strong { font-size: 49px; }
    .hero-decoration { width: 48%; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { min-height: 83px; gap: 10px; padding: 14px; }
    .stat-card:last-child { grid-column: span 2; }
    .mini-icon { width: 39px; height: 39px; }
    .stat-card strong { font-size: 20px; }
    .recent-section { padding: 20px 15px 7px; }
    .recent-date { display: none; }
    .filters-form { align-items: stretch; flex-wrap: wrap; }
    .search-field { flex-basis: 100%; }
    .select-field { flex: 1; width: auto; }
    .filter-button { min-width: 80px; }
    .clear-filter { display: flex; align-items: center; }
    .data-table-wrap { display: none; }
    .mobile-person-list { display: block; }
    .mobile-person-card { display: flex; align-items: center; gap: 11px; padding: 13px; border-bottom: 1px solid var(--border); }
    .mobile-person-card:last-child { border-bottom: 0; }
    .mobile-person-card > img { width: 48px; height: 48px; flex: 0 0 auto; object-fit: cover; border-radius: 50%; }
    .mobile-person-copy { min-width: 0; flex: 1; }
    .mobile-person-copy strong, .mobile-person-copy small, .mobile-person-copy > span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .mobile-person-copy strong { font-size: 13px; }
    .mobile-person-copy small { color: var(--muted); font-size: 9px; }
    .mobile-person-copy > span { margin-top: 3px; color: var(--text-soft); font-size: 10px; }
    .mobile-person-date { display: flex; align-items: center; gap: 3px; color: var(--text-soft); font-size: 9px; }
    .mobile-person-date svg { width: 17px; height: 17px; }
    .pagination { justify-content: space-between; gap: 5px; }
    .pagination p { font-size: 10px; }
    .empty-state.compact { flex-direction: column; text-align: center; }
    .empty-state.compact .button { width: 100%; margin: 5px 0 0; }
    .form-page-heading .back-link { margin-bottom: 15px; }
    .form-section { padding: 20px 16px; }
    .form-section-title { margin-bottom: 20px; }
    .form-grid, .upload-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .upload-box { min-height: 205px; }
    .form-actions { position: sticky; z-index: 20; bottom: 74px; display: grid; grid-template-columns: .65fr 1.35fr; margin: 0 -15px -16px; padding: 12px 15px; background: color-mix(in srgb, var(--bg) 92%, transparent); border-top: 1px solid var(--border); backdrop-filter: blur(12px); }
    .form-actions .button { padding-inline: 10px; }
    .detail-layout { grid-template-columns: 1fr; }
    .profile-card { position: static; }
    .profile-card { display: grid; grid-template-columns: 125px 1fr; align-items: center; text-align: left; }
    .profile-photo-wrap { grid-row: span 3; margin: 0 18px 0 0; }
    .profile-photo-wrap img { width: 112px; height: 112px; }
    .profile-card h2 { align-self: end; }
    .profile-card > p { align-self: start; margin: 1px 0 10px; }
    .entry-highlight { grid-column: span 2; margin-top: 15px; }
    .info-card, .document-card { padding: 20px 16px; }
    .info-grid { grid-template-columns: 1fr; }
    .info-grid > div:first-child { grid-column: span 1; }
    .care-grid { grid-template-columns: 1fr; }
    .history-list li { grid-template-columns: 1fr; gap: 4px; }
    .report-preview { min-height: 230px; }
    .theme-options { grid-template-columns: 1fr; }
    .theme-option { grid-template-columns: 88px 1fr 22px; }
    .theme-preview { width: 88px; }
    .privacy-list { grid-template-columns: 1fr; }
    .account-section { align-items: stretch; flex-direction: column; }
    .account-section .button { width: 100%; }
    .settings-section { padding: 20px 16px; }
    .messages { top: 73px; right: 12px; }
    .login-card h2 { font-size: 28px; }
}

@media (max-width: 390px) {
    .hero-stat-copy > .stat-icon { display: none; }
    .stat-card { align-items: flex-start; flex-direction: column; }
    .stat-card:last-child { align-items: center; flex-direction: row; }
    .section-heading .eyebrow { display: none; }
    .detail-heading .header-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .profile-card { grid-template-columns: 105px 1fr; }
    .profile-photo-wrap img { width: 94px; height: 94px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
