@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:ital@1&display=swap');

:root {
    --brand: #2B3889;
    --brand-light: #3d4bb0;
    --accent: #EA252E;
    --bg: #f2f3f6;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0; color: var(--text); line-height: 1.55; font-size: 15px;
    display: flex; align-items: flex-start; min-height: 100vh;
    background: linear-gradient(160deg, #e9ecf7 0%, #eef1f8 35%, #e3e9f6 100%) fixed;
}
h1 { font-size: 25px; font-weight: 800; margin: 0 0 4px; color: var(--brand); letter-spacing: -.2px; }
h2 { font-size: 17px; font-weight: 700; margin: 0 0 14px; color: var(--brand); }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
a { color: var(--brand-light); }

.container { flex: 1; min-width: 0; max-width: 1440px; margin: 0 auto; padding: 30px 34px 60px; }

.sidebar {
    width: 240px; min-width: 240px; background: linear-gradient(165deg, rgba(43,56,137,.94) 0%, rgba(26,36,86,.94) 100%);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    overflow-y: auto; box-shadow: 2px 0 24px rgba(20,26,60,.18); z-index: 10;
}
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.14); font-weight: 800; font-size: 12.5px; color: #fff; text-decoration: none; transition: background .15s; }
.sidebar-brand:hover { background: rgba(255,255,255,.06); }
.sidebar-brand img { width: 32px; height: 32px; min-width: 32px; object-fit: contain; background: #fff; border-radius: 7px; padding: 3px; }
.sidebar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar .nav-links { display: flex; flex-direction: column; padding: 10px 0; }
.sidebar .nav-links a {
    color: rgba(255,255,255,.88); text-decoration: none; font-size: 13.5px; font-weight: 500;
    padding: 10px 18px; display: flex; align-items: center; gap: 10px; transition: background .15s;
    border-left: 3px solid transparent; white-space: nowrap;
}
.sidebar .nav-links a:hover { background: rgba(255,255,255,.08); }
.sidebar .nav-links a.active { background: rgba(255,255,255,.16); border-left-color: var(--accent); font-weight: 700; }
.nav-section-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    margin-top: 8px; padding: 11px 18px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px;
    font-weight: 800; color: #fff; background: none; border: none; cursor: pointer;
    text-align: left; font-family: inherit; transition: background .15s;
}
.nav-section-toggle:hover { background: rgba(255,255,255,.06); }
.nav-chevron { font-size: 10px; opacity: .9; transition: transform .2s; }
.nav-section-toggle.nav-section-expanded .nav-chevron { transform: rotate(180deg); }
.nav-section-overview { background: rgba(125,211,252,.32); border-left: 5px solid #7dd3fc; }
.nav-section-overview .nav-chevron { color: #7dd3fc; }
.nav-section-shareholders { background: rgba(94,234,212,.32); border-left: 5px solid #5eead4; }
.nav-section-shareholders .nav-chevron { color: #5eead4; }
.nav-section-review { background: rgba(251,191,36,.32); border-left: 5px solid #fbbf24; }
.nav-section-review .nav-chevron { color: #fbbf24; }
.nav-section-transactions { background: rgba(134,239,172,.32); border-left: 5px solid #86efac; }
.nav-section-transactions .nav-chevron { color: #86efac; }
.nav-section-expenses { background: rgba(249,168,212,.32); border-left: 5px solid #f9a8d4; }
.nav-section-expenses .nav-chevron { color: #f9a8d4; }
.nav-section-insights { background: rgba(196,181,253,.32); border-left: 5px solid #c4b5fd; }
.nav-section-insights .nav-chevron { color: #c4b5fd; }
.nav-section-admin { background: rgba(129,140,248,.32); border-left: 5px solid #818cf8; }
.nav-section-admin .nav-chevron { color: #818cf8; }
.nav-section-system { background: rgba(148,163,184,.32); border-left: 5px solid #94a3b8; }

.nav-section-content[data-section="overview"] a { background: rgba(125,211,252,.16); border-left: 5px solid rgba(125,211,252,.5); }
.nav-section-content[data-section="shareholders"] a { background: rgba(94,234,212,.16); border-left: 5px solid rgba(94,234,212,.5); }
.nav-section-content[data-section="review"] a { background: rgba(251,191,36,.16); border-left: 5px solid rgba(251,191,36,.5); }
.nav-section-content[data-section="transactions"] a { background: rgba(134,239,172,.16); border-left: 5px solid rgba(134,239,172,.5); }
.nav-section-content[data-section="expenses"] a { background: rgba(249,168,212,.16); border-left: 5px solid rgba(249,168,212,.5); }
.nav-section-content[data-section="insights"] a { background: rgba(196,181,253,.16); border-left: 5px solid rgba(196,181,253,.5); }
.nav-section-content[data-section="admin"] a { background: rgba(129,140,248,.16); border-left: 5px solid rgba(129,140,248,.5); }
.nav-section-content[data-section="system"] a { background: rgba(148,163,184,.16); border-left: 5px solid rgba(148,163,184,.5); }
/* The active-page highlight (brighter white overlay + accent-red border) still wins over the section tint, so the current page never gets lost in its own section's color. */
.nav-section-content a.active { background: rgba(255,255,255,.22) !important; border-left-color: var(--accent) !important; }
.nav-section-system .nav-chevron { color: #94a3b8; }
.nav-section-content { display: flex; flex-direction: column; }
.nav-badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: auto; font-weight: 700; }
.sidebar-footer { margin-top: auto; padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.14); font-size: 12.5px; }
.nav-user { color: rgba(255,255,255,.85); margin-bottom: 8px; }
.logout-link { color: rgba(255,255,255,.75); text-decoration: none; font-size: 12.5px; display: block; text-align: center; }
.logout-link:hover { color: #fff; text-decoration: underline; }
.app-footer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; text-align: center;
    font-size: 11px; color: var(--accent); background: rgba(255,255,255,.75);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 6px 20px; border-top: 1px solid rgba(43,56,137,.1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-toggle { display: none; }

.back-link {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
    background: var(--brand); color: #fff; padding: 10px 22px; border-radius: 24px;
    font-size: 15px; font-weight: 700; text-decoration: none; transition: background .15s, transform .1s;
    box-shadow: 0 2px 6px rgba(43,56,137,.3);
}
.back-link:hover { background: #1e2a5e; transform: translateX(-2px); }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }

.flag-category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.flag-category-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    background: rgba(255,255,255,.7); border: 2px solid #EA252E; border-radius: var(--radius);
    padding: 24px 16px; text-decoration: none; text-align: center;
    transition: transform .12s, box-shadow .12s;
}
.flag-category-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(234,37,46,.18); }
.flag-category-count { font-size: 30px; font-weight: 800; color: #EA252E; line-height: 1; }
.flag-category-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.flag-category-uncategorized { border-color: var(--muted); }
.flag-category-uncategorized .flag-category-count { color: var(--muted); }

.closed-account-view { filter: grayscale(70%) opacity(0.82); }

.card {
    background: rgba(255,255,255,.62); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(255,255,255,.6); border-radius: var(--radius);
    padding: 24px; margin-bottom: 22px; box-shadow: 0 8px 28px rgba(31,38,135,.08);
}
.sticky-note-card { border-left: 4px solid #f5c518; }

.picker { position: relative; }
.picker input[type="text"] {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px;
    font-size: 14px; font-family: inherit; background: #fff;
}
.picker input[type="text"]:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(61,75,176,.15); }
.picker-results {
    position: relative; margin-top: 8px; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 4px 14px rgba(16,24,40,.06); max-height: 320px; overflow-y: auto;
}
.picker.dropdown-style .picker-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; box-shadow: 0 12px 28px rgba(16,24,40,.14);
    z-index: 30; display: none;
}
.picker.dropdown-style .picker-results.open { display: block; }
.picker-header-row {
    display: flex; padding: 8px 14px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
    font-weight: 800; color: var(--muted); border-bottom: 1px solid var(--border); background: #f8f9fc;
}
.picker-result-item { display: flex; align-items: center; padding: 9px 14px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid #f1f2f6; transition: background .1s; }
.picker-result-item:last-child { border-bottom: none; }
.picker-result-item:hover, .picker-result-item.active { background: #eef0fb; }
.picker-col-name { flex: 2; font-weight: 600; color: var(--text); }
.picker-col-shares { flex: 1; text-align: right; color: var(--brand); font-weight: 700; }
.picker-col-region { flex: 1.2; text-align: right; color: var(--muted); font-size: 12.5px; }
.picker-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.picker-pager { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-top: 1px solid #f1f2f6; }
.picker-page-btn {
    border: 1px solid var(--border); background: #f5f6fb; color: var(--brand); border-radius: 6px;
    padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.picker-page-btn:hover { background: #e9ebf6; }
.picker-page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.confirm-modal-overlay {
    position: fixed; inset: 0; background: rgba(20,26,60,.55); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.confirm-modal {
    background: #fff; border-radius: 14px; padding: 30px 28px; max-width: 380px; width: 100%;
    text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.confirm-modal .icon { font-size: 44px; margin-bottom: 10px; }
.confirm-modal h3 { margin: 0 0 8px; color: var(--brand); font-size: 18px; }
.confirm-modal p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.confirm-modal button { width: 100%; }

.passport-card { padding: 0; overflow: hidden; max-width: 1040px; margin: 0 auto; }
.passport-header {
    background: linear-gradient(120deg, var(--brand) 0%, #1a2456 100%); color: #fff; padding: 14px 22px;
    font-weight: 800; font-size: 13.5px; letter-spacing: .4px; display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 8px;
}
.passport-coord-badge { background: var(--accent); padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.passport-body { display: flex; gap: 26px; padding: 22px; flex-wrap: wrap; }
.passport-photo-col { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 140px; flex-shrink: 0; }
.passport-photo-box {
    width: 130px; height: 150px; border: 2px solid var(--brand); border-radius: 8px; background: #f5f6fb;
    display: flex; align-items: center; justify-content: center; overflow: hidden; text-align: center; padding: 6px;
}
.passport-photo-box img { width: 100%; height: 100%; object-fit: cover; }
.passport-fingerprint-box { height: 90px; margin-top: 10px; border-style: dashed; }
.passport-file-label {
    font-size: 11.5px; color: var(--brand-light); cursor: pointer; text-align: center; font-weight: 600;
}
.passport-file-label input { display: none; }
.passport-rotate-row { display: flex; justify-content: center; gap: 8px; margin-top: -6px; }
.passport-rotate-btn {
    border: 1px solid var(--border); background: #f5f6fb; color: var(--brand); border-radius: 6px;
    width: 30px; height: 30px; font-size: 15px; cursor: pointer;
}
.passport-rotate-btn:hover { background: #e9ebf6; }
.passport-fields-grid { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 22px; align-content: start; }
.passport-fields-grid.compact-stack { gap: 10px; }
.passport-fields-grid.compact-stack label { margin-bottom: 0; }
.passport-fields-grid.compact-stack label input, .passport-fields-grid.compact-stack label select {
    padding: 8px 11px; margin-top: 4px;
}
.passport-fields-grid.compact-stack .passport-section-label { margin-top: 6px; padding-top: 8px; }
.passport-fields-grid label { margin: 0; }
.form-section {
    background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; padding: 24px 26px;
}
.form-section-title {
    font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; font-weight: 800;
    color: var(--brand); margin-bottom: 20px; display: flex; align-items: center; gap: 9px;
    padding-bottom: 12px; border-bottom: 1px solid rgba(43,56,137,.12);
}
.form-section-grid { display: flex; flex-wrap: wrap; gap: 18px 24px; align-items: start; }
.form-section-grid label { margin: 0; font-size: 12.5px; font-weight: 700; color: #4b5568; letter-spacing: .1px; flex: 1 1 200px; max-width: 260px; }
.form-section-grid label.field-wide { flex: 1 1 280px; max-width: 380px; }
.form-section-grid label.field-narrow { flex: 0 1 140px; max-width: 170px; }
.form-section-grid label.field-tiny { flex: 0 1 100px; max-width: 120px; }
.form-section-grid label input, .form-section-grid label select {
    margin-top: 7px; padding: 11px 13px; font-size: 14px; border-color: #dde1e8; width: 100%;
}
.form-section-grid label input:hover, .form-section-grid label select:hover { border-color: var(--brand-light); }
.form-section-grid .hint { font-size: 12px; line-height: 1.5; flex-basis: 100%; }
@media (max-width: 640px) {
    .form-section-grid label, .form-section-grid label.field-wide, .form-section-grid label.field-narrow, .form-section-grid label.field-tiny { flex-basis: 100%; max-width: 100%; }
}
.passport-section-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 800;
    color: var(--brand); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; width: 100%;
}
.passport-readonly div { font-size: 13.5px; }
.passport-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
@media (max-width: 640px) {
    .passport-body { flex-direction: column; align-items: center; }
    .passport-fields-grid { width: 100%; }
}
.count-badge { font-size: 11.5px; font-weight: 700; background: #e9ebf6; color: var(--brand); padding: 2px 10px; border-radius: 12px; margin-left: 8px; vertical-align: middle; }

.table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 100%; min-width: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.data-table th { background: #f7f8fb; font-weight: 700; color: #374151; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.data-table th a.sort-link { color: inherit; text-decoration: none; }
.data-table th a.sort-link:hover { color: var(--brand); }
.data-table tbody tr:hover { background: #eef0fb; }

.expenses-table tbody tr:nth-child(even) { background: #f7f8fc; }
.expenses-table tbody tr:nth-child(even):hover { background: #eef0fb; }

.data-table-mini-bar .mini-bar-cell { position: relative; padding-bottom: 12px; }
.data-table-mini-bar .mini-bar-cell::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 3px; height: 3px; border-radius: 2px;
    background: linear-gradient(to right, var(--bar-color, var(--brand)) var(--bar-pct, 0%), transparent var(--bar-pct, 0%));
}

.card { animation: card-in .5s cubic-bezier(.22,.9,.3,1) both; }
.card:nth-of-type(1) { animation-delay: .04s; }
.card:nth-of-type(2) { animation-delay: .08s; }
.card:nth-of-type(3) { animation-delay: .12s; }
.card:nth-of-type(4) { animation-delay: .16s; }
.card:nth-of-type(5) { animation-delay: .20s; }
.card:nth-of-type(n+6) { animation-delay: .24s; }
@keyframes card-in { from { transform: translateY(8px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .card { animation: none; }
}

.badge { padding: 3px 11px; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .2px; }
.badge-valid { background: #e6f4ea; color: #1e7e34; }
.badge-void { background: #fdecea; color: var(--accent); }
.badge-superseded { background: #fef3e2; color: #b45309; }
.badge-deleted { background: #f3f4f6; color: #6b7280; }

.class-badge { padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.class-bronze { background: #f3e3d3; color: #92451c; }
.class-silver { background: #e8eaed; color: #52525b; }
.class-gold { background: #fdf0c8; color: #92700c; }
.class-diamond { background: #dbeefe; color: #0f5fa8; }
.class-estate { background: #ece3fb; color: #6b21a8; }
.class-none { background: #f3f4f6; color: #9ca3af; }

label { display: block; margin-bottom: 15px; font-size: 13.5px; font-weight: 600; color: #374151; }
label input, label select, label textarea {
    display: block; width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 14px; font-weight: 400; color: var(--text); font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
label input:focus, label select:focus, label textarea:focus {
    outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(43,56,137,.14);
}
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 16px 16px 6px; margin-bottom: 18px; }
legend { font-weight: 700; padding: 0 8px; font-size: 13px; color: var(--brand); }

.btn {
    display: inline-block; background: var(--brand); color: #fff; padding: 10px 20px; border: none;
    border-radius: 8px; font-size: 13.5px; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: background .15s, transform .05s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(43,56,137,.25);
}
.btn:hover { background: var(--brand-light); box-shadow: 0 2px 6px rgba(43,56,137,.3); }
.btn:active { transform: translateY(1px); }
.btn-danger { background: var(--accent); margin-left: 8px; box-shadow: 0 1px 2px rgba(234,37,46,.25); }
.btn-danger:hover { background: #c81f27; }

.alert-error { background: #fdecea; color: var(--accent); padding: 12px 16px; border-radius: 9px; border: 1px solid #f6c6c1; font-size: 13.5px; }
.alert-success { background: #e6f4ea; color: #1e7e34; padding: 12px 16px; border-radius: 9px; border: 1px solid #bfe4c9; font-size: 13.5px; }
.alert-superseded { background: #fef3e2; color: #b45309; padding: 12px 16px; border-radius: 9px; border: 1px solid #fbdca0; font-size: 13.5px; }
.hint { color: var(--muted); font-size: 12.5px; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; width: 100%; padding: 20px;
    background: radial-gradient(circle at 20% 20%, #3d4bb0 0%, transparent 45%),
                radial-gradient(circle at 85% 80%, var(--accent) 0%, transparent 40%),
                linear-gradient(165deg, var(--brand) 0%, #161e46 100%);
}
.auth-box { position: relative; z-index: 1; background: rgba(255,255,255,.85); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); padding: 40px 36px 32px; border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.3); width: 100%; max-width: 380px; text-align: center; border: 1px solid rgba(255,255,255,.5); border-top: 5px solid var(--accent); }
.auth-logo { width: 64px; height: 64px; object-fit: contain; margin-bottom: 14px; }
.auth-box h1 { font-size: 20px; margin-bottom: 0; }
.auth-box h2 { font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.auth-box form { text-align: left; margin-top: 26px; }
.auth-box button { width: 100%; margin-top: 4px; padding: 12px; font-size: 14px; }
.auth-footer { margin-top: 22px; font-size: 11px; color: var(--accent); letter-spacing: .3px; }

.stat-grid { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 165px; background: rgba(255,255,255,.62); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border: 1px solid rgba(255,255,255,.6); border-radius: var(--radius); padding: 19px 14px; text-align: center; box-shadow: 0 8px 28px rgba(31,38,135,.08); display: flex; flex-direction: column; justify-content: center; min-height: 100px; color: inherit; transition: box-shadow .25s, transform .25s cubic-bezier(.34,1.56,.64,1); }
.stat-box[href]:hover { box-shadow: 0 4px 14px rgba(16,24,40,.12); transform: translateY(-2px); }
.stat-box div:last-child { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--brand); overflow-wrap: break-word; word-break: break-word; line-height: 1.15; }
.stat-box-alert { border: 2px solid var(--accent); }
.stat-box-alert .stat-num { color: var(--accent); }

.stat-box-iconed { position: relative; padding-top: 46px; }
.stat-icon {
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}

.approval-item { border: 1px solid var(--border); border-radius: 9px; padding: 15px; margin-bottom: 12px; }
.approval-item:last-child { margin-bottom: 0; }

.receipt-sheet { background: #fff; padding: 34px; border-radius: var(--radius); max-width: 660px; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.certificate-sheet { max-width: 780px; border: 6px solid var(--accent); position: relative; padding: 38px; }
.certificate-sheet::after {
    content: ""; position: absolute; top: -6px; right: -6px; width: 0; height: 0;
    border-style: solid; border-width: 0 90px 90px 0; border-color: transparent var(--brand) transparent transparent;
}

.cert-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.cert-logo-block { flex: 0 0 auto; min-width: 60px; }
.cert-logo { max-height: 64px; max-width: 140px; }
.cert-script-title-block { flex: 1; text-align: center; }
.cert-script-title { font-style: italic; color: var(--accent); font-size: 25px; text-align: center; font-family: 'Playfair Display', Georgia, serif; }
.cert-no-box { border: 1px dashed var(--accent); border-radius: 6px; padding: 6px 12px; text-align: center; font-size: 10.5px; color: var(--accent); flex: 0 0 auto; }
.cert-no-box-label { font-weight: 700; }
.cert-no-box-value { font-family: monospace; font-size: 11px; margin-top: 2px; }

.cert-company-block { text-align: center; margin-top: 6px; }
.cert-company-name { font-size: 19px; font-weight: 800; color: var(--brand); }
.cert-company-reg { font-size: 12.5px; font-weight: 700; color: #374151; margin-top: 2px; }
.cert-company-incorp { font-size: 12px; color: var(--muted); font-style: italic; }

.cert-certify-text { font-size: 13px; color: #374151; text-align: center; margin: 16px auto; max-width: 560px; line-height: 1.6; }

.cert-main-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
.cert-main-table th {
    background: var(--brand); color: #fff; padding: 9px 8px; font-size: 10.5px; text-transform: uppercase;
    letter-spacing: .3px; text-align: left; border: 1px solid var(--brand);
}
.cert-main-table td { border: 1px solid var(--border); padding: 10px 8px; vertical-align: top; font-size: 13px; }

.cert-footer-contact { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 22px; border-top: 1px solid var(--border); padding-top: 10px; }

.receipt-header { text-align: center; }
.receipt-title { background: var(--brand); color: #fff; display: inline-block; padding: 5px 22px; border-radius: 4px; margin-top: 8px; letter-spacing: 2.5px; font-size: 13px; font-weight: 700; }
.receipt-no { text-align: center; font-size: 13px; margin: 18px 0; color: #374151; }
.receipt-fields { width: 100%; }
.receipt-fields th { width: 190px; text-align: left; padding: 9px 0; vertical-align: top; font-size: 13px; color: #374151; font-weight: 600; }
.receipt-fields td { padding: 9px 0; font-size: 14px; }
.receipt-security { display: flex; gap: 22px; align-items: center; border-top: 1px dashed #ccc; margin-top: 22px; padding-top: 22px; }
.qr-img { width: 128px; height: 128px; }
.security-details { font-size: 12.5px; word-break: break-all; color: #374151; }

.receipt-sig { margin-top: 32px; font-size: 13.5px; display: flex; gap: 60px; }
.sig-row-center { justify-content: center; }
.sig-row-spread { justify-content: space-between; }
.sig-block { display: inline-block; text-align: center; }
.sig-img { display: block; max-height: 60px; margin-bottom: -18px; margin-left: auto; margin-right: auto; }
.sig-line { display: inline-block; }

.dashboard-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.dashboard-main { min-width: 0; }
.dashboard-side { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 20px; }
.dashboard-side canvas { max-width: 100%; }

.reports-flow { display: flex; gap: 22px; flex-wrap: wrap; align-items: stretch; margin-bottom: 22px; }

.reports-page .card h2, .reports-page .card h3 { text-align: center; }
.reports-page .data-table th, .reports-page .data-table td { text-align: center; }
.reports-page .data-table tbody tr:nth-child(even) { background: #eef0fa; }
.reports-page .data-table tbody tr:nth-child(even):hover { background: #e3e6f7; }

.reports-split-cols { display: flex; gap: 32px; flex-wrap: wrap; }
.reports-split-col { flex: 1 1 320px; min-width: 280px; }
.reports-split-col h3 { font-size: 13px; color: var(--brand); margin: 0 0 10px; text-transform: uppercase; letter-spacing: .3px; }
.reports-split-col:not(:first-child) { border-left: 1px solid rgba(43,56,137,.1); padding-left: 32px; }
@media (max-width: 700px) {
    .reports-split-col:not(:first-child) { border-left: none; padding-left: 0; border-top: 1px solid rgba(43,56,137,.1); padding-top: 20px; }
}

.bar-chart { display: flex; flex-direction: column; gap: 11px; }
.bar-chart-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-chart-label { flex: 0 0 128px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-chart-track { flex: 1; height: 11px; background: #eef0fb; border-radius: 6px; overflow: hidden; display: flex; }
.bar-chart-fill { display: block; height: 100%; min-width: 0; animation: bar-chart-grow .9s cubic-bezier(.22,.9,.3,1) both; }
.bar-chart-fill:first-child { border-radius: 6px 0 0 6px; }
.bar-chart-fill:last-child { border-radius: 0 6px 6px 0; min-width: 3px; }
.bar-chart-fill:first-child:last-child { border-radius: 6px; }
@keyframes bar-chart-grow { from { width: 0 !important; } }

.stat-box { animation: stat-box-in .45s cubic-bezier(.22,.9,.3,1) both; }
.stat-box:hover { transform: translateY(-7px) scale(1.06); box-shadow: 0 20px 44px rgba(31,38,135,.22); z-index: 2; position: relative; }
.stat-box:hover .stat-icon { transform: translateX(-50%) scale(1.18); }
.stat-icon { transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.stat-num { transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.stat-box:hover .stat-num { transform: scale(1.16); }
.stat-box:nth-child(1) { animation-delay: .02s; }
.stat-box:nth-child(2) { animation-delay: .08s; }
.stat-box:nth-child(3) { animation-delay: .14s; }
.stat-box:nth-child(4) { animation-delay: .20s; }
.stat-box:nth-child(5) { animation-delay: .26s; }
.stat-box:nth-child(6) { animation-delay: .32s; }
@keyframes stat-box-in { from { transform: translateY(10px); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
    .bar-chart-fill, .stat-box { animation: none; }
    .stat-box, .stat-icon { transition: none; }
    .stat-box:hover { transform: none; }
    .stat-box:hover .stat-icon { transform: translateX(-50%); }
}
.bar-chart-value { flex: 0 0 auto; min-width: 44px; text-align: right; font-weight: 700; color: #111827; }
.reports-card-sm { flex: 1 1 380px; max-width: 480px; margin-bottom: 0; }

.reports-region-cols { display: flex; gap: 28px; flex-wrap: wrap; }
.reports-region-cols table { flex: 1 1 220px; min-width: 220px; }
.reports-region-cols table:not(:first-child) { border-left: 1px solid rgba(43,56,137,.08); padding-left: 24px; }

.page-bg-minerals {
    position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}
.page-bg-minerals span {
    position: absolute; left: var(--x, 20%); bottom: -60px; font-size: 30px; opacity: 0;
    animation: mineral-rise-bg 24s linear infinite; animation-delay: var(--d, 0s);
}
@keyframes mineral-rise-bg {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    8%   { opacity: .16; }
    92%  { opacity: .1; }
    100% { transform: translateY(-115vh) rotate(30deg); opacity: 0; }
}
.container { position: relative; z-index: 1; }

@media (max-width: 980px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .dashboard-side { position: static; }
    .reports-flow { flex-direction: column; }
    .reports-card-sm { max-width: 100%; margin-bottom: 22px; }
}

@media (max-width: 860px) {
    body { flex-direction: column; }
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; transform: translateX(-100%);
        transition: transform .2s ease; width: 250px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle {
        display: block; position: fixed; top: 14px; left: 14px; z-index: 20; background: var(--brand);
        color: #fff; border: none; border-radius: 8px; width: 42px; height: 42px; font-size: 18px;
        cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25);
    }
    .container { padding-top: 70px; width: 100%; }
    .receipt-sig { flex-direction: column; gap: 20px; align-items: center; }
    .stat-grid { gap: 10px; }
    .cert-topbar { flex-direction: column; align-items: center; text-align: center; }
}

@media print {
    @page { size: A4; margin: 8mm; }
    .sidebar, .sidebar-toggle, .no-print { display: none !important; }
    body { background: #fff; display: block; }
    .container { padding: 0 !important; max-width: 100% !important; }
    .container.print-center {
        min-height: 100vh; display: flex; flex-direction: column;
        align-items: center; justify-content: center;
    }
    .receipt-sheet { box-shadow: none; max-width: 100% !important; }
    .certificate-sheet::after { border-width: 0 70px 70px 0; }
}