:root {
  color-scheme: light;
  --ink: #16181b;
  --muted: #747980;
  --line: #eceef0;
  --line-strong: #d9dcdf;
  --surface: #ffffff;
  --canvas: #f7f8f9;
  --green: #00bf63;
  --red: #ff3141;
  --amber: #e69600;
  --blue: #306bff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(48, 107, 255, .18);
  outline-offset: 1px;
}

.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;
}

.app-header {
  height: 86px;
  padding: 0 clamp(24px, 4vw, 68px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-brand, .account-area, .filter-group, .action-group, .order-number, .credit-value, .status-value {
  display: flex;
  align-items: center;
}

.app-brand { gap: 14px; }
.account-area { gap: 18px; color: var(--muted); }

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.04em;
}

.brand-mark.small { width: 42px; height: 42px; font-size: 17px; }

.eyebrow {
  margin: 0 0 3px;
  color: #8a8e94;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
}

h1, h2 { margin: 0; letter-spacing: -.025em; }
.app-header h1 { font-size: 20px; font-weight: 680; }

.content { padding: 26px clamp(24px, 4vw, 68px) 60px; }

.toolbar {
  min-height: 58px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.filter-group, .action-group { gap: 10px; }

input[type="text"], input[type="password"], input[type="search"], input[type="datetime-local"], select {
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  padding: 0 12px;
  color: var(--ink);
  transition: border-color .16s, box-shadow .16s;
}

input:hover, select:hover { border-color: #bec3c8; }
input:focus, select:focus { border-color: #7a8796; }

.search-field { position: relative; }
.search-field svg {
  position: absolute;
  left: 13px;
  top: 12px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #858a90;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search-field input { width: min(320px, 30vw); padding-left: 40px; }

.button {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 620;
  transition: background .16s, border-color .16s, opacity .16s, transform .08s;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .38; cursor: default; }
.button.primary { color: white; background: var(--ink); }
.button.primary:hover:not(:disabled) { background: #303338; }
.button.secondary { background: white; border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { background: #f4f5f6; }
.button.danger { color: #d72837; background: white; border-color: #efcfd2; }
.button.danger:hover:not(:disabled) { background: #fff3f4; }

.text-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
}
.text-button:hover { text-decoration: underline; }
.selection-count { min-width: 70px; color: var(--muted); font-size: 14px; text-align: right; }

.table-shell {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1100px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 0 20px; text-align: left; white-space: nowrap; }
th {
  height: 72px;
  background: #fbfbfc;
  border-bottom: 1px solid var(--line);
  color: #202327;
  font-size: 14px;
  font-weight: 650;
}
td {
  height: 88px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fbfcfc; }
.check-column { width: 74px; padding-left: 24px; padding-right: 10px; }
.order-column { width: 360px; }
.time-column { width: 200px; }
.status-column { width: 140px; border-left: 1px solid var(--line); }

input[type="checkbox"] {
  appearance: none;
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-content: center;
  border: 1.5px solid #aeb3b8;
  border-radius: 5px;
  background: white;
  cursor: pointer;
}
input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 5px;
  margin-top: -2px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) scale(0);
}
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { border-color: var(--ink); background: var(--ink); }
input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
input[type="checkbox"]:indeterminate::before { width: 9px; height: 0; margin: 0; border-left: 0; transform: rotate(0) scale(1); }

.order-number { gap: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 15px; font-weight: 550; }
.copy-button, .icon-button {
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.copy-button:hover, .icon-button:hover { background: #eff1f2; }
.copy-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.credit-value { gap: 5px; }
.currency-symbol { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: white; background: #1c1d1f; font-size: 15px; }
.muted { color: #8a8e93; }

.invoice-tag {
  display: inline-flex;
  height: 28px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid #dcdfe1;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.invoice-tag.uninvoiced { color: #00a956; border-color: #b8eeca; background: #edfff3; }

.status-value { gap: 9px; }
.status-value i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.status-value.unpaid i { background: var(--red); }
.status-value.pending i { background: var(--amber); }
.status-value.refunded i { background: var(--blue); }

.empty-state { padding: 110px 20px; color: var(--muted); text-align: center; }
.empty-state p { margin: 0 0 12px; font-size: 17px; }

dialog {
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(19, 24, 30, .24);
}
dialog::backdrop { background: rgba(20, 24, 28, .42); backdrop-filter: blur(2px); }
.order-dialog { width: min(680px, calc(100vw - 32px)); }
.order-dialog form { padding: 28px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; }
.dialog-header h2 { font-size: 24px; }
.icon-button { width: 36px; height: 36px; color: #565b61; font-size: 25px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid label, .login-panel label { display: grid; gap: 7px; color: #555b62; font-size: 13px; font-weight: 620; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; }
.form-error { min-height: 21px; margin: 13px 0 0; color: #d72837; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 20;
  transform: translate(-50%, 20px);
  padding: 11px 16px;
  border-radius: 8px;
  background: #202327;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  box-shadow: 0 8px 30px rgba(20, 24, 28, .2);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b31f2d; }

.login-page { background: white; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-panel { width: min(100%, 380px); }
.login-panel .brand-mark { margin-bottom: 34px; }
.login-panel h1 { margin-bottom: 9px; font-size: 32px; }
.login-intro { margin: 0 0 34px; color: var(--muted); }
.login-panel form { display: grid; gap: 13px; }
.login-panel form label { margin-top: 3px; }
.login-panel input { width: 100%; height: 46px; }
.login-button { width: 100%; height: 46px; margin-top: 3px; }

@media (max-width: 900px) {
  .app-header { height: 74px; padding: 0 18px; }
  .brand-mark.small { width: 36px; height: 36px; }
  .content { padding: 18px 16px 48px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filter-group, .action-group { width: 100%; }
  .filter-group > *, .search-field input { flex: 1; width: 100%; }
  .action-group { justify-content: flex-end; flex-wrap: wrap; }
  .selection-count { margin-right: auto; align-self: center; text-align: left; }
}

@media (max-width: 560px) {
  .account-area #account-name, .eyebrow { display: none; }
  .app-brand { gap: 10px; }
  .app-header h1 { font-size: 18px; }
  .filter-group { flex-direction: column; }
  .action-group .button { padding: 0 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .order-dialog form { padding: 22px 18px; }
}
