/* CC Forms. The base (tokens, login, forms, buttons, topbar, modals) is shared with the other GTI
   modules so they look like one family. CC Forms's own pieces are at the bottom. */
/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand blues — pulled from GTI logo */
  --blue:          #1a5ca8;
  --blue-dark:     #144a8c;
  --blue-mid:      #2a6fbf;
  --blue-light:    #e8f0fb;
  --blue-pale:     #f0f5fd;

  /* Status colors */
  --green:         #2e7d32;
  --green-light:   #e8f5e9;
  --yellow:        #f59f00;
  --yellow-light:  #fff8e1;
  --orange:        #e65c00;
  --orange-light:  #fff3e0;
  --red:           #c62828;
  --red-light:     #ffebee;

  /* Neutrals */
  --bg:            #F0F2F5;   /* page background */
  --surface:       #ffffff;   /* cards, panels, tables */
  --border:        #D0D7E2;
  --gray-light:    #F0F2F5;
  --text:          #1C2B3A;   /* dark navy */
  --muted:         #5A6A7E;
  --white:         #ffffff;

  --topbar-h:      72px;
  --shadow:        0 1px 4px rgba(26,44,80,.10), 0 2px 8px rgba(26,44,80,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-container {
  max-width: 380px;
  margin: 80px auto;
  background: var(--surface);
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(26,44,80,.14);
  border: 1px solid var(--border);
}
.login-container form { display: flex; flex-direction: column; gap: 16px; }

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 80px; width: auto; }
.login-module {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}
.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
  line-height: 1.5;
}
.login-link {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  font-weight: 500;
}
.login-link:hover { text-decoration: underline; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 16px;            /* 16px stops iOS zooming into the field */
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,92,168,.13);
}
input[readonly], input.readonly-input { background: var(--gray-light); color: var(--muted); }

