:root {
  --navy: #1a3c6e;
  --navy-dark: #122c52;
  --blue-light: #eef3fa;
  --blue-accent: #2e6bd6;
  --grey: #666;
  --grey-light: #ddd;
  --bg: #f4f6fa;
  --danger: #c0392b;
  --ok: #1b7a3f;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #222;
}

header.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
}

header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

header.topbar .brand img { height: 34px; background: #fff; border-radius: 4px; padding: 2px; }

header.topbar nav button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-left: 8px;
  font-size: 13px;
}
header.topbar nav button:hover { background: rgba(255,255,255,0.15); }

.container {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 16px 60px;
}

.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.steps .step {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--grey-light);
  font-size: 13px;
  color: var(--grey);
  font-weight: 600;
}
.steps .step.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.steps .step.done { background: var(--blue-light); color: var(--navy); border-color: var(--blue-accent); }

.panel {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--grey-light);
  padding: 24px;
  margin-bottom: 20px;
}

.panel h2 {
  margin-top: 0;
  color: var(--navy);
  font-size: 18px;
  border-bottom: 2px solid var(--blue-light);
  padding-bottom: 10px;
}

.dropzone {
  border: 2px dashed var(--blue-accent);
  border-radius: var(--radius);
  padding: 50px 20px;
  text-align: center;
  color: var(--grey);
  cursor: pointer;
  background: var(--blue-light);
}
.dropzone.dragover { background: #dceafd; }
.dropzone p { margin: 6px 0; }
.dropzone .hint { font-size: 12px; }

.btn {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { background: var(--navy-dark); }
.btn.secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--navy);
}
.btn.secondary:hover { background: var(--blue-light); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.section-block {
  border: 1px solid var(--grey-light);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.section-block > .section-title {
  background: var(--navy);
  color: #fff;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-block > .section-body { padding: 16px; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label {
  font-size: 12px;
  color: var(--grey);
  font-weight: 600;
}
.field input[type=text],
.field input[type=number],
.field input[type=date],
.field select,
.field textarea {
  padding: 7px 9px;
  border: 1px solid var(--grey-light);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 50px; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.radio-row { display: flex; gap: 16px; align-items: center; }
.radio-row label { display: flex; align-items: center; gap: 5px; font-size: 13px; }

.smartlogger-card {
  border: 1px dashed var(--grey-light);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fbfcfe;
}
.smartlogger-card h4 { margin: 0 0 8px; color: var(--navy); font-size: 13px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.summary-card {
  background: var(--blue-light);
  border-radius: var(--radius);
  padding: 14px;
  border-left: 4px solid var(--blue-accent);
}
.summary-card .label { font-size: 11px; color: var(--grey); text-transform: uppercase; letter-spacing: .03em; }
.summary-card .value { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.summary-card .sub { font-size: 11px; color: var(--grey); margin-top: 4px; }

table.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items-table th {
  background: var(--navy); color: #fff; text-align: left; padding: 8px; font-size: 12px;
}
table.items-table td { padding: 6px 8px; border-bottom: 1px solid var(--grey-light); vertical-align: top; }
table.items-table input, table.items-table textarea {
  width: 100%; border: 1px solid var(--grey-light); border-radius: 4px; padding: 5px 6px; font-size: 12.5px; font-family: inherit;
}
table.items-table td.num input { text-align: right; }
table.items-table td.amt { text-align: right; font-weight: 600; white-space: nowrap; }

.totals {
  margin-top: 14px;
  margin-left: auto;
  width: 300px;
}
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
.totals .row.total { font-weight: 700; font-size: 16px; color: var(--navy); border-top: 2px solid var(--navy); margin-top: 4px; padding-top: 8px; }
.totals .row input[type=number] { width: 70px; text-align: right; padding: 3px 5px; border: 1px solid var(--grey-light); border-radius: 4px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.toolbar .right { display: flex; gap: 10px; }

.notice {
  background: #fff8e6;
  border: 1px solid #f0d98c;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #6b5300;
  margin-bottom: 16px;
}
.notice.error { background: #fdecea; border-color: #f1a9a0; color: #8a2b1e; }

.hidden { display: none !important; }

.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid #fff;
  border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 24px; width: 90%; max-width: 800px; max-height: 85vh; overflow: auto;
}
.modal h2 { margin-top: 0; color: var(--navy); }
.modal.modal-wide { max-width: 980px; }
.modal details { border: 1px solid var(--grey-light); border-radius: var(--radius); padding: 10px 14px; }
.modal details + details { margin-top: 10px; }
.modal details summary::-webkit-details-marker { color: var(--navy); }

table.catalog-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.catalog-table th { text-align: left; padding: 6px; background: var(--blue-light); }
table.catalog-table td { padding: 5px 6px; border-bottom: 1px solid var(--grey-light); }
table.catalog-table input { width: 100%; padding: 5px 6px; border: 1px solid var(--grey-light); border-radius: 4px; }

.footer-note { text-align: center; font-size: 12px; color: var(--grey); margin-top: 30px; }

/* ============ additions: home, sign-off, summary, catalog ============ */

.btn.ghost {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.45);
  padding: 6px 14px; border-radius: var(--radius); cursor: pointer; font-size: 13px;
  margin-left: 8px; text-decoration: none; display: inline-block; font-weight: 600;
}
.btn.ghost:hover { background: rgba(255,255,255,0.15); }
.btn.warn { background: #b26a00; }
.btn.warn:hover { background: #915600; }

.muted { color: var(--grey); font-size: 13px; }

/* home action cards */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.action-card {
  border: 1px solid var(--grey-light); border-radius: var(--radius); padding: 20px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.action-card:first-child { cursor: pointer; }
.action-card:hover, .action-card.dragover { border-color: var(--blue-accent); box-shadow: 0 2px 12px rgba(46,107,214,.12); }
.action-card.dragover { background: var(--blue-light); }
.action-card h3 { margin: 10px 0 6px; font-size: 15px; color: var(--navy); }
.action-card p { margin: 0 0 14px; font-size: 13px; color: var(--grey); line-height: 1.5; }
.action-card .btn { margin-right: 8px; }
.action-icon {
  display: inline-block; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; padding: 5px 10px; border-radius: 4px;
}
.action-icon.alt { background: var(--blue-accent); }
.filename-line { margin-top: 14px; font-size: 13px; color: var(--navy); font-weight: 600; }

/* submissions list */
table.list-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list-table th {
  text-align: left; padding: 8px; background: var(--blue-light); color: var(--navy); font-size: 12px;
}
table.list-table td { padding: 8px; border-bottom: 1px solid var(--grey-light); }
table.list-table code { background: var(--blue-light); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* sign-off */
.notice.ok { background: #eaf7ee; border-color: #a8d8b9; color: #1b5e2f; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; margin-top: 16px; }
.sig-card { border: 1px solid var(--grey-light); border-radius: var(--radius); overflow: hidden; background: #fff; }
.sig-card.signed { border-color: #a8d8b9; }
.sig-card.unsigned { border-color: #f1a9a0; }
.sig-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; background: var(--blue-light); font-size: 12px;
}
.sig-role { font-weight: 700; color: var(--navy); letter-spacing: .02em; }
.sig-image { padding: 8px; background: #fff; min-height: 96px; display: flex; align-items: center; justify-content: center; }
.sig-image img { max-width: 100%; max-height: 150px; }
.sig-meta { padding: 6px 10px; font-size: 11px; color: var(--grey); border-top: 1px solid var(--grey-light); }

.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill.yes { background: #e3f4e8; color: #1b6e39; }
.pill.no { background: #fdecea; color: #a3372a; }
.pill.unknown { background: #eee; color: #777; }
.pill.warn { background: #fff3d9; color: #8a6100; }

/* summary */
.sum-block { margin-top: 22px; }
.sum-block h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--navy);
  border-bottom: 2px solid var(--blue-light); padding-bottom: 6px; margin: 0 0 10px;
}
table.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.sum-table th {
  text-align: left; width: 210px; font-weight: 600; color: var(--grey);
  padding: 7px 10px 7px 0; vertical-align: top; font-size: 12.5px;
}
table.sum-table td { padding: 7px 0; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
table.sum-table.wide th { width: auto; padding: 7px 10px; background: var(--blue-light); }
table.sum-table.wide td { padding: 7px 10px; }
table.sum-table.wide thead th { color: var(--navy); }

.summary-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

table.sum-table input[type=text], table.sum-table input[type=number],
table.sum-table select, table.sum-table textarea {
  width: 100%; max-width: 360px; border: 1px solid var(--grey-light); border-radius: 4px;
  padding: 6px 8px; font-size: 13px; font-family: inherit;
}
table.sum-table.wide input[type=text], table.sum-table.wide input[type=number],
table.sum-table.wide select { max-width: none; }
table.sum-table textarea { resize: vertical; min-height: 40px; max-width: none; width: 100%; }
.chk-group { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chk-group .chk { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 400; cursor: pointer; }

/* order status tracker */
.track-steps { display: flex; flex-direction: column; }
.track-step { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.track-step:last-child { padding-bottom: 0; }
.track-step::before {
  content: ""; position: absolute; left: 7px; top: 20px; bottom: -2px; width: 2px;
  background: var(--grey-light);
}
.track-step:last-child::before { display: none; }
.track-step.done::before { background: var(--blue-accent); }
.track-dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2px solid var(--grey-light); background: #fff; z-index: 1;
}
.track-step.done .track-dot { background: var(--blue-accent); border-color: var(--blue-accent); }
.track-step.current .track-dot {
  background: #fff; border-color: var(--navy); box-shadow: 0 0 0 3px var(--blue-light);
}
.track-step-label { font-size: 14px; font-weight: 600; color: var(--grey); }
.track-step.done .track-step-label, .track-step.current .track-step-label { color: var(--navy); }
.track-step.current .track-step-label::after {
  content: "Current"; margin-left: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; background: var(--navy); color: #fff; border-radius: 3px; padding: 2px 6px; vertical-align: middle;
}
.track-step-time { font-size: 11.5px; color: var(--grey); margin-top: 2px; }

/* fulfilment status badges (Records list + status modal) */
.pill.status-submitted, .pill.status-received { background: #eef1fb; color: #33438a; }
.pill.status-processing, .pill.status-ready_to_ship { background: #fff3d9; color: #8a6100; }
.pill.status-shipped, .pill.status-installation_done { background: #e6f4ff; color: #0b5f8a; }
.pill.status-site_config_done, .pill.status-complete { background: #e3f7ea; color: #1d7a3f; }
.pill.on-hold { background: #fff3d9; color: #8a6100; }
.pill.cancelled { background: #fdecea; color: #a3372a; }
.tag {
  display: inline-block; background: var(--blue-light); color: var(--navy);
  border-radius: 4px; padding: 2px 8px; font-size: 12px; margin: 1px 2px 1px 0;
}

/* quote table extras */
.qh { margin-top: 22px; color: var(--navy); font-size: 14px; }
.note-input { margin-top: 4px; font-size: 11px; color: var(--grey); }
td.refcell { font-size: 12px; color: var(--grey); text-align: right; white-space: nowrap; }
.ref-price { color: var(--navy); font-weight: 600; }
.linklike {
  background: none; border: none; color: var(--blue-accent); font-size: 11px;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.code-line { font-size: 10.5px; color: #999; margin-top: 2px; }
.ref-note { font-size: 10.5px; color: var(--grey); margin-top: 3px; font-style: italic; max-width: 380px; }
.cat-row { background: var(--navy); color: #fff; font-weight: 600; padding: 6px 8px; }
input.needs-price { background: #fff8e6; border-color: #f0d98c; }
label.grouplabel { font-size: 12px; color: var(--grey); font-weight: 600; display: block; margin-bottom: 4px; }
.step.skipped { background: #f4f4f4; color: #aaa; border-color: #e2e2e2; }
details summary { cursor: pointer; font-size: 13px; color: var(--blue-accent); }

/* records browser */
.tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tabs .tab {
  background: #fff; border: 1px solid var(--grey-light); color: var(--grey);
  padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.tabs .tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs input[type=search] {
  flex: 1; min-width: 200px; padding: 7px 10px; border: 1px solid var(--grey-light);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}
table.list-table a.btn { text-decoration: none; display: inline-block; margin-left: 4px; }
