/**
 * loadcon.css — what LoadCon's screens need on top of the shared kit.
 *
 * The kit supplies the top bar, cards, tables, buttons and fields. This is the
 * list search, the two-column detail grid, the form and the modal. Colours all
 * come from the kit's variables, so a client's own colour carries through.
 */

.lc-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 64px 20px; color: var(--s-muted); font-size: 14px;
}

/* ── The list ────────────────────────────────────────────────────────────── */
/* Laid out as the system this replaces laid it out — four figures, a filter
   bar, then the table — because that is the screen the office reads by shape.
   Measurements are carried across; the colours come from the kit's variables
   so a second client is not wearing this one's indigo. */

/* The old app ran to 1400px and the table needs it: nine columns at the kit's
   default 1240px push Actions off the right-hand edge. */
.s-page { max-width: 1400px; }

.lc-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin-bottom: 32px;
}
.lc-metric {
  min-width: 0;
  padding: 20px;
  background: var(--s-surface);
  border: 1px solid var(--s-line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.lc-metric-label {
  margin-bottom: 8px;
  font-size: 12px; font-weight: 600; color: var(--s-muted); text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lc-metric-value {
  margin-bottom: 4px;
  font-size: 28px; font-weight: 700; color: var(--s-ink); letter-spacing: -.5px;
}
.lc-metric-value-sm { font-size: 22px; }
.lc-metric-split { display: flex; align-items: center; gap: 20px; margin-top: 5px; }
.lc-metric-rule { width: 1px; height: 35px; background: var(--s-line); }

.lc-trend { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.lc-trend.positive { color: #059669; }
.lc-trend.negative { color: #dc2626; }
.lc-trend.neutral { color: var(--s-muted); }

.lc-controls {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.lc-filters { display: flex; gap: 12px; flex: 1; }
.lc-actions { display: flex; gap: 10px; }

.lc-search-wrap { position: relative; width: 300px; }
.lc-search-wrap svg { position: absolute; left: 12px; top: 11px; color: var(--s-faint); pointer-events: none; }
.lc-control-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 10px 10px 36px;
  border: 1px solid var(--s-line); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--s-text);
}
.lc-control-input:focus {
  border-color: var(--sight-primary); outline: none;
  box-shadow: 0 0 0 3px var(--sight-primary-soft);
}
.lc-control-select {
  height: 38px; box-sizing: border-box;
  padding: 0 32px 0 12px;
  background: var(--s-surface);
  border: 1px solid var(--s-line); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--s-text); cursor: pointer;
}

.lc-table-container {
  width: 100%; margin-bottom: 40px;
  background: var(--s-surface);
  border: 1px solid var(--s-line); border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .05);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.lc-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.lc-table th {
  padding: 12px 20px;
  background: var(--s-line-soft);
  text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--s-muted);
  border-bottom: 1px solid var(--s-line);
  user-select: none;
}
.lc-sortable { cursor: pointer; }
.lc-sortable:hover { background: var(--s-line); color: var(--s-ink); }
.lc-sort-icon { margin-left: 4px; opacity: .3; }
.lc-sort-icon.is-on { opacity: 1; color: var(--sight-primary); }

.lc-table td {
  padding: 16px 20px;
  font-size: 13px; color: var(--s-text); vertical-align: middle;
  border-bottom: 1px solid var(--s-line-soft);
}
.lc-table tbody tr:hover { background: var(--s-line-soft); }
.lc-table tbody tr:last-child td { border-bottom: none; }

.lc-strong { font-weight: 600; color: var(--s-ink); }
.lc-sub { display: block; margin-top: 2px; font-size: 11px; color: var(--s-muted); }
.lc-arrow { color: var(--s-faint); }
.lc-right { text-align: right; }
.lc-center { text-align: center; }
.lc-nothing { padding: 48px 24px !important; text-align: center; color: var(--s-muted); }

.lc-badge {
  display: inline-block; padding: 4px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  white-space: nowrap;
}
.lc-badge-local { background: #dbeafe; color: #1e40af; }
.lc-badge-cross { background: #fee2e2; color: #991b1b; }
.lc-badge-cancelled { background: var(--s-line); color: var(--s-muted); margin-left: 6px; }

.lc-action-btn {
  display: inline-block;
  padding: 6px 12px; margin-left: 6px;
  background: var(--s-surface); border: 1px solid var(--s-line); border-radius: 6px;
  font-size: 12px; font-weight: 500; color: var(--s-text); text-decoration: none;
  white-space: nowrap; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.lc-action-btn:hover { background: var(--s-line-soft); border-color: var(--s-faint); }

.lc-table-footer {
  padding: 12px 20px;
  background: var(--s-line-soft);
  border-top: 1px solid var(--s-line);
  font-size: 12px; color: var(--s-muted);
}

.lc-search { margin-bottom: 16px; max-width: 520px; }
.lc-row { cursor: pointer; }

@media (max-width: 1024px) {
  .lc-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .lc-metrics { grid-template-columns: 1fr; gap: 12px; }
  .lc-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .lc-filters { flex-direction: column; width: 100%; }
  .lc-search-wrap { width: 100%; }
  .lc-control-select, .lc-actions .s-btn { width: 100%; }
  .lc-actions { flex-direction: column; }
  .lc-table td, .lc-table th { padding: 12px 16px; }
}

/* ── One load ────────────────────────────────────────────────────────────── */

.lc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.lc-card-wide { grid-column: 1 / -1; }
.lc-card-alert { border-color: #fecaca; }
.lc-card-alert .s-card-head { background: var(--s-danger-soft); border-radius: var(--s-radius) var(--s-radius) 0 0; }
.lc-card-alert .s-card-head h2 { color: var(--s-danger); }

.lc-field {
  display: flex; align-items: baseline; gap: 14px;
  padding: 7px 0; border-bottom: 1px solid var(--s-line-soft);
}
.lc-field:last-child { border-bottom: 0; }
.lc-field span { flex: 0 0 42%; font-size: 12.5px; color: var(--s-muted); }
.lc-field b { flex: 1; font-weight: 550; color: var(--s-ink); word-break: break-word; }

.lc-text { margin: 0; white-space: pre-wrap; line-height: 1.6; color: var(--s-text); }

.lc-banner {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 18px; padding: 11px 14px;
  background: var(--s-danger-soft); color: var(--s-danger);
  border: 1px solid #fecaca; border-radius: var(--s-radius);
  font-size: 13px; font-weight: 550;
}

.lc-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lc-files li { display: flex; align-items: baseline; gap: 10px; }
.lc-files a { color: var(--sight-primary); font-weight: 550; text-decoration: none; }
.lc-files a:hover { text-decoration: underline; }

.lc-danger-zone {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--s-line);
}

/* ── The form ────────────────────────────────────────────────────────────── */

.lc-form { display: flex; flex-direction: column; gap: 16px; }
.lc-form .s-card-head { display: flex; align-items: center; gap: 12px; }
.lc-form .s-card-head h2 { font-size: 14px; }

.lc-switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--s-text); cursor: pointer; }
.lc-switch input { width: 16px; height: 16px; accent-color: var(--sight-primary); cursor: pointer; }

.lc-form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0;
  padding: 14px 0;
  background: linear-gradient(to top, var(--s-bg) 70%, transparent);
}

/* ── The modal ───────────────────────────────────────────────────────────── */

.lc-backdrop {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(16, 24, 40, .45); overflow-y: auto;
}
.lc-modal {
  width: 100%; max-width: 560px;
  background: var(--s-surface); border-radius: 12px; box-shadow: var(--s-shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100vh - 40px);
}
.lc-modal header { padding: 16px 20px; border-bottom: 1px solid var(--s-line); }
.lc-modal header h2 { margin: 0; font-size: 16px; font-weight: 660; color: var(--s-ink); }
.lc-modal form { padding: 20px; overflow-y: auto; }
.lc-modal footer {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--s-line);
  background: #fcfcfd; border-radius: 0 0 12px 12px;
}

/* Shared with the platform's error style, so a message looks the same
   wherever somebody meets it. */
.auth-error {
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--s-danger-soft); color: var(--s-danger);
  border: 1px solid #fecaca; border-radius: var(--s-radius-sm);
  font-size: 13px;
}

@media (max-width: 720px) {
  .lc-field { flex-direction: column; gap: 2px; }
  .lc-field span { flex: none; }
}

/* ── The capture form ────────────────────────────────────────────────────── */
/* One sheet of paper with ruled section headings, as the old form was: the
   people filling this in are reading a load off a phone call and following the
   order they were given it in. */

.lc-doc {
  padding: 32px 36px 40px;
  background: var(--s-surface);
  border: 1px solid var(--s-line); border-radius: 12px;
  box-shadow: var(--s-shadow);
}
.lc-doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.lc-doc-head h2 {
  margin: 0;
  font-size: 30px; font-weight: 800; letter-spacing: -.5px; color: var(--s-ink);
  text-transform: uppercase;
}
.lc-doc-meta { text-align: right; font-size: 13px; color: var(--s-muted); white-space: nowrap; }
.lc-doc-id {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--sight-primary-soft); color: var(--sight-primary); font-weight: 700;
}

