/* Novagent Kökspanel — kiosk-UI för 10" platta i liggande läge.
   Minimalistiskt mörkt tema: hairline-avdelare, mjuka radier, dämpade
   sekundärfärger. Stora tryckytor kvar (tumme, stressad, mjölig) och
   inga hover-beroenden. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0d0f13;
  --panel: #16191f;
  --panel-light: #1e222a;
  --text: #f5f6f8;
  --text-dim: #8a93a1;
  --accent: #30d158;          /* Apple-grön */
  --alarm: #ff453a;           /* Apple-röd */
  --warn: #ffd60a;
  --hairline: rgba(255, 255, 255, 0.09);
  --radius: 18px;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  letter-spacing: -0.01em;
  overscroll-behavior: none;
  user-select: none;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 11, 14, 0.88);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: center;
}
.overlay-inner { text-align: center; padding: 24px; }
.overlay-logo { font-size: 14px; letter-spacing: 6px; color: var(--text-dim); margin-bottom: 20px; }
.overlay-msg { font-size: 28px; font-weight: 600; line-height: 1.35; }
.overlay-sub { font-size: 16px; color: var(--text-dim); margin-top: 12px; }

.dialog {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  max-width: 540px; width: 92%;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.dialog-title { font-size: 23px; font-weight: 700; margin-bottom: 8px; }
.dialog-text { font-size: 17px; color: var(--text-dim); line-height: 1.45; margin-bottom: 20px; }
.dialog-buttons { display: flex; gap: 12px; margin-top: 6px; }
.dialog-buttons button { flex: 1; }

.reason-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip {
  padding: 12px 18px; min-height: 50px;
  border-radius: 999px;
  background: var(--panel-light);
  border: 1px solid var(--hairline);
  color: var(--text-dim);
  font-size: 16px; font-weight: 600;
}
.chip.selected { background: var(--text); color: #111; border-color: var(--text); }

/* ---------- Banners ---------- */
.conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: var(--alarm); color: #fff; text-align: center;
  font-size: 19px; font-weight: 700; padding: 14px 10px;
  animation: bannerblink 1.6s ease-in-out infinite;
}
@keyframes bannerblink { 50% { filter: brightness(0.8); } }
.resync-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: var(--warn); color: #1c1500; text-align: center;
  font-size: 17px; font-weight: 600; padding: 12px 10px;
}

/* ---------- Toppbar ---------- */
#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(13, 15, 19, 0.85);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  position: sticky; top: 0; z-index: 10;
}
#rest-name { font-size: 19px; font-weight: 700; flex: 0 0 auto; }
nav {
  display: flex; gap: 4px; flex: 1;
  background: var(--panel);
  border-radius: 12px; padding: 4px; max-width: 260px;
}
.nav-btn {
  flex: 1; border-radius: 9px;
  color: var(--text-dim);
  font-size: 16px; font-weight: 600;
  padding: 10px 18px; min-height: 48px;
}
.nav-btn.active { background: var(--panel-light); color: var(--text); }
.topbar-right { display: flex; gap: 10px; align-items: center; margin-left: auto; }

