h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ===== Design tokens ===== */
:root {
    --brand-orange: #f76123;
    --brand-orange-dark: #e2551a;
    --sidebar-bg: #222d32;
    --sidebar-text-muted: #8a95a1;
    --page-bg: #eeeeee;
}

/* ===== Layout ===== */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--page-bg);
    color: #1f2933;
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* ===== Topbar ===== */
.topbar {
    height: 64px;
    flex-shrink: 0;
    background: var(--brand-orange);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand {
    display: flex;
    align-items: center;
    height: 100%;
}

.topbar-brand img {
    height: 40px;
}

.topbar-search {
    position: relative;
    width: 280px;
    max-width: 320px;
    margin-left: auto;
}

.topbar-search input {
    width: 100%;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 2.2rem 0.5rem 0.9rem;
    font-size: 0.88rem;
    outline: none;
}

.topbar-search svg {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #6b7280;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    z-index: 40;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.search-status {
    padding: 0.9rem 1rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.search-group-title {
    padding: 0.5rem 1rem 0.2rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-orange);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #1f2933;
}

.search-result-item:hover {
    background: #fff4ec;
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.search-result-subtitle {
    font-size: 0.78rem;
    color: #6b7280;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.topbar-bell-wrap {
    position: relative;
    display: flex;
}

.topbar-bell {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    padding: 0.2rem;
    position: relative;
}

.topbar-bell svg {
    width: 20px;
    height: 20px;
}

.bell-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #d03b3b;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.2rem 0.35rem;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
}

.bell-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: -0.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    z-index: 40;
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.bell-panel-title {
    padding: 0.6rem 1rem 0.4rem 1rem;
    font-weight: 700;
    color: #1f2933;
    font-size: 0.9rem;
    border-bottom: 1px solid #eef0f2;
    margin-bottom: 0.2rem;
}

.bell-row {
    display: flex;
    align-items: stretch;
}

.bell-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem 0.4rem 0.5rem 1rem;
    text-decoration: none;
    color: #1f2933;
    border-left: 3px solid transparent;
    position: relative;
}

.bell-item:hover {
    background: #fff4ec;
}

.bell-item-title {
    font-size: 0.86rem;
    font-weight: 600;
}

.bell-item-subtitle {
    font-size: 0.76rem;
    color: #6b7280;
}

.bell-item-critical {
    border-left-color: #d03b3b;
}

.bell-item-warning {
    border-left-color: #eb6834;
}

.bell-item-info {
    border-left-color: #2a78d6;
}

.bell-item-read {
    opacity: 0.6;
}

.bell-item-read .bell-item-title {
    font-weight: 500;
}

.bell-unread-dot {
    position: absolute;
    top: 0.7rem;
    left: 0.3rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2a78d6;
}

.bell-dismiss {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.7rem;
    line-height: 1;
}

.bell-dismiss:hover {
    color: #d03b3b;
}

.topbar-account {
    background: none;
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0.4rem 0.2rem;
}

.topbar-account svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.topbar-account-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.topbar-account-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.topbar-account-role {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.topbar-account-menu {
    position: absolute;
    top: 100%;
    right: 2.5rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    padding: 0.3rem;
    min-width: 150px;
}

.topbar-account-menu a {
    display: block;
    padding: 0.5rem 0.7rem;
    color: #1f2933;
    text-decoration: none;
    font-size: 0.88rem;
    border-radius: 4px;
}

.topbar-account-menu a:hover {
    background: #f3f4f6;
}

.topbar-gear {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    padding: 0.2rem;
}

.topbar-gear svg {
    width: 20px;
    height: 20px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    transition: width 0.15s ease;
}

.sidebar.sidebar-collapsed {
    width: 64px;
}

.sidebar.sidebar-collapsed .side-label,
.sidebar.sidebar-collapsed .side-chevron,
.sidebar.sidebar-collapsed .side-children {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #9aa5b1;
    cursor: pointer;
    padding: 0.9rem 0;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar nav {
    padding: 0.5rem 0.6rem 1.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.side-link, .side-section-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.7rem;
    border-radius: 6px;
    color: #cbd3da;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.side-link:hover, .side-section-header:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.side-link-top.active {
    color: var(--brand-orange);
    text-decoration: underline;
}

.side-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: flex;
}

.side-icon svg {
    width: 100%;
    height: 100%;
}

.side-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.side-chevron.chevron-down {
    transform: rotate(90deg);
}

.side-section-header.expanded {
    background: var(--brand-orange);
    color: #fff;
}

.side-children {
    display: flex;
    flex-direction: column;
    padding: 0.2rem 0 0.3rem 2.6rem;
}

.side-child {
    color: var(--sidebar-text-muted);
    text-decoration: none;
    font-size: 0.87rem;
    padding: 0.4rem 0.3rem;
    border-radius: 4px;
}

.side-child:hover {
    color: #fff;
}

.side-child.active {
    color: #fff;
    font-weight: 700;
}

.app-main {
    flex: 1;
    padding: 1.75rem 2rem;
    max-width: 100%;
    overflow-x: auto;
}

/* ===== Page header (full-bleed white strip above the gray content) ===== */
.page-header {
    background: #fff;
    margin: -1.75rem -2rem 1.5rem -2rem;
    padding: 1.1rem 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--brand-orange);
    font-weight: 700;
}

