body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #102030;
}

.topbar {
  background: #102b46;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-weight: 700;
  font-size: 20px;
}

.nav a {
  color: #dbe8f5;
  text-decoration: none;
  margin-right: 14px;
}

.session-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.card {
  background: #fff;
  border: 1px solid #d6dee7;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.narrow {
  max-width: 520px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e5ebf1;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f5f9;
}

.form-grid,
.filter-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: center;
}

input,
select,
button {
  padding: 8px;
  border: 1px solid #b7c5d4;
  border-radius: 6px;
}

button,
.btn {
  background: #1c5a8b;
  color: #fff;
  text-decoration: none;
  border: none;
  display: inline-block;
  cursor: pointer;
}

.small-btn {
  padding: 6px 10px;
}

.errors {
  background: #ffe2e2;
  border: 1px solid #e4aaaa;
  color: #8b2020;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.flash {
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.flash.error {
  background: #ffe2e2;
  border: 1px solid #e4aaaa;
}

.inline-form {
  display: inline;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #0a4d87;
}

.danger {
  color: #a32020;
}

.muted {
  color: #566578;
  margin-top: -8px;
}

.details-cell {
  max-width: 420px;
  word-break: break-word;
  font-size: 13px;
}

/* status detail — door grid */
.door-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.door-tile {
  background: #fff;
  border: 1px solid #d6dee7;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.door-tile.disabled {
  opacity: 0.6;
}

.door-tile-number {
  font-size: 28px;
  font-weight: 700;
  color: #102b46;
}

.door-tile-product {
  font-size: 14px;
  color: #102030;
}

.door-tile-price {
  font-size: 18px;
  font-weight: 600;
  color: #1c5a8b;
}

.door-tile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid transparent;
}

.status-in-stock {
  background: #d4f4dd;
  color: #1f7a3a;
  border-color: #a4d8b2;
}

.status-out-of-stock {
  background: #ffe2e2;
  color: #8b2020;
  border-color: #e4aaaa;
}

.status-disabled {
  background: #e5ebf1;
  color: #566578;
  border-color: #c9d2dc;
}

.door-tile-tracking {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #566578;
}

.wo-status-sent {
  background: #dbeafe;
  color: #1c5a8b;
  border-color: #93c5fd;
}

.wo-status-progress {
  background: #fef3c7;
  color: #9a6700;
  border-color: #fcd34d;
}

/* work order builder — inline expansion */
.door-tile-expand {
  width: 100%;
  text-align: left;
  border-top: 1px solid #e5ebf1;
  margin-top: 8px;
  padding-top: 8px;
}

.expand-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.expand-fields {
  margin: 4px 0 4px 20px;
}

.expand-fields input {
  margin: 2px 0;
  width: 160px;
  font-size: 13px;
}

.expand-buttons {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.expand-buttons .btn {
  padding: 4px 12px;
  font-size: 12px;
}

.tile-queued {
  border-color: #1c5a8b;
  box-shadow: 0 0 0 2px #93c5fd;
}

.tile-incomplete {
  border-color: #d97706;
  box-shadow: 0 0 0 2px #fcd34d;
}

/* pending changes bar */
.pending-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #102b46;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 50;
}

.pending-summary {
  flex: 1;
  font-size: 14px;
}

.pending-notes input {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #566578;
  background: #1a3a5c;
  color: #fff;
  width: 200px;
}

.pending-notes input::placeholder {
  color: #8ba3bd;
}

.pending-buttons {
  display: flex;
  gap: 8px;
}

.age-fresh, .sync-fresh {
  color: #1f7a3a;
  font-weight: 600;
}

.age-warning, .sync-warning {
  color: #9a6700;
  font-weight: 600;
}

.age-stale, .sync-stale {
  color: #8b2020;
  font-weight: 600;
}

.door-tile-footer {
  font-size: 11px;
  color: #566578;
}

/* reports */
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.preset-btn {
  background: #e5ebf1;
  color: #102030;
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
}

.preset-btn:hover {
  background: #d6dee7;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.summary-item {
  text-align: center;
}

.summary-label {
  font-size: 12px;
  color: #566578;
  margin-bottom: 2px;
}

.summary-value {
  font-size: 18px;
  font-weight: 600;
  color: #102b46;
}

.export-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

@media print {
  .topbar, .date-presets, .filter-grid, .export-row, button[type="submit"], .nav {
    display: none !important;
  }
  .card {
    border: none;
    box-shadow: none;
  }
  body {
    background: #fff;
  }
}

/* modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.modal-card h3 {
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-cancel {
  background: #566578;
}

.flash.success {
  background: #d4f4dd;
  border: 1px solid #a4d8b2;
  color: #1f7a3a;
}
