:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #f59e0b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #facc15;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    background: radial-gradient(circle at top left, rgba(15, 118, 110, .12), transparent 35%), var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

a { text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 270px;
    flex: 0 0 270px;
    background: linear-gradient(180deg, #062f2b 0%, #0f172a 100%);
    color: #fff;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 1.12rem;
    font-weight: 700;
    margin-bottom: 22px;
}
.brand img { width: 44px; height: 44px; }
.brand strong { color: #5eead4; }
.app-nav .nav-link {
    color: rgba(255,255,255,.82);
    padding: 11px 12px;
    border-radius: 14px;
    margin-bottom: 4px;
    font-weight: 650;
}
.app-nav .nav-link:hover,
.app-nav .nav-link.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}
.main-content { flex: 1; min-width: 0; }
.topbar {
    min-height: 82px;
    padding: 16px 24px;
    background: rgba(255,255,255,.86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.55rem; line-height: 1.1; font-weight: 750; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill,
.cash-pill {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}
.cash-open { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .35); color: #166534; }
.cash-closed { background: rgba(239, 68, 68, .10); border-color: rgba(239, 68, 68, .25); color: #991b1b; }
.content-area { padding: 24px; }
.card-soft {
    background: var(--surface);
    border: 1px solid rgba(229,231,235,.85);
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.metric-card { padding: 18px; min-height: 126px; }
.metric-card .label { color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.metric-card .value { font-size: 1.65rem; font-weight: 750; margin-top: 8px; }
.metric-card .hint { color: var(--muted); font-size: .86rem; }
.form-control, .form-select { border-radius: 14px; border-color: var(--border); min-height: 42px; }
.btn { border-radius: 14px; font-weight: 700; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.table { vertical-align: middle; }
.table thead th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.status-strip { border-left: 7px solid var(--border); }
.status-aguardando { border-left-color: #facc15; }
.status-em_lavagem { border-left-color: #2563eb; }
.status-finalizacao { border-left-color: #9333ea; }
.status-pronto { border-left-color: #22c55e; }
.status-entregue { border-left-color: #134e4a; }
.status-cancelado { border-left-color: #ef4444; }

/* Tabelas com ações compactas */
.servicos-list-card { overflow: hidden; }
.servicos-table-wrap {
    overflow-x: hidden !important;
    width: 100%;
}
.servicos-table {
    width: 100%;
    min-width: 0 !important;
    table-layout: fixed;
    margin-bottom: 0;
}
.servicos-table th,
.servicos-table td {
    padding: 7px 8px;
    line-height: 1.25;
}
.servicos-table thead th:nth-child(1) { width: 38%; }
.servicos-table thead th:nth-child(2) { width: 12%; }
.servicos-table thead th:nth-child(3) { width: 12%; }
.servicos-table thead th:nth-child(4) { width: 13%; }
.servicos-table thead th:nth-child(5) { width: 12%; }
.servicos-table thead th:nth-child(6) { width: 13%; }
.servicos-table .servico-info strong {
    display: block;
    line-height: 1.2;
}
.servicos-table .servico-info small {
    display: block;
    margin-top: 2px;
    line-height: 1.25;
}
.mini-actions {
    display: inline-flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}
.mini-actions-vertical {
    flex-direction: column;
    width: 74px;
}
.btn-mini-action {
    min-height: 28px;
    padding: 4px 6px;
    border-radius: 9px;
    font-size: .72rem;
    line-height: 1.05;
}
.mini-actions form { display: block; width: 100%; }
.mini-actions form .btn { white-space: nowrap; width: 100%; }
.servicos-actions { width: 82px; }
.os-card-title { font-size: 1rem; font-weight: 750; }
.small-muted { color: var(--muted); font-size: .86rem; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.service-check {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    background: #fff;
    height: 100%;
}
.service-check:hover { border-color: rgba(15, 118, 110, .45); }
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 20% 15%, rgba(94, 234, 212, .35), transparent 28%), linear-gradient(135deg, #052e2b 0%, #0f172a 100%);
}
.login-card {
    max-width: 430px;
    width: 100%;
    background: rgba(255,255,255,.96);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,.22);
    padding: 30px;
}
.login-logo { width: 72px; height: 72px; display: block; margin: 0 auto 14px; }
.receipt {
    max-width: 320px;
    margin: 0 auto;
    color: #000;
    background: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}
.receipt h1 { font-size: 17px; text-align: center; margin: 0 0 8px; }
.receipt .line { border-top: 1px dashed #000; margin: 8px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 2px 0; vertical-align: top; }
.receipt .right { text-align: right; }
.no-print { display: block; }

@media print {
    @page { size: 58mm auto; margin: 4mm; }
    body { background: #fff; }
    .no-print, .sidebar, .topbar, .sidebar-backdrop { display: none !important; }
    .app-shell, .main-content, .content-area { display: block; padding: 0; margin: 0; min-height: auto; }
    .receipt { max-width: 58mm; width: 58mm; box-shadow: none; }
}

.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    body { font-size: 14px; }
    .sidebar {
        position: fixed;
        z-index: 1000;
        left: -285px;
        transition: left .22s ease;
        height: 100dvh;
    }
    body.sidebar-open .sidebar { left: 0; }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .45);
        z-index: 999;
    }
    .main-content { width: 100%; }
    .topbar {
        padding: 12px 14px;
        align-items: flex-start;
        gap: 10px;
    }
    .topbar h1 { font-size: 1.18rem; }
    .topbar-actions { gap: 6px; }
    .user-pill { display: none; }
    .cash-pill { font-size: .76rem; padding: 6px 9px; }
    .content-area { padding: 14px; }
    .card-soft { border-radius: 18px; }
    .metric-card .value { font-size: 1.35rem; }
    .table-responsive { border-radius: 16px; }
    .mobile-stack .btn { width: 100%; }
}



@media (max-width: 767.98px) {
    .servicos-page,
    .servicos-page > [class*="col-"] {
        max-width: 100%;
        overflow-x: hidden;
    }

    .servicos-table-wrap {
        overflow-x: hidden !important;
        width: 100%;
    }

    .servicos-mobile-cards,
    .servicos-mobile-cards thead,
    .servicos-mobile-cards tbody,
    .servicos-mobile-cards tr,
    .servicos-mobile-cards th,
    .servicos-mobile-cards td {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .servicos-mobile-cards {
        min-width: 0 !important;
        table-layout: auto;
        margin-bottom: 0;
    }

    .servicos-mobile-cards thead {
        display: none;
    }

    .servicos-mobile-cards tbody {
        display: grid;
        gap: 10px;
    }

    .servicos-mobile-cards tr {
        border: 1px solid var(--border);
        border-radius: 14px;
        background: #fff;
        padding: 8px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
        overflow: hidden;
    }

    .servicos-mobile-cards td {
        border: 0 !important;
        padding: 4px 0 !important;
        font-size: .8rem;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .servicos-mobile-cards td:not(:first-child):not(.servicos-actions) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        border-top: 1px dashed rgba(229, 231, 235, .9) !important;
        padding-top: 5px !important;
    }

    .servicos-mobile-cards td:not(:first-child):not(.servicos-actions)::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .04em;
        text-transform: uppercase;
        flex: 0 0 auto;
    }

    .servicos-mobile-cards td:first-child strong {
        display: block;
        font-size: .9rem;
        line-height: 1.15;
        word-break: break-word;
    }

    .servicos-mobile-cards td:first-child small {
        display: block;
        font-size: .72rem;
        line-height: 1.2;
        margin-top: 3px;
    }

    .servicos-actions {
        width: 100% !important;
        min-width: 0;
        padding-top: 8px !important;
        text-align: left !important;
    }

    .servicos-actions::before {
        display: none;
    }

    .mini-actions {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 5px;
        width: 100%;
        white-space: normal;
    }

    .mini-actions form {
        width: 100%;
        display: block;
    }

    .btn-mini-action {
        width: 100%;
        min-height: 28px;
        padding: 4px 6px;
        border-radius: 9px;
        font-size: .7rem;
        line-height: 1.05;
        white-space: nowrap;
    }
}

.btn {
    max-height: fit-content;
    padding-top: 7px;
}
