/* FX Utilities — shared app styling.
   Same class vocabulary as fx-annual-leave-system/css/styles.css, so if you
   want the two apps to look pixel-identical you can copy that file straight
   over this one — css/fleet.css supplies the fleet-only extras either way. */

:root {
  /* --ink deliberately removed: it was #1f2933 here and var(--ink) in every
     other module, which is visible when you move between them. brand.css
     now supplies it. --ink-muted stays, since nothing else defines it. */
  --ink-muted: #6b7785;
  --ok: #1b7f4b;
  --warn: #a86400;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 1px 8px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

/* `hidden` must win over the display rules below — otherwise a hidden overlay
   or panel keeps swallowing clicks. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3 { margin: 0 0 12px; font-weight: 600; color: var(--navy); }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

.muted { color: var(--ink-muted); }
.error-text { color: var(--bad); margin: 8px 0 0; }

/* ---------- Sign-in ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo { max-width: 180px; max-height: 80px; margin-bottom: 16px; }
.login-card h2 { margin-top: 18px; }

/* ---------- Top bar ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { max-height: 40px; max-width: 120px; }
.topbar-title { font-weight: 600; }
.topbar-subtitle { color: var(--ink-muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--ink-muted); font-size: 14px; }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
}

.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--action); border-bottom-color: var(--action); font-weight: 600; }

/* ---------- Layout ---------- */

.content { padding: 20px; max-width: 1400px; margin: 0 auto; }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.cards-row .card { margin-bottom: 0; }

.banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.banner-warning { background: #fff6e5; border-color: #f0d9a8; color: #6b4a00; }
.banner-info { background: var(--blue-light); border-color: #b9cee3; color: var(--navy); }

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: end;
}

.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-muted); }
.form-grid .full-width { grid-column: 1 / -1; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }

input[type="text"], input[type="email"], input[type="date"], input[type="number"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(31, 56, 100, 0.15);
}

.days-preview { color: var(--ink-muted); font-size: 14px; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 9px 16px;
}

.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: #f0f3f6; }
.btn-block { width: 100%; margin-top: 8px; }

/* ---------- Tables ---------- */

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  background: var(--grey-light);
  color: #333;
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: #f7f9fb; }

/* ---------- Toast / loading ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(31, 56, 100, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
  .content { padding: 12px; }
  .card { padding: 14px; }
  .data-table { display: block; overflow-x: auto; }
}

/* ---------- Multi-file attachment picker (js/attachments.js) ---------- */

.field-label { font-size: 0.88em; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.attachment-picker { display: flex; flex-direction: column; gap: 8px; }
.attachment-list { display: flex; flex-direction: column; gap: 6px; }
.attachment-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.9em;
  background: var(--surface);
}
.attachment-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.attachment-chip-name em { color: var(--ink-muted); font-style: italic; font-weight: normal; }
.attachment-chip button { flex: 0 0 auto; padding: 4px 10px; font-size: 0.85em; }
.attachment-file-input { font-size: 0.9em; }

/* ---------- Mechanics: job detail card ---------- */
.job-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px;
  margin: 10px 0 14px;
}
.job-detail-grid .field-label { display: block; margin-bottom: 2px; }
.job-detail-grid .full-width { grid-column: 1 / -1; }

.history-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.history-list li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92em;
}
.history-list li:last-child { border-bottom: none; }
.history-list li.muted { color: var(--ink-muted); }
