:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1c2536;
  --muted: #5b6678;
  --border: #e2e7f0;
  --brand: #1f6feb;
  --brand-dark: #1a5fce;
  --accent: #0f9d8a;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --shadow: 0 8px 24px rgba(20, 33, 61, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
}
.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
}
.topbar nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  margin-left: 18px;
}
.topbar nav a:hover { color: var(--ink); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}
.narrow { max-width: 680px; }

.hero h1 {
  font-size: 1.9rem;
  margin: 0 0 10px;
}
.hero p.lead {
  font-size: 1.06rem;
  color: var(--muted);
  margin: 0 0 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 1.25rem; }
.card h3 { font-size: 1.02rem; margin: 0 0 12px; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 4px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #e8f0fe;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 8px;
}
.step strong { display: block; }
.step span { color: var(--muted); font-size: 0.92rem; }

form .field { margin-bottom: 16px; }
label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.94rem;
}
.hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 11px 12px;
  font-size: 0.98rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}
.field.has-error input,
.field.has-error textarea,
.field.has-error select { border-color: var(--danger); }
.error-text {
  color: var(--danger);
  font-size: 0.84rem;
  margin-top: 5px;
  min-height: 1em;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn-ghost:hover { background: #f0f3f9; }

.banner {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.94rem;
}
.banner-error { background: var(--danger-bg); color: var(--danger); }
.banner-info { background: #e8f0fe; color: var(--brand-dark); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-new { background: #e8f0fe; color: #1a5fce; }
.badge-acknowledged { background: #fff4d6; color: #9a6b00; }
.badge-in_progress { background: #e3f2ec; color: #0c7a5d; }
.badge-waiting_guest { background: #f3e8ff; color: #7c3aed; }
.badge-done { background: #e7ebf0; color: #475067; }

.type-tag {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  background: #f0f3f9;
  border-radius: 6px;
  padding: 2px 8px;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f9fc; }
.req-ref { font-weight: 700; }
.req-sub { color: var(--muted); font-size: 0.86rem; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.confirm-ref {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
  background: #e8f0fe;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 10px;
  margin: 6px 0 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.detail-grid .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-grid .value { margin-bottom: 6px; }
.full { grid-column: 1 / -1; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  padding: 9px 0 9px 28px;
  position: relative;
  border-bottom: 1px dashed var(--border);
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
  content: '';
  position: absolute;
  left: 2px; top: 13px;
  width: 14px; height: 14px;
  border: 2px solid var(--brand);
  border-radius: 4px;
}

.history { list-style: none; padding: 0; margin: 0; }
.history li {
  padding: 10px 0 10px 18px;
  border-left: 2px solid var(--border);
  position: relative;
}
.history li::before {
  content: '';
  position: absolute;
  left: -6px; top: 14px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand);
}
.history .when { color: var(--muted); font-size: 0.82rem; }
.history .note { margin-top: 2px; }

.status-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.status-form .grow { flex: 1; min-width: 200px; }

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--muted);
}

.muted { color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .row2, .detail-grid, .steps { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
