/* ============ IES orders ============ */
:root {
  --ink: #0c2629;
  --ink-2: #123a3e;
  --ink-3: #1b4b50;
  --green: #238f76;
  --green-dark: #1b725e;
  --lime: #79c441;
  --yellow: #ffc72c;
  --aqua: #21d4d8;
  --aqua-soft: #e3f8f8;
  --bg: #f2f6f5;
  --surface: #ffffff;
  --text: #17292b;
  --muted: #5d7275;
  --border: #d9e3e2;
  --danger: #c2393b;
  --danger-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(12, 38, 41, .06), 0 4px 16px rgba(12, 38, 41, .06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
a { color: var(--green); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Carga ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(33, 212, 216, .25); border-top-color: var(--aqua);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(33, 212, 216, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(121, 196, 65, .16), transparent 60%),
    var(--ink);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--ink-2);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 18px;
  padding: 32px 28px;
  color: #eaf2f1;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.auth-card .logo { display: block; width: 220px; max-width: 80%; margin: 0 auto 8px; }
.auth-card .subtitle { text-align: center; color: #9fb7b9; margin: 0 0 24px; font-size: 14px; }
.auth-card h2 { font-size: 18px; margin-bottom: 6px; }
.auth-card p.info { color: #b9cdce; font-size: 14px; margin: 0 0 18px; }
.auth-card .field label { color: #cfe0e0; }
.auth-card .input, .auth-card .affix {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .16);
  color: #fff;
}
.auth-card .affix .input { background: transparent; }
.auth-card .affix-addon { color: var(--aqua); }
.auth-card .btn-primary { width: 100%; margin-top: 8px; }
.auth-card .field-error { color: #ff9c9c; }
.auth-card .alert { margin-bottom: 16px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 12px; color: #7f9a9c; }

/* ---------- Layout app ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink);
  color: #eaf2f1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
}
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand img { height: 38px; width: auto; display: block; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav:empty { display: none; }
.nav:empty ~ .usermenu { margin-left: auto; }
.nav a {
  color: #b9cdce; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 500;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav a.active { color: var(--ink); background: var(--aqua); }

.usermenu { position: relative; margin-left: auto; }
.usermenu-btn {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px;
  padding: 4px 12px 4px 4px; cursor: pointer; color: #eaf2f1;
}
.usermenu-btn:hover { background: rgba(255, 255, 255, .06); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--green), var(--aqua)); color: var(--ink);
}
.usermenu-name { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.usermenu-name small { color: #9fb7b9; font-size: 11px; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--surface); color: var(--text); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  padding: 6px; border: 1px solid var(--border);
}
.usermenu-panel .who { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.usermenu-panel .who strong { display: block; }
.usermenu-panel .who span { color: var(--muted); font-size: 13px; }
.usermenu-panel button, .usermenu-panel a {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none;
  border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--text);
}
.usermenu-panel button:hover, .usermenu-panel a:hover { background: var(--bg); }

.main { max-width: 1200px; margin: 0 auto; padding: 24px 20px calc(48px + var(--safe-bottom)); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head .count { color: var(--muted); font-weight: 400; font-size: 15px; margin-left: 8px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 10px; font-size: 14px; }
.back:hover { color: var(--green); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: #b7c8c6; background: #f8fbfa; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-danger { color: var(--danger); border-color: #efc4c4; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a52f31; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Toolbar lista ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 260px; position: relative; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.toolbar .search .input { padding-left: 38px; }
/* El selector de orden sólo se usa en móvil; en escritorio se ordena desde las cabeceras. */
.sort-mobile { display: none; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; color: inherit;
}
.sort-btn:hover { color: var(--green); }
.sort-btn .arrow { display: inline-block; min-width: 10px; font-size: 10px; color: var(--green); }
.table th[aria-sort="ascending"], .table th[aria-sort="descending"] { color: var(--ink); }

/* ---------- Tarjetas y tablas ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-body { padding: 24px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #f8fbfa;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
/* Sólo escritorio: en móvil cada fila es una tarjeta y conserva la línea bajo la cabecera. */
@media (min-width: 761px) {
  .table tbody tr:last-child td { border-bottom: 0; }
}
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: #f6faf9; }
.table .order { font-weight: 700; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.table .order:hover { color: var(--green); }
.table .sub { display: block; color: var(--muted); font-size: 13px; }
.creator-mobile { display: none; }
.table .clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; }
.nowrap { white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--aqua-soft); color: #0f6f72; white-space: nowrap;
}
.pill.ft20 { background: #fff4d6; color: #8a6400; }
.role { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.role-proveedor { background: #eaf6e1; color: #3f7a17; }
.role-gestor { background: var(--aqua-soft); color: #0f6f72; }
.role-admin { background: #fff4d6; color: #8a6400; }
.badge-warn { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #fff4d6; color: #8a6400; margin-left: 6px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* ---------- Formularios ---------- */
.narrow { max-width: 460px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field-error { color: var(--danger); font-size: 13px; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(33, 212, 216, .25); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 110px; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d7275' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
.input:disabled { background: var(--bg); color: var(--muted); }

.affix {
  display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.affix:focus-within { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(33, 212, 216, .25); }
.affix.invalid { border-color: var(--danger); }
.affix-addon { display: grid; place-items: center; padding: 0 4px 0 12px; font-weight: 700; color: var(--green); user-select: none; }
.affix .input { border: 0; box-shadow: none !important; padding-left: 4px; }

.combo { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; }

.meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;
  background: #f6faf9; border: 1px dashed var(--border); border-radius: 10px; padding: 14px 16px; margin-top: 22px;
}
.meta div span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.meta div strong { font-weight: 600; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border);
}
.form-actions .spacer { flex: 1; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.alert-error { background: var(--danger-soft); color: #8d2224; border: 1px solid #f3c7c7; }
.alert-info { background: var(--aqua-soft); color: #0d5e61; border: 1px solid #bfeced; }
.alert-warn { background: #fff7e0; color: #6d5000; border: 1px solid #ffe4a0; }

/* ---------- Modal ---------- */
dialog.modal {
  border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3); color: var(--text);
}
dialog.modal::backdrop { background: rgba(12, 38, 41, .55); }
.modal-body { padding: 22px 22px 8px; }
.modal-body h2 { font-size: 18px; margin-bottom: 10px; }
.modal-body p { margin: 0 0 10px; color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 20px; flex-wrap: wrap; }
.secret {
  display: flex; align-items: center; gap: 8px; background: var(--ink); color: var(--yellow);
  border-radius: 8px; padding: 10px 12px; margin: 6px 0 12px;
}
.secret code { flex: 1; font-size: 17px; letter-spacing: .06em; word-break: break-all; user-select: all; }
.secret .btn { min-height: 32px; padding: 4px 10px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 50; right: 16px; bottom: calc(16px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  border-left: 4px solid var(--lime); max-width: 360px; animation: toast-in .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .usermenu-name { display: none; }
  .usermenu-btn { padding: 2px; }
}

@media (max-width: 760px) {
  body { font-size: 16px; } /* evita el zoom automático de iOS en inputs */
  .topbar-inner { flex-wrap: wrap; padding: 8px 14px; gap: 8px 12px; }
  .brand img { height: 32px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav a { flex: 1; text-align: center; padding: 8px 10px; }
  .main { padding: 16px 14px calc(96px + var(--safe-bottom)); }
  .page-head h1 { font-size: 21px; }
  .card-body { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .combo { grid-template-columns: minmax(0, 1fr) 130px; }
  .sort-mobile { display: flex; flex: 1 1 100%; gap: 8px; }
  .sort-mobile select { flex: 1; }
  .sort-mobile .dir-btn { min-height: 44px; }

  /* Acciones principales como barra fija inferior en móvil */
  .page-head .actions .btn-primary.fab {
    position: fixed; right: 16px; bottom: calc(16px + var(--safe-bottom)); z-index: 15;
    border-radius: 999px; min-height: 52px; padding: 0 20px; box-shadow: 0 8px 24px rgba(35, 143, 118, .45);
  }
  .form-actions { position: sticky; bottom: 0; background: var(--surface); margin: 24px -16px -18px; padding: 12px 16px calc(12px + var(--safe-bottom)); border-radius: 0 0 var(--radius) var(--radius); }
  .form-actions .btn { flex: 1; }
  .form-actions .spacer { display: none; }

  /* La tabla pasa a tarjetas apiladas */
  .table-wrap.card { background: transparent; border: 0; box-shadow: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; padding: 12px 14px;
  }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table td::before {
    content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; flex-shrink: 0;
  }
  .table td.cell-head { text-align: left; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); align-items: center; }
  .table td.cell-head::before { display: none; }
  .table td.cell-block { display: block; text-align: left; }
  .table td.cell-block::before { display: block; margin-bottom: 2px; }
  .table .clamp { max-width: none; }
  .table tbody tr.clickable:hover td { background: transparent; }
  .table .sub { display: none; }
  .creator-mobile { display: inline; color: var(--muted); font-size: 13px; text-align: right; }
}

@media (max-width: 420px) {
  .page-head .actions .btn:not(.fab) .label { display: none; }
  .auth-card { padding: 26px 20px; }
}

/* ---------- Selector de idioma (ES | EN) ---------- */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
}
.lang-btn {
  border: 0; background: none; padding: 4px 10px; min-height: 28px; border-radius: 6px;
  font-weight: 700; font-size: 12px; letter-spacing: .04em; cursor: pointer; color: var(--muted);
}
.lang-btn:hover { color: var(--text); }
.lang-btn[aria-pressed="true"] { background: var(--green); color: #fff; }

/* Dentro del menú de usuario (anula el estilo genérico de sus botones) */
.usermenu-panel .lang-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 6px; margin-top: 4px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
.usermenu-panel .lang-btn { display: inline-block; width: auto; padding: 4px 10px; text-align: center; color: var(--muted); }
.usermenu-panel .lang-btn:hover { background: transparent; color: var(--text); }
.usermenu-panel .lang-btn[aria-pressed="true"], .usermenu-panel .lang-btn[aria-pressed="true"]:hover { background: var(--green); color: #fff; }

/* En las tarjetas oscuras de login / cambio de contraseña forzado */
.auth-lang { display: flex; justify-content: center; margin-top: 18px; }
.auth-card .lang-switch { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); }
.auth-card .lang-btn { color: #9fb7b9; }
.auth-card .lang-btn:hover { color: #fff; }
.auth-card .lang-btn[aria-pressed="true"] { background: var(--green); color: #fff; }
.auth-lang + .auth-footer { margin-top: 12px; }

/* ---------- Pedido cerrado e historial de cambios ---------- */
.badge-closed {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #e6ecec; color: #4a5f62; white-space: nowrap;
}
.page-head h1 .badge-closed { margin-left: 10px; font-size: 13px; vertical-align: middle; }
.badge-deleted {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--danger-soft); color: #8d2224; white-space: nowrap;
}
/* Filtro Activos / Borrados (sólo administradores) */
.order-filter { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.filter-btn { border: 0; background: none; padding: 6px 14px; min-height: 34px; border-radius: 6px; font-weight: 600; cursor: pointer; color: var(--muted); }
.filter-btn[aria-pressed="true"] { background: var(--green); color: #fff; }
.order-wrap { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.closed-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.history { margin-top: 24px; }
.history-head { display: flex; align-items: baseline; gap: 8px; padding: 20px 24px 12px; }
.history-head h2 { font-size: 18px; }
.history-head .count { color: var(--muted); }
.history-empty { margin: 0; padding: 0 24px 24px; color: var(--muted); }
.history .table th:first-child, .history .table th:last-child { border-radius: 0; }
.hist-val { max-width: 280px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hist-old { color: var(--muted); }

@media (max-width: 760px) {
  /* Historial: sin marco propio (cada cambio ya es una tarjeta) */
  .history.card { background: transparent; border: 0; box-shadow: none; }
  .history-head { padding: 0 2px 10px; }
  .history-empty { padding: 0 2px; }
  .hist-val { max-width: none; text-align: right; }
}

/* Campo con prefijo (#, @) deshabilitado: todo el conjunto en gris */
.affix:has(.input:disabled) { background: var(--bg); }

/* ---------- Estado del pedido + candado (cabecera del detalle) ---------- */
.status-control { display: inline-flex; align-items: center; gap: 8px; }
.status-label { color: var(--muted); }
.status-value { padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-value.is-open { background: #eaf6e1; color: #3f7a17; }
.status-value.is-closed { background: #e6ecec; color: #4a5f62; }
.lock-btn { width: 40px; padding: 0; }
.lock-btn .icon { width: 20px; height: 20px; }

/* Modales en móvil: botones apilados a todo el ancho, el principal arriba */
@media (max-width: 760px) {
  .modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .modal-actions .btn { width: 100%; }
}

/* ---------- Pie de página (siempre al final, aunque haya poco contenido) ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > .main { flex: 1; width: 100%; }
#app > .auth, #app > .boot { flex: 1; }
.site-footer {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px;
  padding: 16px 20px calc(16px + var(--safe-bottom)); font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.auth-card .site-footer { border-top: 0; padding: 18px 0 0; font-size: 12px; color: #7f9a9c; }
.auth-card .site-footer a { color: var(--aqua); }

@media (max-width: 760px) {
  #app > .main { padding-bottom: 24px; }
  /* Pie en móvil: a la izquierda y sin línea */
  #app > .site-footer {
    justify-content: flex-start; border-top: 0; font-size: 12px; gap: 4px 10px;
    padding: 4px 16px calc(10px + var(--safe-bottom));
  }
  /* En los listados (con botón flotante) el pie queda fijo abajo, siempre visible, a la izquierda del botón */
  #app:has(.fab) > .site-footer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 14; background: var(--bg);
    flex-wrap: wrap; justify-content: flex-start; align-content: center; align-items: center; gap: 2px 8px;
    min-height: calc(76px + var(--safe-bottom)); padding: 0 166px var(--safe-bottom) 12px;
  }
  #app .page-head .actions .btn-primary.fab { bottom: calc(12px + var(--safe-bottom)); }
  /* Hueco para que la última tarjeta no quede detrás del pie */
  #app:has(.fab) > .main { padding-bottom: calc(88px + var(--safe-bottom)); }
}

/* Pie en una sola línea junto al botón flotante: "Nuevo pedido" es más ancho que "New order" */
@media (max-width: 760px) {
  :root[lang="es"] #app:has(.fab) > .site-footer { padding-right: 192px; }
}
@media (max-width: 420px) {
  #app .page-head .actions .btn-primary.fab { right: 12px; padding: 0 14px; font-size: 14px; gap: 6px; }
  #app:has(.fab) > .site-footer { font-size: 11px; column-gap: 6px; padding-right: 144px; }
  :root[lang="es"] #app:has(.fab) > .site-footer { padding-right: 166px; }
}
