/* ============================================================
   Restaurant Suite — Login + Lanzador
   Shell compartido: pizarra (izquierda) + papel (derecha)
   ============================================================ */

:root {
  --board: #0a0a0a;
  --board-2: #0c0c0c;
  --board-line: rgba(255, 255, 255, .12);
  --chalk: #f3f3f3;
  --chalk-dim: rgba(243, 243, 243, .62);
  --paper: #f5f5f5;
  --card: #ffffff;
  --line: #dcdcdc;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --teal: #131313;
  --teal-dark: #0f0f0f;
  --saffron: #e3a72f;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn-bg: #fff6e0;
  --warn: #8a5a00;

  --app-manager: #131313;
  --app-pedido: #c9781a;
  --app-appcc: #4f46a5;
  --app-etiquetas: #b4364a;
  --app-reservas: #2f6f9f;

  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(.3, .7, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.45;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }

/* ---------- Shell ---------- */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(300px, 5fr) 7fr;
}

.board {
  background: var(--board);
  color: var(--chalk);
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  overflow: hidden;
}
/* rejilla tenue tipo pizarra de pase */
.board::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--board-line) 1px, transparent 1px);
  background-size: 100% 56px;
  opacity: .35;
  pointer-events: none;
}
.board > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand > div:last-child { min-width: 0; }
.brand-mark {
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  background: var(--saffron);
  color: var(--board);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.brand-sub { font-size: .85rem; color: var(--chalk-dim); }

.clock { font-variant-numeric: tabular-nums; }
.clock-time {
  font-size: clamp(4rem, 9vw, 7.5rem);
  font-weight: 800;
  font-stretch: 85%;
  line-height: .9;
  letter-spacing: -.035em;
}
.clock-date { margin-top: 10px; font-size: 1.1rem; color: var(--chalk-dim); }

.board-foot { font-size: .8rem; color: var(--chalk-dim); }

/* ---------- Paper side ---------- */
.paper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.panel { width: 100%; max-width: 420px; }
.panel.wide { max-width: 520px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

/* Selector de idioma */
.lang {
  display: inline-flex;
  padding: 3px;
  background: #e8e8e8;
  border-radius: 999px;
}
.lang button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  min-height: 36px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(10, 10, 10, .15); }

h1.title { font-size: 2rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.lead { margin-top: 6px; color: var(--muted); }

/* ---------- Form ---------- */
form { margin-top: 28px; display: grid; gap: 18px; }
.field label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.input-wrap { position: relative; }
.field input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(19, 19, 19, .14); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap input { padding-right: 56px; }
.reveal {
  position: absolute; right: 4px; top: 4px;
  width: 44px; height: 44px;
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.reveal:hover { background: var(--paper); color: var(--text); }
.reveal svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hint { margin-top: 6px; font-size: .85rem; color: var(--warn); display: none; }
.hint.show { display: block; }

.alert {
  display: none;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: .92rem;
  font-weight: 500;
  background: var(--danger-bg);
  color: var(--danger);
}
.alert.show { display: flex; animation: shake .32s var(--ease); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { cursor: progress; opacity: .75; }
.btn-primary { width: 100%; background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--teal); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn-danger-confirm { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn .spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Acceso rápido */
.quick { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.quick h2 { font-size: .95rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-grid .btn { justify-content: flex-start; font-weight: 600; }
.quick-grid .emoji { font-size: 1.3rem; }

/* ---------- Lanzador ---------- */
.user-chip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--board); color: var(--saffron);
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.1rem; text-transform: uppercase;
  flex-shrink: 0;
}
.user-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .85rem; color: var(--muted); }

.apps { margin-top: 28px; display: grid; gap: 14px; }
.app {
  --c: var(--teal);
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 20px 18px 18px;
  min-height: 100px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--c);
  border-radius: var(--r-lg);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, transform .08s, box-shadow .15s;
}
.app:hover { border-color: var(--c); box-shadow: 0 6px 18px -8px rgba(10, 10, 10, .35); }
.app:active { transform: scale(.99); }
.app.is-busy { opacity: .7; pointer-events: none; }
.app[data-app="manager"] { --c: var(--app-manager); }
.app[data-app="pedido"] { --c: var(--app-pedido); }
.app[data-app="appcc"] { --c: var(--app-appcc); }
.app[data-app="etiquetas"] { --c: var(--app-etiquetas); }
.app[data-app="reservas"] { --c: var(--app-reservas); }
.app-icon {
  width: 64px; height: 64px; border-radius: var(--r-md);
  background: var(--c); color: #fff;
  display: grid; place-items: center;
}
.app-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.app-desc { font-size: .92rem; color: var(--muted); margin-top: 2px; }
.app-go { color: var(--c); }
.app-go svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.empty {
  margin-top: 28px;
  padding: 24px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .board { padding: 20px; flex-direction: row; align-items: center; gap: 16px; }
  .board::after { display: none; }
  .clock { text-align: right; }
  .clock-time { font-size: 2.2rem; letter-spacing: -.02em; }
  .clock-date { margin-top: 2px; font-size: .85rem; white-space: nowrap; }
  .board-foot { display: none; }
  .brand-sub { display: none; }
  .brand-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; font-size: 1.05rem; }
  .paper { align-items: flex-start; padding: 28px 16px 40px; }
}
@media (max-width: 420px) {
  .quick-grid { grid-template-columns: 1fr; }
  .app { grid-template-columns: 52px 1fr auto; gap: 14px; padding: 14px; }
  .app-icon { width: 52px; height: 52px; }
  h1.title { font-size: 1.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
