:root {
    --navy: #0b2748;
    --navy-2: #143b66;
    --orange: #f28c28;
    --orange-2: #d87512;
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #d9e1ea;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-topnav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--navy);
    color: #fff;
    border-bottom: 4px solid var(--orange);
    box-shadow: 0 2px 12px rgba(11, 39, 72, 0.14);
}

.topnav-inner,
.page-main,
.site-footer-inner {
    width: min(1280px, calc(100% - 28px));
    margin: 0 auto;
}

.topnav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    padding: 4px;
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
    background: var(--orange);
    color: #1b1208;
}

.nav-user {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    color: #dce8f5;
    font-size: 13px;
    font-weight: 700;
}

.nav-logout {
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.page-main {
    flex: 1;
    padding: 24px 0 40px;
}

.site-footer {
    margin-top: auto;
    background: #071d36;
    color: #fff;
    border-top: 3px solid var(--orange);
}

.site-footer-inner {
    padding: 14px 0;
    font-size: 13px;
}

h1 {
    margin: 0;
    font-size: 24px;
}

.page-header,
.actions,
.tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-header,
.actions {
    margin-bottom: 16px;
}

.tools {
    margin-bottom: 10px;
}

.stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
}

.stat strong {
    color: var(--navy);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--orange);
    color: #1b1208;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--orange-2);
    color: #fff;
}

.button.secondary {
    background: var(--navy);
    color: #fff;
}

.search {
    width: min(420px, 100%);
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 12px;
    font: inherit;
}

.hint {
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    overflow: auto;
    max-height: calc(100vh - 250px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--navy);
    color: #fff;
    white-space: nowrap;
}

tbody tr:hover {
    background: #fff7ef;
}

.amount {
    text-align: right;
    white-space: nowrap;
    color: var(--navy);
    font-weight: 700;
    cursor: pointer;
}

.amount:focus {
    outline: 2px solid var(--orange);
    outline-offset: -2px;
}

.message {
    min-width: 220px;
    max-width: 340px;
}

.edit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
}

.edit-link:hover {
    background: var(--orange);
    color: #1b1208;
}

.edit-heading {
    width: 48px;
}

.form-panel,
.simple-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 10px;
    color: var(--text);
    font: inherit;
}

.field-note {
    min-height: 18px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.field-note-error {
    color: var(--danger);
}

.field-note-ok {
    color: #198754;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.wide {
    grid-column: 1 / -1;
}

.errors {
    margin-bottom: 14px;
    padding: 12px;
    border-left: 4px solid var(--danger);
    background: #fff4f2;
    color: #7a271a;
}

.success-message {
    margin-bottom: 14px;
    padding: 12px;
    border-left: 4px solid #198754;
    background: #effaf4;
    color: #07572f;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.metric-row {
    margin-bottom: 18px;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--navy);
    color: #fff;
    border-radius: 8px;
    padding: 18px;
    border-bottom: 4px solid var(--orange);
}

.metric-card span {
    color: #dce8f5;
    font-size: 15px;
    font-weight: 700;
}

.metric-card strong {
    color: #fff;
    font-size: 26px;
    white-space: nowrap;
}

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

.dashboard-section {
    margin-top: 18px;
}

.chart-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.chart-panel h2 {
    margin: 0 0 16px;
    color: var(--navy);
    font-size: 19px;
}

.panel-note {
    margin: -8px 0 14px;
    color: var(--muted);
    font-size: 13px;
}

.chart-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.pie-chart {
    width: 220px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 8px solid #fff;
    box-shadow: 0 0 0 1px var(--line), 0 8px 22px rgba(11, 39, 72, 0.12);
}

.mini-table-wrap {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.mini-table {
    min-width: 0;
}

.mini-table th,
.mini-table td {
    font-size: 13px;
}

.mini-table td:nth-child(2),
.mini-table td:nth-child(3) {
    text-align: right;
    white-space: nowrap;
}

.total-row td {
    background: #eef3f7;
    color: var(--navy);
    font-weight: 800;
}

.announcement-table-wrap table {
    min-width: 1280px;
}

.announcement-row td:first-child {
    border-left: 6px solid #d9e1ea;
}

.announcement-row.color-primary td:first-child,
.color-badge.color-primary {
    border-left-color: #0d6efd;
    background: #0d6efd;
}

.announcement-row.color-success td:first-child,
.color-badge.color-success {
    border-left-color: #198754;
    background: #198754;
}

.announcement-row.color-info td:first-child,
.color-badge.color-info {
    border-left-color: #0dcaf0;
    background: #0dcaf0;
    color: #092f36;
}

.announcement-row.color-warning td:first-child,
.color-badge.color-warning {
    border-left-color: #ffc107;
    background: #ffc107;
    color: #3b2c00;
}

.announcement-row.color-danger td:first-child,
.color-badge.color-danger {
    border-left-color: #dc3545;
    background: #dc3545;
}

.announcement-row.color-default td:first-child,
.color-badge.color-default {
    border-left-color: var(--navy);
    background: var(--navy);
}

.color-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    color: var(--text);
}

.checkbox-line input {
    width: auto;
    min-height: 0;
}

.login-body {
    min-height: 100vh;
    overflow: hidden;
}

.login-body .login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        linear-gradient(135deg, rgba(11, 39, 72, 0.94), rgba(20, 59, 102, 0.9)),
        radial-gradient(circle at 20% 12%, rgba(242, 140, 40, 0.28), transparent 30%),
        radial-gradient(circle at 82% 88%, rgba(255, 255, 255, 0.12), transparent 28%),
        var(--navy);
}

.login-body .login-panel {
    width: min(460px, 100%);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
    border-top: 5px solid var(--orange);
}

.login-brand {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin-bottom: 22px;
    text-align: center;
}

.login-body .login-logo {
    display: block;
    width: 132px;
    height: 132px;
    object-fit: contain;
}

.login-body .login-panel h1 {
    color: var(--navy);
    font-size: 28px;
    margin: 0 0 6px;
}

.login-body .login-panel p {
    color: var(--muted);
    margin: 0;
    font-size: 15px;
}

.login-body .login-form {
    display: grid;
    gap: 14px;
}

.login-body .login-form label {
    color: var(--navy);
}

.login-body .login-form input {
    background: #f8fafc;
    border-color: #cfd8e3;
}

.login-body .login-form input:focus {
    outline: 2px solid rgba(242, 140, 40, 0.35);
    border-color: var(--orange);
    background: #fff;
}

.login-body .login-form .button {
    width: 100%;
    margin-top: 4px;
}

.login-footnote {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.profile-summary {
    margin-bottom: 18px;
}

.profile-summary p {
    margin: 0 0 8px;
}

@media (max-width: 860px) {
    .topnav-inner,
    .page-header,
    .actions,
    .tools {
        align-items: stretch;
        flex-direction: column;
    }

    .topnav-inner {
        padding: 12px 0;
    }

    .nav-menu {
        justify-content: flex-start;
    }

    .button,
    .search {
        width: 100%;
    }

    .metric-card,
    .dashboard-grid,
    .chart-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .metric-card strong {
        white-space: normal;
    }

    .pie-chart {
        width: min(260px, 100%);
        align-self: center;
    }
}

@media (max-width: 720px) {
    .grid,
    .form-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
}
