:root {
    --color-primary: #e1261c;
    --color-dark: #1f1a17;
    --color-background: #f7f7f7;
    --color-card: #ffffff;
    --color-border: #e6e6e6;
    --color-text: #312a26;
    --color-muted: #6c6661;
    --color-success: #2d8a52;
    --color-warning: #c98518;
    --shadow-soft: 0 16px 40px rgba(31, 26, 23, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--color-text);
    background: linear-gradient(180deg, #fbfbfb 0%, var(--color-background) 100%);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.9rem 0.85rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); }
.table-wrap { overflow-x: auto; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    background: #fff;
    color: var(--color-text);
}
textarea { resize: vertical; }
label { display: block; margin-bottom: 0.45rem; font-weight: 600; }
.public-body { min-height: 100vh; }
.public-shell, .app-shell { min-height: 100vh; }
.public-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.public-card, .login-card {
    width: min(960px, 100%);
    background: var(--color-card);
    border: 1px solid rgba(225, 38, 28, 0.08);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 2rem;
}
.public-card.compact, .login-card { width: min(480px, 100%); }
.public-card-header { margin-bottom: 1.5rem; }
.eyebrow {
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.muted { color: var(--color-muted); }
.small { font-size: 0.88rem; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}
.field.full-width, .full-width { grid-column: 1 / -1; }
.honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }
.button-primary, .button-secondary, .link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 0;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    cursor: pointer;
}
.button-primary { background: var(--color-primary); color: #fff; }
.button-secondary {
    background: #fff;
    color: var(--color-dark);
    border: 1px solid var(--color-border);
}
.link-button { background: transparent; color: var(--color-primary); padding: 0; }
.small-button { padding: 0.55rem 0.95rem; font-size: 0.9rem; }
.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
    background: var(--color-dark);
    color: #f6f1ef;
    padding: 1.8rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;
}
.brand-mark {
    margin-bottom: 0.65rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 241, 239, 0.94) 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    padding: 0.9rem 1rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 24px rgba(0, 0, 0, 0.18);
}
.brand-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
    object-fit: contain;
    filter: none;
}
.brand-subtitle { color: rgba(255, 255, 255, 0.72); margin-bottom: 0; }
.sidebar-nav { display: grid; gap: 0.35rem; }
.sidebar-nav a {
    padding: 0.8rem 0.9rem;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.78);
}
.sidebar-nav a.active, .sidebar-nav a:hover { background: rgba(225, 38, 28, 0.16); color: #fff; }
.sidebar-nav a.nav-placeholder { color: rgba(255, 255, 255, 0.48); }
.sidebar-nav a.nav-placeholder:not(.active):hover { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.72); }
.sidebar-footer {
    margin-top: auto;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}