.lc-crossbox {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 22px; padding: 12px 18px;
  background: var(--s-line-soft);
  border: 1px solid var(--s-line); border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--s-text); cursor: pointer;
}
.lc-crossbox input { width: 17px; height: 17px; accent-color: var(--sight-primary); }

.lc-section-title {
  display: flex; align-items: center; gap: 14px;
  margin: 34px 0 18px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--s-muted);
}
.lc-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--s-line);
}
.lc-section-cross { color: #b91c1c; }
.lc-section-cross::after { background: #fca5a5; }

.lc-row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.lc-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }

.lc-movement { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.lc-col-title { margin-bottom: 14px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.lc-col-load { color: var(--sight-primary); }
.lc-col-offload { color: #dc2626; }

.lc-with-add { display: flex; gap: 8px; }
.lc-with-add .s-select { flex: 1; min-width: 0; }
.lc-add-btn {
  display: grid; place-items: center;
  width: 42px; flex: none;
  background: var(--s-surface);
  border: 1px solid var(--s-line); border-radius: 8px;
  font-size: 20px; line-height: 1; color: var(--sight-primary); text-decoration: none;
}
.lc-add-btn:hover { background: var(--sight-primary-soft); border-color: var(--sight-primary); }

.lc-doc-note {
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid var(--s-line);
  text-align: center; font-size: 12px; line-height: 1.7; color: var(--s-muted);
}

@media (max-width: 860px) {
  .lc-doc { padding: 22px 18px 28px; }
  .lc-doc-head { flex-direction: column; gap: 10px; }
  .lc-doc-meta { text-align: left; }
  .lc-movement, .lc-row-2, .lc-row-3 { grid-template-columns: 1fr; gap: 14px; }
}
