/* Paletas copiadas de dcdt-app (Components/Theme/AppTheme.cs y Layout/AuthLayout.razor). */
.brand-dcdt {
    --primary: #1E5FB8; --primary-dark: #1A4F99; --primary-light: #2B7FD9; --secondary: #52C41A;
    --bg: #F6F8FB; --text: #1F2937; --text-2: #4B5563; --lines: #E5E7EB;
    --auth-bg: linear-gradient(165deg, #0d47a1 0%, #1565c0 42%, #e3f2fd 42%, #f5f7fb 100%);
}
.brand-heru {
    --primary: #0D9488; --primary-dark: #0F766E; --primary-light: #2DD4BF; --secondary: #10B981;
    --bg: #F1F5F9; --text: #1E293B; --text-2: #64748B; --lines: #E2E8F0;
    --auth-bg: linear-gradient(165deg, #0f766e 0%, #0d9488 42%, #ccfbf1 42%, #f1f5f9 100%);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); }

/* Barra superior (como MudAppBar dense + Color.Primary) */
.appbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; background: var(--primary); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.appbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.appbar-brand .long-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emg-chip { display: inline-block; background: #FBBF24; color: #422006; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.logout { display: flex; gap: 12px; align-items: center; margin: 0; }
.logout .user { opacity: .9; }
.appbar-btn { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 5px 12px; font: inherit; cursor: pointer; }
.appbar-btn:hover { background: rgba(255,255,255,.25); }
.banner { background: #FFF4E5; color: #663C00; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #FFE0B2; }
.content { max-width: 960px; margin: 24px auto; padding: 0 16px; }

/* Acceso (como AuthLayout) */
body.auth { background: var(--auth-bg); min-height: 100vh; }
.auth-header { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; color: #fff; text-align: center; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.auth-main { display: flex; justify-content: center; padding: 24px 16px 48px; }
.auth-card { width: 100%; max-width: 480px; background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 1rem 3rem rgba(0,0,0,.175); }
.auth-card h1 { font-size: 1.5rem; font-weight: 500; }

/* Contenido */
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 16px; }
h1 { font-size: 1.6rem; font-weight: 500; margin: 0 0 16px; }
h2 { font-size: 1.1rem; font-weight: 500; margin: 0 0 12px; color: var(--primary); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.field { margin-bottom: 4px; }
.summary { background: #FDECEA; color: #8A1C1C; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.summary ul { margin: 4px 0 0; padding-left: 18px; }
.ok { background: #EDF7ED; color: #1E4620; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.btn { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 8px; padding: 10px 20px; font: inherit; font-weight: 500; text-transform: uppercase; letter-spacing: .03em; text-decoration: none; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn.secondary:hover { background: var(--bg); }
.btn.block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--lines); }
th { font-size: 12px; font-weight: 500; color: var(--text-2); }
.muted { color: var(--text-2); }

input.invalid, select.invalid { border-color: #D32F2F; background: #FFF8F8; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Envíos / servicios */
.lines-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.lines-title h2 { margin: 0; font-size: 1.3rem; color: var(--text); }
.lines-title .muted { font-size: 13px; }
.line { border-left: 4px solid var(--primary); }
.line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.line-head h2 { margin: 0; }
.btn-icon { background: none; border: 1px solid var(--lines); color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn-icon:hover { background: #FDECEA; color: #D32F2F; border-color: #F5C2C0; }
.btn-icon[hidden] { display: none; }
.subgroup + .subgroup, .grid + .subgroup { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--lines); }
.subgroup h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.line-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid.driver-row { grid-template-columns: 2fr 1fr; }
.grid.place-grid { grid-template-columns: minmax(140px, 1fr) minmax(170px, 1.4fr) 120px minmax(170px, 1.4fr); }
.grid.goods-grid { grid-template-columns: minmax(180px, 1.5fr) 120px minmax(220px, 2.5fr); }

/* Buscador de localidad */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 4px 0; list-style: none;
    background: #fff; border: 1px solid var(--lines); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12);
    max-height: 280px; overflow-y: auto; min-width: 260px; }
.ac-list li { padding: 7px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.ac-list li small { color: var(--text-2); white-space: nowrap; }
.ac-list li.on, .ac-list li:hover { background: color-mix(in srgb, var(--primary) 10%, #fff); }

@media (max-width: 900px) {
    .grid.place-grid { grid-template-columns: 1fr 1fr; }
}

.cell-action { text-align: right; }
.content.wide { max-width: 1440px; }
.num, .nowrap { white-space: nowrap; }
.num { text-align: right; }
.table-scroll { overflow-x: auto; }
.btn .icon { width: 16px; height: 16px; vertical-align: -3px; }
.btn.icon-btn { display: inline-flex; align-items: center; padding: 6px 9px; }
.btn.icon-btn .icon { vertical-align: 0; }
.stack { display: flex; flex-direction: column; gap: 2px; }
.doc-number { font-size: 12px; color: var(--text-2); }
@media (max-width: 640px) { table.responsive td .stack { align-items: flex-end; text-align: right; } }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.ok.created { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.created-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }

.page-head { display: flex; align-items: center; gap: 14px; }
.page-head h1 { margin: 0; }
@media (max-width: 640px) { .page-head .btn.small { width: auto; } }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.day-head h2 { margin: 0; }
.day-nav { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day-nav input[type=date] { width: auto; margin: 0; }
@media (max-width: 640px) { .day-nav .btn.small { width: auto; } }
.company-head { justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.main-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.main-status[hidden] { display: none; }
.main-status .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.main-status.up { background: #EDF7ED; color: #1E7B34; }
.main-status.down { background: #FDECEA; color: #B3261E; }
a.appbar-btn { text-decoration: none; }
.gate-closed { background: #FFF4E5; border: 1px solid #F5C98B; color: #663C00; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.gate-closed[hidden] { display: none; }
.gate-closed a { color: inherit; font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .55; }
.auth-card { position: relative; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; color: var(--text-2); cursor: pointer; line-height: 0; }
.eye-btn:hover { color: var(--text); }
.eye-btn svg { width: 20px; height: 20px; }
.eye-btn .eye-closed, .eye-btn.showing .eye-open { display: none; }
.eye-btn.showing .eye-closed { display: inline; }
.admin-key { position: absolute; right: 10px; bottom: 8px; background: none; border: 0; padding: 4px; color: var(--text-2); opacity: .3; cursor: pointer; line-height: 0; }
.admin-key:hover { opacity: .7; }
.admin-key svg { width: 14px; height: 14px; }
.admin-key[hidden] { display: none; }
.gate-now { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; margin-bottom: 8px; }
.gate-now .dot { width: 14px; height: 14px; border-radius: 50%; }
.gate-now.open .dot { background: #1E7B34; }
.gate-now.closed .dot { background: #B3261E; }
.gate-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }

.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.readonly-value { padding: 10px 12px; border: 1px dashed var(--lines); border-radius: 8px; background: #F7F8FA; font-weight: 600; }

.draft-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #E8F1FB; border: 1px solid #BFD6F2;
    color: #1B3A5C; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.draft-banner[hidden] { display: none; }
.draft-status { align-self: center; font-size: 12px; color: var(--text-2); }

@media (max-width: 640px) {
    .appbar { padding: 6px 10px; }
    .appbar-brand .long-title, .logout .user { display: none; }
    .auth-brand .long-title { display: none; }
    .auth-card { padding: 24px; }
    .content { margin: 16px auto; padding: 0 10px; }
    h1 { font-size: 1.35rem; }
    .card { padding: 14px; }
    .grid, .grid.driver-row, .grid.place-grid, .grid.goods-grid { grid-template-columns: 1fr; gap: 10px; }
    input, select, textarea { font-size: 16px; } /* evita el zoom automático en iOS */
    .btn, .block-mobile { width: 100%; text-align: center; }
    .line-actions .btn { width: auto; flex: 1; }
    .actions { flex-direction: column; }
    .sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; margin: 0; box-shadow: 0 -4px 8px rgba(0,0,0,.04); flex-direction: row; }
    .sticky-actions .btn { width: auto; }
    .sticky-actions .btn:first-child { flex: 1; }
    .btn.small { width: auto; }

    /* Listado: cada fila pasa a ser una ficha */
    table.responsive thead { display: none; }
    table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
    table.responsive tr { border-bottom: 1px solid var(--lines); padding: 10px 0; }
    table.responsive td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; }
    table.responsive td[data-label]::before { content: attr(data-label); color: var(--text-2); font-size: 12px; flex-shrink: 0; }
    table.responsive td.cell-action { justify-content: flex-end; padding-top: 6px; }
}
