:root {
  --yellow: #f0b705;
  --yellow-soft: #fff4cc;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e7e2d6;
  --bg: #faf8f2;
  --card: #ffffff;
  --green: #1f8a4c;
  --red: #c0392b;
  --blue: #2563eb;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
button, input, select, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--ink);
  color: #fff;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 10px; }
.brand strong { display: block; font-size: 18px; color: var(--yellow); line-height: 1.1; }
.brand span { font-size: 12px; color: #cfcfcf; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button {
  background: transparent;
  color: #e9e9e9;
  border: 0;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button.active { background: var(--yellow); color: var(--ink); font-weight: 700; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  margin-inline-start: 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 28px 0 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card.narrow { max-width: 380px; margin: 40px auto; }
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--yellow); border-color: var(--yellow); }
button {
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.ghost { background: transparent; color: inherit; border: 1px solid currentColor; font-weight: 600; }
button.danger { background: var(--red); color: #fff; }
button.ok { background: var(--green); color: #fff; }
button.small { padding: 4px 10px; font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; }
.toolbar select, .toolbar input { max-width: 280px; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat b { display: block; font-size: 28px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.hot { background: var(--yellow-soft); border-color: var(--yellow); }

.list { display: grid; gap: 10px; }
.row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}
.row .head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.row .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eee;
}
.pill.searching, .pill.pending { background: var(--yellow-soft); color: #7a5b00; }
.pill.accepted, .pill.arrived, .pill.in_progress { background: #e0ecff; color: var(--blue); }
.pill.completed, .pill.approved { background: #dcf3e5; color: var(--green); }
.pill.cancelled, .pill.expired, .pill.rejected, .pill.suspended { background: #fbe3e0; color: var(--red); }
.empty { color: var(--muted); padding: 20px; text-align: center; }

.docs { display: flex; gap: 6px; flex-wrap: wrap; }
.docs select { width: auto; margin: 0; padding: 2px 6px; font-size: 12px; }
.docs label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; font-size: 12px; }

.prices { display: grid; gap: 12px; }
.price-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.price-card label { margin: 0; font-size: 12px; }
.price-card .check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.price-card .check input { width: auto; margin: 0; }

.toast {
  position: fixed;
  bottom: 20px;
  inset-inline: 0;
  margin: 0 auto;
  width: max-content;
  max-width: 90vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  z-index: 10;
}
.toast.error { background: var(--red); }

dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: 520px; width: 92vw; }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.timeline { padding-inline-start: 20px; }
.timeline li { margin-bottom: 6px; }
.timeline time { color: var(--muted); font-size: 12px; margin-inline-start: 6px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { white-space: nowrap; }
}
