:root {
    --ink: #20271e;
    --muted: #566253;
    --subtle: #eef1e8;
    --line: #e0e5da;
    --canvas: #f5f7f2;
    --white: #fff;
    --olive: #3b522b;
    --olive-dark: #2c4020;
    --nav: #202c20;
    --nav-active: #374830;
    --corner: 15px;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--canvas);
    --bs-body-font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --bs-link-color-rgb: 59, 82, 43;
    --bs-link-hover-color-rgb: 44, 64, 32;
    --bs-border-color: var(--line);
}

body { min-width: 290px; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.7rem, 3.5vw, 2.45rem); font-weight: 720; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 1.12rem; font-weight: 700; }
strong { font-weight: 680; }
a { text-underline-offset: .17em; }
button, select, summary { touch-action: manipulation; }
.muted, .form-text { color: var(--muted); }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.surface { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--corner); }
.surface .table-responsive { border-radius: inherit; }
.btn { display: inline-flex; gap: .55rem; align-items: center; justify-content: center; font-weight: 650; min-height: 44px; border-radius: 9px; padding: .55rem .95rem; }
.btn-primary {
    --bs-btn-bg: var(--olive);
    --bs-btn-border-color: var(--olive);
    --bs-btn-hover-bg: var(--olive-dark);
    --bs-btn-hover-border-color: var(--olive-dark);
    --bs-btn-active-bg: var(--olive-dark);
    --bs-btn-active-border-color: var(--olive-dark);
    --bs-btn-focus-shadow-rgb: 100, 128, 79;
}
.btn-secondary {
    --bs-btn-color: var(--olive-dark);
    --bs-btn-bg: var(--white);
    --bs-btn-border-color: #cbd4c3;
    --bs-btn-hover-color: var(--olive-dark);
    --bs-btn-hover-bg: var(--subtle);
    --bs-btn-hover-border-color: #b7c4ac;
    --bs-btn-active-color: var(--olive-dark);
    --bs-btn-active-bg: var(--subtle);
    --bs-btn-active-border-color: #b7c4ac;
    --bs-btn-focus-shadow-rgb: 100, 128, 79;
}
.form-control, .form-select {
    --bs-body-bg: var(--white);
    --bs-border-color: #ccd4c7;
    min-height: 44px;
    border-radius: 9px;
    color: var(--ink);
}
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #6b8556;
    box-shadow: 0 0 0 .2rem #a5b88d55;
    background-color: var(--white);
}
.form-control[readonly] { background: var(--canvas); }
.form-label { margin-bottom: .35rem; font-size: .9rem; font-weight: 650; }
.form-text { font-size: .875rem; }
.form-check { min-height: 1.75rem; }
.form-check-input { border-color: #829178; }
.form-check-input:checked { background-color: var(--olive); border-color: var(--olive); }
.form-check-label { cursor: pointer; }
.form-switch .form-check-input { width: 2.25em; }
.form-stack { display: grid; gap: 1.15rem; min-width: 0; }
.form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .65rem; }
.form-panel { padding: clamp(1rem, 3vw, 1.65rem); }
.submit-button { justify-self: start; }
.measure { max-width: 700px; }

