:root {
    --gold: #b8860b;
    --gold-light: #d9a520;
    --gold-soft: #f8e7b5;
    --cream: #fffaf0;
    --cream-2: #f7f0df;
    --white: #ffffff;
    --text: #1f1f1f;
    --muted: #6f6f6f;
    --danger: #c62828;
    --danger-soft: #fff1f1;
    --success: #2e7d32;
    --warning: #d18a00;
    --warning-soft: #fff7df;
    --border: #ead8a4;
    --shadow: 0 10px 28px rgba(97, 68, 12, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(218, 165, 32, 0.14), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #fffaf0 45%, #f6edd8 100%);
    color: var(--text);
    overflow: hidden;
}

.dashboard {
    width: 100vw;
    height: 100vh;
    padding: 16px;
    display: grid;
    grid-template-rows: 100px minmax(0, 1fr) 110px;
    gap: 12px;
}

/* HEADER */

.top-header {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 0.9fr 1.1fr 0.95fr;
    gap: 12px;
    align-items: center;
    min-height: 0;
}

.brand-area,
.header-card {
    height: 100%;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(184, 134, 11, 0.18);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.brand-area {
    display: flex;
    align-items: center;
    padding: 8px 18px;
}

.brand-logo {
    max-width: 100%;
    max-height: 72px;
    object-fit: contain;
}

.header-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    overflow: hidden;
}

.icon-cp {
    color: var(--gold);
    font-size: 20px;
}

.icon-box,
.header-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #fff4c8, #ffffff);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 6px rgba(184,134,11,0.18);
}

.header-label {
    display: block;
    font-size: 11px;
    font-weight: 900;
    color: var(--muted);
    letter-spacing: 0.5px;
}

.header-card strong {
    display: block;
    font-size: 24px;
    line-height: 1;
    color: #222;
    white-space: nowrap;
}

.header-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.status-card strong {
    color: var(--gold);
    font-size: 27px;
}

/* MAIN */

.main-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: 21% 79%;
    gap: 12px;
}

/* PANELS */

