:root {
    --color-primary: #1e3a8a;
    --color-primary-dark: #142a63;
    --color-accent: #f59e0b;
    --color-bg: #f4f6fb;
    --color-text: #1f2937;
    --color-error-bg: #fdecea;
    --color-error-text: #b91c1c;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
}

/* ---------- LOGIN ---------- */

.login-body {
    min-height: 100vh;
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap;
}

.login-cover {
    flex: 1 1 45%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    min-height: 260px;
}

.login-cover-content {
    max-width: 420px;
    text-align: center;
}

.login-cover-icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

.login-cover-content h1 {
    font-size: 28px;
    margin: 0 0 12px;
}

.login-cover-content p {
    font-size: 16px;
    opacity: 0.9;
    margin: 0;
}

.login-form-section {
    flex: 1 1 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.login-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: var(--color-primary-dark);
}

.login-subtitle {
    margin: 0 0 24px;
    color: #6b7280;
    font-size: 14px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    font-size: 16px;
    line-height: 1;
    border-radius: 6px;
}

.password-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-login {
    width: 100%;
    padding: 13px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--color-primary-dark);
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
}

.form-actions {
    margin-top: 20px;
}

.progress-track {
    width: 100%;
    height: 22px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #3b82f6);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.bar-chart-row {
    display: grid;
    grid-template-columns: 160px 1fr 60px;
    align-items: center;
    gap: 12px;
}

.bar-chart-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-chart-track {
    background: #f0f1f4;
    border-radius: 6px;
    height: 22px;
    overflow: hidden;
}

.bar-chart-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.bar-chart-value {
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.color-swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    vertical-align: middle;
}

.color-input {
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.foto-acta-preview {
    display: block;
    max-width: 100%;
    width: 320px;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 12px 0;
    cursor: zoom-in;
}

.data-table input[type="number"] {
    width: 100%;
    min-width: 90px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.alert p {
    margin: 0;
}

.alert p + p {
    margin-top: 4px;
}

/* ---------- DASHBOARD ---------- */

.navbar {
    background: var(--color-primary);
    color: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 18px;
}

.btn-logout {
    background: var(--color-accent);
    color: #1f2937 !important;
    text-decoration: none !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
}

/* ---------- LAYOUT CON PANEL LATERAL ---------- */

.app-layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 60px);
}

.sidebar {
    flex: 0 0 240px;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    min-height: calc(100vh - 60px);
    padding: 24px 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-left: 3px solid transparent;
}

.sidebar-icon {
    font-size: 18px;
}

.sidebar-nav a:hover {
    background: #f4f6fb;
}

.sidebar-nav a.active {
    background: #eef2ff;
    border-left-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.app-content {
    flex: 1 1 auto;
    padding: 32px 28px;
    min-width: 0;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header-row .page-title {
    margin: 0;
}

.page-subtitle {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 14px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- PÁGINAS INTERNAS (locales, listados) ---------- */

.page-title {
    font-size: 24px;
    color: var(--color-primary-dark);
    margin: 0 0 20px;
}

.panel-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 28px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.search-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.search-form .form-group {
    margin-bottom: 0;
    min-width: 220px;
}

.panel-card h2 {
    margin-top: 0;
    font-size: 19px;
    color: var(--color-primary-dark);
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
    margin-top: 16px;
}

.grid-form .form-group-full {
    grid-column: 1 / -1;
}

.grid-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.data-table th {
    background: #f4f6fb;
    color: var(--color-primary-dark);
    font-weight: 700;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.text-center {
    text-align: center;
    color: #6b7280;
}

.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--color-text);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-edit,
.btn-delete {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-edit {
    background: #dbeafe;
    color: #1e40af;
}

.btn-edit:hover {
    background: #bfdbfe;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-activo {
    background: #dcfce7;
    color: #15803d;
}

.badge-inactivo {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-mesas {
    background: #dcfce7;
    color: #15803d;
}

.btn-mesas:hover {
    background: #bbf7d0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    background: #f0f1f4;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
}

.btn-icon:hover {
    background: #e5e7eb;
}

.btn-icon-delete:hover {
    background: #fecaca;
}

.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-delete:hover {
    background: #fecaca;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        flex: none;
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 8px 0;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 0;
    }

    .sidebar-nav a {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        padding: 10px 16px;
    }

    .sidebar-nav a.active {
        border-left-color: transparent;
        border-bottom-color: var(--color-primary);
    }

    .app-content {
        padding: 20px 16px;
    }

    .bar-chart-row {
        grid-template-columns: 90px 1fr 45px;
        gap: 8px;
    }

    .bar-chart-label {
        font-size: 12px;
        white-space: normal;
    }

    .grid-form {
        grid-template-columns: 1fr;
    }

    .panel-card {
        padding: 20px;
    }

    .data-table thead {
        display: none;
    }

    .data-table, .data-table tbody, .data-table tr, .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        overflow: hidden;
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px solid #f0f1f4;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--color-primary-dark);
    }

    .login-wrapper {
        flex-direction: column;
    }

    .login-cover {
        padding: 32px 20px;
        min-height: 180px;
    }

    .login-cover-icon {
        font-size: 48px;
    }

    .login-cover-content h1 {
        font-size: 22px;
    }

    .login-card {
        padding: 28px 22px;
    }
}

@media (max-width: 420px) {
    .login-card {
        padding: 22px 18px;
        border-radius: 8px;
    }

    .navbar {
        padding: 14px 16px;
    }
}