.pause-btn {
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  color: var(--accent);
  font-size: 15px; font-weight: 700;
  padding: 12px 18px; min-height: 48px;
}
.pause-btn.paused { color: #fff; background: var(--alarm); border-color: var(--alarm); }
.test-btn {
  border-radius: 999px;
  border: 1px dashed var(--hairline);
  color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  padding: 10px 14px; min-height: 48px;
}
.prep-btn {
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 15px; font-weight: 700;
  padding: 12px 18px; min-height: 48px;
}

/* Utskriftsspaken: avstängd = nedtonad, så läget syns på avstånd. */
.prep-btn.print-off {
  color: var(--text-dim);
  opacity: 0.6;
}

/* ---------- Tillagningstids-reglaget ---------- */
.prep-stepper {
  display: flex; align-items: center; justify-content: center;
  gap: 22px; margin: 6px 0 20px;
}
.stepper-btn {
  width: 76px; height: 76px;
  border-radius: 999px;
  background: var(--panel-light);
  border: 1px solid var(--hairline);
  font-size: 34px; font-weight: 600; line-height: 1;
}
.stepper-btn:active { background: var(--text); color: #111; }
.prep-value {
  min-width: 120px; text-align: center;
  font-size: 54px; font-weight: 800; letter-spacing: -1px;
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
}
.prep-unit { font-size: 18px; font-weight: 600; color: var(--text-dim); }
.prep-quick { justify-content: center; }

/* ---------- Sektioner ---------- */
main { padding: 20px; max-width: 1080px; margin: 0 auto; }
.section-title {
  font-size: 13px; font-weight: 600; letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 18px 4px 12px;
}
.larm-title { color: var(--alarm); }
.empty-msg { color: var(--text-dim); font-size: 18px; padding: 36px 0; text-align: center; }

/* ---------- Orderkort ---------- */
.order-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.order-card.unacked {
  border-color: rgba(255, 69, 58, 0.55);
  animation: cardpulse 1.6s ease-in-out infinite;
}
@keyframes cardpulse {
  50% { box-shadow: 0 0 0 5px rgba(255, 69, 58, 0.22); border-color: var(--alarm); }
}

.order-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px; flex-wrap: wrap;
}
.order-ref { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.order-time { font-size: 22px; font-weight: 700; }
.order-time-label { font-size: 14px; color: var(--text-dim); font-weight: 500; }
.order-meta { font-size: 16px; color: var(--text-dim); margin-top: 2px; }
.order-meta b { color: var(--text); font-weight: 600; }

.allergy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 69, 58, 0.16);
  color: #ff6961;
  border: 1px solid rgba(255, 69, 58, 0.45);
  border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.4px;
  padding: 6px 14px;
  margin-top: 10px;
}

.order-items { list-style: none; margin: 14px 0 4px; }
.order-items li {
  font-size: 20px; font-weight: 500;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
  display: flex; gap: 14px;
}
.order-items li:last-child { border-bottom: 0; }
.item-qty { font-weight: 700; min-width: 40px; color: var(--text-dim); }
.item-notes { display: block; font-size: 16px; color: var(--warn); font-weight: 500; margin-top: 2px; }

.order-notes {
  background: var(--panel-light);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 10px 0 4px;
  font-size: 16px; font-weight: 500;
  color: var(--text);
}
.order-notes.has-allergy { border: 1px solid rgba(255, 69, 58, 0.45); }

.order-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
}
.order-total { font-size: 20px; font-weight: 700; }
.order-phone { font-size: 15px; color: var(--text-dim); }

.ack-btn {
  width: 100%; min-height: 68px; margin-top: 14px;
  background: var(--accent); color: #06210f;
  border-radius: 14px;
  font-size: 22px; font-weight: 800; letter-spacing: 0.5px;
}
.ack-btn:active { filter: brightness(0.85); }
.ack-btn[disabled] { opacity: 0.55; }

.decline-link {
  display: block; width: 100%;
  text-align: center;
  margin-top: 6px; padding: 14px;
  color: var(--text-dim);
  font-size: 15px; font-weight: 600;
}
.decline-link:active { color: var(--alarm); }

.print-btn {
  min-height: 48px; padding: 10px 18px;
  background: var(--panel-light);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
}

.acked-stamp { font-size: 15px; color: var(--accent); font-weight: 600; }
.unacked-stamp { color: var(--alarm); }
.declined-stamp { color: var(--alarm); }
.order-card.declined { opacity: 0.72; }

/* ---------- Historik ---------- */
.hist-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
#hist-date-wrap {
  position: relative; flex: 1; text-align: center;
  min-height: 52px; display: flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 12px;
}
.hist-date { font-size: 18px; font-weight: 700; text-transform: capitalize; }
#hist-picker {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}