.crud-page h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.6rem;
}

.muted {
    color: #6b7280;
}

.muted.small {
    font-size: 0.85rem;
}

/* ===== Grid card (toolbar + table) ===== */
.grid-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    position: relative;
}

.click-catcher {
    position: fixed;
    inset: 0;
    z-index: 30;
}

.grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-toolbar {
    background: var(--brand-orange);
    border: 1px solid var(--brand-orange);
    color: #fff;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-toolbar svg {
    width: 15px;
    height: 15px;
}

.btn-toolbar:hover {
    background: var(--brand-orange-dark);
}

.btn-toolbar .caret {
    font-size: 0.7rem;
    margin-left: 0.1rem;
}

.search-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    font-size: 0.88rem;
    min-width: 220px;
}

.search-bar {
    display: inline-flex;
    align-items: stretch;
}

.search-bar .search-input {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

.clear-filters-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    border: 1px solid #d1d5db;
    border-radius: 6px 0 0 6px;
    background: #e5e7eb;
    color: #374151;
    cursor: pointer;
}

.clear-filters-btn svg {
    width: 15px;
    height: 15px;
}

.clear-filters-btn:hover {
    background: #d1d5db;
    color: var(--brand-orange);
}

.dropdown {
    position: relative;
    display: inline-flex;
}

