:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e4e7ec;
  --brand: #e8572a;
  --brand-dark: #c8461d;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }

/* ---------- header ---------- */
.topbar {
  background: #1d2330;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px 18px;
  padding: 10px 20px;
  flex-wrap: wrap;
}
.topbar .logo { font-weight: 700; font-size: 17px; color: #fff; margin-right: 10px; }
.topbar .logo span { color: var(--brand); }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  color: #cbd2de;
  padding: 6px 10px;
  border-radius: 6px;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: #cbd2de; font-size: 14px; }
.bell { position: relative; color: #fff !important; font-size: 18px; }
.bell .count {
  position: absolute; top: -6px; right: -10px;
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 700; padding: 1px 6px;
}
.linkbtn { background: none; border: 0; color: #cbd2de; cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: #fff; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 60px; }

/* ---------- blocks ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat.bad .num { color: var(--bad); }
.stat.warn .num { color: var(--warn); }
a.stat:hover { text-decoration: none; border-color: #c5cad3; }
a.stat { color: inherit; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.clickable:hover td { background: #fafbfc; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #eef0f3; color: #374151;
}
.badge.ok, .badge.design_done, .badge.received { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.waiting_files, .badge.soon { background: var(--warn-bg); color: var(--warn); }
.badge.bad, .badge.overdue, .badge.today, .badge.needs_attention { background: var(--bad-bg); color: var(--bad); }
.badge.info, .badge.ready { background: var(--info-bg); color: var(--info); }
.badge.in_design { background: #ede9fe; color: #6d28d9; }
.badge.cancelled { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }

/* ---------- notes / alerts ---------- */
.flash { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.flash.success { background: var(--ok-bg); border-color: #bbf7d0; color: #14532d; }
.flash.error { background: var(--bad-bg); border-color: #fecaca; color: #7f1d1d; }
.note-box { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; border: 1px solid; }
.note-box.yellow { background: var(--warn-bg); border-color: #fde68a; color: #713f12; }
.note-box.red { background: var(--bad-bg); border-color: #fecaca; color: #7f1d1d; }
.note-box.blue { background: var(--info-bg); border-color: #bfdbfe; color: #1e3a8a; }
.note-box > strong:first-child { display: block; margin-bottom: 2px; }

.alert-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: 0; }
.alert-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); margin-top: 7px; flex: none; }
.alert-item.urgent .dot { background: var(--bad); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd4dc; border-radius: 8px;
  font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #fbcfbe; border-color: var(--brand); }
.field { margin-bottom: 14px; }
.error-text { color: var(--bad); font-size: 13px; margin-top: 4px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid #cfd4dc;
  background: #fff; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 16px 28px; font-size: 18px; border-radius: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- order detail ---------- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.folder {
  display: flex; gap: 8px; align-items: center;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 10px 12px;
}
.folder code { flex: 1; overflow-wrap: anywhere; font-size: 14px; }
.opt { display: inline-block; background: #f3f4f6; border-radius: 6px; padding: 1px 8px; margin: 0 4px 4px 0; font-size: 13px; }
.opt b { font-weight: 600; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .sent_back { color: var(--bad); }
.timeline .returned { color: var(--ok); }

.hero { text-align: center; padding: 40px 18px; }
.hero .big-num { font-size: 48px; font-weight: 800; line-height: 1; }

.login-wrap { max-width: 380px; margin: 10vh auto; }

.dropzone {
  border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 30px; text-align: center;
  background: #f8fafc;
}

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

@media (max-width: 640px) {
  main { padding: 16px 16px 40px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .topbar { padding: 10px 16px; }
}

/* customer emails */
.email-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.email-item .email-body { margin-top: 4px; }
.timeline .customer { white-space: pre-line; background: var(--info-bg); border-radius: 8px; padding: 10px 12px; margin: 6px 0; border-bottom: 0; }
.nav-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* import progress */
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.progress-bar { height: 100%; background: var(--brand); transition: width .4s; }
