:root {
  --navy: #0e2a52;
  --navy-dark: #081b38;
  --blue: #1f6fd6;
  --blue-dark: #14509e;
  --blue-pale: #eaf1fb;
  --bg: #eef2f7;
  --white: #ffffff;
  --text: #22344a;
  --text-light: #6b7a8d;
  --orange: #f2994a;
  --orange-dark: #d9791f;
  --line: #d7e0ea;
  --radius: 0;
  --shadow: 0 2px 6px rgba(14, 42, 82, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -60%;
  left: -60%;
  width: 220%;
  height: 220%;
  z-index: -1;
  pointer-events: none;
  transform: rotate(-24deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='120'%3E%3Ctext x='0' y='70' font-family='Poppins, Arial, sans-serif' font-weight='700' font-size='22' letter-spacing='2' fill='%23ccd4de'%3EWE AREN%27T REAL%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

h1, h2, h3, .heading {
  font-family: 'Poppins', 'Open Sans', Helvetica, Arial, sans-serif;
}

a { color: var(--blue); }

.app-header {
  background: var(--navy);
  color: var(--white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand svg { flex-shrink: 0; }

.brand-text .logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-text .tagline {
  font-size: 11px;
  opacity: 0.75;
  letter-spacing: 0.3px;
}

.header-icons {
  display: flex;
  gap: 16px;
  opacity: 0.85;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* ---- Tracking code entry gate ---- */
.gate-wrap {
  min-height: calc(100vh - 66px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.gate-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.gate-card .paw-big { margin-bottom: 12px; }

.gate-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
  color: var(--navy);
}

.gate-card p {
  color: var(--text-light);
  font-size: 14px;
  margin: 0 0 20px;
}

.gate-card input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid var(--line);
  border-radius: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 12px;
}

.gate-card input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
}

.btn {
  display: inline-block;
  width: 100%;
  background: var(--blue);
  color: var(--white);
  border: none;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover { background: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn-secondary {
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-secondary:hover { background: var(--blue-pale); }

.error-msg {
  color: #c0392b;
  font-size: 13px;
  margin: -4px 0 12px;
  min-height: 16px;
}

/* ---- Status hero ---- */
.status-hero {
  background: var(--blue);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.status-hero.exception { background: var(--orange); }

.status-hero .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.status-hero .title {
  font-family: 'Poppins', sans-serif;
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 4px;
}

.status-hero .meta {
  font-size: 13px;
  opacity: 0.9;
}

.tracking-code-pill {
  display: inline-block;
  background: var(--white);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 0;
  margin-bottom: 14px;
}

.welfare-box {
  margin-bottom: 20px;
  text-align: center;
}
.welfare-box .error-msg {
  margin: 8px 0 0;
  text-align: center;
}

/* ---- Timeline ---- */
.timeline {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 18px 8px;
}

.tl-item {
  position: relative;
  padding: 16px 0 16px 34px;
  border-bottom: 1px solid var(--line);
}
.tl-item:last-child { border-bottom: none; }

.tl-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 16px;
  bottom: -1px;
  width: 2px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }

.tl-dot {
  position: absolute;
  left: 0;
  top: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 1;
}

.tl-item.exception .tl-dot { background: var(--orange); }

.tl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 8px;
}

.tl-head h3 {
  margin: 0;
  font-size: 15.5px;
  color: var(--navy);
}

.tl-item.exception .tl-head h3 { color: var(--orange-dark); }

.tl-now-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--blue-pale);
  color: var(--blue-dark);
  padding: 2px 7px;
  border-radius: 0;
  margin-left: 8px;
  vertical-align: middle;
}
.tl-item.exception .tl-now-badge { background: #fdf0e0; color: var(--orange-dark); }

.chevron {
  flex-shrink: 0;
  transition: transform 0.15s ease;
  color: var(--blue);
}
.tl-item.exception .chevron { color: var(--orange); }
.tl-item.collapsed .chevron { transform: rotate(180deg); }

.tl-body {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.2s ease;
}
.tl-item.collapsed .tl-body {
  max-height: 0;
}

.tl-time {
  font-size: 12.5px;
  color: var(--text-light);
  margin: 6px 0 4px;
}

.tl-message {
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  padding: 20px 16px 32px;
  line-height: 1.6;
}

.footer-note button.linklike {
  background: none;
  border: none;
  color: var(--text-light);
  text-decoration: underline;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.loading, .empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 40px 16px;
}

/* ---- Admin ---- */
.admin-shell { max-width: 720px; }

.admin-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.admin-card h2 {
  font-size: 16px;
  color: var(--navy);
  margin: 0 0 14px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 0;
  font-size: 15px;
  font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
}

.type-toggle {
  display: flex;
  gap: 10px;
}
.type-toggle label {
  flex: 1;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
}
.type-toggle input { display: none; }
.type-toggle input:checked + span { color: var(--blue); }
.type-toggle label:has(input:checked) { border-color: var(--blue); background: var(--blue-pale); color: var(--blue-dark); }
.type-toggle label.exception:has(input:checked) { border-color: var(--orange); background: #fdf0e0; color: var(--orange-dark); }

.admin-update-row {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.admin-update-row .aur-main { flex: 1; min-width: 0; }
.admin-update-row .aur-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.admin-update-row.exception .aur-title { color: var(--orange-dark); }
.admin-update-row .aur-time { font-size: 12px; color: var(--text-light); margin: 2px 0 4px; }
.admin-update-row .aur-msg { font-size: 13px; color: var(--text); word-wrap: break-word; }
.admin-update-row .aur-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-light);
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.danger:hover { color: #c0392b; border-color: #c0392b; }

.login-wrap {
  min-height: calc(100vh - 66px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.badge-authed {
  font-size: 12px;
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: 0;
  cursor: pointer;
  border: none;
  color: var(--white);
  font-family: inherit;
}

.templates-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}
.tmpl-chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--blue-pale);
  color: var(--blue-dark);
  border-radius: 0;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tmpl-chip:hover { background: #dbe8fb; }

@media (max-width: 400px) {
  .brand-text .logo { font-size: 17px; }
  .status-hero .title { font-size: 18px; }
}