.summary-panel,
.services-panel,
.alerts-panel,
.last-dispatch-panel {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(184, 134, 11, 0.22);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* SUMMARY */

.summary-panel {
    min-height: 0;
}

.panel-title {
    height: 42px;
    background: linear-gradient(90deg, #fff6d8, #ffffff);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: var(--gold);
}

.panel-title h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 900;
}

.summary-kpi {
    margin: 8px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    display: grid;
    grid-template-columns: 46px 1fr 50px;
    align-items: center;
    background: linear-gradient(135deg, #ffffff, #fff9e9);
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon .icon-cp {
    font-size: 18px;
}

.kpi-info span {
    display: block;
    font-size: 12px;
    font-weight: 900;
}

.kpi-info strong {
    display: block;
    font-size: 32px;
    line-height: 0.95;
    color: var(--gold);
    letter-spacing: -1px;
}

.kpi-info small {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}

.circle-meter {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 5px solid var(--gold-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    background: white;
}

.circle-meter.progress {
    border-color: var(--gold);
}

.circle-meter.warning {
    border-color: var(--warning);
}

/* MEAL SUMMARY */

.meal-summary {
    margin: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: white;
}

.meal-summary h3 {
    margin: 0;
    padding: 8px 10px;
    background: linear-gradient(90deg, var(--gold-light), #fff4c8);
    color: #5a3900;
    font-size: 13px;
    font-weight: 900;
}

.meal-table-header,
.meal-row {
    display: grid;
    grid-template-columns: 1.5fr 0.75fr 0.75fr 0.75fr;
    gap: 4px;
    align-items: center;
}

.meal-table-header {
    padding: 7px 9px;
    font-size: 9px;
    font-weight: 900;
    color: #444;
    border-bottom: 1px solid #eee0b9;
}

.meal-table-header span:nth-child(5),
.meal-row span:nth-child(5) {
    display: none;
}

.meal-row {
    padding: 8px 9px;
    border-bottom: 1px solid #f1e4c0;
    font-size: 12px;
    font-weight: 800;
}

.meal-row:last-child {
    border-bottom: none;
}

.meal-type-name {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.meal-type-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-progress {
    grid-column: 1 / 5;
    height: 7px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
}

.meal-progress > div {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 999px;
}

/* SERVICES */

.services-panel {
    display: grid;
    grid-template-rows: 48px 38px minmax(0, 1fr) 26px;
    min-height: 0;
}

.services-header {
    background: linear-gradient(90deg, #fff7df, #ffffff);
    border-bottom: 1px solid var(--border);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
}

.services-header > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.services-header h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 900;
}

.sort-label {
    font-size: 12px;
    font-weight: 900;
    color: #705000;
}

.services-table-header {
    display: grid;
    grid-template-columns: 72px 1.95fr 1fr 0.62fr 0.75fr 0.75fr 0.95fr 1.15fr;
    align-items: center;
    padding: 0 12px;
    background: #fffaf0;
    border-bottom: 1px solid #ead8a4;
    font-size: 11px;
    font-weight: 900;
    color: #4a4a4a;
}

.services-list {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 4px 12px;
    min-height: 0;
    scroll-behavior: smooth;
}

.services-list::-webkit-scrollbar {
    width: 10px;
}

.services-list::-webkit-scrollbar-track {
    background: #fff4d4;
    border-radius: 10px;
}

.services-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    border-radius: 10px;
}

.service-row {
    min-height: 88px;
    display: grid;
    grid-template-columns: 72px 1.95fr 1fr 0.62fr 0.75fr 0.75fr 0.95fr 1.15fr;
    align-items: center;
    border: 1px solid var(--border);
    border-left: 7px solid var(--gold);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    margin-bottom: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(184, 134, 11, 0.18);
}

.priority {
    height: 100%;
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    font-weight: 900;
}

.priority strong {
    font-size: 27px;
    line-height: 1;
}

.priority span {
    font-size: 9px;
    margin-top: 4px;
}

.cell {
    padding: 0 10px;
    border-right: 1px solid #f0e1b8;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.cell:last-child {
    border-right: none;
}

.customer-name {
    font-size: 21px;
    font-weight: 900;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contract-name {
    font-size: 17px;
    font-weight: 900;
    color: var(--gold);
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meal-icon {
    font-size: 18px;
    margin-bottom: 5px;
    opacity: 0.9;
}

.meal-name {
    width: fit-content;
    max-width: 100%;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6f6f6f;
    background: rgba(184,134,11,0.12);
    padding: 4px 8px;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.number-cell {
    font-size: 27px;
    font-weight: 900;
    text-align: center;
}

.dispatched {
    color: var(--success);
}

.pending-ok {
    color: var(--success);
}

.pending-bad {
    color: var(--danger);
}

.pending-warning {
    color: var(--warning);
}

.pending-sub {
    display: block;
    font-size: 9px;
    font-weight: 900;
    margin-top: 3px;
}

.last-dispatch-time {
    font-size: 16px;
    font-weight: 900;
}

.last-dispatch-date {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.action-buttons button,
.dispatch-main-btn {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 900;
    font-size: 13px;
    transition: all 0.15s ease;
}

.action-buttons button {
    height: 29px;
    background: linear-gradient(180deg, #fff5c7, var(--gold-light));
    color: #4c3300;
    border: 1px solid #d7a019;
}

.dispatch-main-btn {
    grid-column: 1 / 4;
    height: 34px;
    margin-top: 6px;
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    color: white;
}

.dispatch-main-btn i {
    margin-right: 6px;
}

.action-buttons button:hover,
.dispatch-main-btn:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.action-buttons button:active,
.dispatch-main-btn:active {
    transform: scale(0.97);
}

.services-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 12px;
    font-weight: 900;
}

/* FOOTER */

.bottom-area {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 12px;
    min-height: 0;
}

.alerts-panel {
    display: grid;
    grid-template-columns: 120px 1fr;
}

.alerts-title {
    background: linear-gradient(180deg, #fff3ca, #ffffff);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 34px;
}

.alerts-title strong {
    margin-top: 5px;
    font-size: 16px;
    line-height: 1.05;
    text-align: center;
}

.alerts-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
}

.alert-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    overflow: hidden;
}

.alert-card.danger {
    border-color: #efb4b4;
    background: var(--danger-soft);
}

.alert-card.warning {
    border-color: #efd79a;
    background: var(--warning-soft);
}

.alert-card .icon {
    font-size: 24px;
    color: var(--gold);
}

.alert-card strong {
    display: block;
    font-size: 15px;
}

.alert-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

/* LAST DISPATCH */

.last-dispatch-panel {
    padding: 12px 16px;
    position: relative;
}

.last-dispatch-panel h3 {
    margin: 0 0 7px 0;
    color: var(--gold);
    font-size: 16px;
}

.last-dispatch-item {
    display: grid;
    grid-template-columns: 56px 1fr 78px;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    padding: 3px 0;
    border-bottom: 1px solid #f0e3c0;
}

.last-dispatch-item strong {
    color: #222;
}

.last-dispatch-item span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.last-dispatch-item span:last-child {
    text-align: right;
    font-weight: 900;
    color: var(--gold);
}

/* TOAST */

.toast {
    position: fixed;
    right: 30px;
    bottom: 30px;
    background: #222;
    color: white;
    padding: 16px 22px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    z-index: 999;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.hidden {
    display: none;
}

/* TV 65 INCH OPTIMIZATION */

@media (min-width: 1800px) {
    .dashboard {
        padding: 18px;
        grid-template-rows: 105px minmax(0, 1fr) 120px;
    }

    .service-row {
        min-height: 94px;
    }

    .services-header h2 {
        font-size: 21px;
    }

    .customer-name {
        font-size: 23px;
    }

    .contract-name {
        font-size: 19px;
    }

    .meal-name {
        font-size: 13px;
    }

    .number-cell {
        font-size: 30px;
    }
}