.form-error {
  color: var(--red);
  font-size: 14px;
  min-height: 18px;
}
.form-msg { font-size: 14px; color: var(--green); line-height: 1.5; }
.field-hint { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--blue); color: var(--white); }
.btn-primary:hover  { background: var(--blue-dark); box-shadow: 0 2px 8px rgba(26,92,168,.3); }
.btn-outline  { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover  { background: var(--blue-light); }
.btn-danger   { background: var(--red);  color: var(--white); }
.btn-danger:hover   { background: #a31f1f; }
.btn-sm       { padding: 7px 15px; font-size: 14px; }
.btn-full     { width: 100%; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 3px solid var(--blue);
  color: var(--text);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: 0 2px 10px rgba(26,44,80,.12);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { height: 52px; width: auto; display: block; }
.topbar-module {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: .8px;
  text-transform: uppercase;
  border-left: 2px solid var(--border);
  padding-left: 14px;
}

.topbar-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 9px 17px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.nav-btn:hover  { background: var(--blue-light); color: var(--blue); }
.nav-btn.active { background: var(--blue); color: var(--white); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-greeting { font-size: 14px; color: var(--muted); font-weight: 500; white-space: nowrap; }

/* ── Views ────────────────────────────────────────────────────────────────── */
.view { padding: 20px; max-width: 1200px; margin: 0 auto; }
.view.hidden { display: none; }
.view-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.view-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 18px; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.section-toolbar h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.toolbar-search { max-width: 260px; }

.admin-list { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.admin-list-item:last-child { border-bottom: none; }
.admin-list-item .item-name { font-weight: 600; }
.admin-list-item .item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.admin-list-item .item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.admin-list-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.inactive-badge { font-size: 11px; color: var(--muted); background: var(--gray-light); padding: 2px 8px; border-radius: 10px; }

/* ── Modals ───────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: 10px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-sm { max-width: 340px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.checkbox-label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Badges (work) ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-timeclock { background: var(--blue-light);   color: var(--blue); }
.badge-local     { background: var(--orange-light); color: var(--orange); }
.badge-admin      { background: var(--blue);        color: var(--white); }
.badge-supervisor { background: var(--blue-mid);    color: var(--white); }
.badge-user       { background: var(--gray-light);  color: var(--muted); border: 1px solid var(--border); }
.badge-warn      { background: var(--yellow-light); color: #8a5a00; }

/* ── Filter chips (work) ──────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.chip:hover  { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue); border-color: var(--blue); color: var(--white); }


/* ═══ CC Forms ═══════════════════════════════════════════════════════════ */
.form-row { display: flex; gap: 12px; }
.form-row > label { flex: 1; }
.label-like { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-select { width: auto; min-width: 200px; padding: 7px 10px; font-size: 14px; }

.back-bar { position: sticky; top: var(--topbar-h); z-index: 50; background: var(--bg); margin: -20px -20px 14px; padding: 12px 20px 8px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--blue); color: var(--blue); font: inherit; font-size: 15px; font-weight: 600; padding: 8px 18px; border-radius: 6px; cursor: pointer; }
.back-link:hover { background: var(--blue-light); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--text); color: #fff; padding: 11px 20px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 900; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.status-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.st-todo     { background: var(--yellow-light); color: #8a5a00; }
.st-progress { background: var(--blue-light);   color: var(--blue); }
.st-complete { background: var(--green-light);  color: var(--green); }

.progress { height: 8px; background: var(--gray-light); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; transition: width .25s; }
.progress.done > i { background: var(--green); }

/* Statements list */
.month-head { font-size: 13px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.month-head:first-child { margin-top: 0; }
.st-card { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(150px, 1fr) 120px; align-items: center; gap: 18px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; margin-bottom: 8px; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow); }
.st-card:hover { border-color: var(--blue); background: var(--blue-pale); }
.st-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.st-name { font-size: 17px; font-weight: 700; }
.st-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.st-prog-text { font-size: 13px; color: var(--muted); margin-top: 6px; }
.st-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.st-total { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mine-tag { font-size: 11px; font-weight: 700; background: var(--blue); color: #fff; padding: 2px 8px; border-radius: 10px; margin-left: 8px; vertical-align: middle; }

.empty { background: var(--surface); border: 1.5px dashed var(--border); border-radius: 12px; padding: 36px 20px; text-align: center; color: var(--muted); line-height: 1.6; }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* One statement */
.st-head { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; justify-content: space-between; }
.st-head h2 { font-size: 22px; }
.st-head .st-sub { font-size: 14px; }
.st-head-prog { min-width: 220px; flex: 1; max-width: 360px; }
.st-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lock-note { background: var(--green-light); color: var(--green); border-radius: 8px; padding: 10px 14px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.same-note { background: var(--yellow-light); border: 1px solid #f0d58a; border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.same-note span { flex: 1; min-width: 200px; }

.charges { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: clip; }  /* clip, not hidden: hidden would make this the scroll box and break the sticky header */
.ch-row { display: grid; grid-template-columns: 78px minmax(160px, 1.2fr) 96px minmax(200px, 2fr) 120px; gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.ch-row:last-child { border-bottom: none; }
.ch-row.ch-head { background: var(--gray-light); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding-top: 10px; padding-bottom: 10px; position: sticky; top: calc(var(--topbar-h) + 58px); z-index: 20; }
.ch-row.done { background: #f7fbf7; }
.ch-date { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-merchant { font-size: 14px; font-weight: 600; word-break: break-word; line-height: 1.35; }
.ch-order { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.ch-amt { font-size: 15px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ch-amt.credit { color: var(--green); }
.ch-memo-wrap { position: relative; display: flex; gap: 6px; align-items: center; }
.ch-memo-wrap input { flex: 1; min-width: 0; }
.ch-row input { padding: 8px 10px; font-size: 15px; }
.ch-row input:disabled { background: transparent; border-color: transparent; color: var(--text); opacity: 1; }
.ch-same { flex: none; background: none; border: 1.5px solid var(--border); border-radius: 6px; width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 15px; }
.ch-same:hover { border-color: var(--blue); color: var(--blue); }
.ch-saved { position: absolute; right: 46px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--green); opacity: 0; transition: opacity .3s; pointer-events: none; }
.ch-saved.show { opacity: 1; }
.ch-saved.err { color: var(--red); }
.ch-label { display: none; }
.charges-foot { display: flex; justify-content: space-between; padding: 12px 16px; font-weight: 700; background: var(--gray-light); border-top: 1px solid var(--border); }
.hint { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

/* Upload */
.drop { background: var(--surface); border: 2px dashed var(--border); border-radius: 14px; padding: 48px 20px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--blue); background: var(--blue-pale); }
.drop strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.drop .btn { margin-top: 16px; }
.drop:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px; }
.panel h3 { font-size: 17px; margin-bottom: 4px; }
.panel.bad { border-color: #e6a0a0; background: var(--red-light); }
.panel.good { border-color: #a5d6a7; background: var(--green-light); }
.checks { list-style: none; margin: 10px 0 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.checks li::before { content: '✔'; color: var(--green); font-weight: 800; margin-right: 8px; }
.checks li.bad::before { content: '✖'; color: var(--red); }
.checks li.bad { color: var(--red); font-weight: 600; }
.up-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.up-card > .up-top { display: flex; align-items: center; gap: 16px; padding: 14px 18px; flex-wrap: wrap; }
.up-card .up-who { flex: 1; min-width: 200px; }
.up-card .up-name { font-size: 16px; font-weight: 700; }
.up-card .up-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.up-card .up-total { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.up-card details { border-top: 1px solid var(--border); }
.up-card summary { padding: 10px 18px; font-size: 14px; font-weight: 600; color: var(--blue); cursor: pointer; }
.up-rows { padding: 0 18px 12px; font-size: 13px; }
.up-rows div { display: grid; grid-template-columns: 74px 1fr 90px; gap: 10px; padding: 4px 0; border-top: 1px solid var(--gray-light); }
.up-rows div span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.pill-ok   { background: var(--green-light);  color: var(--green); }
.pill-warn { background: var(--yellow-light); color: #8a5a00; }
.pill-bad  { background: var(--red-light);    color: var(--red); }
.upload-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.upload-actions .why { font-size: 14px; color: var(--muted); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards and people */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; max-height: 190px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.check-grid label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.check-grid input { width: auto; }
.list-section { margin-bottom: 26px; }
.list-section h3 { font-size: 15px; margin: 0 0 8px; }
.list-section .sub { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.add-person { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.add-person select { flex: 1; min-width: 220px; max-width: 360px; }

@media (max-width: 900px) {
  .ch-row { grid-template-columns: 70px minmax(0, 1fr) 90px; grid-template-areas: "date merchant amt" "memo memo memo" "job job job"; row-gap: 8px; padding: 12px 14px; }
  .ch-row.ch-head { display: none; }
  .ch-row > .ch-date { grid-area: date; } .ch-row > .ch-merchant { grid-area: merchant; } .ch-row > .ch-amt { grid-area: amt; }
  .ch-row > .ch-memo-wrap { grid-area: memo; } .ch-row > .ch-job { grid-area: job; }
  .ch-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
  .ch-saved { right: 50px; }
}
.mobile-nav { display: none; }
@media (max-width: 768px) {
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 2px solid var(--border); z-index: 200; box-shadow: 0 -2px 8px rgba(26,44,80,.10); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 4px 10px; background: transparent; border: none; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; gap: 3px; line-height: 1.2; font-family: inherit; }
  .mobile-nav-btn .mnav-icon { font-size: 22px; line-height: 1; }
  .mobile-nav-btn.active { color: var(--blue); }
  .topbar-nav { display: none; }
  .user-greeting { display: none; }
  .topbar { padding: 0 14px; --topbar-h: 60px; }
  .topbar-logo { height: 42px; }
  #app-screen { padding-bottom: 76px; }
  .view { padding: 12px; }
  .back-bar { top: 60px; margin: -12px -12px 10px; padding: 10px 12px 8px; }
  .back-link { width: 100%; justify-content: center; padding: 12px 18px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 16px 16px 0 0; max-width: 100%; max-height: 90vh; padding: 24px 20px 32px; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .login-container { margin: 32px 16px; padding: 28px 20px; }
  .form-row { flex-direction: column; }
  .section-toolbar > .btn { width: 100%; }
  .st-card { grid-template-columns: 1fr auto; row-gap: 10px; }
  .st-card .st-mid { grid-column: 1 / -1; order: 3; }
  .st-head { padding: 14px; }
  .st-head-actions .btn { flex: 1 1 45%; }
  .filter-select { width: 100%; }
  .drop { padding: 34px 16px; }
}.charges .same-inline { margin: 0; border-radius: 0; border-left: none; border-right: none; border-top: none; }.st-by { font-size: 12px; color: var(--muted); }