.main-content { padding: 2rem; }
.page-header { margin-bottom: 1.5rem; }
.panel, .stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}
.panel { padding: 1.25rem; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.tight-header {
    margin-bottom: 0.55rem;
}
.tight-header label {
    margin-bottom: 0;
}
.page-header-flex, .actions-row, .form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}
.compact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { padding: 1rem 1.15rem; min-height: 124px; }
.stat-card strong { display: block; font-size: 1.8rem; margin-top: 0.35rem; }
.stat-card.accent { border-color: rgba(225, 38, 28, 0.24); }
.stat-card.wide { grid-column: span 2; }
.filters, .split-layout {
    display: grid;
    gap: 1rem;
}
.filters {
    grid-template-columns: 220px 240px minmax(0, 1fr) auto;
    align-items: end;
}
.calendar-filters,
.calendar-list-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.calendar-filters-shell {
    display: grid;
    gap: 0.85rem;
}
.calendar-filters-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 0.85rem;
    align-items: end;
}
.calendar-field label {
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.calendar-field input,
.calendar-field select {
    min-height: 42px;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
}
.calendar-filter-actions {
    align-self: end;
}
.calendar-advanced-filters {
    border-top: 1px solid var(--color-border);
    padding-top: 0.85rem;
}
.calendar-advanced-filters summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--color-dark);
}
.calendar-advanced-grid {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 0.85rem;
    align-items: start;
}
.calendar-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
}
.calendar-chip {
    cursor: pointer;
}
.calendar-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.calendar-chip span {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}
.calendar-chip input:checked + span {
    border-color: rgba(225, 38, 28, 0.24);
    background: rgba(225, 38, 28, 0.08);
    color: var(--color-primary);
}
.view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
}
.view-switcher-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    font-weight: 700;
    color: var(--color-dark);
}
.view-switcher-link.is-active {
    background: var(--color-primary);
    color: #fff;
}
.calendar-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(300px, 0.8fr);
    gap: 1rem;
    align-items: start;
}
.calendar-main {
    min-width: 0;
}
.calendar-side-panel {
    top: 2rem;
    max-height: calc(100vh - 3rem);
    overflow: auto;
}
.calendar-job-panel {
    min-height: 220px;
}
.calendar-panel-card h2 {
    margin-bottom: 0;
}
.calendar-inline-panel {
    margin: 1rem 0;
}
.filters-simple { grid-template-columns: minmax(0, 1fr) auto; }
.grow { min-width: 0; }
.filter-actions { padding-bottom: 0.1rem; }
.split-layout { grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr); align-items: start; }
.side-panel { min-height: 320px; position: sticky; top: 1.5rem; }
.detail-meta { display: grid; gap: 0.7rem; margin-bottom: 1.25rem; font-size: 0.95rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.2rem; }
.drawer-meta { gap: 0.8rem; }
.drawer-status-line {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.95fr);
    gap: 1rem;
    align-items: start;
}
.dashboard-kpis .stat-card span { display: block; min-height: 2.4em; }
.dashboard-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.compact-summary-panel { margin-bottom: 1rem; }
.compact-summary-header { margin-bottom: 0.75rem; }
.compact-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}
.compact-metrics div {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, #fff 0%, #fbfbfb 100%);
}
.compact-metrics span {
    display: block;
    color: var(--color-muted);
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.compact-metrics strong {
    font-size: 1.15rem;
}
.compact-list { gap: 0.7rem; }
.line-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.line-card h2 {
    margin-bottom: 0.55rem;
}
.line-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}
.compact-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: #fcfcfc;
}
.compact-list-meta {
    display: grid;
    gap: 0.35rem;
    justify-items: end;
}
.inline-hint {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    color: var(--color-muted);
    font-size: 0.92rem;
}
.offer-workflow-shell {
    width: min(1180px, 100%);
}
.offer-page-header {
    display: grid;
    gap: 1rem;
}
.offer-page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.summary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}
.summary-chip {
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: linear-gradient(180deg, #fff 0%, #fcfbfb 100%);
}
.summary-chip span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--color-muted);
    font-size: 0.82rem;
}
.summary-chip strong {
    font-size: 1rem;
}
.offer-total-emphasis {
    color: var(--color-primary);
    font-size: 1.15rem;
}
.offer-card {
    padding: 1.35rem 1.5rem;
}
.seat-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0.75rem;
    margin-bottom: 1.25rem;
}
.seat-map-shell {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}
.seat-map-grid {
    display: grid;
    gap: 0.8rem;
}
.seat-map-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}
.seat-map-row-label {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    background: #f7f5f4;
    color: var(--color-muted);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.85rem 0.6rem;
}
.seat-map-row-cells {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.6rem;
}
.seat-cell {
    min-height: 92px;
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
    padding: 0.75rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    justify-content: space-between;
}
.seat-cell strong {
    font-size: 1rem;
}
.seat-cell span {
    color: var(--color-muted);
    font-size: 0.82rem;
}
.seat-cell form {
    margin-top: auto;
}
.seat-cell-available {
    border-color: rgba(45, 138, 82, 0.28);
    background: linear-gradient(180deg, rgba(45, 138, 82, 0.08) 0%, #ffffff 100%);
}
.seat-cell-blocked {
    border-color: rgba(117, 109, 105, 0.28);
    background: linear-gradient(180deg, rgba(117, 109, 105, 0.12) 0%, #ffffff 100%);
}
.seat-cell-reserved {
    border-color: rgba(201, 133, 24, 0.28);
    background: linear-gradient(180deg, rgba(201, 133, 24, 0.14) 0%, #ffffff 100%);
}
.seat-cell-occupied {
    border-color: rgba(31, 26, 23, 0.28);
    background: linear-gradient(180deg, rgba(31, 26, 23, 0.18) 0%, #ffffff 100%);
}
.seat-cell-layout {
    border-color: rgba(225, 38, 28, 0.16);
}
.seat-cell-aisle,
.seat-cell-empty {
    background: transparent;
    border-style: dashed;
    min-height: 92px;
}
.seat-cell-driver {
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(31, 26, 23, 0.08) 0%, #ffffff 100%);
}
.offer-form-layout {
    gap: 1.25rem;
}
.customer-mode-switch {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.mode-pill {
    cursor: pointer;
}
.mode-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mode-pill span {
    display: inline-flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
}
.mode-pill input:checked + span {
    border-color: rgba(225, 38, 28, 0.24);
    background: rgba(225, 38, 28, 0.08);
    color: var(--color-primary);
}
.mode-panel[hidden] {
    display: none !important;
}
.inline-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}
.offer-snapshot {
    margin-bottom: 1rem;
}
#transport-edit-fields.is-collapsed {
    display: none;
}
.offer-actions {
    justify-content: flex-start;
}
.offer-actions-grid {
    align-items: stretch;
}
.offer-price-grid {
    align-items: start;
}
.offer-total-card {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(225, 38, 28, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff8f7 0%, #ffffff 100%);
}
.offer-total-card span {
    display: block;
    color: var(--color-muted);
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}
.offer-total-card strong {
    color: var(--color-primary);
    font-size: 1.35rem;
}
.inquiry-offer-panel {
    margin-bottom: 1rem;
}
.inline-action-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #f1efee;
    color: var(--color-dark);
    font-weight: 700;
    font-size: 0.8rem;
}
.status-new { background: rgba(225, 38, 28, 0.12); color: var(--color-primary); }
.status-in_review, .status-priced, .status-offer_sent, .status-scheduled { background: rgba(201, 133, 24, 0.14); color: #8a5a11; }
.status-draft, .status-generated, .status-sent, .status-issued { background: rgba(201, 133, 24, 0.14); color: #8a5a11; }
.status-accepted, .status-invoiced, .status-completed, .status-paid { background: rgba(45, 138, 82, 0.12); color: var(--color-success); }
.status-rejected, .status-cancelled, .status-expired { background: #efebea; color: #756d69; }
.is-new { background: rgba(225, 38, 28, 0.018); }
.empty-state, .empty-panel { color: var(--color-muted); padding: 1rem 0; }
.stack { display: grid; gap: 1rem; }
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(31, 26, 23, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 20;
}
.drawer-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.drawer-panel {
    position: fixed;
    top: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: min(560px, calc(100vw - 2rem));
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 28px;
    box-shadow: 0 28px 64px rgba(31, 26, 23, 0.18);
    padding: 1.25rem;
    overflow-y: auto;
    transform: translateX(calc(100% + 1rem));
    transition: transform 0.22s ease;
    z-index: 30;
}
.drawer-panel.is-open {
    transform: translateX(0);
}
.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.drawer-actions { justify-content: flex-start; }
.drawer-empty { padding-top: 4rem; }
.messages { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.message {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: #f3f7f2;
    border: 1px solid #d9eadb;
}
.checkbox-field label { display: inline-flex; align-items: center; gap: 0.5rem; }
.checkbox-field input { width: auto; }
.pdf-preview-panel { overflow: auto; }
.error { color: #b42318; font-size: 0.88rem; margin-top: 0.35rem; }
.error-list { display: grid; gap: 0.5rem; }
.info-panel { border-left: 4px solid var(--color-primary); }
.warning-panel {
    border-left: 4px solid var(--color-warning);
    background: #fff9f2;
    border-color: rgba(201, 133, 24, 0.28);
}
.summary-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}
.form-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}
.plain-list {
    display: grid;
    gap: 0.55rem;
}
.plain-list div {
    min-width: 0;
}
.inline-muted {
    color: var(--color-muted);
    font-size: 0.9rem;
}
.formset-grid {
    display: grid;
    gap: 1rem;
}
.formset-item {
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 1rem;
    background: linear-gradient(180deg, #fff 0%, #fcfbfb 100%);
}
.detail-table {
    width: 100%;
}
.badge-overdue {
    background: rgba(225, 38, 28, 0.12);
    color: var(--color-primary);
}
.calendar-panel {
    padding: 1rem;
}
#operations-calendar {
    min-height: 620px;
}
.fc .fc-toolbar-title {
    font-size: 1.35rem;
    font-weight: 700;
}
.fc .fc-button {
    background: var(--color-dark);
    border-color: var(--color-dark);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.fc .fc-button-primary:disabled {
    opacity: 0.6;
}
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-timegrid-slot-label-cushion,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
    color: var(--color-text);
}
.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
    border-color: var(--color-border);
}
.fc .fc-list-event:hover td,
.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
    cursor: pointer;
}
.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
    border-radius: 10px;
    font-size: 0.82rem;
}
.fc .fc-event-main {
    padding: 0.08rem 0.15rem;
}
.fc .event-conflict {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.fc .event-missing-resource {
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0.16) 75%, transparent 75%, transparent);
    background-size: 10px 10px;
}
.fc .event-completed {
    opacity: 0.8;
}
.table-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}
.row-conflict {
    background: rgba(225, 38, 28, 0.04);
}

@media (max-width: 1080px) {
    .app-shell, .split-layout, .stats-grid, .filters, .form-grid, .compact-grid, .dashboard-grid, .compact-metrics, .summary-strip, .summary-grid-4, .form-section-grid, .calendar-filters, .calendar-list-filters, .calendar-filters-row, .calendar-advanced-grid, .calendar-workspace, .line-card-grid {
        grid-template-columns: 1fr;
    }
    .seat-map-row {
        grid-template-columns: 1fr;
    }
    .sidebar { position: static; }
    .side-panel { position: static; }
    .calendar-side-panel {
        max-height: none;
    }
    .drawer-panel {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 88vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        transform: translateY(100%);
    }
    .drawer-panel.is-open {
        transform: translateY(0);
    }
    .offer-card {
        padding: 1.25rem;
    }
}

@media (max-width: 720px) {
    .detail-grid,
    .seat-summary-strip,
    .seat-map-row-cells {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 1.1rem;
    }
}
