:root {
  --primary: #ffc400;
  --primary-dark: #c99a00;
  --text: #131313;
  --muted: #6b6b6b;
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(19, 19, 19, 0.06);

  /* Dark surfaces (used where the white logo needs contrast) */
  --dark-surface: #1c1c1c;
  --dark-surface-2: #262626;
  --dark-border: #343434;
  --on-dark: #f5f5f5;
  --on-dark-muted: #a0a0a0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
html,
body {
  min-height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body > main,
body > .wf_login {
  flex: 1 0 auto;
}
body > .wf_footerbar {
  flex-shrink: 0;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------- Login ---------- */
.wf_login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--dark-surface);
}

.wf_body--login {
  background: var(--dark-surface);
}

.wf_login__card {
  width: 100%;
  max-width: 380px;
  background: var(--dark-surface-2);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 32px 28px;
  border-top: 4px solid var(--primary);
  color: var(--on-dark);
}

.wf_login__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.wf_login__logo img {
  max-width: 160px;
  height: auto;
}

.wf_login__card h1 {
  font-size: 18px;
  text-align: center;
  margin: 0 0 20px;
  color: var(--on-dark);
  font-weight: 600;
}

.wf_login__card .wf_field label {
  color: var(--on-dark-muted);
}
.wf_login__card .wf_field input {
  background: #111;
  color: var(--on-dark);
  border-color: var(--dark-border);
}
.wf_login__card .wf_field input::placeholder {
  color: #666;
}
.wf_login__card .wf_field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.25);
  background: #0d0d0d;
}

/* ---------- Field ---------- */
.wf_field {
  margin-bottom: 14px;
}
.wf_field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 500;
}
.wf_field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.wf_field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.2);
}
.wf_field select {
  width: 100%;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.wf_field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.2);
}
.wf_field select:hover {
  border-color: #d0d0d0;
}

/* ---------- Alert ---------- */
.wf_alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.wf_alert--error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
}
.wf_login__card .wf_alert--error {
  background: rgba(192, 57, 43, 0.15);
  color: #ff8a80;
  border-color: rgba(192, 57, 43, 0.4);
}

/* ---------- Button ---------- */
.wf_btn {
  display: inline-block;
  background: var(--primary);
  color: var(--text);
  border: 0;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
}
.wf_btn:hover {
  background: var(--primary-dark);
  color: #fff;
}
.wf_btn--block {
  display: block;
  width: 100%;
  text-align: center;
}
.wf_btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.wf_btn--ghost:hover {
  background: #f0f0f0;
  color: var(--text);
}
.wf_btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}
.wf_btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.4);
}
.wf_btn--danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.wf_btn--success {
  background: #2e9d5a;
  color: #fff;
  border: 1px solid #2e9d5a;
}
.wf_btn--success:hover {
  background: #247a46;
  color: #fff;
  border-color: #247a46;
}

/* ---------- Topbar ---------- */
.wf_topbar {
  background: var(--dark-surface);
  border-bottom: 3px solid var(--primary);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.wf_topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--on-dark);
}
.wf_topbar__brand img {
  height: 32px;
  width: auto;
}
.wf_topbar__user {
  font-size: 13px;
  color: var(--on-dark-muted);
  display: flex;
  align-items: center;
  gap: 14px;
}
.wf_topbar__user strong {
  color: var(--on-dark);
}
.wf_topbar__link {
  color: var(--on-dark);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}
.wf_topbar__link:hover {
  background: var(--dark-surface-2);
  text-decoration: none;
}
.wf_topbar .wf_btn--ghost {
  background: transparent;
  color: var(--on-dark);
  border-color: var(--dark-border);
}
.wf_topbar .wf_btn--ghost:hover {
  background: var(--dark-surface-2);
  color: var(--on-dark);
}

/* ---------- Container ---------- */
.wf_container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

/* ---------- Page title ---------- */
.wf_page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
}
.wf_page-title h1 {
  margin: 0;
  font-size: 22px;
  color: var(--text);
}
.wf_page-title__count {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Filters ---------- */
.wf_filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  align-items: end;
  gap: 12px;
  margin: 0 0 18px;
}
.wf_filters .wf_field {
  margin-bottom: 0;
}
.wf_filters .wf_btn {
  min-height: 41px;
  white-space: nowrap;
}

/* ---------- Empty state ---------- */
.wf_empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  padding: 40px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- Order card ---------- */
.wf_order {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
  border-left: 4px solid var(--primary);
}
.wf_order--archived {
  border-left-color: var(--muted);
  opacity: 0.95;
}
.wf_order--archived .wf_order__total {
  background: #f0f0f0;
}
.wf_order--confirmed {
  border-left-color: #2e9d5a;
}
.wf_order--confirmed .wf_order__total {
  background: #e7f6ec;
}
.wf_order__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.wf_order__meta {
  font-size: 13px;
  color: var(--muted);
}
.wf_order__meta strong {
  color: var(--text);
}
.wf_order__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wf_order__form {
  margin: 0;
}
.wf_order__total {
  font-weight: 700;
  color: var(--text);
  font-size: 18px;
  background: #fff7d6;
  padding: 4px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.wf_order__received {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Flash ---------- */
.wf_flash {
  max-width: 1200px;
  margin: 14px auto 0;
  padding: 10px 16px;
  background: #fff7d6;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

/* ---------- Customer ---------- */
.wf_customer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 24px;
  margin: 8px 0 12px;
  font-size: 14px;
}
.wf_customer div strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  font-weight: 600;
}

/* ---------- Items table ---------- */
table.wf_items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 14px;
}
table.wf_items th,
table.wf_items td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
table.wf_items th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
table.wf_items td.wf_items__qty {
  width: 120px;
  text-align: right !important;
}
table.wf_items th.wf_items__qty {
  text-align: right !important;
}

/* ---------- Stats ---------- */
.wf_stats__toggle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.wf_stats__toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.wf_stats__note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.wf_stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.wf_stats-summary--sub {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 14px 0 16px;
}

.wf_stat {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
}
.wf_stat__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.wf_stat__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.wf_stats-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.wf_stats-section h2 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.wf_stats-search {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 8px;
}
.wf_stats-search .wf_field {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .wf_stats-search {
    grid-template-columns: 1fr;
  }
}

/* ---------- Orders list + infinite scroll sentinel ---------- */
.wf_orders__sentinel {
  height: 1px;
  margin: 0 auto 20px;
  max-width: 1200px;
}

/* ---------- Footer ---------- */
.wf_footerbar {
  background: var(--dark-surface);
  border-top: 3px solid var(--primary);
  color: var(--on-dark-muted);
  text-align: center;
  padding: 12px 16px;
  font-size: 12px;
  margin-top: 32px;
}
.wf_footerbar strong {
  color: var(--on-dark);
  font-weight: 600;
}

@media (max-width: 720px) {
  .wf_topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .wf_topbar__user {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .wf_filters {
    grid-template-columns: 1fr;
  }
}
