/* Fortis Logistics LLC — Personnel Ledger
   Same visual identity as the original Claude-hosted version, carried over so the
   transition doesn't feel like a different product to the people using it. */

:root {
  --ink: #182420;
  --ink-soft: #4b5a55;
  --paper: #eef0ea;
  --surface: #ffffff;
  --surface-2: #f7f7f2;
  --line: rgba(24, 36, 32, 0.14);
  --line-strong: rgba(24, 36, 32, 0.24);
  --accent: #0b6e63;
  --accent-ink: #ffffff;
  --accent-soft: #e3efec;
  --amber: #915610;
  --amber-soft: #f6e8d2;
  --danger: #a3342a;
  --danger-soft: #f5e1de;
  --success: #2f7a4f;
  --success-soft: #e2f0e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(24, 36, 32, 0.07), 0 10px 28px -14px rgba(24, 36, 32, 0.24);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-script: "Caveat", cursive;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .3em; }
a { color: var(--accent); }
label { font-weight: 600; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 18px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(155deg, var(--accent), #0a4a44);
  display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display);
  font-weight: 700; font-size: 17px; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 16.5px; font-weight: 700; }
.brand-text span { font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: 10px 10px 4px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13.6px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .badge {
  font-size: 11px; font-weight: 700; background: var(--amber-soft); color: var(--amber); border-radius: 999px;
  padding: 1px 7px; min-width: 18px; text-align: center;
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.whoami { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--ink-soft); }
.whoami b { color: var(--ink); font-weight: 600; display: block; font-size: 13px; }
.whoami form { display: inline; }
.whoami button { background: none; border: none; color: var(--accent); font-size: 11.5px; padding: 4px 0 0; cursor: pointer; font-weight: 600; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 28px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 5;
}
.topbar .eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 2px; }
.topbar h1 { font-size: 21px; margin: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 24px 28px 60px; max-width: 1100px; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13.5px;
  font-weight: 600; cursor: pointer; text-decoration: none; min-height: 38px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(.95); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; min-height: 30px; }

.tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.tile .num { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.tile .label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.tile.warn .num { color: var(--amber); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15.5px; margin: 0; }
.panel-body { padding: 16px 18px; }

.row-list { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; font-family: var(--font-display); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 13.8px; }
.row-sub { font-size: 12px; color: var(--ink-soft); }
.row-meta { font-size: 12px; color: var(--ink-soft); text-align: right; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-neutral { background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input, .field select, .field textarea {
  padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); width: 100%; font-family: var(--font-body); font-size: 14px;
}
.field textarea { resize: vertical; min-height: 76px; }
.field-hint { color: var(--ink-soft); font-size: 11.5px; font-weight: 400; }
.validation-summary { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.validation-summary ul { margin: 0; padding-left: 18px; }
.field-validation-error, .text-danger { color: var(--danger); font-size: 12px; font-weight: 500; }
.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 400; }
.checkline input { margin-top: 3px; width: auto; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 9px; font-size: 12.8px; background: var(--amber-soft); color: var(--amber); margin-bottom: 16px; }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.banner.success { background: var(--success-soft); color: var(--success); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab-btn { padding: 9px 4px; margin-right: 18px; text-decoration: none; font-weight: 600; font-size: 13.3px; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-id { display: flex; align-items: center; gap: 12px; }
.detail-id .avatar { width: 48px; height: 48px; font-size: 17px; border-radius: 12px; }
.back-link { display: inline-flex; gap: 4px; font-size: 12.5px; color: var(--ink-soft); text-decoration: none; margin-bottom: 10px; font-weight: 600; }
.back-link:hover { color: var(--accent); }

.audit-item { display: flex; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 12.8px; }
.audit-item:last-child { border-bottom: none; }
.audit-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); margin-top: 6px; flex: none; }
.audit-time { color: var(--ink-soft); flex: none; white-space: nowrap; }

.doc-thumb { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); max-height: 420px; background: var(--surface-2); }

.sig-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.sig-tab { padding: 7px 13px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.sig-tab.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.sig-canvas-wrap { border: 1.5px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); }
canvas.sig-canvas { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; border-radius: 10px; }
.sig-typed-preview { font-family: var(--font-script); font-size: 40px; padding: 30px 14px; text-align: center; background: var(--surface-2); border-radius: 10px; border: 1.5px dashed var(--line-strong); min-height: 100px; display: flex; align-items: center; justify-content: center; }
.consent-box { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-size: 12.5px; margin: 12px 0; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th, table.data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 12px; }
  .brand-text span { display: none; }
  .nav-group { flex-direction: row; }
  .nav-label { display: none; }
  .sidebar-foot { flex: none; margin: 0 0 0 6px; }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 12px 14px; }
  .tile-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .field-row { grid-template-columns: 1fr; }
  .field input, .field select, .field textarea { font-size: 16px; } /* avoid iOS auto-zoom */
  .btn { min-height: 42px; }
}
