:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #0a6ed1;
  --danger: #bb0000;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.shell {
  background: #0a6ed1;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
}
.brand { display: grid; gap: 0.15rem; }
.brand span { font-size: 12px; opacity: 0.8; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
aside { background: #fff; border-right: 1px solid var(--border); padding: 0.75rem; }
.nav-title { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem; }
.nav-item {
  display: block;
  padding: 0.55rem 0.7rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  margin-bottom: 2px;
}
.nav-item.active, .nav-item:hover { background: #eaf3fc; color: var(--primary); font-weight: 600; }
.content { padding: 1rem 1.25rem; }
.page-head h1 { margin: 0.2rem 0 1rem; font-size: 1.35rem; }
.muted { color: var(--muted); font-size: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn.light { background: #fff; color: var(--text); border-color: var(--border); }
.btn.danger { background: #fff; color: var(--danger); border-color: #f1c0c0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; }
.stat { font-size: 1.6rem; font-weight: 700; margin-top: 0.35rem; }
.stat.danger { color: var(--danger); }
.limit-bar {
  margin-top: 0.25rem;
  height: 6px;
  background: #e8eef5;
  border-radius: 999px;
  overflow: hidden;
  min-width: 72px;
}
.limit-bar-fill {
  height: 100%;
  background: #2f8fdb;
  border-radius: 999px;
  max-width: 100%;
}
.limit-bar-fill.warn { background: #d97706; }
.limit-bar-fill.over { background: var(--danger); }
.limit-cell { min-width: 110px; font-size: 12px; }
.limit-cell .limit-bar { margin-top: 4px; min-width: 88px; }
.warn-text { color: #b45309; font-weight: 600; }
.btn.active-filter { background: #eaf3fc; border-color: #0a6ed1; color: #0a6ed1; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; align-items: center; }
.limit-usage-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  max-width: 920px;
}
.limit-usage-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.55rem;
}
.limit-usage-head h2 { margin: 0; font-size: 1.1rem; }
.limit-usage-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.95rem;
}
.limit-usage-totals strong { font-size: 1.35rem; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-top: 1px solid var(--border); vertical-align: middle; }
th { background: #f7f7f7; color: var(--muted); font-weight: 600; }
tr.row-error td { background: #fff5f5; }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: #f3f8fc; }
a.cell-link {
  color: #0b5cab;
  text-decoration: none;
  font-weight: 600;
}
a.cell-link:hover { text-decoration: underline; }
.pager { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.badge { background: #fff4e5; color: #b54708; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 11px; font-weight: 700; }
.banner { background: #eaf3fc; border: 1px solid #cde2f7; padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 0.75rem; }
.prepare-progress { display: grid; gap: 0.45rem; }
.prepare-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.prepare-progress-pct { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #0b5cab; }
.prepare-progress-track { height: 10px; background: #d7e8f8; border-radius: 999px; overflow: hidden; }
.prepare-progress-fill { height: 100%; background: linear-gradient(90deg, #2f8fdb, #0b5cab); border-radius: 999px; transition: width 0.4s ease; min-width: 0; }
.prepare-progress-meta { font-size: 0.9rem; color: #355872; }
.meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 12px; color: var(--muted); margin-bottom: 0.75rem; }
.error { color: var(--danger); font-size: 12px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.login-head { display: block; padding: 1rem 1rem 0; }
.login-head h1 { margin: 0.35rem 0 0; font-size: 1.5rem; }
.login-form { display: grid; gap: 0.75rem; padding: 1rem; }
.login-form label { display: grid; gap: 0.3rem; font-size: 12px; font-weight: 600; color: var(--muted); }
.login-form input, .toolbar input[type="text"], .toolbar input:not([type="file"]), .toolbar select {
  height: 34px; border: 1px solid var(--border); border-radius: 4px; padding: 0 0.6rem; font-size: 13px;
}
.form-grid { display: grid; gap: 0.75rem; max-width: 820px; background:#fff; border:1px solid var(--border); border-radius:6px; padding:1rem; }
.form-grid h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.form-grid label { display:grid; gap:0.3rem; font-size:12px; font-weight:600; color:var(--muted); }
.form-grid textarea, .form-grid input, .form-grid select, .inline-form input {
  border:1px solid var(--border); border-radius:4px; padding:0.45rem 0.6rem; font-size:13px; font-family:inherit;
}
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:0.75rem; }
.inline-form { display:flex; flex-wrap:wrap; gap:0.4rem; align-items:center; }
.prepare-form { display:flex; flex-wrap:wrap; gap:0.6rem; align-items:center; }
.prepare-form label { font-size:13px; display:inline-flex; gap:0.3rem; align-items:center; }
.row-price-form {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.row-price-form input[type="number"] {
  width: 5.2rem;
  min-height: 30px;
  padding: 0.2rem 0.35rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 13px;
}
.customer-id-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.customer-id-btn.customer-id-missing {
  color: #b91c1c;
  font-weight: 600;
}
.customer-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
}
.customer-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.customer-modal-card { padding: 1rem 1.1rem 1.05rem; }
.customer-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.customer-suggest-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
  margin-bottom: 0.85rem;
}
.customer-suggest-item {
  display: grid;
  text-align: left;
  border: 1px solid #dbe3f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}
.customer-suggest-item:hover { background: #eff6ff; border-color: #93c5fd; }
.customer-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
code { font-size: 12px; background:#f3f4f6; padding:0.1rem 0.3rem; border-radius:3px; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  aside { border-right: none; border-bottom: 1px solid var(--border); }
}
