@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500;600&display=swap');

:root {
  --paper: #F6F3EC;
  --paper-line: #DCD5C4;
  --ink: #232722;
  --ink-soft: #5B5A50;
  --rust: #B5502C;
  --rust-deep: #8C3D22;
  --slate: #3C5A63;
  --ok: #4B6B45;
  --hold: #A6462E;
  --radius: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

h1, h2 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  margin: 0 0 0.6em;
  color: var(--ink);
}

h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }

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

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.container.narrow { max-width: 380px; }

/* ---- Public tracking page ---- */

.masthead {
  border-bottom: 1px solid var(--paper-line);
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  max-width: 640px;
  margin: 0 auto;
}

.masthead .brand {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
}

.masthead .brand span {
  color: var(--rust);
}

.track-form {
  display: flex;
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}

.track-form input[type="text"] {
  flex: 1;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1rem;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  color: var(--ink);
}

.track-form input[type="text"]:focus {
  outline: 2px solid var(--slate);
  outline-offset: 1px;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  background: var(--rust);
  color: #fff;
  font-weight: 500;
}

button:hover { background: var(--rust-deep); }

.error {
  color: var(--hold);
  border-left: 2px solid var(--hold);
  padding-left: 0.75rem;
}

.success {
  color: var(--ok);
  border-left: 2px solid var(--ok);
  padding-left: 0.75rem;
  margin-bottom: 1.2rem;
}

.result {
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: #fff;
}

.result h2 {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.status {
  display: inline-block;
  margin: 0.2rem 0 1.1rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  font-weight: 500;
  font-size: 0.92rem;
}

.status-delivered { border-color: var(--ok); color: var(--ok); }
.status-on-hold { border-color: var(--hold); color: var(--hold); }

.result dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
}

.result dt { color: var(--ink-soft); font-size: 0.92rem; }
.result dd { margin: 0; }

.notes {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--paper-line);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---- Admin ---- */

.admin-header {
  border-bottom: 1px solid var(--paper-line);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.admin-header a { color: var(--rust); }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.login-form input {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  font-size: 1rem;
}

.new-shipment {
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  background: #fff;
}

.new-shipment summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--rust);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.inline-form input,
.inline-form select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.shipments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}

.shipments-table th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink);
  padding: 0.6rem 0.7rem;
}

.shipments-table td {
  border-bottom: 1px solid var(--paper-line);
  padding: 0.6rem 0.7rem;
  vertical-align: middle;
}

.shipments-table td:first-child {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
}

.shipments-table select,
.shipments-table input[type="text"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  font-size: 0.88rem;
  width: 100%;
}

.shipments-table button {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .shipments-table { display: block; overflow-x: auto; white-space: nowrap; }
}