.dropdown-menu {
    /* Posición real (top/left o bottom/right) la calcula dropdown-position.js en
       píxeles fijos de ventana, para que el menú nunca quede recortado por el
       "overflow: auto" de contenedores como .table-wrap. */
    position: fixed;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    padding: 0.4rem;
    min-width: 180px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.dropdown-menu button {
    background: none;
    border: none;
    text-align: left;
    padding: 0.5rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.87rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu button:hover {
    background: #f3f4f6;
}

.dropdown-menu button svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.column-menu {
    min-width: 240px;
}

.column-menu-actions {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #eef0f2;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
}

.column-menu-actions button {
    font-weight: 600;
    color: var(--brand-orange);
}

.column-menu-actions button svg {
    color: var(--brand-orange);
}

.column-menu-list {
    max-height: 280px;
    overflow-y: auto;
}

.column-menu label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 5px;
}

.column-menu label:hover {
    background: #f3f4f6;
}

.row-menu-view svg { color: #2563eb; }
.row-menu-edit svg { color: var(--brand-orange); }
.row-menu-delete svg { color: #ef4444; }
.row-menu-extra svg { color: #2563eb; }
.row-menu-abono svg { color: #0ca30c; }
.row-menu-verabonos svg { color: #2563eb; }
.row-menu-cobro svg { color: var(--brand-orange); }
.row-menu-entregar svg { color: #0ca30c; }
.row-menu-archivar svg { color: var(--brand-orange); }
.row-menu-imprimir svg { color: var(--brand-orange); }
.row-menu-generarpedido svg { color: #0ca30c; }
.row-menu-duplicar svg { color: var(--brand-orange); }

.config-thumb {
    height: 40px;
    max-width: 140px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
}

.config-preview {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    margin-top: 0.4rem;
    display: block;
}

.status-badge {
    display: inline-block;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* ===== Table ===== */
.table-wrap {
    overflow: auto;
    border-top: 1px solid #e5e7eb;
}

.crud-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.87rem;
}

.crud-table th, .crud-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #eef0f2;
    white-space: nowrap;
}

.crud-table td.cell-wrap {
    white-space: normal;
    word-break: break-word;
    min-width: 220px;
    max-width: 420px;
}

.crud-table th {
    background: #fafafa;
    font-weight: 600;
    color: #4b5563;
    position: sticky;
    top: 0;
    user-select: none;
    z-index: 31;
}

.crud-table th.sortable {
    padding: 0;
}

.crud-table th.sortable .th-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.6rem 0.3rem 0.6rem 0.9rem;
}

.crud-table th.sortable .th-label:hover {
    color: var(--brand-orange);
}

.sort-arrow {
    color: var(--brand-orange);
    margin-left: 0.3rem;
    font-size: 0.7rem;
}

.col-menu-wrap {
    display: inline-flex;
}

.col-menu-btn {
    background: none;
    border: none;
    color: #c1c7cf;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.6rem 0.6rem 0.6rem 0.1rem;
}

.col-menu-btn:hover, .col-menu-btn.has-filter {
    color: var(--brand-orange);
}

.column-filter-menu {
    min-width: 210px;
}

.col-menu-icon {
    display: inline-block;
    width: 14px;
}

.col-filter-input {
    position: relative;
    padding: 0.3rem 0.4rem 0.2rem 0.4rem;
    border-top: 1px solid #eef0f2;
    margin-top: 0.2rem;
}

.col-filter-input input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 0.35rem 1.6rem 0.35rem 0.5rem;
    font-size: 0.83rem;
    font-weight: 400;
}

.col-filter-clear {
    position: absolute;
    right: 0.7rem;
    top: 0.55rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.95rem;
    line-height: 1;
}

.col-filter-clear:hover {
    color: #ef4444;
}

.crud-table tbody tr:nth-child(even) {
    background: #fbfbfb;
}

.crud-table tbody tr:hover {
    background: #fff4ec;
}

.actions-col {
    white-space: nowrap;
    text-align: center;
    width: 1%;
}

.row-action-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.row-action-btn:hover {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.row-action-btn svg {
    width: 15px;
    height: 15px;
}

.row-menu {
    min-width: 180px;
}

/* ===== Row controls (hamburger menu + expand toggle) ===== */
.row-controls-col {
    white-space: nowrap;
    text-align: left;
    width: 1%;
}

.row-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.expand-btn {
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.expand-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.expand-btn.expanded svg {
    transform: rotate(90deg);
}

.expand-btn:hover {
    color: var(--brand-orange);
}

.cell-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== Pedidos detalle (grupo por pedido) ===== */
.pedido-group-row td {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding-top: 0.75rem;
}

.pedido-detail-row td {
    background: #f3f4f6;
}

.pedido-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--brand-orange);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.pedido-link:hover {
    text-decoration: underline;
}

.pedido-expand-arrow {
    display: inline-block;
    transition: transform 0.15s ease;
    font-size: 0.75rem;
}

.pedido-expand-arrow.expanded {
    transform: rotate(90deg);
}

/* ===== Detail row (Pedido -> PedidoServicio) ===== */
.detail-row td {
    background: #fafafa;
    padding: 0;
    border-bottom: 1px solid #eef0f2;
    white-space: normal;
}

.detail-panel {
    padding: 1rem 1.5rem 1.25rem 3.5rem;
}

.detail-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #374151;
    text-align: center;
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

.detail-table th, .detail-table td {
    padding: 0.55rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #eef0f2;
}

.detail-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #4b5563;
}

.detail-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0 0.1rem 0;
}

.grid-footer {
    padding: 0.7rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid #eef0f2;
}

.grid-footer .muted {
    margin: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-btn {
    border: 1px solid var(--brand-orange);
    background: #fff;
    color: #374151;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.85rem;
    color: #4b5563;
    padding: 0 0.4rem;
    white-space: nowrap;
}

/* ===== Buttons ===== */
.btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}

.btn:hover {
    background: #f3f4f6;
}

.btn-primary {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-orange-dark);
}

.btn-danger {
    background: #fff;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Alerts ===== */
.alert {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-info {
    background: #eef6ff;
    border: 1px solid #bfdcff;
    color: #1d4ed8;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: inherit;
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1rem;
    overflow-y: auto;
    z-index: 1000;
}

.modal-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-card.modal-small {
    max-width: 420px;
}

.modal-card h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

/* ===== Form ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
}

.form-input, .form-field input[type=text], .form-field input[type=number], .form-field input[type=datetime-local], .form-field textarea {
    padding: 0.4rem 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
    font-family: inherit;
}

.form-field textarea {
    resize: vertical;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap input {
    padding-right: 2.5rem;
}

.password-eye-btn {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    padding: 0.2rem;
}

.password-eye-btn svg {
    width: 16px;
    height: 16px;
}

.password-eye-btn:hover {
    color: var(--brand-orange);
}

.file-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: flex-start;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    border-top: 1px solid #eef0f2;
    padding-top: 1rem;
}

/* ===== Captura (Cotización / formularios de página completa) ===== */
.captura-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.paste-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 90px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
    cursor: text;
}

.paste-zone:focus {
    outline: none;
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.paste-zone img {
    max-height: 120px;
    max-width: 100%;
    object-fit: contain;
}

.captura-card h2 {
    margin: 0 0 1.25rem 0;
    font-size: 1.1rem;
    color: #374151;
}

.captura-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 2.5rem;
}

@media (max-width: 720px) {
    .captura-grid {
        grid-template-columns: 1fr;
    }
}

.captura-field-inline {
    display: flex;
    gap: 0.5rem;
}

.captura-field-inline .form-input {
    flex: 1;
}

.btn-icon {
    border: 1px solid var(--brand-orange);
    background: #fff;
    color: var(--brand-orange);
    width: 38px;
    flex-shrink: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-icon:hover {
    background: var(--brand-orange);
    color: #fff;
}

.lineas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.lineas-table th {
    background: #fafafa;
    color: #4b5563;
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #eef0f2;
}

.lineas-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #eef0f2;
    vertical-align: middle;
}

.lineas-table tbody tr:nth-child(even) {
    background: #fbfbfb;
}

.lineas-table tbody tr:hover {
    background: #fff4ec;
}

/* Servicio (columna 1) más angosta y Cantidad (columna 4) angosta, para darle más espacio
   a la Descripción y al Valor unitario (columna 5), que se veía recortado. */
.lineas-table th:nth-child(1),
.lineas-table td:nth-child(1) {
    width: 280px;
}

.lineas-table th:nth-child(4),
.lineas-table td:nth-child(4) {
    width: 80px;
}

.lineas-table th:nth-child(5),
.lineas-table td:nth-child(5) {
    width: 150px;
}

.lineas-table input,
.lineas-table select,
.lineas-table textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
}

.lineas-table textarea {
    resize: vertical;
    min-height: 2.2rem;
    line-height: 1.3;
}

.lineas-table .cell-money input {
    text-align: right;
}

.lineas-table .linea-total {
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.linea-remove-btn {
    border: none;
    background: none;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    padding: 0.2rem;
}

.linea-remove-btn svg {
    width: 15px;
    height: 15px;
}

.nueva-fila-row {
    text-align: center;
    padding: 0.6rem;
}

.nueva-fila-btn {
    background: none;
    border: none;
    color: #2a78d6;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.nueva-fila-btn:hover {
    text-decoration: underline;
}

.captura-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.cliente-select-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.cliente-select-table th {
    background: #fafafa;
    color: #6b7280;
    font-weight: 600;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}

.cliente-select-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid #eef0f2;
}

.cliente-select-table tbody tr:hover {
    background: #fff4ec;
    cursor: pointer;
}

.cliente-pick-btn {
    border: none;
    background: none;
    color: #0ca30c;
    cursor: pointer;
    display: flex;
    padding: 0;
}

.cliente-pick-btn svg {
    width: 20px;
    height: 20px;
}

.modal-card.modal-wide {
    max-width: 820px;
}

.modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.modal-header-row h2 {
    margin: 0;
}

/* ===== Dashboard ===== */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.kpi-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #1f2933;
    margin: 0.2rem 0 0.35rem 0;
    line-height: 1.1;
}

.kpi-value-warning {
    color: var(--brand-orange);
}

.kpi-trend {
    font-size: 0.8rem;
    font-weight: 600;
}

.kpi-trend-up {
    color: #0ca30c;
}

.kpi-trend-down {
    color: #d03b3b;
}

.kpi-sub {
    margin: 0;
}

.kpi-card-split {
    display: flex;
    align-items: center;
    justify-content: space-around;
    text-align: center;
}

.kpi-split-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kpi-split-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #1f2933;
    line-height: 1.1;
}

.kpi-split-divider {
    width: 1px;
    align-self: stretch;
    background: #eef0f2;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.1rem 1.25rem 1.3rem 1.25rem;
}

.chart-card h3 {
    margin: 0 0 1rem 0;
    font-size: 0.95rem;
    color: #374151;
    font-weight: 700;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.6rem;
    height: 180px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 100%;
}

.bar-value {
    font-size: 0.72rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.3rem;
    white-space: nowrap;
}

.bar-fill {
    width: 60%;
    max-width: 34px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
}

.bar-fill-orange {
    background: var(--brand-orange);
}

.bar-fill-blue {
    background: #2a78d6;
}

.bar-label {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.4rem;
    white-space: nowrap;
}

.donut-wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.donut {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
    flex-shrink: 0;
}

.donut-bg {
    fill: none;
    stroke: #eef0f2;
    stroke-width: 6;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    color: #374151;
    font-weight: 600;
}

.legend-value {
    color: #6b7280;
}

.hbar-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.hbar-row {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    gap: 0.6rem;
}

.hbar-name {
    font-size: 0.82rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hbar-track {
    background: #f3f4f6;
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.hbar-fill {
    background: var(--brand-orange);
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
}

.hbar-value {
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
}

.dashboard-table-card {
    padding: 1.1rem 0 0.2rem 0;
}

.dashboard-table-title {
    margin: 0 1.25rem 0.8rem 1.25rem;
    font-size: 0.95rem;
    color: #374151;
    font-weight: 700;
}

.saldo-cell {
    font-weight: 700;
    color: var(--brand-orange);
}
