/* ═══════════════════════════════════════════
   Cia Verde — Painel de Viagens
   Visual alinhado à identidade da logo
═══════════════════════════════════════════ */

:root,
html[data-theme="light"] {
    --green-900: #143526;
    --green-800: #1b432c;
    --green-700: #245538;
    --green-600: #2f6b45;
    --green-500: #3d8a55;
    --green-400: #5ea36f;
    --green-300: #8fbc5c;
    --green-200: #c5dfb0;
    --green-100: #e7f2dc;
    --green-50: #f3f8ee;

    --bg-base: #eef2ec;
    --bg-page: #f4f7f2;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-muted: #f0f4ed;
    --bg-hover: #e8efe3;
    --bg-sidebar: var(--green-800);
    --bg-sidebar-active: rgba(255, 255, 255, 0.14);
    --bg-table-head: #dce9d2;

    --border: rgba(27, 67, 44, 0.1);
    --border-strong: rgba(27, 67, 44, 0.18);
    --text-primary: #1a2e22;
    --text-secondary: #4a6354;
    --text-muted: #6d8174;
    --text-on-green: #f5faf3;
    --accent: var(--green-600);
    --accent-strong: var(--green-800);
    --accent-soft: var(--green-100);
    --shadow: 0 8px 28px rgba(20, 53, 38, 0.08);
    --shadow-sm: 0 2px 10px rgba(20, 53, 38, 0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --font: "DM Sans", "Segoe UI", sans-serif;
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 78px;
}

html[data-theme="dark"] {
    --bg-base: #0c1410;
    --bg-page: #101a15;
    --bg-surface: #162019;
    --bg-elevated: #1b2820;
    --bg-muted: #1a261f;
    --bg-hover: #223229;
    --bg-sidebar: #0f1a14;
    --bg-sidebar-active: rgba(143, 188, 92, 0.18);
    --bg-table-head: #1e3228;
    --border: rgba(197, 223, 176, 0.1);
    --border-strong: rgba(197, 223, 176, 0.18);
    --text-primary: #eef5ea;
    --text-secondary: #b4c7ba;
    --text-muted: #84998c;
    --text-on-green: #f5faf3;
    --accent: var(--green-300);
    --accent-strong: var(--green-300);
    --accent-soft: rgba(143, 188, 92, 0.15);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.app-bg { display: none; }

a { color: inherit; text-decoration: none; }

button, input, select {
    font: inherit;
}

/* ── Sidebar ── */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w-collapsed);
    background: var(--bg-sidebar);
    color: var(--text-on-green);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition);
    overflow: visible;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body.sidebar-expanded .sidebar {
    width: var(--sidebar-w);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem 0.75rem;
    min-height: 76px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-logo {
    max-height: 42px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: none;
}

/* Expandido: logo completa. Recolhido: logopequena quadrada. */
body.sidebar-expanded .sidebar-logo-full {
    display: block;
}

body.sidebar-collapsed .sidebar-logo-collapsed,
body:not(.sidebar-expanded) .sidebar-logo-collapsed {
    display: block;
}

body.sidebar-expanded .sidebar-logo-collapsed {
    display: none;
}

body.sidebar-collapsed .sidebar-logo-full,
body:not(.sidebar-expanded) .sidebar-logo-full {
    display: none;
}

body.sidebar-collapsed .sidebar-logo-collapsed,
body:not(.sidebar-expanded) .sidebar-logo-collapsed {
    max-height: 40px;
    max-width: 40px;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.sidebar-toggle {
    position: absolute;
    top: 28px;
    right: -14px;
    z-index: 1001;
    width: 28px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-left: none;
    background: var(--bg-sidebar);
    color: #fff;
    border-radius: 0 10px 10px 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.18);
    transition: background var(--transition), color var(--transition);
}

.sidebar-toggle:hover {
    background: var(--green-700);
    color: #fff;
}

.sidebar-toggle i {
    font-size: 0.95rem;
    line-height: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.65rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-link,
.sidebar-theme-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    border: 0;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}

.sidebar-link i,
.sidebar-theme-btn i {
    font-size: 1.15rem;
    width: 1.35rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link span,
.sidebar-theme-btn span,
.sidebar-slogan {
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity var(--transition);
}

body.sidebar-expanded .sidebar-link span,
body.sidebar-expanded .sidebar-theme-btn span,
body.sidebar-expanded .sidebar-slogan {
    opacity: 1;
    width: auto;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-theme-btn {
    justify-content: center;
    padding-inline: 0.55rem;
}

.sidebar-link:hover,
.sidebar-theme-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-slogan {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    line-height: 1.3;
    margin: 0.15rem 0.35rem 0.4rem;
}

.sidebar-slogan p {
    margin: 0;
}

.sidebar-slogan-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, var(--green-300), transparent 55%),
        radial-gradient(circle at 70% 70%, var(--green-600), var(--green-800));
    flex-shrink: 0;
}

.sidebar-floating-tip {
    position: fixed;
    transform: translateY(-50%);
    background: var(--green-900);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    z-index: 3000;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.sidebar-floating-tip.show {
    opacity: 1;
}

/* ── Shell ── */

.app-shell {
    margin-left: var(--sidebar-w-collapsed);
    min-height: 100vh;
    transition: margin-left var(--transition);
}

body.sidebar-expanded .app-shell {
    margin-left: var(--sidebar-w);
}

.page-header {
    padding: 1.35rem 1.5rem 0.35rem;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.page-sub {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.page-header-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.main-content {
    padding: 0.75rem 1.5rem 2rem;
}

/* ── Filters bar ── */

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin: 0.85rem 0 1.1rem;
    padding: 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrap > i {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input,
.header-periodo-select,
.header-date-input,
.export-input,
.form-control,
.premio-config-input {
    height: 40px;
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0 0.8rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input {
    padding-left: 2.1rem;
    min-width: 180px;
}

.search-input:focus,
.header-periodo-select:focus,
.header-date-input:focus,
.export-input:focus,
.form-control:focus {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(61, 138, 85, 0.15);
}

.header-periodo,
.header-custom-periodo,
.header-mes,
.header-frota,
.header-grupo {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.header-date-sep {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.header-filtrar-btn,
.btn-apply,
.btn-primary-green,
.export-btn-primary {
    height: 40px;
    padding: 0 1rem;
    border: 0;
    border-radius: 10px;
    background: var(--green-800);
    color: #fff;
    font-weight: 600;
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: background var(--transition), transform 0.15s ease;
}

html[data-theme="dark"] .header-filtrar-btn,
html[data-theme="dark"] .btn-apply,
html[data-theme="dark"] .btn-primary-green,
html[data-theme="dark"] .export-btn-primary {
    background: var(--green-600);
}

.header-filtrar-btn:hover,
.btn-apply:hover,
.btn-primary-green:hover,
.export-btn-primary:hover {
    background: var(--green-700);
}

.btn-nav,
.btn-outline-green,
.export-btn-secondary {
    height: 40px;
    padding: 0 0.9rem;
    border: 1px solid var(--green-700);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--green-800);
    font-weight: 600;
    font-size: 0.84rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

html[data-theme="dark"] .btn-nav,
html[data-theme="dark"] .btn-outline-green,
html[data-theme="dark"] .export-btn-secondary {
    color: var(--green-300);
    border-color: rgba(143, 188, 92, 0.45);
}

.btn-nav:hover,
.btn-outline-green:hover,
.export-btn-secondary:hover {
    background: var(--accent-soft);
}

/* ── Sync badge ── */

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--green-100);
    color: var(--green-800);
    border: 1px solid rgba(61, 138, 85, 0.2);
}

html[data-theme="dark"] .sync-badge {
    background: rgba(143, 188, 92, 0.12);
    color: var(--green-300);
}

.sync-badge-running { opacity: 0.85; }
.sync-badge-error {
    background: #fde8e8;
    color: #9b1c1c;
}
html[data-theme="dark"] .sync-badge-error {
    background: rgba(220, 80, 80, 0.15);
    color: #f5a8a8;
}

/* ── Stats ── */

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 78px;
    animation: fadeUp 0.35s ease both;
    animation-delay: var(--delay, 0ms);
}

.stat-card-highlight {
    background: linear-gradient(145deg, var(--green-800), var(--green-600));
    color: #fff;
    border-color: transparent;
}

.stat-card-highlight .stat-label,
.stat-card-highlight .stat-value {
    color: #fff;
}

.stat-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.15;
}

.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--green-700);
    margin-bottom: 0.05rem;
    font-size: 0.85rem;
}

html[data-theme="dark"] .stat-icon {
    color: var(--green-300);
}

.stat-card-highlight .stat-icon {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* ── Panels / tables ── */

.panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.panel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    background: var(--bg-table-head);
    border-bottom: 1px solid var(--border);
}

.panel-card-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-800);
}

