:root {
  color-scheme: dark;
  --bg: #0a0e12;
  --panel: #11171d;
  --panel2: #19232b;
  --line: #293740;
  --text: #e8f0f3;
  --muted: #8b9ca6;
  --cyan: #39d6cb;
  --cyan-dim: #153a3a;
  --red: #ff737a;
  --green: #7de0b0;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 75% -10%, #143333 0, transparent 38%), var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; }
.topbar {
  min-height: 76px;
  padding: 12px max(22px, calc((100% - 1440px)/2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #090e12ed;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 1.4px;
  flex-shrink: 0;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.4px;
}
.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--cyan);
  border-radius: 12px;
  background: var(--cyan-dim);
  color: var(--cyan);
  font-size: 22px;
  box-shadow: 0 0 22px #39d6cb12;
}
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.access-label { color: var(--muted); font-size: 10px; letter-spacing: 1.1px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--cyan);
  border-radius: 9px;
  background: var(--cyan);
  color: #061b1a;
  padding: 9px 14px;
  font-weight: 750;
  cursor: pointer;
  text-align: center;
  transition: filter .15s, border-color .15s, background .15s;
}
.button:hover { filter: brightness(1.09); }
.button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
main { max-width: 1440px; padding: 30px 24px 60px; margin: auto; min-height: calc(100vh - 145px); }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 10px 0 26px; }
.eyebrow { color: var(--cyan); font-size: 10px; letter-spacing: 2px; font-weight: 850; }
h1 { font-size: clamp(27px, 4vw, 39px); line-height: 1.2; letter-spacing: -1px; margin: 8px 0; overflow-wrap: anywhere; }
h2 { font-size: 21px; letter-spacing: -.35px; margin: 4px 0; }
h3 { font-size: 16px; line-height: 1.4; margin: 7px 0; overflow-wrap: anywhere; }
.hero p, .muted { color: var(--muted); }
.hero p { margin: 8px 0 0; }
.today { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.stat, .panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #141d24, #10161c);
}
.stat { padding: 17px 18px; position: relative; overflow: hidden; }
.stat:before { content: ""; position: absolute; left: 0; top: 15px; bottom: 15px; width: 2px; background: var(--cyan); opacity: .65; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 5px; font-size: 31px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(270px, .8fr); gap: 20px; align-items: start; }
.panel { padding: 22px; margin-bottom: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.panel-head > a { font-size: 13px; }
.order-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.order {
  display: block;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0c1217;
  color: var(--text);
  transition: border-color .15s, background .15s, transform .15s;
}
.order:hover { border-color: #329e99; background: #101b20; }
.order-top, .order-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order-id, .priority, .count {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 4px 7px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 11px;
}
.order-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
  white-space: nowrap;
}
.status-active { color: var(--cyan); background: #12302f; border-color: #245451; }
.status-active:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }
.status-closed { color: var(--green); background: #142b23; border-color: #2a4a3c; }
.status-closed:before { content: "✓"; font-size: 10px; }
.order h3 { margin: 14px 0 5px; }
.order-meta { margin-top: 10px; }
.urgent { color: #ffb1a5; border: 1px solid #653b38; background: #2a1c1c; }
.order-bottom { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 12px; font-size: 12px; }
.red { color: var(--red) !important; }
.empty { text-align: center; padding: 36px 12px; }
.empty-icon { color: var(--cyan); font-size: 28px; }
.empty p { color: var(--muted); margin-bottom: 22px; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #30414b;
  border-radius: 8px;
  padding: 11px 12px;
  background: #0a1116;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--cyan); border-color: var(--cyan); }
input[type="checkbox"] { accent-color: var(--cyan); }
.task-form { display: grid; gap: 9px; margin-bottom: 20px; }
.tasks { border-top: 1px solid var(--line); }
.task { display: flex; align-items: start; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.task form { margin: 0; }
.check { width: 27px; height: 27px; border: 1px solid #42606b; border-radius: 7px; background: transparent; color: var(--cyan); cursor: pointer; }
.task-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.form-wrap { max-width: 760px; margin: 0 auto; }
.back { display: inline-block; margin: 0 0 18px; color: var(--muted); }
.back:hover { color: var(--cyan); }
.big-form { display: grid; gap: 17px; margin-top: 24px; }
.big-form label { display: grid; gap: 7px; color: #c6d5dc; font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.item-input { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.item-input .kind { display: flex; align-items: center; gap: 9px; }
.item-input .kind input { width: 18px; height: 18px; }
.quantity { display: flex !important; align-items: center; gap: 10px !important; }
.quantity input { width: 90px; }
.small { font-size: 11px; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 5px; }
.error { color: var(--red); }
.detail h1 { margin-bottom: 8px; }
.detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.detail-heading > div { min-width: 0; }
.detail-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 25px; }
.detail-grid div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #0b1217; }
.detail-grid small, .detail-grid strong { display: block; }
.detail-grid small { color: var(--muted); font-size: 11px; }
.detail-grid strong { margin-top: 5px; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; padding-top: 15px; border-top: 1px solid var(--line); color: #bdcbd1; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 0; border-top: 1px solid var(--line); }
.item-row h3 { margin: 0 0 4px; }
.status-form { display: flex; align-items: center; gap: 8px; }
.status-form select { min-width: 155px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
footer { padding: 20px; border-top: 1px solid var(--line); color: #617783; text-align: center; font-size: 11px; }
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar { min-height: 65px; padding: 10px 13px; gap: 9px; }
  .brand { gap: 8px; font-size: 11px; letter-spacing: .7px; }
  .brand small { font-size: 8px; letter-spacing: .6px; }
  .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 19px; }
  .header-actions { gap: 6px; }
  .access-label { display: none; }
  .header-actions .button { min-height: 35px; padding: 7px 9px; font-size: 12px; }
  main { padding: 22px 13px 40px; }
  .hero { align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 4px; }
  .hero h1 { font-size: 29px; }
  .stats { gap: 8px; }
  .stat { padding: 13px; }
  .stat strong { font-size: 27px; }
  .stat span { font-size: 11px; }
  .panel { padding: 16px; border-radius: 12px; }
  .order-list { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-heading { flex-direction: column; gap: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .item-row { align-items: flex-start; flex-direction: column; }
  .status-form { width: 100%; }
  .status-form select { flex: 1; min-width: 0; }
  .quantity input { width: 75px; }
  .actions { justify-content: stretch; }
  .actions .button { flex: 1; }
}
@media (max-width: 360px) {
  .brand small { letter-spacing: 0; }
  .header-actions .button { padding: 7px; }
  .order-bottom { align-items: flex-start; flex-direction: column; gap: 5px; }
}

/* Order and item management */
.item-add-form,
.item-admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
}

.item-add-form {
  padding: 16px;
  border: 1px solid var(--border, #303b43);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.item-add-form label,
.item-admin-actions label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 100px;
  flex: 1;
}

.item-add-form input,
.item-add-form select,
.item-admin-actions input,
.item-admin-actions select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
}

.item-admin-actions {
  justify-content: flex-start;
  width: 100%;
}

.item-admin-actions form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.button.danger {
  background: #8f303b;
  color: #fff;
  border: 1px solid #b94b58;
}

.button.danger:hover {
  background: #a83a47;
}

.delete-order-zone {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid rgba(220, 70, 85, 0.45);
  border-radius: 14px;
  background: rgba(150, 35, 50, 0.07);
}

.delete-order-zone h2 {
  margin-top: 0;
}

@media (max-width: 600px) {
  .item-add-form,
  .item-admin-actions,
  .item-admin-actions form {
    flex-direction: column;
    align-items: stretch;
  }

  .item-add-form label,
  .item-admin-actions label,
  .item-admin-actions form,
  .item-add-form .button,
  .item-admin-actions .button,
  .delete-order-zone .button {
    width: 100%;
    box-sizing: border-box;
  }
}
