/* PlanetaJJ UI foundation
 * Centraliza tokens e comportamentos responsivos compartilhados.
 * Regras especificas de cada modulo continuam em app.css.
 */

:root {
    --ui-brand: #f57c00;
    --ui-brand-strong: #e65100;
    --ui-ink: #0b1c2d;
    --ui-muted: #64748b;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f8fafc;
    --ui-border: #dbe3ec;
    --ui-focus: rgba(245, 124, 0, .22);
    --ui-shadow-sm: 0 6px 18px rgba(11, 28, 45, .07);
    --ui-shadow-md: 0 14px 38px rgba(11, 28, 45, .11);
    --ui-radius-sm: 10px;
    --ui-radius-md: 16px;
    --ui-radius-lg: 20px;
    --ui-space-1: 4px;
    --ui-space-2: 8px;
    --ui-space-3: 12px;
    --ui-space-4: 16px;
    --ui-space-5: 20px;
    --ui-space-6: 24px;
    --ui-space-8: 32px;
    --ui-control-height: 44px;
    --ui-content-max: 1600px;
}

html[data-theme='dark'] {
    --ui-ink: #f8fafc;
    --ui-muted: #9fb0c3;
    --ui-surface: #10202e;
    --ui-surface-soft: #142433;
    --ui-border: #2d4254;
    --ui-focus: rgba(251, 146, 60, .25);
    --ui-shadow-sm: 0 8px 22px rgba(0, 0, 0, .2);
    --ui-shadow-md: 0 18px 44px rgba(0, 0, 0, .28);
}

body {
    color: var(--ui-ink);
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
[role='button'],
.menu-item {
    touch-action: manipulation;
}

.main-content {
    min-width: 0;
    padding: clamp(20px, 2.25vw, 36px);
}

.page-header,
.view {
    width: min(100%, var(--ui-content-max));
}

.page-header {
    gap: var(--ui-space-5);
}

.page-title {
    min-width: 0;
    line-height: 1.15;
}

#pageTitle {
    overflow-wrap: anywhere;
}

.user-menu,
.user-identity,
.user-actions {
    min-width: 0;
}

.card,
.dashboard-panel,
.metric-card,
.stat-card {
    border: 1px solid rgba(219, 227, 236, .75);
}

.card-title,
.module-header-copy .card-title {
    font-size: clamp(20px, 1.7vw, 25px);
    line-height: 1.2;
    letter-spacing: -.35px;
}

.module-header-copy {
    min-width: 0;
}

.module-header-copy p,
.card-subtitle {
    max-width: 72ch;
    line-height: 1.45;
}

.btn,
.btn-add,
.btn-secondary,
.btn-export,
.btn-logout {
    min-height: var(--ui-control-height);
    align-items: center;
    justify-content: center;
    line-height: 1.15;
}

.form-input,
.form-select,
.form-textarea,
.search-input {
    min-height: var(--ui-control-height);
    border-width: 1px;
    border-color: var(--ui-border);
    border-radius: var(--ui-radius-sm);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus {
    box-shadow: 0 0 0 4px var(--ui-focus);
}

.form-label,
.toolbar-label {
    line-height: 1.25;
}

.module-card > .module-toolbar,
.module-filter-panel,
.reservation-filters,
.damage-filters,
.reports-filter-panel {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius-md);
}

.reservation-filters,
.damage-filters {
    align-items: end;
}

.reservation-filters .form-group,
.damage-filters .form-group {
    min-width: 0;
}

.reservation-clear-filter {
    min-height: var(--ui-control-height);
}

.table-wrapper,
.report-table-wrapper {
    position: relative;
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-md);
    background: #fff;
    box-shadow: 0 7px 20px rgba(11, 28, 45, .045);
    overscroll-behavior-inline: contain;
    scrollbar-gutter: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper > table,
