:root {
    --bg: #f3f6fb;
    --bg-soft: #eef6ff;
    --card: #ffffff;
    --card-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;

    --primary: #0ea5e9;
    --primary-dark: #0369a1;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #eab308;
    --dark: #111827;

    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 26px;
    --shadow: 0 16px 40px rgba(15, 23, 42, .08);
    --shadow-soft: 0 10px 28px rgba(15, 23, 42, .06);
}

/* =========================
   BASE GENERAL
========================= */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, .13), transparent 28%),
        radial-gradient(circle at top right, rgba(139, 92, 246, .12), transparent 24%),
        var(--bg);
    font-size: 15px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

h1,
h2,
h3 {
    color: var(--text);
    letter-spacing: -.035em;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 8px;
}

h2 {
    font-size: 1.25rem;
    margin: 0 0 12px;
}

h3 {
    font-size: 1.05rem;
    margin: 0 0 10px;
}

p {
    line-height: 1.5;
}

.muted {
    color: var(--muted);
}

/* =========================
   LOGIN / AUTH
========================= */

body.auth {
    display: grid;
    place-items: center;
    padding: 24px 14px;
}

.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 950;
}

.login-card label {
    margin-top: 12px;
}

/* =========================
   HEADER GENERAL
========================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 74px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid rgba(226, 232, 240, .85);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}

.brand {
    font-size: 1.05rem;
    font-weight: 950;
    color: var(--text);
}

.who {
    margin-top: 3px;
    color: var(--muted);
    font-size: .88rem;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topbar nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    color: var(--primary);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-weight: 750;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
    transition: .18s ease;
}

.topbar nav a:hover {
    transform: translateY(-2px);
    border-color: rgba(14, 165, 233, .35);
    background: #f8fbff;
}

/* =========================
   CONTENEDORES
========================= */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 18px 38px;
}

.page-head {
    margin-bottom: 16px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.card,
.panel,
.box {
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.shadow {
    box-shadow: var(--shadow);
}

/* =========================
   FORMULARIOS
========================= */

form {
    margin: 0;
}

label {
    display: block;
    margin-bottom: 7px;
    font-weight: 850;
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text);
    outline: none;
    font: inherit;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(14, 165, 233, .65);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .12);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: end;
}

/* =========================
   BOTONES
========================= */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 900;
    font-size: .94rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 12px 25px rgba(14, 165, 233, .22);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, opacity .16s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    color: #ffffff;
    box-shadow: 0 16px 34px rgba(14, 165, 233, .28);
}

button:active,
.btn:active {
    transform: translateY(0);
}

button:disabled,
.btn.disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.secondary,
.btn.secondary {
    background: #334155;
    box-shadow: 0 12px 25px rgba(51, 65, 85, .18);
}

button.good,
.btn.good {
    background: var(--success);
    box-shadow: 0 12px 25px rgba(22, 163, 74, .2);
}

button.danger,
.btn.danger,
.danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(220, 38, 38, .2);
}

button.light,
.btn.light {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}

button.light:hover,
.btn.light:hover {
    background: #f8fafc;
    color: var(--text);
}

/* =========================
   ALERTAS
========================= */

.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin: 12px 0;
    border: 1px solid var(--border);
    font-weight: 700;
}

.alert.success,
.success {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #166534;
}

.alert.error,
.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert.warning,
.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert.info,
.info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* =========================
   BADGES / ESTADOS
========================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .76rem;
    font-weight: 900;
}

.badge.dark {
    background: #111827;
    color: #ffffff;
}

.badge.green {
    background: #dcfce7;
    color: #166534;
}

.badge.red {
    background: #fee2e2;
    color: #991b1b;
}

.badge.yellow {
    background: #fef3c7;
    color: #92400e;
}

/* =========================
   TABLAS
========================= */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 18px;
}

.table th {
    text-align: left;
    background: #f8fafc;
    color: var(--text);
    padding: 13px 12px;
    font-size: .86rem;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #eef2f7;
    color: #1e293b;
    vertical-align: middle;
}

.table tr:hover td {
    background: #f8fbff;
}

.table tr:last-child td {
    border-bottom: 0;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================
   TABS / FILTROS
========================= */

.tabs,
.filters,
.category-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tabs a,
.filters a,
.category-tabs a,
.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    font-weight: 850;
    transition: .16s ease;
}

.tabs a:hover,
.filters a:hover,
.category-tabs a:hover,
.tab:hover {
    transform: translateY(-2px);
    border-color: rgba(14, 165, 233, .35);
}

.tabs a.active,
.filters a.active,
.category-tabs a.active,
.tab.active {
    background: var(--dark);
    color: #ffffff;
    border-color: var(--dark);
}

/* =========================
   POS
========================= */

.pos-layout,
.pos-grid {
    display: grid;
    grid-template-columns: 1.3fr .95fr;
    gap: 16px;
    align-items: start;
}