.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  color: var(--text);
  font-size: 17px; font-weight: 600;
  padding: 12px 20px; min-height: 52px;
}
.btn-secondary[disabled] { opacity: 0.4; }
.btn-danger {
  background: var(--alarm); color: #fff;
  border-radius: 12px;
  font-size: 17px; font-weight: 700;
  padding: 12px 20px; min-height: 52px;
}

/* Smalare skärmar (mindre plattor stående) */
@media (max-width: 700px) {
  #topbar { flex-wrap: wrap; }
  nav { order: 3; width: 100%; max-width: none; }
}

/* ---------- Förbrukningsräknare + terminalnotiser (prismodell v3) ---------- */
.usage-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 6px 14px; border-radius: 12px;
  background: var(--panel-light); border: 1px solid var(--hairline);
  font-size: 15px; color: var(--text-dim); line-height: 1.3;
  white-space: nowrap;
}
.usage-chip.usage-high #usage-count { color: var(--warn); }
.usage-boost { font-size: 12px; color: var(--accent); }

.notice-banner {
  display: flex; align-items: center; gap: 16px;
  margin: 12px 16px 0; padding: 14px 18px;
  background: var(--panel-light); border: 1px solid var(--hairline);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  font-size: 16px; line-height: 1.4;
}
.notice-banner.notice-warn { border-left-color: var(--warn); }
.notice-banner.notice-alarm { border-left-color: var(--alarm); }
.notice-banner #notice-text { flex: 1; }
.notice-banner #notice-close { flex-shrink: 0; }

/* ---------- Ägarpanelen (steg 4) ---------- */
.pin-input {
  width: 100%; box-sizing: border-box;
  font-size: 32px; letter-spacing: 12px; text-align: center;
  padding: 14px 10px; margin-bottom: 12px;
  background: var(--panel-light); color: var(--text);
  border: 1px solid var(--hairline); border-radius: 14px;
}
.pin-error { color: var(--alarm); font-size: 15px; margin-bottom: 12px; }
.owner-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--hairline);
  font-size: 16px; color: var(--text);
}
.owner-row .owner-sub { color: var(--text-dim); font-size: 13px; }
.owner-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.owner-paused {
  background: rgba(255, 69, 58, 0.12); border: 1px solid var(--alarm);
  border-radius: 12px; padding: 12px 14px; margin: 12px 0;
  color: var(--text); font-size: 15px;
}

/* ---------- Bokningsvyn (steg 5) ---------- */
.bok-new-btn { margin-left: auto; }
.bok-summary { padding: 10px 16px 0; color: var(--text-dim); font-size: 15px; }
.bok-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 18px; margin: 10px 16px;
  font-size: 16px;
}
.bok-card.bok-pending { border-left: 4px solid var(--warn); }
.bok-card.bok-cancelled { opacity: 0.45; text-decoration: line-through; }
.bok-time { font-size: 22px; font-weight: 700; min-width: 64px; }
.bok-main { flex: 1; }
.bok-sub { color: var(--text-dim); font-size: 13px; }
.bok-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
/* min-width: 0 bryter grid-cellernas min-width:auto. Utan den kan cellen inte
   krympa under innehållets naturliga bredd — och Androids native date/time-
   fält är breda nog att trycka ut hela högerkolumnen utanför skärmen. */
.bok-form label { display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
  font-size: 13px; color: var(--text-dim); }
/* Fritextfälten får hela bredden — de rymmer mest och används oftast. */
.bok-form label.bok-wide { grid-column: 1 / -1; }
.bok-form input {
  width: 100%; min-width: 0; max-width: 100%;
  background: var(--panel-light); color: var(--text);
  border: 1px solid var(--hairline); border-radius: 10px;
  padding: 10px 12px; font-size: 16px;
}
