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

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --secondary: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dcdde1;
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 { font-size: 1.5rem; }
.sidebar-subtitle { font-size: 0.75rem; opacity: 0.7; }

.nav-links {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 10px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-links li a:hover, .nav-links li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-section {
    padding: 15px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    flex: 1;
    min-width: 0;
}

.content-full {
    padding: 30px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 { font-size: 1.8rem; margin-bottom: 20px; color: var(--primary); }
h2 { font-size: 1.4rem; margin-bottom: 15px; color: var(--primary); }
h3 { font-size: 1.1rem; margin-bottom: 10px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

tr:hover { background: #f8f9fa; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(41,128,185,0.2);
}

select.form-control { appearance: auto; }
textarea.form-control { min-height: 80px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.alert {
    padding: 12px 16px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa8; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-danger { background: #f8d7da; color: #721c24; }

.tree { list-style: none; padding-left: 0; }
.tree ul { list-style: none; padding-left: 25px; border-left: 1px dashed var(--border); margin-left: 10px; }
.tree li { padding: 5px 0; }
.tree-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}
.tree-item:hover { background: var(--bg); }

.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
}

.login-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 980px;
    min-height: 610px;
    overflow: hidden;
    border-radius: 10px;
    background: #f5f2ed;
    box-shadow: 0 20px 55px rgba(23, 25, 24, .5);
}
.login-container {
    display: flex;
    flex-direction: column;
    max-width: none;
    padding: 50px 56px 34px;
    border-radius: 0;
    background: #f5f2ed;
    box-shadow: none;
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 58px;
}
.login-brand img { width: 32px; height: 32px; object-fit: contain; }
.login-brand-custom img { width: auto; max-width: 90px; height: 42px; }
.login-brand strong {
    display: block;
    color: #292b2a;
    font-size: .83rem;
    letter-spacing: .05em;
}
.login-brand small { display: block; margin-top: 2px; color: #858780; font-size: .62rem; }
.login-form-wrap { width: 100%; max-width: 340px; }
.login-eyebrow {
    margin-bottom: 9px;
    color: #777a74;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.login-container h1 {
    margin-bottom: 9px;
    color: #292b2a;
    font-size: 2.1rem;
    letter-spacing: -.04em;
    text-align: left;
}
.login-intro {
    margin-bottom: 27px;
    color: #777a74;
    font-size: .8rem;
    line-height: 1.6;
}
.login-cookie-alert { margin-bottom: 18px; }
.login-container .form-group { margin-bottom: 15px; }
.login-container .form-control { height: 42px; }
.login-forgot { margin: -2px 0 20px; text-align: right; }
.login-forgot a { font-size: .7rem; font-weight: 600; text-decoration: none; }
.login-submit {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 43px;
    align-items: center;
}
.login-legal { margin-top: auto; padding-top: 28px; color: #858780; font-size: .62rem; }
.login-legal p { margin: 3px 0 0; }
.login-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 52px 48px;
    background: #dad0c5;
}
.login-story:before,
.login-story:after {
    position: absolute;
    border: 1px solid #9f8f80;
    border-radius: 50%;
    content: '';
    opacity: .45;
}
.login-story:before { top: 80px; right: -110px; width: 390px; height: 390px; }
.login-story:after { top: 140px; right: -30px; width: 270px; height: 270px; }
.login-story > * { position: relative; z-index: 1; }
.login-story h2 {
    max-width: 320px;
    margin: 15px 0;
    color: #292b2a;
    font-size: 2.35rem;
    line-height: 1.08;
    letter-spacing: -.05em;
}
.login-story > div > p:last-child {
    max-width: 310px;
    color: #625f58;
    font-size: .8rem;
    line-height: 1.65;
}
.login-story-footer {
    display: flex;
    gap: 8px;
    padding-top: 17px;
    border-top: 1px solid #b8aba0;
    color: #625f58;
    font-size: .7rem;
}

@media (max-width: 760px) {
    .login-shell { display: block; max-width: 480px; min-height: 0; }
    .login-container { min-height: min(680px, calc(100vh - 36px)); padding: 34px 28px 25px; }
    .login-brand { margin-bottom: 40px; }
    .login-story { display: none; }
}

.report-filters {
    display: flex;
    gap: 15px;
    align-items: end;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.report-filters .form-group { margin-bottom: 0; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-item {
    background: var(--bg);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.summary-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 3px;
}

.profit { color: var(--secondary); font-weight: 600; }
.loss { color: var(--danger); font-weight: 600; }

.dashboard-filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.dashboard-filters .form-group { margin-bottom: 0; }

.dashboard-section { margin-bottom: 10px; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi-grid-small {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary);
}

.kpi-card.kpi-revenue { border-left-color: var(--primary); }
.kpi-card.kpi-cost { border-left-color: var(--warning); }
.kpi-card.kpi-profit { border-left-color: var(--secondary); }
.kpi-card.kpi-loss { border-left-color: var(--danger); }

.kpi-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.kpi-card.kpi-profit .kpi-value { color: var(--secondary); }
.kpi-card.kpi-loss .kpi-value { color: var(--danger); }

.kpi-sub {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 4px;
}

.kpi-card-sm {
    background: var(--bg);
    border-radius: 6px;
    padding: 12px 15px;
    border-left: 3px solid var(--primary);
}

.kpi-card-sm.kpi-profit { border-left-color: var(--secondary); }
.kpi-card-sm.kpi-loss { border-left-color: var(--danger); }

.kpi-value-sm {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.kpi-card-sm.kpi-profit .kpi-value-sm { color: var(--secondary); }
.kpi-card-sm.kpi-loss .kpi-value-sm { color: var(--danger); }

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.85rem;
}

.breakdown-label { color: var(--text-light); }
.breakdown-value { font-weight: 600; }

.yield-bars { margin-top: 10px; }

.yield-bar-row {
    display: grid;
    grid-template-columns: 180px 1fr 160px;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

.yield-bar-label {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
}

.yield-bar-track {
    height: 26px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.yield-bar-fill {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    min-width: 50px;
    transition: width 0.3s ease;
}

.bar-good { background: var(--secondary); }
.bar-warn { background: var(--warning); }
.bar-bad { background: var(--danger); }

.yield-bar-detail {
    font-size: 0.8rem;
    color: var(--text-light);
}

.print-only { display: none; }

@media print {
    .sidebar, .no-print, .flash-messages { display: none !important; }
    .content { margin-left: 0; padding: 0; }
    .print-only { display: block; }
    body { background: white; }
}

.search-filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.search-filter-bar input[type="text"],
.search-filter-bar input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-filter-bar input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.15);
}

.search-filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.search-filter-bar .filter-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-filter-bar .result-count {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-left: auto;
    white-space: nowrap;
}

.search-filter-bar .btn-clear {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: all 0.2s;
}

.search-filter-bar .btn-clear:hover {
    background: var(--bg);
    color: var(--text);
}

tr.filter-hidden {
    display: none;
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h2 { font-size: 1rem; }
    .sidebar-subtitle, .nav-section, .sidebar-footer span { display: none; }
    .nav-links li a { padding: 10px; font-size: 0.75rem; text-align: center; }
    .content { margin-left: 60px; padding: 15px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .dashboard-filters { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr; }
    .yield-bar-row { grid-template-columns: 1fr; gap: 4px; }
    .yield-bar-label { text-align: left; }
}

/* Lynx Utilities production shell and compatibility layer */
:root {
    --primary: #b82f34;
    --primary-light: #9e272c;
    --secondary: #467d64;
    --danger: #aa3c3c;
    --warning: #a55b34;
    --bg: #f4f1ec;
    --bg-light: #f7f4ef;
    --card-bg: #fcfbf8;
    --text: #292b2a;
    --text-light: #747771;
    --border: #dedbd4;
    --sidebar-width: 244px;
    --focus-ring: rgba(184, 47, 52, 0.25);
}

html { background: var(--bg); }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

a { color: #9e272c; }
a:hover { color: #761d21; }

:focus-visible {
    outline: 3px solid rgba(226, 111, 115, 0.72);
    outline-offset: 2px;
}

.sidebar {
    background: #292b2a;
    color: #e8e6df;
    padding: 0 16px;
    scrollbar-color: #5b5d59 #292b2a;
}

.sidebar-header {
    padding: 24px 0 17px;
    border-color: #464844;
    text-align: left;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0 10px;
}

.sidebar-brand-image {
    width: 31px;
    height: 31px;
    flex: none;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar-brand-image-custom {
    width: 42px;
    height: 36px;
    filter: none;
}

.sidebar-brand span { min-width: 0; }
.sidebar-brand strong {
    display: block;
    overflow: hidden;
    color: #f4f2ed;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-brand small {
    display: block;
    margin-top: 3px;
    color: #aaa9a0;
    font-size: 0.63rem;
}

.scope-badge {
    display: inline-block;
    margin: 13px 10px 0;
    padding: 4px 8px;
    border: 1px solid #7d393c;
    border-radius: 4px;
    background: #432f30;
    color: #f4c7c8;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-links {
    padding: 8px 0 18px;
}

.nav-section {
    padding: 17px 10px 6px;
    color: #858780;
    font-size: 0.61rem;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.nav-links li a {
    margin: 2px 0;
    padding: 8px 10px;
    border-radius: 6px;
    color: #bcbdb5;
    font-size: 0.78rem;
    line-height: 1.25;
    transition: background-color 0.15s, color 0.15s;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: #3a3c39;
    color: #fff;
}

.nav-links li a.active {
    box-shadow: inset 3px 0 #be2d32;
    font-weight: 600;
}

.nav-links .nav-sub {
    padding: 2px 0 4px 16px !important;
}
.nav-links .nav-sub li a {
    padding: 5px 10px !important;
    color: #91938e !important;
    font-size: 0.7rem !important;
}
.nav-links .nav-sub li a:hover { color: #fff !important; }

.sidebar-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 11px;
    align-items: center;
    margin-top: auto;
    padding: 16px 10px 18px;
    border-color: #464844;
    color: #aeb0a9;
}

.sidebar-user {
    min-width: 0;
    font-size: 0.7rem;
}
.sidebar-user strong,
.sidebar-user small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user strong { color: #e8e6df; }
.sidebar-user small { margin-top: 2px; color: #858780; font-size: 0.62rem; }
.sidebar-account-actions { display: flex; gap: 5px; }
.sidebar-footer .btn {
    border: 1px solid #5a5d58;
    background: transparent;
    color: #d6d6d0;
}
.sidebar-footer .btn:hover { border-color: #8d9088; background: #3a3c39; color: #fff; }
.sidebar-legal {
    grid-column: 1 / -1;
    padding-top: 9px;
    border-top: 1px solid #3d3f3c;
    color: #747771;
    font-size: 0.53rem;
    line-height: 1.45;
}

.content {
    width: calc(100% - var(--sidebar-width));
    max-width: 1500px;
    padding: 30px 34px 42px;
}

.content-full {
    width: 100%;
    min-height: 100vh;
    padding: 30px;
}

h1, h2 { color: var(--text); letter-spacing: -0.025em; }
h1 { margin-bottom: 24px; font-size: 1.72rem; line-height: 1.15; }
h2 { font-size: 1.3rem; }
h3 { font-size: 0.96rem; }

.page-header {
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}
.page-header h1 { margin-bottom: 0; }
.page-header > div { display: flex; gap: 8px; flex-wrap: wrap; }

.card,
.stat-card,
.kpi-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: none;
}
.card { padding: 19px; }
.card-header {
    margin: -2px -2px 15px;
    padding: 0 2px 13px;
    border-color: #e5e1da;
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
}

.stat-card {
    padding: 19px;
    text-align: left;
    transition: border-color .15s, transform .15s;
}
a.stat-card:hover { border-color: #bcb6ad; transform: translateY(-1px); }
.stat-value { color: var(--text); font-size: 1.65rem; letter-spacing: -0.035em; }
.stat-label { color: var(--text-light); font-size: 0.75rem; }

.btn {
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 8px 13px;
    font-size: 0.78rem;
    font-weight: 600;
}
.btn-primary { border-color: #b82f34; background: #b82f34; color: #fff; }
.btn-primary:hover { border-color: #9e272c; background: #9e272c; color: #fff; }
.btn-secondary { border-color: #4d504b; background: #4d504b; color: #fff; }
.btn-outline { border-color: #d5d0c8; background: #fff; color: #4d504b; }
.btn-outline:hover { border-color: #a9a49c; background: #f8f5f0; color: #292b2a; }
.btn-success { background: #467d64; }
.btn-warning { background: #a55b34; color: #fff; }
.btn-danger { background: #aa3c3c; }

.form-group label {
    margin-bottom: 7px;
    color: #454843;
    font-size: 0.72rem;
    font-weight: 700;
}
.form-control,
.search-filter-bar input[type="text"],
.search-filter-bar input[type="search"],
.search-filter-bar select {
    min-height: 38px;
    border-color: #d8d4cc;
    border-radius: 5px;
    background: #fff;
    color: #3f423d;
    font-size: 0.78rem;
}
.form-control:focus,
.search-filter-bar input:focus,
.search-filter-bar select:focus {
    outline: none;
    border-color: #b82f34;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.search-filter-bar,
.report-filters {
    gap: 10px;
}
.search-filter-bar {
    padding: 12px;
    border-radius: 7px;
    background: #faf8f5;
}
.search-filter-bar .filter-label { color: #777a74; font-size: 0.65rem; }

.card:has(> table) { overflow-x: auto; }
table { font-size: 0.76rem; }
th, td { padding: 11px 12px; border-color: #e8e4dd; }
th {
    background: #f5f2ed;
    color: #777a74;
    font-size: 0.63rem;
    letter-spacing: 0.075em;
}
tbody tr:hover { background: #f6f2ec; }

.alert {
    border-radius: 5px;
    font-size: 0.8rem;
}
.alert-success, .badge-success { border-color: #cbded1; background: #e8f1eb; color: #315f49; }
.alert-warning, .badge-warning { border-color: #ecd2c4; background: #faeee7; color: #814628; }
.alert-danger, .badge-danger { border-color: #ecc9c8; background: #f9e8e7; color: #8c3030; }
.alert-info, .badge-info { border-color: #d8d6cf; background: #eeece7; color: #5f625d; }
.badge { border-radius: 4px; font-size: 0.68rem; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border-radius: 4px;
    font-size: .65rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill:before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: '';
}
.status-good { background: #e8f1eb; color: #3b765c; }
.status-warning { background: #faeee7; color: #a55b34; }
.status-danger { background: #f9e8e7; color: #aa3c3c; }
.status-neutral { background: #eeece7; color: #777b76; }

.summary-grid { gap: 10px; }
.summary-item,
.kpi-card-sm,
.breakdown-item {
    border: 1px solid #e4e0d9;
    border-radius: 6px;
    background: #f7f4ef;
}
.summary-item { padding: 16px; text-align: left; }
.summary-value { color: var(--text); font-size: 1.25rem; letter-spacing: -0.025em; }
.summary-label { color: var(--text-light); font-size: 0.68rem; }
.kpi-card { border-left: 3px solid var(--primary); }
.profit { color: #467d64; }
.loss { color: #aa3c3c; }

.dashboard-tabs {
    border-color: #d9d5ce !important;
    overflow-x: auto;
}
.dashboard-tab {
    color: #777a74 !important;
    font-size: 0.77rem;
    white-space: nowrap;
}
.dashboard-tab.active {
    border-color: #b82f34 !important;
    color: #9e272c !important;
}

.overview-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}
.overview-heading h1 { margin: 0 0 7px; }
.overview-heading p { color: var(--text-light); font-size: .8rem; }
.overview-eyebrow {
    margin-bottom: 8px;
    color: #858780;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.dashboard-tabs {
    display: flex;
    gap: 22px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border) !important;
}
.dashboard-tab {
    margin-bottom: -1px;
    padding: 0 0 11px;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    text-decoration: none;
}
.overview-primary-grid,
.overview-utility-grid {
    display: grid;
    gap: 14px;
}
.overview-primary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 26px;
}
.overview-card {
    min-height: 195px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, transform .15s;
}
.overview-card:hover { border-color: #bdb7af; color: inherit; transform: translateY(-2px); }
.overview-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.overview-icon {
    display: grid;
    width: 33px;
    height: 33px;
    place-items: center;
    border-radius: 6px;
    background: #efe6dd;
    color: #9e272c;
    font-size: 1rem;
}
.overview-status {
    padding: 4px 7px;
    border-radius: 4px;
    background: #eeece7;
    color: #676a65;
    font-size: .63rem;
    font-weight: 600;
}
.overview-card h2 { margin-bottom: 7px; font-size: 1rem; }
.overview-card p { max-width: 480px; color: var(--text-light); font-size: .74rem; }
.overview-link {
    display: block;
    margin-top: 18px;
    color: #9e272c;
    font-size: .7rem;
    font-weight: 700;
}
.overview-section {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
}
.overview-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 19px 13px;
    border-bottom: 1px solid #e5e1da;
}
.overview-section-head h2 { margin: 0; font-size: .88rem; }
.overview-section-head span { color: #858780; font-size: .65rem; }
.overview-utility-grid {
    grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
    padding: 16px 19px 19px;
}
.overview-utility-card {
    display: flex;
    min-height: 140px;
    flex-direction: column;
    padding: 15px;
    border: 1px solid #e4e0d9;
    border-radius: 6px;
    background: #f8f5f0;
    color: inherit;
    text-decoration: none;
}
.overview-utility-card:hover { border-color: #c8c2b9; color: inherit; background: #f5f1eb; }
.overview-utility-card strong { font-size: .8rem; }
.overview-utility-card span { margin-top: 7px; color: var(--text-light); font-size: .69rem; line-height: 1.45; }
.overview-utility-card b { margin-top: auto; padding-top: 14px; color: #9e272c; font-size: .67rem; }

.nav-toggle,
.nav-overlay { display: none; }

@media (max-width: 900px) {
    body { display: block; }
    .sidebar {
        width: min(86vw, 300px);
        padding: 0 16px;
        transform: translateX(-102%);
        transition: transform .2s ease;
        box-shadow: 10px 0 35px rgba(20, 21, 20, .24);
        z-index: 1002;
    }
    .nav-open .sidebar { transform: translateX(0); }
    .nav-toggle {
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1003;
        display: grid;
        place-content: center;
        gap: 4px;
        width: 38px;
        height: 38px;
        border: 1px solid #d7d3cb;
        border-radius: 6px;
        background: #fcfbf8;
        box-shadow: 0 2px 8px rgba(35, 37, 34, .12);
        cursor: pointer;
    }
    .nav-toggle span { width: 18px; height: 2px; border-radius: 2px; background: #292b2a; }
    .nav-open .nav-toggle { left: min(calc(86vw - 52px), 248px); }
    .nav-open .nav-toggle span { background: #fff; }
    .nav-open .nav-toggle { border-color: #5b5d59; background: #3a3c39; }
    .nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 1001;
        background: rgba(25, 27, 25, .52);
    }
    .nav-open .nav-overlay { display: block; }
    .sidebar-header h2,
    .sidebar-subtitle,
    .nav-section,
    .sidebar-footer span { display: initial; }
    .nav-section { display: list-item; }
    .nav-links li a { padding: 8px 10px; font-size: .78rem; text-align: left; }
    .content {
        width: 100%;
        margin-left: 0;
        padding: 72px 18px 34px;
    }
    .content-full { padding: 18px; }
    body.nav-open { overflow: hidden; }
}

@media (max-width: 560px) {
    h1 { font-size: 1.48rem; }
    .page-header { display: block; }
    .page-header > div { margin-top: 12px; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .card { padding: 14px; }
    .form-row { grid-template-columns: 1fr; }
    .report-filters { display: grid; align-items: stretch; }
    .overview-primary-grid { grid-template-columns: 1fr; }
    .overview-section-head span { display: none; }
}

@media print {
    .nav-toggle, .nav-overlay { display: none !important; }
    .content { width: 100%; margin-left: 0; padding: 0; max-width: none; }
    .card { box-shadow: none; }
}

/* Interactive consumption workflows — scoped to the Lynx operations shell. */
@media screen {
    .consumption-page {
        --consumption-ink: #292b2a;
        --consumption-muted: #747771;
        --consumption-line: #dedbd4;
        --consumption-soft: #f7f4ef;
        --consumption-accent: #b82f34;
        width: 100%;
    }
    .consumption-page-header {
        padding-bottom: 18px;
        border-bottom: 1px solid var(--consumption-line);
    }
    .consumption-page-header > div:first-child {
        display: block;
        min-width: 220px;
        margin-top: 0;
    }
    .consumption-eyebrow {
        margin: 0 0 7px;
        color: #8a5c4d;
        font-size: .64rem;
        font-weight: 700;
        letter-spacing: .13em;
        text-transform: uppercase;
    }
    .consumption-subtitle {
        max-width: 680px;
        margin: 7px 0 0;
        color: var(--consumption-muted) !important;
        font-size: .78rem;
        line-height: 1.5;
    }
    .consumption-search {
        max-width: 620px;
        margin-bottom: 14px;
        border-color: var(--consumption-line);
        background: var(--card-bg);
    }
    .consumption-table-card { padding: 0; overflow: hidden; }
    .consumption-table-card > table,
    .consumption-table-card > div > table { min-width: 700px; }
    .consumption-table-card th:first-child,
    .consumption-table-card td:first-child { padding-left: 18px; }
    .consumption-table-card tbody td:first-child { color: var(--consumption-ink); font-weight: 700; }
    .consumption-table-wrap { width: 100%; overflow-x: auto; }

    .consumption-modal {
        padding: 24px;
        background: rgba(28, 29, 28, .66) !important;
        backdrop-filter: blur(2px);
    }
    .consumption-modal-dialog {
        width: min(100%, 620px);
        margin: 5vh auto !important;
        padding: 25px !important;
        border: 1px solid #d8d3cb;
        border-radius: 9px !important;
        box-shadow: 0 24px 70px rgba(22, 23, 22, .28) !important;
    }
    .consumption-modal-dialog h2 { font-size: 1.18rem; }
    .consumption-modal-dialog label { color: #454843; font-size: .78rem; }
    .consumption-modal-dialog input[type="radio"],
    .consumption-modal-dialog input[type="checkbox"] { accent-color: var(--consumption-accent); }
    .consumption-notice {
        border: 1px solid #e2ddd5;
        border-left-width: 4px !important;
        box-shadow: none;
    }
    .consumption-notice-info { border-left-color: #777b76; background: #f4f2ed !important; }
    .consumption-notice-warning { border-left-color: #a55b34 !important; background: #fbefe8 !important; }
    .consumption-notice-danger { border-left-color: #aa3c3c !important; background: #f9e8e7 !important; }
    .recalc-progress-widget {
        overflow: hidden;
        border-color: #d4cfc7 !important;
        border-radius: 8px !important;
        box-shadow: 0 14px 45px rgba(32, 33, 31, .2) !important;
        font-family: 'DM Sans', sans-serif;
    }
    .recalc-progress-widget > div:first-child { background: #4d504b !important; }

    .billing-period-page .consumption-page-header { align-items: flex-start; }
    .consumption-workflow-actions {
        display: flex;
        justify-content: flex-end;
        gap: 7px;
        max-width: 900px;
    }
    .consumption-action-group {
        display: inline-flex;
        gap: 6px;
        padding-right: 7px;
        border-right: 1px solid #ddd8d0;
    }
    .consumption-action-group form { margin: 0; }
    .consumption-action-group[aria-label="Prepare and check"] .btn {
        border-color: #d5d0c8;
        background: #fff;
        color: #4d504b;
    }
    .consumption-action-group[aria-label="Prepare and check"] a:nth-child(2) {
        border-color: var(--consumption-accent);
        background: var(--consumption-accent);
        color: #fff;
    }
    .consumption-context-card {
        display: grid;
        grid-template-columns: minmax(160px, .6fr) 2fr;
        align-items: center;
        background: #f8f5f0;
    }
    .consumption-context-card .card-header { margin: 0; border: 0; }
    .consumption-context-card .form-row { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
    .consumption-context-card p { margin: 0; font-size: .78rem; }
    .consumption-evidence-card .card-header,
    .consumption-dates-card .card-header { letter-spacing: .01em; }
    .consumption-evidence-card code { font-family: 'Space Mono', monospace; font-size: .64rem; }
    .consumption-dates-card { border-top: 3px solid #7b7d77; }

    .slip-review-page { max-width: 1180px; margin: 0 auto; }
    .slip-review-header h1 { font-size: 1.6rem; text-transform: none; }
    .slip-navigation {
        border-left-color: var(--consumption-accent) !important;
        background: #f7f4ef !important;
    }
    .slip-company-identity {
        padding: 20px !important;
        background: #302f2d;
        color: #f6f3ed;
    }
    .slip-company-identity h2 { color: #fff; font-size: 1rem; letter-spacing: .015em; }
    .slip-company-identity p { color: #c4c1ba !important; font-size: .72rem !important; }
    .slip-account-card,
    .slip-readings-card { border-top: 3px solid #5e615c; }
    .slip-account-card .form-row { gap: 28px; }
    .slip-account-card p { margin: 6px 0; font-size: .78rem; }
    .slip-readings-card tbody tr:last-child { background: #f3eee7; }
    .slip-edit-card {
        margin-left: 18px;
        border-left: 3px solid #c9c4bc;
        background: #faf8f4;
    }
    .slip-edit-card .card-header { font-size: .84rem; }
    .slip-edit-card-warning { border-left-color: #a55b34; }
    .slip-review-page table { font-variant-numeric: tabular-nums; }

    .usage-analysis-page .consumption-filter-card { padding: 16px 18px; }
    .usage-analysis-page .report-filters {
        display: grid;
        grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
        margin: 0;
    }
    .usage-analysis-page .report-filters .btn { min-height: 38px; }
    .usage-report-card > .card-header {
        display: flex;
        gap: 14px;
        flex-wrap: wrap;
    }
    .usage-report-card > .card-header > span:last-child { margin-left: auto; white-space: nowrap; }
    .usage-kpi-grid { gap: 10px !important; }
    .usage-kpi-grid > div {
        min-width: 0;
        padding: 16px !important;
        border: 1px solid #e1ddd5;
        border-top: 3px solid #7b7d77;
        border-radius: 6px !important;
        background: #f7f4ef !important;
        text-align: left !important;
    }
    .usage-kpi-grid > div:nth-child(1) { border-top-color: #b82f34; }
    .usage-kpi-grid > div:nth-child(2) { border-top-color: #467d64; }
    .usage-kpi-grid > div > div:first-child { color: var(--consumption-ink) !important; font-size: 1.28rem !important; }
    .usage-kpi-grid > div > div:nth-child(2) { color: var(--consumption-muted) !important; }
    .usage-analysis-page h3 { color: var(--consumption-ink) !important; }
    .usage-analysis-page .data-table { min-width: 620px; }
    .usage-analysis-page tfoot tr { background: #eeeae3 !important; }
    .usage-chart-frame {
        min-height: 240px;
        padding: 18px;
        border: 1px solid var(--consumption-line);
        border-radius: 8px;
        background: var(--card-bg);
    }
    .usage-two-column > div {
        min-width: 0;
        padding: 16px;
        border: 1px solid #e2ded7;
        border-radius: 7px;
        background: #faf8f5;
        overflow-x: auto;
    }
}

@media screen and (max-width: 1100px) {
    .billing-period-page .consumption-page-header { display: block; }
    .consumption-workflow-actions { justify-content: flex-start; max-width: none; margin-top: 14px; }
    .usage-analysis-page .report-filters { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
    .usage-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media screen and (max-width: 700px) {
    .consumption-modal { padding: 10px; }
    .consumption-modal-dialog { margin: 2vh auto !important; padding: 18px !important; }
    .recalc-progress-widget { right: 10px !important; bottom: 10px !important; width: calc(100% - 20px) !important; }
    .consumption-workflow-actions { display: grid; }
    .consumption-action-group { flex-wrap: wrap; padding: 0 0 7px; border: 0; border-bottom: 1px solid #ddd8d0; }
    .consumption-context-card { display: block; }
    .consumption-context-card .card-header { margin-bottom: 12px; }
    .slip-navigation { gap: 8px; }
    .slip-navigation > div:nth-child(2) { text-align: center; }
    .slip-edit-card { margin-left: 0; }
    .usage-analysis-page .report-filters { grid-template-columns: 1fr; }
    .usage-kpi-grid { grid-template-columns: 1fr !important; }
    .usage-two-column { grid-template-columns: 1fr !important; }
    .usage-report-card > .card-header > span:last-child { width: 100%; margin-left: 0; }
    .usage-chart-frame { min-height: 200px; padding: 10px; }
}