.workspace { display: grid; min-height: 100dvh; grid-template-columns: 226px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
    overflow-y: auto;
    background: var(--nav);
    color: #e4ecdf;
    padding: 1.6rem .9rem .9rem;
}
.brand { display: inline-flex; gap: .75rem; align-items: center; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.sidebar .brand { margin: 0 .5rem; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; flex: none; border-radius: 13px; background: #dce7c9; color: #354b29; font-size: 1.25rem; }
.brand strong { display: block; color: #fff; font-size: 1.22rem; letter-spacing: -.02em; line-height: 1.15; }
.brand small { display: block; margin-top: .18rem; font-size: .82rem; color: #c0cdb9; }
.workspace-nav { display: grid; gap: .27rem; min-width: 0; }
.workspace-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 44px;
    padding: .55rem .75rem;
    color: #e2eadc;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: .925rem;
    white-space: nowrap;
}
.workspace-nav .nav-link:hover, .workspace-nav .nav-link.is-active { color: #fff; background: var(--nav-active); }
.workspace-nav .nav-link.is-active { border-color: #52634a; }
.workspace-nav .nav-link i { color: #bdcfae; font-size: 1rem; }
.sidebar :is(a, button):focus-visible { outline: 2px solid #dce7c9; outline-offset: 3px; }
.account { display: flex; align-items: center; gap: .65rem; margin-top: auto; padding: .85rem .25rem .25rem .45rem; border-top: 1px solid #41503e; min-width: 0; }
.avatar { width: 33px; height: 33px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #f2f7ec; background: #40563a; font-weight: 700; }
.account-text { flex: 1; min-width: 0; }
.account-text strong, .account-text small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text strong { color: #fff; font-size: .86rem; }
.account-text small { color: #c2cebc; font-size: .8rem; }
.logout { width: 40px; min-height: 44px; border: 0; border-radius: 8px; color: #e2eadc; background: transparent; font-size: 1.1rem; }
.logout:hover { color: #fff; background: var(--nav-active); }
.workspace-main { width: 100%; max-width: 1540px; margin-inline: auto; min-width: 0; padding: clamp(1.1rem, 3vw, 2.55rem); }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.55rem; }
.page-header p { color: var(--muted); margin: .52rem 0 0; }
.page-header .btn { flex: none; }
.back-link { display: inline-block; font-size: .9rem; font-weight: 620; margin-bottom: .55rem; }
.panel-header { display: flex; align-items: center; min-height: 60px; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.detail-grid, .report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.report-grid { grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); margin: 1rem 0; }
.report-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .95rem 1.2rem; padding: 1rem; }
.period-control { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding: .18rem; background: var(--subtle); border-radius: 9px; }
.period-control a { display: grid; place-items: center; min-height: 39px; color: var(--muted); border-radius: 7px; padding: .34rem .65rem; font-size: .9rem; font-weight: 650; text-decoration: none; }
.period-control :is(a:hover, a.is-active) { color: var(--olive-dark); }
.period-control a.is-active { background: var(--white); box-shadow: 0 1px 3px #253c2226; }
.report-filters { display: grid; flex: 1 1 570px; grid-template-columns: minmax(145px, .9fr) repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: .7rem; }
.metrics { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: .9rem; margin-top: 1rem; }
.metric { display: grid; grid-template-columns: 1fr auto; align-content: start; gap: .45rem .35rem; padding: 1.05rem 1.1rem; }
.metric-total { background: #e9f0e2; border-color: #d2dfc9; }
.metric-icon { grid-column: 2; grid-row: 1; display: grid; place-items: center; background: var(--subtle); color: var(--olive); width: 34px; height: 34px; border-radius: 9px; font-size: 1rem; }
.metric-total .metric-icon { background: #d9e5d0; }
.metric-label { grid-column: 1; grid-row: 1; align-self: center; font-size: .9rem; font-weight: 600; color: var(--muted); }
.metric-value { grid-column: 1 / -1; color: var(--ink); font-size: clamp(1.35rem, 2.6vw, 1.95rem); line-height: 1.16; letter-spacing: -.035em; white-space: normal; overflow-wrap: anywhere; }

.empty { display: grid; justify-items: center; align-content: center; text-align: center; gap: .65rem; min-height: 190px; padding: 1.2rem; color: var(--muted); }
.empty h2 { color: var(--ink); }
.empty.compact { min-height: 125px; }
.empty > .bi { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; background: var(--subtle); color: var(--olive); font-size: 1.1rem; }
.panel-table { --bs-table-bg: var(--white); --bs-table-color: var(--ink); --bs-table-border-color: var(--line); vertical-align: middle; }
.panel-table > :not(caption) > * > * { padding: .65rem .82rem; }
.panel-table > :not(caption) > * > :first-child { padding-left: 1.2rem; }
.panel-table > :not(caption) > * > :last-child { padding-right: 1.2rem; }
.panel-table thead th { font-size: .84rem; font-weight: 680; white-space: nowrap; color: var(--muted); background: #f8faf6; }
.panel-table tbody tr:last-child > * { border-bottom: 0; }
.panel-table :is(td, th) { overflow-wrap: anywhere; }
.row-subtitle { display: block; margin-top: .15rem; color: var(--muted); font-size: .85rem; }
.table-main-link { color: var(--olive-dark); font-weight: 680; }
.catalog-table, .users-table { min-width: 555px; }
.journal-table { min-width: 695px; }
.status-chip { display: inline-block; white-space: nowrap; padding: .12rem .53rem; font-size: .875rem; font-weight: 620; border-radius: 99px; background: #f0f0ef; color: #4b5148; }
.status-chip.positive { color: #3a5230; background: #eaf1e4; }
.search-control { position: relative; width: min(100%, 340px); }
.search-control .bi { position: absolute; top: .65rem; left: .75rem; color: var(--muted); }
.search-control .form-control { padding-left: 2.25rem; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { display: flex; align-items: center; gap: .65rem; padding: .8rem 1.05rem; }
.activity-list li + li { border-top: 1px solid var(--line); }
.activity-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; background: var(--subtle); color: var(--olive); }
.activity-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-text small { display: block; color: var(--muted); }
.person-detail + .person-detail { border-top: 1px solid var(--line); }
.person-detail summary { display: grid; align-items: center; grid-template-columns: auto minmax(0, 1fr) auto; gap: .65rem; padding: .8rem 1.1rem; cursor: pointer; overflow-wrap: anywhere; }
.person-detail summary::-webkit-details-marker { display: none; }
.person-detail summary i { color: var(--olive); }
.person-detail[open] summary i { transform: rotate(180deg); }
.person-detail ul { margin: 0; padding: .2rem 1.1rem .75rem 2.72rem; color: var(--muted); list-style: none; }
.person-detail li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .7rem; padding: .45rem 0; }
.journal-pages { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .7rem; padding: .8rem; border-top: 1px solid var(--line); }
.audit-panel { margin-top: 1rem; }
.correction-summary { display: grid; gap: .52rem; margin: 1rem 0 1.35rem; padding: .85rem; border-radius: 9px; background: var(--canvas); }
.correction-summary > div { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 1.5fr); gap: .6rem; }
.correction-summary dt { color: var(--muted); font-weight: 600; }
.correction-summary dd { margin: 0; overflow-wrap: anywhere; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.setting .form-check-label, .permissions legend { font-weight: 680; }
.permissions { border: 1px solid var(--line); padding: .65rem 1rem 1rem; border-radius: 9px; }
.permissions legend { float: none; width: auto; margin: 0; padding-inline: .35rem; font-size: 1rem; }

.guest-shell { display: grid; place-items: center; min-height: 100dvh; padding: min(6vw, 2rem); background: radial-gradient(ellipse at 30% 20%, #edf3e6, var(--canvas) 65%); }
.guest-frame { width: min(100%, 440px); }
.guest-brand { margin: 0 0 1rem .25rem; }
.guest-brand strong { color: var(--ink); }
.guest-brand small { color: var(--muted); }
.guest-card { padding: clamp(1.2rem, 5vw, 2.3rem); box-shadow: 0 12px 35px #2739200c; }
.guest-card h1 { margin-bottom: .6rem; font-size: clamp(1.45rem, 6vw, 2rem); }
.guest-card .form-stack > a { font-size: .92rem; }

@media (max-width: 1150px) {
    .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .person-detail li { padding-left: 0; }
}

@media (max-width: 900px) {
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem 1rem; padding: .8rem 1rem .55rem; }
    .sidebar .brand { margin: 0; }
    .account { grid-column: 2; grid-row: 1; margin: 0; border: 0; padding: 0; }
    .workspace-nav { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: .3rem; padding: .15rem 0 .05rem; }
    .workspace-nav .nav-link { gap: .45rem; min-height: 42px; padding: .45rem .6rem; }
}

@media (max-width: 690px) {
    .workspace-main { padding: 1rem; }
    .page-header { align-items: start; flex-direction: column; margin-bottom: 1rem; }
    .report-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
    .metric { padding: .8rem; }
    .person-detail ul { padding-left: 1rem; }
}

@media (max-width: 390px) {
    .brand-mark { width: 37px; height: 37px; }
    .account-text { display: none; }
    .form-columns { grid-template-columns: minmax(0, 1fr); }
    .workspace-nav .nav-link { font-size: .85rem; gap: .35rem; }
    .submit-button { width: 100%; }
}