.products,
.products-grid,
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 12px;
}

.product-card,
.menu-item,
.app-like-card {
    position: relative;
    min-height: 132px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .05);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    overflow: hidden;
}

.product-card:hover,
.menu-item:hover,
.app-like-card:hover {
    transform: translateY(-4px);
    border-color: rgba(14, 165, 233, .38);
    box-shadow: 0 18px 35px rgba(15, 23, 42, .10);
}

.product-card::before,
.menu-item::before,
.app-like-card::before {
    content: "";
    position: absolute;
    top: -34px;
    right: -34px;
    width: 88px;
    height: 88px;
    border-radius: 999px;
    background: rgba(14, 165, 233, .09);
}

.product-card strong,
.menu-item strong {
    display: block;
    margin-top: 58px;
    font-weight: 950;
}

.product-card .price,
.menu-item .price,
.price {
    color: var(--success);
    font-weight: 850;
}

.cart,
.order-panel {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid #eef2f7;
}

.cart-row:last-child {
    border-bottom: 0;
}

.total-line,
.summary-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
}

.total-line.final,
.summary-line.final,
.grand-total {
    font-size: 1.2rem;
    font-weight: 950;
}

/* =========================
   KDS / COCINA
========================= */

.kds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.kds-ticket {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 16px;
    box-shadow: var(--shadow-soft);
}

.kds-ticket h3 {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.kds-ticket ul {
    margin: 10px 0;
    padding-left: 20px;
}

/* =========================
   HOME TIPO ANDROID
========================= */

.home-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 36px;
}

.home-header {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 31px;
    font-weight: 950;
    background: linear-gradient(135deg, var(--primary), var(--dark));
    box-shadow: 0 16px 35px rgba(14, 165, 233, .25);
}

.brand-title {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 950;
    color: var(--text);
}

.brand-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: .95rem;
}

.user-pill {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--text);
    font-weight: 800;
    white-space: nowrap;
}

.user-pill span {
    color: var(--muted);
    font-weight: 700;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 22px 4px 14px;
    gap: 12px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.15rem;
}

.section-title p {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 18px;
}

.app-card {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 18px 14px 16px;
    min-height: 160px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.app-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 45px rgba(15, 23, 42, .12);
    border-color: rgba(14, 165, 233, .35);
    color: var(--text);
}

.app-card::before {
    content: "";
    position: absolute;
    inset: -40px -40px auto auto;
    width: 100px;
    height: 100px;
    background: var(--app-color, var(--primary));
    opacity: .10;
    border-radius: 999px;
}

.app-icon {
    width: 76px;
    height: 76px;
    border-radius: 25px;
    display: grid;
    place-items: center;
    font-size: 38px;
    background: rgba(14, 165, 233, .10);
    border: 1px solid rgba(14, 165, 233, .16);
    margin-bottom: 13px;
    box-shadow: inset 0 -8px 18px rgba(255,255,255,.55);
}

.app-title {
    font-weight: 950;
    text-align: center;
    font-size: .98rem;
    color: var(--text);
    margin-bottom: 4px;
}

.app-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.25;
}

.quick-panel {
    margin-top: 26px;
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 18px;
}

.info-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #111827;
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 850;
    font-size: .85rem;
}

.footer-home {
    text-align: center;
    color: var(--muted);
    margin-top: 28px;
    font-size: .85rem;
}

/* =========================
   UTILIDADES
========================= */

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 14px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 14px;
}

.hidden {
    display: none !important;
}

/* =========================
   RESPONSIVE
========================= */

@media(max-width: 900px) {
    .pos-layout,
    .pos-grid,
    .quick-panel {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar nav {
        width: 100%;
    }

    .topbar nav a {
        flex: 1;
    }
}

@media(max-width: 760px) {
    body {
        font-size: 14px;
    }

    .container {
        padding: 16px 12px 28px;
    }

    .login-card {
        padding: 22px;
        border-radius: 22px;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-shell {
        padding: 18px 12px 28px;
    }

    .home-header {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 22px;
    }

    .brand-logo {
        width: 56px;
        height: 56px;
        border-radius: 20px;
    }

    .brand-title {
        font-size: 1.35rem;
    }

    .user-pill {
        white-space: normal;
        width: 100%;
    }

    .apps-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }

    .app-card {
        min-height: 145px;
        border-radius: 22px;
        padding: 14px 10px;
    }

    .app-icon {
        width: 64px;
        height: 64px;
        border-radius: 21px;
        font-size: 32px;
    }

    .table {
        min-width: 760px;
    }

    .card {
        overflow-x: auto;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn,
    .actions button {
        width: 100%;
    }
}

@media(max-width: 420px) {
    .apps-grid {
        grid-template-columns: 1fr 1fr;
    }

    .app-title {
        font-size: .9rem;
    }

    .app-subtitle {
        font-size: .74rem;
    }
}