/* Colors are variables so the website theme can be dropped in later. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --line: #d9dee5;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --ok: #2e7d4f;
  --warn: #8a5a00;
  --bad: #9b2c2c;
  --focus: #2f6fd0;
  --radius: 8px;
  --gap: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.4; }
a { color: var(--accent); }
button { font: inherit; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }

.bar { display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; }
.nav a { padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--text); background: var(--bg); font-weight: 600; }
.bar-right { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; min-width: 0; margin-left: auto; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
@media (max-width: 560px) {
  .bar { gap: 8px; padding: 8px 12px; }
  .brand { font-size: 0; }
  .brand::before { content: "EC"; font-size: 16px; }
  .who-name { display: none; }
}

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.center { display: flex; justify-content: center; align-items: center; min-height: 40vh; flex-direction: column; gap: 6px; text-align: center; }
.center p { margin: 0 0 8px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

h1 { font-size: 22px; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--gap); }
.card h2 { font-size: 15px; margin: 0 0 12px; color: var(--text); }
.sections { display: grid; gap: 14px; }
.signin { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.signin h1 { font-size: 20px; margin: 0 0 16px; }
.gslot { display: flex; justify-content: center; }
.msg { color: var(--bad); margin-top: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Lists (files, people) */
.tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; min-width: 0; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 34px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.toggle button { border: 0; background: none; padding: 8px 16px; cursor: pointer; color: var(--muted); }
.toggle button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1.6fr) minmax(0, 1.4fr);
  gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); align-items: center; }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--bg); }
.row > div { min-width: 0; overflow-wrap: anywhere; }
.head-row { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; padding-top: 9px; padding-bottom: 9px; background: var(--bg); }
.count { color: var(--muted); font-size: 14px; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 10px; }
@media (max-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .people .row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .head-row { display: none; }
  .list .row:nth-child(2) { border-top: 0; }
  .people .row > div:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; }
  .people .row > div:nth-child(3) { grid-column: 1; }
  .people .row > div:nth-child(4) { grid-column: 2; grid-row: 2; justify-self: end; }
}
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; min-height: 22px; padding: 0; border-radius: 11px; background: var(--line);
  border: 0; position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 19px; }