.report-table-wrapper > table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.table-wrapper > table thead,
.report-table-wrapper > table thead {
    background: linear-gradient(105deg, #0b1c2d 0%, #143750 100%);
}

.table-wrapper > table thead th,
.report-table-wrapper > table thead th {
    height: 48px;
    padding: 13px 16px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #f8fafc;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .38px;
    line-height: 1.25;
    white-space: nowrap;
}

.table-wrapper > table thead th + th,
.report-table-wrapper > table thead th + th {
    box-shadow: inset 1px 0 rgba(255, 255, 255, .035);
}

.table-wrapper > table thead th:first-child,
.report-table-wrapper > table thead th:first-child {
    border-top-left-radius: calc(var(--ui-radius-md) - 1px);
}

.table-wrapper > table thead th:last-child,
.report-table-wrapper > table thead th:last-child {
    border-top-right-radius: calc(var(--ui-radius-md) - 1px);
}

.table-wrapper > table tbody tr,
.report-table-wrapper > table tbody tr {
    background: #fff;
    transition: background-color .16s ease, box-shadow .16s ease;
}

.table-wrapper > table tbody tr:nth-child(even),
.report-table-wrapper > table tbody tr:nth-child(even) {
    background: #fbfcfe;
}

.table-wrapper > table tbody tr:hover,
.report-table-wrapper > table tbody tr:hover {
    background: #f4f7fa;
    box-shadow: inset 3px 0 #f57c00;
    transform: none;
}

.table-wrapper > table tbody td,
.report-table-wrapper > table tbody td {
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid #e8eef3;
    color: #26384a;
    font-size: 13px;
    line-height: 1.45;
}

.table-wrapper > table tbody tr:last-child td,
.report-table-wrapper > table tbody tr:last-child td {
    border-bottom: 0;
}

.table-wrapper > table tbody tr:has(.empty-state):hover,
.report-table-wrapper > table tbody tr:has(.empty-state):hover {
    background: inherit;
    box-shadow: none;
}

.table-wrapper > table td[colspan],
.report-table-wrapper > table td[colspan] {
    padding: 0;
}

.table-wrapper > table td[colspan] .empty-state,
.report-table-wrapper > table td[colspan] .empty-state {
    min-height: 190px;
    padding: 34px 20px;
    background: radial-gradient(circle at 50% 35%, #f4f7fa 0, #fff 52%);
}

.table-wrapper > table td[colspan] .empty-icon,
.report-table-wrapper > table td[colspan] .empty-icon {
    display: inline-flex;
    width: 52px;
    height: 52px;
    margin-bottom: 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe5ed;
    border-radius: 15px;
    background: #f8fafc;
    color: #f57c00;
    font-size: 20px;
    box-shadow: 0 7px 18px rgba(11, 28, 45, .055);
}

.table-wrapper > table td[colspan] .empty-text,
.report-table-wrapper > table td[colspan] .empty-text {
    color: #607286;
    font-size: 13px;
    font-weight: 750;
}

th,
td {
    vertical-align: middle;
}

th {
    line-height: 1.25;
}

html[data-theme='dark'] .table-wrapper,
html[data-theme='dark'] .report-table-wrapper {
    border-color: #30485a;
    background: #10202e;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}

html[data-theme='dark'] .table-wrapper > table thead,
html[data-theme='dark'] .report-table-wrapper > table thead {
    background: linear-gradient(105deg, #0b1c2d 0%, #173d58 100%);
}

html[data-theme='dark'] .table-wrapper > table tbody tr,
html[data-theme='dark'] .report-table-wrapper > table tbody tr {
    background: #10202e;
}

html[data-theme='dark'] .table-wrapper > table tbody tr:nth-child(even),
html[data-theme='dark'] .report-table-wrapper > table tbody tr:nth-child(even) {
    background: #122432;
}

html[data-theme='dark'] .table-wrapper > table tbody tr:hover,
html[data-theme='dark'] .report-table-wrapper > table tbody tr:hover {
    background: #182d3d;
}

html[data-theme='dark'] .table-wrapper > table tbody td,
html[data-theme='dark'] .report-table-wrapper > table tbody td {
    border-bottom-color: #263c4d;
    color: #dbe5ef;
}

html[data-theme='dark'] .table-wrapper > table td[colspan] .empty-state,
html[data-theme='dark'] .report-table-wrapper > table td[colspan] .empty-state {
    background: radial-gradient(circle at 50% 35%, #172d3e 0, #10202e 54%);
}

html[data-theme='dark'] .table-wrapper > table td[colspan] .empty-icon,
html[data-theme='dark'] .report-table-wrapper > table td[colspan] .empty-icon {
    border-color: #344d60;
    background: #172a39;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .16);
}

html[data-theme='dark'] .table-wrapper > table td[colspan] .empty-text,
html[data-theme='dark'] .report-table-wrapper > table td[colspan] .empty-text {
    color: #a9bac9;
}

.actions-column,
.action-buttons {
    white-space: nowrap;
}

.action-buttons {
    min-width: max-content;
}

.btn-action {
    flex: 0 0 auto;
}

.reservation-summary-grid,
.inventory-summary-grid,
.damage-summary-grid,
.reports-stats-grid,
.log-summary-grid {
    align-items: stretch;
}

.reservation-summary-card,
.inventory-summary-card,
.damage-summary-card,
.report-stat-card {
    min-width: 0;
    height: 100%;
}

.reservation-summary-card strong,
.inventory-summary-card strong,
.damage-summary-card strong,
.report-stat-card .stat-value {
    overflow-wrap: anywhere;
}

.modal-content {
    width: min(700px, calc(100vw - 32px));
}

.modal-wide {
    width: min(960px, calc(100vw - 32px));
}

@media (max-width: 1200px) {
    .main-content {
        padding: 24px;
    }

    .reservation-summary-grid,
    .inventory-summary-grid,
    .damage-summary-grid,
    .reports-stats-grid,
    .log-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-header {
        align-items: flex-start;
    }

    .user-name {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .module-card > .card-header,
    .analytics-page-card > .card-header {
        gap: var(--ui-space-4);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }

    .page-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        padding: 16px;
        margin-bottom: 18px;
    }

    .page-title,
    .user-menu {
        width: 100%;
    }

    .page-title {
        justify-content: flex-start;
    }

    .user-menu {
        justify-content: space-between;
        gap: var(--ui-space-3);
        padding-top: var(--ui-space-3);
        border-top: 1px solid var(--ui-border);
    }

    .user-actions {
        gap: var(--ui-space-2);
        padding-left: 0;
        border-left: 0;
    }

    .card,
    .dashboard-panel,
    .metric-card,
    .stat-card {
        border-radius: var(--ui-radius-md);
    }

    .module-card > .card-header,
    .analytics-page-card > .card-header {
        padding: 20px;
    }

    .module-card > .module-toolbar,
    .module-filter-panel,
    .reservation-filters,
    .damage-filters,
    .reports-filter-panel {
        margin-right: 20px;
        margin-left: 20px;
    }

    .materials-toolbar,
    .reservation-filters,
    .damage-filters,
    .inventory-filters,
    .reports-filter-grid,
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .reservation-clear-filter,
    .damage-filters .reservation-clear-filter {
        width: 100%;
    }

    .table-wrapper > table,
    .report-table-wrapper > table {
        min-width: 720px;
    }

    th,
    td {
        padding-right: 14px;
        padding-left: 14px;
    }

    .modal {
        padding: 16px;
    }

    .modal-content,
    .modal-wide {
        width: 100%;
        max-height: calc(100dvh - 32px);
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 12px;
    }

    .page-header {
        padding: 14px;
        border-radius: 14px;
    }

    .page-title {
        font-size: 21px;
    }

    .user-name {
        max-width: 112px;
        font-size: 14px;
    }

    .module-card > .card-header,
    .analytics-page-card > .card-header {
        padding: 18px 14px;
    }

    .module-card > .card-header,
    .reports-filter-header {
        align-items: stretch;
        flex-direction: column;
    }

    .module-card > .card-header .btn-add,
    .analytics-page-card > .card-header .btn-export,
    .reports-filter-actions,
    .reports-filter-actions > button {
        width: 100%;
    }

    .module-card > .module-toolbar,
    .module-filter-panel,
    .reservation-filters,
    .damage-filters,
    .reports-filter-panel {
        margin-right: 14px;
        margin-left: 14px;
        padding: 14px;
    }

    .reservation-summary-grid,
    .inventory-summary-grid,
    .damage-summary-grid,
    .reports-stats-grid,
    .log-summary-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .reservation-summary-card,
    .inventory-summary-card,
    .damage-summary-card,
    .report-stat-card {
        padding: 18px;
    }

    .damage-tabs {
        width: calc(100% - 28px);
        margin-right: 14px;
        margin-left: 14px;
    }

    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content,
    .modal-wide {
        width: 100%;
        max-height: 94dvh;
        border-radius: 20px 20px 0 0;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer > button {
        width: 100%;
    }
}

@media (max-width: 390px) {
    .user-avatar,
    .theme-toggle,
    .notification-button,
    .btn-logout,
    .mobile-menu-toggle {
        width: 38px;
        height: 38px;
        min-height: 38px;
    }

    .user-actions {
        gap: 6px;
    }

    .user-name {
        max-width: 92px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Surface, accent and focus refinement */
body {
    background-color: #eaf0f5;
    background-image:
        radial-gradient(circle at 8% 0, rgba(245, 124, 0, .065) 0, transparent 26rem),
        radial-gradient(circle at 92% 8%, rgba(32, 88, 124, .12) 0, transparent 36rem),
        linear-gradient(145deg, #eef3f7 0%, #e7eef4 52%, #e2eaf1 100%);
    background-attachment: fixed;
}

html[data-theme='dark'] body {
    background-color: #071522;
    background-image:
        radial-gradient(circle at 7% 0, rgba(245, 124, 0, .055) 0, transparent 27rem),
        radial-gradient(circle at 88% 4%, rgba(36, 91, 127, .22) 0, transparent 39rem),
        linear-gradient(145deg, #06121d 0%, #091927 48%, #0c2131 100%);
    background-attachment: fixed;
}

.page-header,
.module-card,
.analytics-page-card,
.card {
    border-color: rgba(187, 202, 214, .74);
    background-image: radial-gradient(circle at 100% 0, rgba(219, 231, 239, .34) 0, transparent 32rem);
}

html[data-theme='dark'] .page-header,
html[data-theme='dark'] .module-card,
html[data-theme='dark'] .analytics-page-card,
html[data-theme='dark'] .card {
    border-color: #2c4355;
    background-color: #10202e;
    background-image: radial-gradient(circle at 100% 0, rgba(31, 67, 91, .26) 0, transparent 34rem);
}

.module-card::after,
.analytics-page-card::after,
.modal-content::before {
    display: none;
}

.module-card,
.analytics-page-card {
    border-color: rgba(112, 146, 168, .5);
    box-shadow:
        0 0 0 1px rgba(145, 173, 191, .07),
        0 0 24px rgba(73, 116, 143, .055),
        0 14px 38px rgba(5, 18, 30, .11);
}

.modal > .modal-content {
    border-color: rgba(112, 146, 168, .56);
    box-shadow:
        0 0 0 1px rgba(145, 173, 191, .08),
        0 0 28px rgba(73, 116, 143, .07),
        0 26px 72px rgba(0, 0, 0, .32);
}

html[data-theme='dark'] .module-card,
html[data-theme='dark'] .analytics-page-card {
    border-color: rgba(65, 111, 137, .76);
    box-shadow:
        0 0 0 1px rgba(60, 102, 127, .1),
        0 0 26px rgba(44, 91, 119, .09),
        0 16px 42px rgba(0, 0, 0, .23);
}

html[data-theme='dark'] .modal > .modal-content {
    border-color: rgba(65, 111, 137, .8);
    box-shadow:
        0 0 0 1px rgba(60, 102, 127, .11),
        0 0 30px rgba(44, 91, 119, .1),
        0 28px 76px rgba(0, 0, 0, .48);
}

.module-card > .card-header,
.modal-header {
    background-image: radial-gradient(circle at 100% 0, rgba(218, 230, 238, .34) 0, transparent 30rem);
}

html[data-theme='dark'] .module-card > .card-header,
html[data-theme='dark'] .modal-header {
    background-color: #10202e;
    background-image: radial-gradient(circle at 100% 0, rgba(35, 75, 101, .28) 0, transparent 30rem);
}

:focus-visible {
    outline: 2px solid rgba(245, 124, 0, .42);
    outline-offset: 2px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus,
.modal-body .form-input:focus,
.modal-body .form-select:focus,
.modal-body .form-textarea:focus {
    outline: none;
    border-color: rgba(245, 124, 0, .82);
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(245, 124, 0, .12);
    transform: none;
}

.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.search-input:focus-visible {
    outline: none;
}

html[data-theme='dark'] .form-input:focus,
html[data-theme='dark'] .form-select:focus,
html[data-theme='dark'] .form-textarea:focus,
html[data-theme='dark'] .search-input:focus,
html[data-theme='dark'] .modal-body .form-input:focus,
html[data-theme='dark'] .modal-body .form-select:focus,
html[data-theme='dark'] .modal-body .form-textarea:focus {
    border-color: rgba(251, 146, 60, .88);
    background-color: #0e2130;
    box-shadow: 0 0 0 2px rgba(251, 146, 60, .14);
}

.table-wrapper:focus-within,
.report-table-wrapper:focus-within {
    border-color: color-mix(in srgb, #f57c00 30%, var(--ui-border));
    box-shadow: 0 7px 20px rgba(11, 28, 45, .045);
}

/* Sidebar refinement */
.sidebar {
    padding: 16px 14px 22px;
    border-right: 1px solid rgba(80, 119, 143, .34);
    background:
        radial-gradient(circle at 12% 5%, rgba(245, 124, 0, .055) 0, transparent 15rem),
        linear-gradient(180deg, #06131f 0%, #071824 48%, #081b29 100%);
    box-shadow: inset -1px 0 rgba(255, 255, 255, .025), 8px 0 28px rgba(0, 0, 0, .2);
    scrollbar-color: rgba(124, 154, 174, .46) transparent;
}

.sidebar-topbar {
    min-height: 36px;
    margin: 0 2px 10px;
    align-items: center;
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(123, 151, 170, .24);
    border-radius: 11px;
    background: rgba(19, 42, 57, .82);
    color: #b7c6d2;
    box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}

.sidebar-toggle:hover {
    border-color: rgba(245, 124, 0, .45);
    background: #172d3c;
    color: #fb923c;
    box-shadow: 0 7px 18px rgba(0, 0, 0, .18);
}

.logo-container {
    min-height: 88px;
    margin: 0 2px 8px;
    padding: 14px;
    gap: 12px;
    overflow: hidden;
    border: 1px solid rgba(72, 111, 136, .46);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0, rgba(245, 124, 0, .13) 0, transparent 9rem),
        linear-gradient(135deg, #102535 0%, #0c1e2c 100%);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .04);
}

.logo-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    background: linear-gradient(145deg, #ff8a1c, #e85c00);
    color: #fff;
    box-shadow: 0 7px 18px rgba(230, 81, 0, .24);
}

.logo-title { font-size: 18px; letter-spacing: -.35px; }
.logo-subtitle { margin-top: 4px; color: #9fb1c0; font-size: 9px; line-height: 1.35; letter-spacing: .65px; }

.menu-section { margin-top: 23px; }

.menu-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 9px;
    color: #718596;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.25px;
}

.menu-label::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, rgba(82, 115, 136, .34), transparent);
}

.menu-item {
    min-height: 46px;
    margin: 3px 0;
    padding: 6px 9px;
    gap: 10px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #aebdca;
    font-size: 13px;
    font-weight: 600;
    transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.menu-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(96, 129, 149, .14);
    border-radius: 10px;
    background: rgba(18, 40, 55, .7);
    color: #aebdca;
    font-size: 14px;
}

.menu-item:hover {
    border-color: rgba(80, 119, 143, .3);
    background: rgba(18, 43, 59, .74);
    color: #f1f5f9;
    transform: none;
}

.menu-item:hover .menu-icon {
    border-color: rgba(101, 139, 162, .27);
    background: #193448;
    color: #e6eef4;
}

.menu-item.active {
    border-color: rgba(245, 124, 0, .34);
    background:
        radial-gradient(circle at 100% 50%, rgba(245, 124, 0, .1) 0, transparent 9rem),
        linear-gradient(105deg, #153247 0%, #102839 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .035);
}

.menu-item.active::before {
    left: 0;
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: #f57c00;
    box-shadow: 0 0 10px rgba(245, 124, 0, .34);
}

.menu-item.active .menu-icon {
    border-color: rgba(245, 124, 0, .24);
    background: rgba(245, 124, 0, .12);
    color: #fb923c;
    filter: none;
    transform: none;
}

.menu-item::after {
    background: linear-gradient(105deg, transparent 34%, rgba(255, 255, 255, .055) 50%, transparent 66%);
}

.badge {
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border: 1px solid rgba(245, 124, 0, .18);
    border-radius: 999px;
    background: rgba(245, 124, 0, .1);
    color: #fb923c;
    font-size: 10px;
    line-height: 19px;
    text-align: center;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { border: 1px solid transparent; background: rgba(124, 154, 174, .42); background-clip: padding-box; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(151, 178, 195, .58); background-clip: padding-box; }

.app-wrapper.sidebar-collapsed .sidebar { padding: 16px 10px 22px; }
.app-wrapper.sidebar-collapsed .logo-container { min-height: 58px; margin-right: 0; margin-left: 0; padding: 8px; }
.app-wrapper.sidebar-collapsed .menu-section { margin-top: 20px; }
.app-wrapper.sidebar-collapsed .menu-item { min-height: 46px; padding: 6px; }
.app-wrapper.sidebar-collapsed .menu-icon { width: 32px; height: 32px; font-size: 14px; }
.app-wrapper.sidebar-collapsed .badge { right: 2px; top: 2px; min-width: 18px; height: 18px; padding: 0 4px; line-height: 16px; }

@media (max-width: 768px) {
    .sidebar,
    .app-wrapper.sidebar-collapsed .sidebar { padding: 16px 14px 22px; }
    .app-wrapper.sidebar-collapsed .logo-container { min-height: 88px; margin: 0 2px 8px; padding: 14px; }
    .app-wrapper.sidebar-collapsed .menu-section { margin-top: 23px; }
    .app-wrapper.sidebar-collapsed .menu-item { min-height: 46px; padding: 6px 9px; gap: 10px; }
    .app-wrapper.sidebar-collapsed .menu-icon { width: 32px; height: 32px; font-size: 14px; }
}

/* Official PlanetaJJ palette: red, graphite and white */
:root {
    --ui-brand: #d71920;
    --ui-brand-strong: #a90f16;
    --ui-ink: #17191d;
    --ui-muted: #656a73;
    --ui-surface: #ffffff;
    --ui-surface-soft: #f6f7f8;
    --ui-border: #d9dce1;
    --ui-focus: rgba(215, 25, 32, .14);
}

html[data-theme='dark'] {
    --ui-ink: #f7f7f8;
    --ui-muted: #a8adb5;
    --ui-surface: #15181d;
    --ui-surface-soft: #1a1e24;
    --ui-border: #30343b;
    --ui-focus: rgba(238, 52, 59, .17);
}

body {
    background-color: #f0f1f3;
    background-image: radial-gradient(circle at 8% 0, rgba(215, 25, 32, .055) 0, transparent 27rem), radial-gradient(circle at 92% 7%, rgba(30, 33, 38, .07) 0, transparent 38rem), linear-gradient(145deg, #f5f6f7 0%, #eff1f3 52%, #e9ebee 100%);
}

html[data-theme='dark'] body {
    background-color: #0b0d10;
    background-image: radial-gradient(circle at 7% 0, rgba(215, 25, 32, .075) 0, transparent 28rem), radial-gradient(circle at 90% 5%, rgba(90, 96, 106, .1) 0, transparent 40rem), linear-gradient(145deg, #090b0e 0%, #0e1115 48%, #12161b 100%);
}

.page-header,
.module-card,
.analytics-page-card,
.card {
    border-color: #d9dce1;
    background-color: #fff;
    background-image: radial-gradient(circle at 100% 0, rgba(215, 25, 32, .025) 0, transparent 32rem);
}

.module-card,
.analytics-page-card {
    border-color: rgba(215, 25, 32, .22);
    box-shadow: 0 0 0 1px rgba(215, 25, 32, .025), 0 0 24px rgba(215, 25, 32, .025), 0 14px 38px rgba(20, 22, 26, .1);
}

html[data-theme='dark'] .page-header,
html[data-theme='dark'] .module-card,
html[data-theme='dark'] .analytics-page-card,
html[data-theme='dark'] .card {
    border-color: #30343b;
    background-color: #15181d;
    background-image: radial-gradient(circle at 100% 0, rgba(215, 25, 32, .045) 0, transparent 34rem);
}

html[data-theme='dark'] .module-card,
html[data-theme='dark'] .analytics-page-card {
    border-color: rgba(215, 25, 32, .34);
    box-shadow: 0 0 0 1px rgba(215, 25, 32, .045), 0 0 28px rgba(215, 25, 32, .055), 0 16px 42px rgba(0, 0, 0, .28);
}

.module-card > .card-header,
.modal-header { border-color: #e2e4e7; background-color: #fff; background-image: radial-gradient(circle at 100% 0, rgba(215, 25, 32, .035) 0, transparent 30rem); }
html[data-theme='dark'] .module-card > .card-header,
html[data-theme='dark'] .modal-header { border-color: #2c3036; background-color: #171a1f; background-image: radial-gradient(circle at 100% 0, rgba(215, 25, 32, .055) 0, transparent 30rem); }

.sidebar { border-right-color: #292d33; background: radial-gradient(circle at 12% 5%, rgba(215, 25, 32, .075) 0, transparent 16rem), linear-gradient(180deg, #090b0f 0%, #0d1014 48%, #111419 100%); box-shadow: inset -1px 0 rgba(255, 255, 255, .025), 8px 0 28px rgba(0, 0, 0, .28); }
.sidebar-toggle { border-color: #30353d; background: rgba(28, 32, 38, .88); color: #b9bdc4; }
.sidebar-toggle:hover { border-color: rgba(215, 25, 32, .5); background: #211719; color: #f05257; }
.logo-container { border-color: #343941; background: radial-gradient(circle at 100% 0, rgba(215, 25, 32, .15) 0, transparent 10rem), linear-gradient(135deg, #191c21 0%, #111419 100%); }
.logo-icon { background: linear-gradient(145deg, #e3262d, #af1017); box-shadow: 0 7px 18px rgba(169, 15, 22, .28); }
.logo-subtitle { color: #a6aab1; }
.menu-label { color: #777c85; }
.menu-label::after { background: linear-gradient(90deg, rgba(105, 110, 119, .3), transparent); }
.menu-item { color: #b1b5bc; }
.menu-icon { border-color: rgba(105, 110, 119, .15); background: rgba(29, 33, 39, .74); color: #b8bcc3; }
.menu-item:hover { border-color: #343941; background: rgba(29, 33, 39, .86); color: #fff; }
.menu-item:hover .menu-icon { border-color: #41464f; background: #252a31; color: #fff; }
.menu-item.active { border-color: rgba(215, 25, 32, .4); background: radial-gradient(circle at 100% 50%, rgba(215, 25, 32, .13) 0, transparent 10rem), linear-gradient(105deg, #24282f 0%, #191d22 100%); box-shadow: 0 8px 20px rgba(0, 0, 0, .25), inset 0 1px rgba(255, 255, 255, .035); }
.menu-item.active::before { background: #d71920; box-shadow: 0 0 10px rgba(215, 25, 32, .4); }
.menu-item.active .menu-icon { border-color: rgba(215, 25, 32, .28); background: rgba(215, 25, 32, .13); color: #f05257; }
.badge { border-color: rgba(215, 25, 32, .22); background: rgba(215, 25, 32, .11); color: #f05257; }

:focus-visible { outline-color: rgba(215, 25, 32, .48); }
.form-input:focus, .form-select:focus, .form-textarea:focus, .search-input:focus,
.modal-body .form-input:focus, .modal-body .form-select:focus, .modal-body .form-textarea:focus { border-color: rgba(215, 25, 32, .82); box-shadow: 0 0 0 2px rgba(215, 25, 32, .12); }
html[data-theme='dark'] .form-input, html[data-theme='dark'] .form-select, html[data-theme='dark'] .form-textarea, html[data-theme='dark'] .search-input,
html[data-theme='dark'] .modal-body .form-input, html[data-theme='dark'] .modal-body .form-select, html[data-theme='dark'] .modal-body .form-textarea { border-color: #353a42; background-color: #111419; color: #f5f5f6; }
html[data-theme='dark'] .form-input:focus, html[data-theme='dark'] .form-select:focus, html[data-theme='dark'] .form-textarea:focus, html[data-theme='dark'] .search-input:focus,
html[data-theme='dark'] .modal-body .form-input:focus, html[data-theme='dark'] .modal-body .form-select:focus, html[data-theme='dark'] .modal-body .form-textarea:focus { border-color: rgba(238, 52, 59, .88); background-color: #171a1f; box-shadow: 0 0 0 2px rgba(238, 52, 59, .15); }

.btn-primary, .btn-add, .page-icon, .report-icon, .login-logo, .reservation-operation-notice > i { background: linear-gradient(135deg, #df2027 0%, #a90f16 100%); color: #fff; }
.btn-primary, .btn-add { box-shadow: 0 5px 15px rgba(169, 15, 22, .22); }
.btn-primary:hover, .btn-add:hover { box-shadow: 0 7px 20px rgba(169, 15, 22, .3); }
.btn-logout { border-color: #d71920; color: #d71920; }
.btn-logout:hover { border-color: #d71920; background: #d71920; color: #fff; }
html[data-theme='dark'] .btn-logout { border-color: #ee343b; color: #ee343b; }
html[data-theme='dark'] .btn-logout:hover { background: #d71920; color: #fff; }
.notification-button:hover, .notification-button[aria-expanded='true'], .theme-toggle:hover { border-color: rgba(215, 25, 32, .42); background: #fff1f2; color: #d71920; }
html[data-theme='dark'] .notification-button:hover, html[data-theme='dark'] .notification-button[aria-expanded='true'], html[data-theme='dark'] .theme-toggle:hover { border-color: rgba(238, 52, 59, .45); background: #281719; color: #f05257; }
.notification-button.has-notifications { color: #d71920; border-color: rgba(215, 25, 32, .34); }
.notification-unread-dot, .notification-badge { background: #d71920; }
.btn-report:hover, .btn-report.active, .quick-filter-btn:hover { border-color: #d71920; }
.btn-report.active { background: #fff1f2; box-shadow: 0 8px 22px rgba(169, 15, 22, .1); }
html[data-theme='dark'] .btn-report.active { border-color: #d71920; background: #281719; }
.chart-toggle-btn.active { background: #d71920; color: #fff; }
.dashboard-link { background: rgba(215, 25, 32, .08); color: #17191d; }
.dashboard-link:hover { border-color: rgba(215, 25, 32, .32); background: rgba(215, 25, 32, .12); }

.table-wrapper > table thead, .report-table-wrapper > table thead { background: linear-gradient(105deg, #17191d 0%, #292d33 100%); }
.table-wrapper > table tbody tr:hover, .report-table-wrapper > table tbody tr:hover { box-shadow: inset 3px 0 #d71920; }
.table-wrapper:focus-within, .report-table-wrapper:focus-within { border-color: color-mix(in srgb, #d71920 30%, var(--ui-border)); }
.table-wrapper > table td[colspan] .empty-icon, .report-table-wrapper > table td[colspan] .empty-icon { color: #d71920; }
html[data-theme='dark'] .table-wrapper, html[data-theme='dark'] .report-table-wrapper { border-color: #30343b; background: #15181d; }
html[data-theme='dark'] .table-wrapper > table thead, html[data-theme='dark'] .report-table-wrapper > table thead { background: linear-gradient(105deg, #111318 0%, #2a2e35 100%); }
html[data-theme='dark'] .table-wrapper > table tbody tr, html[data-theme='dark'] .report-table-wrapper > table tbody tr { background: #15181d; }
html[data-theme='dark'] .table-wrapper > table tbody tr:nth-child(even), html[data-theme='dark'] .report-table-wrapper > table tbody tr:nth-child(even) { background: #191c21; }
html[data-theme='dark'] .table-wrapper > table tbody tr:hover, html[data-theme='dark'] .report-table-wrapper > table tbody tr:hover { background: #20242a; }
html[data-theme='dark'] .table-wrapper > table tbody td, html[data-theme='dark'] .report-table-wrapper > table tbody td { border-bottom-color: #2b2f35; color: #e5e7eb; }

.modal > .modal-content { border-color: rgba(215, 25, 32, .24); box-shadow: 0 0 0 1px rgba(215, 25, 32, .025), 0 0 28px rgba(215, 25, 32, .035), 0 26px 72px rgba(0, 0, 0, .32); }
html[data-theme='dark'] .modal > .modal-content { border-color: rgba(215, 25, 32, .38); background: #15181d; box-shadow: 0 0 0 1px rgba(215, 25, 32, .05), 0 0 30px rgba(215, 25, 32, .065), 0 28px 76px rgba(0, 0, 0, .5); }
html[data-theme='dark'] .modal-body { background: #15181d; }
html[data-theme='dark'] .modal-footer { border-color: #2c3036; background: #101216; }
.modal-close:hover { border-color: rgba(215, 25, 32, .44); background: #fff1f2; color: #b51219; }
html[data-theme='dark'] .modal-close:hover { border-color: rgba(238, 52, 59, .48); background: #281719; color: #f05257; }
::selection { background: rgba(215, 25, 32, .22); color: #17191d; }

.login-subtitle,
.material-details-code,
.maintenance-material-summary > div:first-child span,
.maintenance-impact i,
.table-date-arrow,
.reservation-detail-code,
.reservation-detail-item b,
.reservation-operation-item b {
    color: #d71920;
}

input,
select,
textarea { caret-color: #d71920; }

.stat-card::before { background: linear-gradient(135deg, #d71920 0%, #a90f16 100%); }
.empty-icon { color: #d71920; }

.active-filter {
    border-color: #fecdd0;
    background: linear-gradient(135deg, #fff1f2 0%, #fff 100%);
    color: #8f1117;
    box-shadow: 0 8px 20px rgba(169, 15, 22, .055);
}

.active-filter span::before { color: #d71920; background: #ffe4e6; }
.active-filter button:hover { background: #d71920; }

.maintenance-action-tabs button.active {
    border-color: #d71920;
    background: #fff1f2;
    color: #a90f16;
    box-shadow: 0 8px 20px rgba(169, 15, 22, .08);
}

html[data-theme='dark'] .maintenance-action-tabs button.active {
    border-color: #d71920;
    background: #281719;
    color: #f05257;
}

.login-theme-toggle:hover { border-color: rgba(215, 25, 32, .42); background: rgba(215, 25, 32, .1); }
html[data-theme='dark'] .login-container::before { background: linear-gradient(90deg, transparent, rgba(215, 25, 32, .72), transparent); }
html[data-theme='dark'] .login-logo { box-shadow: 0 16px 36px rgba(169, 15, 22, .25); }
html[data-theme='dark'] .login-subtitle { color: #f05257; }

html[data-theme='dark'] .dashboard-link { background: rgba(215, 25, 32, .12); color: #f05257; }
html[data-theme='dark'] .dashboard-link:hover { border-color: rgba(238, 52, 59, .4); background: rgba(215, 25, 32, .18); color: #ffb4b7; }
html[data-theme='dark'] .quick-filter-btn:hover { border-color: #d71920; color: #f05257; }