html[data-theme="dark"] .panel-card-header h2 {
    color: var(--green-300);
}

.table-wrap {
    overflow: auto;
}

.table-wrap-fixed {
    height: 700px;
    max-height: 700px;
    overflow: auto;
}

.table-wrap-fixed .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-wrap-fixed .data-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.data-table,
.trips-table,
.premio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.data-table thead th,
.premio-table thead th {
    background: var(--bg-table-head);
    color: var(--green-800);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .premio-table thead th {
    color: var(--green-300);
}

.data-table td,
.premio-table td,
.trips-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:hover,
.premio-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tfoot td,
.premio-table tfoot td {
    font-weight: 700;
    background: var(--bg-muted);
}

.driver-name-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.driver-chevron {
    transition: transform var(--transition);
    color: var(--green-600);
}

.driver-summary.open .driver-chevron {
    transform: rotate(90deg);
}

.driver-detail-row td {
    background: var(--bg-muted);
    padding: 0.65rem 0.85rem 1rem;
}

.driver-detail-row:not(.open) {
    display: none;
}

.trips-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
}

.trips-table thead th {
    background: var(--bg-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.trips-empty,
.trips-loading,
.premio-loading,
.premio-empty,
.loading-state,
.settings-empty {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 1.25rem;
    text-align: center;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1rem;
}

.loader {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--green-200);
    border-top-color: var(--green-700);
    animation: spin 0.8s linear infinite;
}

.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem;
}