/* File screen */
.head { margin-bottom: 10px; }
.head-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-bottom: 4px; }
.head-top .stage { font-size: 13px; padding: 2px 10px; border-radius: 12px; background: #e8eef7; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%; }
.head h1 { margin: 2px 0 4px; }
.head .facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; color: var(--muted); font-size: 14px; }
.head .facts > span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.head .facts > span + span::before { content: "\00b7"; margin: 0 8px; color: var(--line); font-weight: 700; }
.crumb { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.fileid { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .head .facts { flex-direction: column; align-items: flex-start; gap: 0; }
  .head .facts > span + span::before { content: none; }
}
.back { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; scrollbar-width: thin; }
.tabs a { flex: none; padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px var(--gap); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.mark { font-size: 12px; white-space: nowrap; }
.mark.saving { color: var(--muted); }
.mark.saved { color: var(--ok); }
.mark.queued, .mark.refused { color: var(--warn); }
.mark.conflict { color: var(--bad); }
input, select, textarea { font: inherit; color: var(--text); width: 100%; min-width: 0; padding: 8px 10px; min-height: 38px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
input::placeholder, textarea::placeholder { color: #8a94a3; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 2px rgba(47, 111, 208, 0.15); }
.conflict-box { border: 1px solid var(--bad); border-radius: 6px; padding: 8px; font-size: 13px; display: grid; gap: 6px; }
.conflict-box .pair { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.conflict-box .pair span:nth-child(2) { overflow-wrap: anywhere; }
.flag { font-size: 13px; color: var(--warn); }
.banner { background: #fff7e0; border: 1px solid #e8d38f; color: var(--text); padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; }

/* History */
.history { list-style: none; margin: 0; padding: 0; }
.history > li { padding: 12px 0; border-top: 1px solid var(--line); }
.history > li:first-child { border-top: 0; padding-top: 0; }
.history > li:last-child { padding-bottom: 0; }
.h-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.h-text { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.change { font-size: 14px; }
.history .corrected .h-text > div:first-child .strong { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; margin-left: 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.fix .tag { margin-left: 0; }
.fix { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--accent); display: grid; gap: 2px; overflow-wrap: anywhere; }
.fix-form { margin-top: 10px; display: grid; gap: 8px; }
.row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-btns .msg { margin: 0; font-size: 13px; }

/* Files list on a phone: name with the stage at the right; vehicle; type with the claim number after it. */
@media (max-width: 720px) {
  .list .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .file-row .c-name { grid-column: 1; grid-row: 1; }
  .file-row .c-stage { grid-column: 2; grid-row: 1; text-align: right; max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .file-row .c-veh { grid-column: 1 / -1; grid-row: 2; }
  .file-row .c-type { grid-column: 1 / -1; grid-row: 3; color: var(--muted); font-size: 14px; }
  .file-row .c-type > div { display: inline; }
  .file-row .c-type > div + div::before { content: "\00b7"; margin: 0 6px; color: var(--line); font-weight: 700; }
  .file-row .c-id { display: none; }
}

/* File header: the address and phone line shows on PC only */
.head .facts.addr { margin-top: 2px; }
@media (max-width: 560px) { .head .facts.addr { display: none; } }

/* People: add a person */
.add-person { align-items: center; margin-bottom: 4px; }
.add-email { flex: 1 1 260px; min-width: 0; }
.add-msg { margin: 0 0 10px; font-size: 14px; min-height: 0; }
.add-msg:empty { display: none; }

/* Bottom bar on every file page */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(28, 36, 48, 0.06); padding-bottom: env(safe-area-inset-bottom); }
.dock-in { max-width: 1100px; margin: 0 auto; padding: 8px 16px 10px; display: grid; gap: 8px; }
.dock-top { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-width: 0; }
.amounts { display: flex; gap: 8px 20px; min-width: 0; }
.amount { display: grid; grid-template-columns: auto; text-align: left; border: 0; background: none; padding: 2px 6px; margin: 0 -6px;
  border-radius: 6px; color: var(--text); font: inherit; min-width: 0; line-height: 1.2; }
button.amount { cursor: pointer; }
button.amount:hover { background: var(--bg); }
.a-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.a-val { font-size: 18px; font-weight: 600; white-space: nowrap; }
.amount.empty .a-val { color: var(--muted); font-weight: 400; }
.a-note { font-size: 11px; color: var(--muted); white-space: nowrap; }
.amount.copied .a-label { color: var(--ok); font-weight: 600; }
.dock-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.dock-actions .btn:disabled { opacity: 1; background: var(--bg); color: #8a94a3; border: 1px dashed var(--line); cursor: not-allowed; }
.copies { display: flex; flex-wrap: wrap; gap: 6px; max-height: 64px; overflow-y: auto; }
.copy { font: inherit; font-size: 13px; padding: 4px 10px; min-height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--text); cursor: pointer; white-space: nowrap; flex: none; text-align: center; }
.copy:hover { border-color: var(--accent); color: var(--accent); }
.copy.copied { border-color: var(--ok); color: var(--ok); background: #eef7f1; }
@media (max-width: 720px) {
  .dock-in { padding: 6px 12px 8px; gap: 6px; }
  .dock-top { flex-direction: column; align-items: stretch; }
  .amounts { gap: 16px; }
  .a-val { font-size: 16px; }
  .dock-actions, .copies { flex-wrap: nowrap; overflow-x: auto; max-height: none; justify-content: flex-start; scrollbar-width: none;
    margin: 0 -12px; padding: 0 12px; }
  .dock-actions::-webkit-scrollbar, .copies::-webkit-scrollbar { display: none; }
  .dock-actions .btn { flex: none; }
}
