:root {
  --primary: #124057;
  --primary-600: #0e3346;
  --primary-700: #0a2735;
  --accent: #42a5f5;
  --accent-light: #e6f9ff;
  --neutral: #eaeeef;
  --neutral-200: #d8dee0;
  --neutral-400: #9aa4a8;
  --ink: #0d2230;
  --ink-soft: #486270;
  --bg: #f5f8f9;
  --white: #ffffff;
  --warn: #f4a93a;
  --warn-bg: #fff4dd;
  --danger: #d65a4a;
  --danger-bg: #fde7e3;
  --good: #3aaa6a;
  --good-bg: #e1f5ea;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(18, 64, 87, 0.08);
  --shadow: 0 6px 20px rgba(18, 64, 87, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; color: var(--primary); }
h1 { font-size: 1.05rem; font-weight: 600; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; margin-top: 1.25rem; }
p { margin: 0; line-height: 1.45; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }
.error { color: var(--danger); min-height: 1.1em; }
.hidden { display: none !important; }

.topbar {
  background: var(--primary);
  color: var(--white);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.topbar h1 {
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.logo {
  height: 36px;
  width: auto;
  max-width: 160px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--white);
  display: block;
}
.staff-link {
  color: var(--accent-light);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  white-space: nowrap;
}
.staff-link:hover { background: rgba(255, 255, 255, 0.15); }

.container {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer {
  text-align: center;
  padding: 1rem;
}

/* ---------- Customer status card ---------- */
.status-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  display: flex;
  gap: 1.1rem;
  align-items: center;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--neutral-200);
  position: relative;
  overflow: hidden;
}
.status-card .status-icon {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--neutral);
  display: grid;
  place-items: center;
  font-size: 38px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(18, 64, 87, 0.05);
}
.status-card.status-open { border-left-color: var(--good); }
.status-card.status-open .status-icon { background: var(--good-bg); }
.status-card.status-closed { border-left-color: var(--danger); }
.status-card.status-closed .status-icon { background: var(--danger-bg); }
.status-card.status-delayed,
.status-card.status-info { border-left-color: var(--warn); }
.status-card.status-delayed .status-icon,
.status-card.status-info .status-icon { background: var(--warn-bg); }

.status-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.status-headline {
  margin: 0;
  color: var(--primary);
  font-size: 1.5rem;
  line-height: 1.2;
}
.status-detail {
  margin-top: 0.5rem;
  color: var(--ink);
}
.status-meta {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* ---------- Notify card ---------- */
.notify-card {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem 0.9rem;
}
.notify-card .notify-emoji { font-size: 28px; line-height: 1; }
.notify-card h3 { margin: 0; color: var(--primary); }
.notify-card p { margin-top: 0.15rem; }
.notify-card #notif-status { grid-column: 1 / -1; min-height: 1.1em; }

/* ---------- Install modal ---------- */
.install-steps { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.25rem; }
.install-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.6rem;
  align-items: start;
  font-size: 0.95rem;
}
.install-step .num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-weight: 600;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.install-step .icon {
  display: inline-block;
  vertical-align: -3px;
  margin: 0 2px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 34, 48, 0.55);
}
.modal-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem 1.25rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}
.modal-card h2 {
  margin-bottom: 0.5rem;
  padding-right: 1.5rem;
  font-size: 1.25rem;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  appearance: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}
.modal-close:hover { background: var(--neutral); color: var(--ink); }
.modal-later { margin-top: 1rem; }

/* ---------- Buttons & inputs ---------- */
.btn {
  appearance: none;
  border: none;
  background: var(--neutral);
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--neutral); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--neutral-200);
  background: var(--white);
  font: inherit;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }
label span { font-weight: 500; }

/* ---------- Staff page ---------- */
.auth-card, .staff-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
#auth-form { display: flex; flex-direction: column; gap: 0.7rem; }
#auth-form button[type="submit"] { margin-top: 0.5rem; }
.current-status {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.current-headline {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 0.15rem;
}
.current-detail { margin-top: 0.2rem; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}
.status-btn {
  appearance: none;
  border: 1px solid var(--neutral-200);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.95rem 0.85rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.status-btn:active { transform: translateY(1px); }
.status-btn-emoji { font-size: 26px; line-height: 1; margin-bottom: 0.35rem; }
.status-btn-title { font-weight: 600; color: var(--primary); font-size: 1rem; }
.status-btn-sub { font-size: 0.78rem; color: var(--ink-soft); }
.status-btn.good { background: var(--good-bg); border-color: var(--good); }
.status-btn.good .status-btn-title { color: #1f6f43; }
.status-btn.warn { background: var(--warn-bg); border-color: #e7b65a; }
.status-btn.warn .status-btn-title { color: #8b5a14; }
.status-btn.danger { background: var(--danger-bg); border-color: #e3927e; }
.status-btn.danger .status-btn-title { color: #8a2f23; }
.status-btn.delay { background: var(--accent-light); border-color: var(--accent); }
.status-btn.delay .status-btn-title { color: var(--primary); }

.custom-form { display: flex; flex-direction: column; gap: 0.7rem; }
.staff-actions { display: flex; justify-content: flex-end; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 420px) {
  .notify-card { grid-template-columns: auto 1fr; }
  .notify-card .btn { grid-column: 1 / -1; width: 100%; }
  .status-headline { font-size: 1.3rem; }
  .status-card .status-icon { width: 60px; height: 60px; font-size: 32px; }
}