.trip-odometro-btn {
    border: 0;
    background: var(--accent-soft);
    color: var(--green-700);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

html[data-theme="dark"] .trip-odometro-btn {
    color: var(--green-300);
}

/* ── Charts ── */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.chart-card {
    margin-bottom: 0;
}

.chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.35rem;
}

.chart-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.chart-sub {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-body {
    position: relative;
    height: 320px;
    padding: 0.5rem 0.85rem 1rem;
}

.chart-body-bar {
    height: 360px;
}

.chart-mode-toggle {
    display: inline-flex;
    background: var(--bg-muted);
    border-radius: var(--radius-pill);
    padding: 0.15rem;
    gap: 0.15rem;
}

.chart-mode-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
}

.chart-mode-btn.active {
    background: var(--bg-surface);
    color: var(--green-800);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .chart-mode-btn.active {
    color: var(--green-300);
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 20;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font-size: 0.75rem;
    box-shadow: var(--shadow);
    min-width: 140px;
}

.chart-tooltip-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* ── Alerts ── */

.alert-custom,
.alert-success-custom,
.export-error {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    font-size: 0.86rem;
}

.alert-custom,
.export-error {
    background: #fdecec;
    color: #9b1c1c;
    border: 1px solid #f5c2c2;
}

.alert-success-custom {
    background: var(--green-100);
    color: var(--green-800);
    border: 1px solid var(--green-200);
}

/* ── Modals ── */

.export-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.export-modal.d-none { display: none; }

.export-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 32, 24, 0.45);
    backdrop-filter: blur(3px);
}

.export-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeUp 0.25s ease;
}

.export-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.export-modal-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.export-modal-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.export-modal-close:hover {
    background: var(--bg-hover);
}

.export-modal-body {
    padding: 1rem 1.15rem;
}

.export-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    padding: 0.85rem 1.15rem 1.1rem;
    border-top: 1px solid var(--border);
}

.export-field {
    margin-bottom: 0.9rem;
}

.export-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.export-period-toggle,
.export-format-toggle {
    display: flex;
    gap: 0.4rem;
}

