:root {
  --ink: #15231f;
  --muted: #687873;
  --green: #173e36;
  --green-2: #245d50;
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --gold: #d69b38;
  --gold-soft: #fff2d5;
  --red: #a94037;
  --red-soft: #fde9e6;
  --line: #dce3df;
  --shadow: 0 12px 38px rgba(24, 51, 44, .11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #edf2ef;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #edf2ef; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 4.8rem); line-height: .98; font-weight: 500; letter-spacing: -.04em; }
h2 { font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.35rem); font-weight: 500; margin-bottom: .5rem; }
h3 { margin-bottom: .4rem; }
.hidden { display: none !important; }
.eyebrow { margin-bottom: .55rem; color: var(--gold); text-transform: uppercase; font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.muted { color: var(--muted); }
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); align-items: center; gap: 5vw; padding: clamp(2rem, 8vw, 8rem); color: #fff; background: radial-gradient(circle at 18% 22%, #2b6657 0, #173e36 42%, #102c26 100%); }
.login-brand { display: flex; gap: 1.4rem; align-items: flex-start; }
.login-brand h1 { max-width: 650px; margin-bottom: 1.1rem; }
.login-copy { color: #d7e5df; font-size: 1.05rem; }
.official-logo { display: block; object-fit: contain; background: #000; }
.login-logo { width: min(290px, 38vw); height: auto; border-radius: 4px; box-shadow: 0 14px 35px rgba(0,0,0,.25); }
.sidebar-logo { width: 84px; height: 36px; border-radius: 3px; }
.mobile-logo { width: 72px; height: 36px; border-radius: 3px; }
.login-card { width: 100%; max-width: 460px; justify-self: end; padding: clamp(1.6rem, 4vw, 2.7rem); border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 26px 70px rgba(0,0,0,.3); }
.login-card h2 { margin-bottom: 1.5rem; }
label { display: grid; gap: .45rem; margin-bottom: 1rem; color: #354640; font-size: .84rem; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #cbd6d1; border-radius: 10px; padding: .75rem .9rem; background: #fff; color: var(--ink); outline: none; }
textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(36,93,80,.14); }
.password-entry { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.show-password-control { display: flex; grid-template-columns: none; align-items: center; gap: .55rem; width: fit-content; margin: -.35rem 0 1rem; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 700; }
.show-password-control input { width: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: var(--green); }
.privacy-note { margin: 1rem 0 0; color: var(--muted); text-align: center; font-size: .77rem; }
.left-note { text-align: left; line-height: 1.45; }
.form-error { min-height: 1.2em; color: var(--red); font-weight: 650; font-size: .82rem; }
.button { border: 0; border-radius: 9px; padding: .78rem 1rem; cursor: pointer; font-weight: 800; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { color: #fff; background: var(--green); }
.button.accent { color: #1f2b22; background: var(--gold); }
.button.quiet { color: var(--green); background: #e7efeb; }
.button.danger { color: #fff; background: var(--red); }
.button.wide { width: 100%; }
.text-button { border: 0; padding: 0; background: none; color: var(--green-2); cursor: pointer; font-weight: 750; }
.icon-button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 1.3rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.35rem 1rem; color: #eaf3ef; background: var(--green); }
.brand { display: flex; align-items: center; gap: .8rem; padding: 0 .45rem 1.4rem; }
.brand span:last-child { display: grid; }
.brand small { color: #a9beb6; font-size: .72rem; margin-top: .15rem; }
.sidebar nav { display: grid; gap: .25rem; }
.sidebar nav a { display: flex; gap: .75rem; align-items: center; padding: .73rem .8rem; border-radius: 9px; color: #bfd0ca; font-size: .9rem; font-weight: 650; }
.sidebar nav a span { width: 19px; text-align: center; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.admin-nav { margin-top: 1.35rem; padding-top: .9rem; border-top: 1px solid rgba(255,255,255,.12); }
.admin-nav p { margin: 0 0 .5rem .8rem; color: #78968b; font-size: .63rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.user-card { display: grid; grid-template-columns: 36px 1fr 28px; gap: .65rem; align-items: center; margin-top: auto; padding: .75rem .45rem 0; border-top: 1px solid rgba(255,255,255,.13); }
.user-card div:nth-child(2) { display: grid; min-width: 0; }
.user-card strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .82rem; }
.user-card small { color: #9fb5ad; font-size: .7rem; text-transform: capitalize; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--ink); font-weight: 900; font-size: .72rem; }
.main-column { min-width: 0; }
.mobile-header { display: none; }
main { max-width: 1400px; min-height: 100vh; padding: clamp(1.5rem, 4vw, 3.4rem); }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.7rem; }
.page-header h1 { margin-bottom: .2rem; font-size: clamp(2.15rem, 4vw, 3.5rem); }
.page-header p { color: var(--muted); margin-bottom: 0; }
.toolbar { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1 1 260px; }
.search-box input { padding-left: 2.5rem; }
.search-box::before { content: "⌕"; position: absolute; left: .9rem; top: .65rem; color: var(--muted); font-size: 1.2rem; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(135px, 1fr)); gap: .9rem; margin-bottom: 2rem; }
.metric { min-height: 116px; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 5px 18px rgba(24,51,44,.04); }
.metric strong { display: block; font-family: Georgia, serif; font-size: 2.15rem; font-weight: 500; }
.metric span { color: var(--muted); font-size: .78rem; font-weight: 750; }
.metric.highlight { color: #644312; background: var(--gold-soft); border-color: #eacb92; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 .8rem; }
.section-heading h2 { margin: 0; font-size: 1.45rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }
.card { padding: 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 5px 18px rgba(24,51,44,.04); }
.card.clickable { transition: transform .16s ease, box-shadow .16s ease; }
.card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.auction-number { color: var(--gold); font-weight: 850; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.auction-title { min-height: 2.7em; margin: .45rem 0 1rem; line-height: 1.35; }
.mini-stats { display: flex; gap: 1.1rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .74rem; }
.mini-stats strong { display: block; color: var(--ink); font-size: 1.08rem; }
.status-chip { display: inline-flex; align-items: center; gap: .3rem; width: fit-content; padding: .28rem .5rem; border-radius: 99px; color: #295e51; background: #e4f1eb; font-size: .67rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.status-chip.shipping { color: #6a491a; background: var(--gold-soft); }
.status-chip.unpaid { color: var(--red); background: var(--red-soft); }
.status-chip.completed { color: #52605b; background: #e8ecea; }
.invoice-list, .result-groups { display: grid; gap: .75rem; margin-top: 1rem; }
.invoice-row { display: grid; grid-template-columns: 32px minmax(150px, 1.4fr) minmax(150px, 1fr) auto auto; gap: .9rem; align-items: center; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.invoice-row.shipping { border-left: 5px solid var(--gold); background: #fffaf0; }
.invoice-row input[type=checkbox] { min-height: 19px; width: 19px; margin: 0; accent-color: var(--green); }
.invoice-row strong, .invoice-row small { display: block; }
.invoice-row small { color: var(--muted); font-size: .72rem; margin-top: .16rem; }
.invoice-row .amount { text-align: right; font-weight: 850; }
.invoice-row-actions { display: flex; gap: .4rem; }
.small-button { border: 1px solid #cbd7d2; border-radius: 7px; padding: .48rem .65rem; background: #fff; color: var(--green); cursor: pointer; font-size: .72rem; font-weight: 800; }
.customer-group { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: var(--paper); }
.customer-heading { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; background: #f9fbfa; border-bottom: 1px solid var(--line); }
.customer-heading h3 { margin: 0 0 .2rem; }
.customer-heading p { margin: 0; color: var(--muted); font-size: .75rem; }
.customer-group .invoice-list { margin: 0; padding: .75rem; }
.customer-note-thread { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: 0 5px 18px rgba(24,51,44,.04); }
.customer-note-body { display: grid; gap: 1rem; padding: 1rem; }
.customer-note-body h4 { margin: 0 0 .65rem; }
.note-history-list { display: grid; gap: .55rem; }
.note-entry { padding: .85rem; border-left: 4px solid var(--gold); border-radius: 8px; background: #fff9ec; }
.note-entry p { margin-bottom: .45rem; white-space: pre-wrap; line-height: 1.45; }
.note-entry small { display: block; color: var(--muted); line-height: 1.4; }
.connected-invoices { display: flex; flex-wrap: wrap; gap: .5rem; }
.connected-invoice { display: grid; gap: .15rem; min-width: 170px; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 9px; color: var(--green); background: #f8fbf9; text-align: left; cursor: pointer; }
.connected-invoice span { color: var(--muted); font-size: .72rem; text-transform: capitalize; }
.customer-note-form { padding-top: 1rem; border-top: 1px solid var(--line); }
.note-save-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.note-save-row p { margin: 0; color: var(--muted); font-size: .76rem; }
.checkout-note-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #bfd0c9; border-radius: 11px; background: #f5faf7; }
.checkout-note-panel .section-heading { margin: 0 0 .8rem; }
.checkout-note-panel .section-heading h3 { margin: 0; }
.compact-loading { padding: 1rem; }
.checkout-note-panel .empty-state { padding: 1.2rem .8rem; }
.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); border: 1px dashed #bac8c2; border-radius: 14px; background: rgba(255,255,255,.45); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: .4rem; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }
.selection-bar { position: fixed; z-index: 20; left: calc(244px + 3vw); right: 3vw; bottom: 1.4rem; display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; color: #fff; background: #102f28; border: 1px solid rgba(255,255,255,.15); border-radius: 13px; box-shadow: 0 16px 45px rgba(0,0,0,.25); }
.selection-bar > div { display: grid; margin-right: auto; }
.selection-bar small { color: #a8bcb5; }
dialog { border: 0; padding: 0; border-radius: 18px; box-shadow: 0 30px 100px rgba(11,31,26,.38); }
dialog::backdrop { background: rgba(12,32,27,.68); backdrop-filter: blur(3px); }
.checkout-dialog { width: min(720px, calc(100vw - 2rem)); max-height: 92vh; }
.checkout-dialog form { padding: clamp(1.2rem, 4vw, 2rem); overflow: auto; max-height: 92vh; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.checkout-invoices { padding: .75rem; margin: .9rem 0 1rem; border-radius: 10px; background: #eff4f1; color: var(--muted); font-size: .8rem; }
.acknowledgment { padding: 1rem; margin: .5rem 0 1rem; border: 1px solid #dfbd7f; border-radius: 10px; background: var(--gold-soft); }
.check-row { grid-template-columns: 20px 1fr; align-items: start; gap: .7rem; margin: 0; line-height: 1.45; }
.check-row input { width: 18px; min-height: 18px; margin: .15rem 0 0; accent-color: var(--green); }
.employee-dialog { width: min(560px, calc(100vw - 2rem)); }
.employee-active-row { margin: .5rem 0 1.2rem; }
.signature-heading { display: flex; justify-content: space-between; gap: 1rem; }
#signature-pad { width: 100%; height: 170px; display: block; border: 1px solid #aebfb8; border-radius: 9px; background: #fff; touch-action: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
.toast { position: fixed; z-index: 50; right: 1.2rem; top: 1.2rem; max-width: 370px; padding: .9rem 1.1rem; color: #fff; background: var(--green); border-radius: 10px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(-12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.import-panel, .employee-panel { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(360px, 1.3fr); gap: 1rem; align-items: start; }
.upload-zone { padding: 2rem; border: 2px dashed #acc0b8; border-radius: 14px; background: var(--paper); text-align: center; }
.upload-zone input { border: 0; padding: .75rem 0; }
.history-list { display: grid; gap: .65rem; }
.history-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem; border-bottom: 1px solid var(--line); }
.history-row:last-child { border: 0; }
.history-row small { display: block; color: var(--muted); margin-top: .2rem; }
.notice { margin: 1rem 0; padding: .9rem 1rem; border-left: 4px solid var(--gold); background: var(--gold-soft); color: #68471c; font-size: .84rem; }
.danger-notice { margin: 1rem 0; padding: .9rem 1rem; border-left: 4px solid var(--red); background: var(--red-soft); color: #762d27; font-size: .84rem; line-height: 1.45; }
@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .invoice-row { grid-template-columns: 28px 1.5fr 1fr auto; }
  .invoice-row .amount { display: none; }
}
@media (max-width: 760px) {
  .login-view { grid-template-columns: 1fr; padding: 1.2rem; }
  .login-brand { padding-top: 2rem; }
  .login-brand { display: block; }
  .login-logo { width: 220px; margin-bottom: 1.5rem; }
  .login-card { justify-self: stretch; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; left: -260px; width: 244px; transition: left .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .mobile-header { position: sticky; z-index: 15; top: 0; display: flex; justify-content: space-between; align-items: center; padding: .65rem 1rem; color: #fff; background: var(--green); }
  .mobile-header .brand { padding: 0; }
  main { padding: 1.2rem 1rem 7rem; }
  .page-header { display: block; }
  .page-header .toolbar { margin-top: 1rem; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid .metric:first-child { grid-column: span 2; }
  .invoice-row { grid-template-columns: 25px minmax(0,1fr) auto; gap: .55rem; }
  .invoice-row > div:nth-child(3) { grid-column: 2; }
  .invoice-row-actions { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
  .selection-bar { left: .75rem; right: .75rem; bottom: .7rem; flex-wrap: wrap; }
  .selection-bar > div { width: calc(100% - 60px); }
  .selection-bar .button.accent { flex: 1; }
  .import-panel, .employee-panel { grid-template-columns: 1fr; }
  .note-save-row { align-items: stretch; flex-direction: column; }
  .note-save-row .button { width: 100%; }
}