.export-period-btn {
    flex: 1;
    border: 1px solid var(--border-strong);
    background: var(--bg-muted);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0.5rem 0.7rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}

.export-period-btn.active {
    background: var(--green-800);
    border-color: var(--green-800);
    color: #fff;
}

html[data-theme="dark"] .export-period-btn.active {
    background: var(--green-600);
    border-color: var(--green-600);
}

.export-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.export-format-option {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
}

.odometro-dialog { max-width: 560px; }

.odometro-compare {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin: 0.75rem 0;
}

.odometro-card {
    background: var(--bg-muted);
    border-radius: 10px;
    padding: 0.7rem;
}

.odometro-card-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.odometro-card-value {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
}

.odometro-detail-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.odometro-detail-table th,
.odometro-detail-table td {
    padding: 0.45rem;
    border-bottom: 1px solid var(--border);
}

/* ── Selectors appended below (from legacy, theme-aware via CSS vars) ── */

.settings-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.75rem 0.95rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.settings-intro h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.settings-intro p {
    margin: 0.2rem 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.35;
}

.premio-config-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.premio-config-label {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.premio-config-input {
    width: 8.5rem;
}

.settings-save-status {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.settings-save-status[data-kind="ok"] {
    color: var(--green-600);
}

.settings-save-status[data-kind="pending"] {
    color: var(--text-secondary);
}

.settings-save-status[data-kind="error"] {
    color: #b42318;
}

.settings-groups {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.settings-group {
    padding: 0;
    overflow: hidden;
}

.settings-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-table-head);
}

.settings-group-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--green-800);
    letter-spacing: 0.02em;
}

html[data-theme="dark"] .settings-group-title {
    color: var(--green-300);
}

.settings-group-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.settings-add-rule {
    padding: 0.28rem 0.55rem !important;
    font-size: 0.72rem !important;
    gap: 0.3rem !important;
}

.settings-rules {
    padding: 0.55rem 0.75rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.settings-rule,
.settings-rule-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.55rem 0.75rem;
    align-items: end;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-muted);
}

.settings-rule-cluster {
    display: grid;
    grid-template-columns: repeat(2, minmax(7.5rem, 9.5rem));
    gap: 0.4rem;
    align-items: end;
    min-width: 0;
}

.settings-rule-values {
    grid-template-columns: repeat(2, 6.25rem);
    padding-left: 0.65rem;
    border-left: 1px solid var(--border);
}

.settings-rule-hint {
    grid-column: 1 / -1;
    margin-top: -0.15rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.settings-pending-banner {
    margin-bottom: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #fff7e6;
    color: #8a5a00;
    border: 1px solid #f0d9a0;
    font-size: 0.84rem;
}

.competencia-panel {
    margin-bottom: 0.65rem;
    padding: 0;
    overflow: hidden;
}

.competencia-panel > .competencia-list {
    padding: 0.75rem 0.9rem 0.9rem;
}

.competencia-intro {
    margin-bottom: 0 !important;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.competencia-list {
    padding: 0.55rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.competencia-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-muted);
}

.competencia-row-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.75rem;
    min-width: 0;
}

.competencia-row-main strong {
    font-size: 0.84rem;
    color: var(--green-800);
}

html[data-theme="dark"] .competencia-row-main strong {
    color: var(--green-300);
}

.competencia-range {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.competencia-tags {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.competencia-row-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.competencia-form {
    padding: 0.6rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.competencia-form-grid {
    display: grid;
    grid-template-columns: minmax(8rem, 11rem) repeat(2, minmax(7.5rem, 10rem));
    gap: 0.45rem;
}

.competencia-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.1rem;
}

.competencia-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.competencia-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

@media (max-width: 700px) {
    .competencia-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Premiação page ── */

.premio-page-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.premio-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    min-width: 0;
}

.premio-page-filters .export-label {
    margin-bottom: 0;
    line-height: 1.2;
    min-height: 1rem;
}

.premio-filter-spacer {
    visibility: hidden;
    user-select: none;
}

.premio-period-toggle {
    height: 36px;
}

.premio-period-toggle .export-period-btn {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 0.85rem;
    border-radius: 8px;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.premio-filter-mes {
    width: 11.5rem;
}

.premio-filter-frota {
    width: 10rem;
}

.premio-filter-dates .export-dates {
    gap: 0.5rem;
}

.premio-page-filters .export-input,
.premio-page-filters .custom-select-trigger,
.premio-page-filters .header-filtrar-btn {
    height: 36px;
    border-radius: 8px;
    box-sizing: border-box;
}

.premio-page-filters .export-input {
    padding: 0 0.65rem;
    font-size: 0.82rem;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    width: 100%;
}

.premio-page-filters .custom-select-trigger {
    padding: 0 0.65rem;
    font-size: 0.82rem;
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.premio-page-filters .header-filtrar-btn {
    padding: 0 0.95rem;
    font-size: 0.82rem;
    white-space: nowrap;
}

.premio-filter-action {
    margin-left: auto;
}

@media (max-width: 900px) {
    .premio-filter-action {
        margin-left: 0;
    }

    .premio-filter-mes,
    .premio-filter-frota {
        width: min(100%, 14rem);
    }
}

.premio-summary {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
}

.premio-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.premio-summary-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}

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

.premio-table-wrap {
    overflow: auto;
    max-height: min(65vh, 640px);
}

.relatorio-card {
    max-width: 520px;
    padding: 1.25rem;
}

.relatorio-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.relatorio-card p {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}

/* ── Utils ── */

.d-none { display: none !important; }
.text-end { text-align: right; }
.fw-semibold { font-weight: 600; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .sidebar {
        width: var(--sidebar-w-collapsed);
    }
    body.sidebar-expanded .sidebar {
        width: min(84vw, var(--sidebar-w));
        box-shadow: var(--shadow);
    }
    .app-shell,
    body.sidebar-expanded .app-shell {
        margin-left: var(--sidebar-w-collapsed);
    }
    .stats-row {
        grid-template-columns: 1fr;
    }
    .page-header,
    .main-content {
        padding-inline: 0.85rem;
    }
    .settings-rule,
    .settings-rule-row {
        grid-template-columns: 1fr;
    }

    .settings-rule-values {
        padding-left: 0;
        border-left: none;
        padding-top: 0.35rem;
        border-top: 1px solid var(--border);
    }

    .odometro-compare {
        grid-template-columns: 1fr;
    }
}

.settings-rule-row.is-pending {
    border-color: rgba(234, 179, 8, 0.35);
    background: rgba(161, 98, 7, 0.08);
}

.settings-rule-field {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.settings-rule-field label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.settings-date-input {
    width: 100%;
    padding: 0.28rem 0.4rem;
    font-size: 0.78rem;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color var(--transition);
    color-scheme: light;
}

html[data-theme="dark"] .settings-date-input {
    color-scheme: dark;
}

.settings-date-input:focus {
    border-color: var(--border-strong);
}

.settings-rule-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 0.05rem;
}

.settings-rule-remove {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: #c45c5c;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.settings-rule-remove:hover {
    background: rgba(127, 29, 29, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
}

.settings-empty-rules,
.settings-empty {
    padding: 0.55rem 0.15rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .settings-rule,
    .settings-rule-row {
        grid-template-columns: 1fr auto;
    }

    .settings-rule-values {
        grid-column: 1 / -1;
        padding-left: 0;
        border-left: none;
        padding-top: 0.3rem;
        border-top: 1px solid var(--border);
        justify-content: start;
    }

    .settings-rule-actions {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (max-width: 560px) {
    .settings-rule-cluster,
    .settings-rule-values {
        grid-template-columns: 1fr 1fr;
    }

    .settings-rule-actions {
        justify-content: flex-start;
        grid-column: 1 / -1;
        grid-row: auto;
    }
}

.money-input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
}

.money-input-wrap span {
    font-size: 0.68rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.money-input {
    width: 100%;
    min-width: 0;
    padding: 0.28rem 0.4rem;
    font-size: 0.78rem;
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: right;
    outline: none;
    transition: border-color var(--transition);
}

.money-input:focus {
    border-color: var(--border-strong);
}

.text-muted-cell {
    color: var(--text-muted) !important;
    font-size: 0.75rem;
    font-weight: 400 !important;
}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ── Filtros ── */

.filtros-panel {
    position: relative;
    z-index: 90;
    background: rgba(17, 17, 19, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0 1rem;
    overflow: visible;
}

.filtros-form {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.filtros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr auto;
    gap: 0.75rem;
    align-items: end;
}

.filtro-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.filtro-item .form-control {
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    transition: border-color var(--transition);
}

.filtro-item .form-control:focus {
    background: var(--bg-base);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: none;
}

/* ── Custom Selectors ── */

.custom-select {
    position: relative;
}

.custom-select {
    min-width: 150px;
}

.filters-bar .custom-select-trigger {
    height: 40px;
    background: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 0.84rem;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    font-family: var(--font);
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    gap: 0.5rem;
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.custom-select-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-label.has-value {
    color: var(--text-primary);
}

.custom-select-chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.custom-select.open .custom-select-chevron {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.custom-select.open .custom-select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

.custom-select-search-wrap i {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.custom-select-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.75rem;
    font-family: var(--font);
    color: var(--text-primary);
}

.custom-select-search::placeholder {
    color: var(--text-muted);
}

.custom-select-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
}

.custom-select-options::-webkit-scrollbar {
    width: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px;
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 1px;
}

.custom-select-option:hover {
    background: var(--bg-hover);
}

.custom-select-option input {
    display: none;
}

.option-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    flex-shrink: 0;
    transition: all var(--transition);
}

.option-check i {
    font-size: 0.65rem;
    color: var(--bg-base);
    opacity: 0;
    transition: opacity var(--transition);
}

.custom-select-option input:checked + .option-check {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.custom-select-option input:checked + .option-check i {
    opacity: 1;
}

.option-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-option input:checked ~ .option-text {
    color: var(--text-primary);
}

.custom-select-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Month Select ── */

.month-select-dropdown {
    min-width: 220px;
}

.month-select-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.35rem;
}

.month-select-list::-webkit-scrollbar {
    width: 4px;
}

.month-select-list::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px;
}

.month-group {
    margin-bottom: 0.5rem;
}

.month-group:last-child {
    margin-bottom: 0;
}

.month-group-year {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.25rem 0.4rem 0.35rem;
}

.month-group-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.month-option {
    padding: 0.35rem 0.4rem;
    font-size: 0.72rem;
    font-family: var(--font);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.month-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.month-option.selected {
    background: var(--green-800);
    color: #fff;
    font-weight: 500;
}

html[data-theme="dark"] .month-option.selected {
    background: var(--green-600);
}

.periodo-opcoes {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.periodo-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.periodo-chip.active {
    background: var(--green-800);
    border-color: var(--green-800);
    color: #fff;
}

html[data-theme="dark"] .periodo-chip.active {
    background: var(--green-600);
    border-color: var(--green-600);
}

/* ═══════════════════════════════════════════
   Portal Padrão Cia Verde — extras
═══════════════════════════════════════════ */

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(61, 138, 85, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 100%, rgba(143, 188, 92, 0.12), transparent 50%),
        var(--bg-page);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem 1.75rem 1.75rem;
    animation: fadeUp 0.4s ease;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
    text-align: center;
}

.login-brand img {
    max-height: 56px;
    width: auto;
}

html[data-theme="dark"] .login-brand img.login-logo-light {
    display: none;
}

html[data-theme="light"] .login-brand img.login-logo-dark,
html:not([data-theme="dark"]) .login-brand img.login-logo-dark {
    display: none;
}

html[data-theme="dark"] .login-brand img.login-logo-dark {
    display: block;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-brand p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.login-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.login-field .form-control {
    width: 100%;
    height: 44px;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

.login-actions .btn-primary-green {
    width: 100%;
    height: 44px;
    justify-content: center;
}

.login-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-meta label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.login-theme-fab {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
}

.login-theme-fab:hover {
    background: var(--bg-hover);
}

/* Top bar / user chip */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--green-700), var(--green-500));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    padding-right: 0.25rem;
}

.topbar-user-name {
    font-size: 0.78rem;
    font-weight: 600;
}

.topbar-user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Badges */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--green-100);
    color: var(--green-800);
}

html[data-theme="dark"] .badge-success {
    background: rgba(143, 188, 92, 0.15);
    color: var(--green-300);
}

.badge-warning {
    background: #fff7e6;
    color: #8a5a00;
}

html[data-theme="dark"] .badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #f5d078;
}

.badge-danger {
    background: #fde8e8;
    color: #9b1c1c;
}

html[data-theme="dark"] .badge-danger {
    background: rgba(220, 80, 80, 0.15);
    color: #f5a8a8;
}

.badge-info {
    background: #e8f1fb;
    color: #1e4d8c;
}

html[data-theme="dark"] .badge-info {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
}

.badge-neutral {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

/* Buttons variants */
.btn-danger {
    height: 40px;
    padding: 0 1rem;
    border: 0;
    border-radius: 10px;
    background: #b42318;
    color: #fff;
    font-weight: 600;
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.btn-danger:hover { background: #912018; }

.btn-ghost {
    height: 40px;
    padding: 0 0.9rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.84rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}

.btn-ghost:hover { background: var(--bg-hover); }

.btn-sm {
    height: 32px;
    padding: 0 0.7rem;
    font-size: 0.76rem;
    border-radius: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

/* Content grids */
.content-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.content-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1000px) {
    .content-grid-2,
    .content-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Info / feature cards */
.info-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.info-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.info-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--green-700);
    font-size: 1.1rem;
}

html[data-theme="dark"] .info-card-icon {
    color: var(--green-300);
}

.info-card h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.info-card p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Form layout */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem 1rem;
}

.form-grid .form-span-2 {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-field .form-control,
.form-field select.form-control,
.form-field textarea.form-control {
    width: 100%;
}

.form-field textarea.form-control {
    height: auto;
    min-height: 100px;
    padding: 0.65rem 0.8rem;
    resize: vertical;
}

.form-hint {
    margin: 0.3rem 0 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
}

@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Tabs */
.tabs-bar {
    display: flex;
    gap: 0.25rem;
    padding: 0.35rem;
    background: var(--bg-muted);
    border-radius: 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn.active {
    background: var(--bg-surface);
    color: var(--green-800);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .tab-btn.active {
    color: var(--green-300);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    color: var(--green-400);
    margin-bottom: 0.75rem;
    display: block;
}

.empty-state h3 {
    margin: 0 0 0.35rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.empty-state p {
    margin: 0 0 1rem;
    font-size: 0.86rem;
}

/* Activity list */
.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green-500);
    margin-top: 0.35rem;
    flex-shrink: 0;
}

.activity-dot.warning { background: #d4a017; }
.activity-dot.danger { background: #c45c5c; }

.activity-body strong {
    display: block;
    font-size: 0.84rem;
    margin-bottom: 0.15rem;
}

.activity-body span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Avatar stack */
.avatar-stack {
    display: flex;
}

.avatar-stack span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--green-600);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid var(--bg-surface);
    margin-left: -8px;
}

.avatar-stack span:first-child {
    margin-left: 0;
}

.avatar-stack span:nth-child(2) { background: var(--green-700); }
.avatar-stack span:nth-child(3) { background: var(--green-500); }
.avatar-stack span:nth-child(4) { background: var(--green-400); color: var(--green-900); }

/* Progress */
.progress-track {
    height: 8px;
    background: var(--bg-muted);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-700), var(--green-400));
    border-radius: var(--radius-pill);
}

/* Component showcase sections */
.showcase-section {
    margin-bottom: 1.25rem;
}

.showcase-section > h2 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--green-800);
}

html[data-theme="dark"] .showcase-section > h2 {
    color: var(--green-300);
}

.showcase-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.panel-card-body {
    padding: 1.1rem;
}

.table-actions {
    display: inline-flex;
    gap: 0.35rem;
}

/* Switch */
.switch {
    position: relative;
    width: 42px;
    height: 24px;
    display: inline-block;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--transition);
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition);
}

.switch input:checked + .switch-slider {
    background: var(--green-600);
    border-color: var(--green-600);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(18px);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
    border-bottom: 0;
}

.settings-row h3 {
    margin: 0 0 0.2rem;
    font-size: 0.88rem;
}

.settings-row p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
