/* Card portal additions to the shared app.css. */

/* The on/off switch from the Default Categories screen. */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob { position: absolute; inset: 0; cursor: pointer; border-radius: 26px;
  background: #8a96a3; transition: background .15s; }
.switch .knob::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px;
  top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::before { transform: translateX(20px); }
.switch input:focus-visible + .knob { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch input:disabled + .knob { opacity: .45; cursor: not-allowed; }

/* One row per category: name | GL account picker | switch. */
.catmap { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(260px, 2fr) auto;
  gap: 10px 18px; align-items: center; }
.catmap .name { font-weight: 600; }
.catmap .name.off { color: var(--muted); font-weight: 500; }
.catmap .picker { position: relative; }
.catmap .picker input { padding-right: 30px; }
.catmap .picker .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; padding: 2px 6px; color: var(--muted); font-size: 16px; }
.catmap .saved { font-size: 11.5px; color: var(--muted); grid-column: 2 / 4; margin-top: -6px; }
.catmap .err { font-size: 12px; color: #a3261d; grid-column: 2 / 4; margin-top: -6px; }
@media (max-width: 700px) { .catmap { grid-template-columns: 1fr auto; }
  .catmap .picker { grid-column: 1 / 3; } }

/* Receipt first: the big photo button (James, 2026-11-02). */
.photo-btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  padding: 14px 16px; border: 2px dashed #9fb3c8; border-radius: 10px; background: #f5f8fc;
  color: #0f4a88; font-weight: 600; font-size: 15px; cursor: pointer; }
.photo-btn:hover { background: #e9f0f8; border-color: #0f4a88; }
/* filled in by the receipt reader - tinted until the cardholder touches it */
#rf-form input.read-in, #rf-form select.read-in, .lbody input.read-in, .lbody select.read-in,
.lbody textarea.read-in { background: #fffbe6; border-color: #e0c460; }
.rf-confirm { margin-top: 8px; padding: 10px 12px; background: #fff; border: 1px solid #e0c460; border-radius: 8px; }

/* Statuses this portal adds to the shared set. */
.status-new { background: #eef1f5; color: #4a5361; }
.status-ready { background: #e7f5ec; color: #1d6b3d; }
.status-submitted { background: #fff4dc; color: #8a5a00; }
/* "In Xero" is green: done (James, 2026-10-30). A shade deeper than "ready", so the two differ. */
.status-posted { background: #d3f0dd; color: #146c36; }
.status-post_failed, .status-review { background: #fde9e7; color: #a3261d; }
.status-approved { background: #e3f0fb; color: #0f4a88; }
.status-drawings { background: #fde9e7; color: #a3261d; }
.status-suspense { background: #fff3d6; color: #8a5300; }
.status-refunded { background: #e6eefb; color: #1c4f96; }
/* "Personal spending": amber - not the blue of Submit, not the red of a danger button. */
button.personal { background: #fff4e0; border-color: #f2b54d; color: #8a4600; font-weight: 600; }
button.personal:hover:not(:disabled) { background: #ffe7bd; border-color: #e09a1f; }
button.personal:disabled { opacity: .6; }
.status-excluded { background: #f1f1f1; color: #777; text-decoration: line-through; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line);
  margin-bottom: 16px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 10px 14px; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.problems { margin: 6px 0 0; padding-left: 18px; color: #8a5a00; font-size: 12.5px; }
.savednote { min-width: 52px; text-align: right; }
.cardline { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 12px; background: #fff; }
/* A line is a header (date, merchant, amount, state) and a body (the form). On a phone the
   body opens when the header is tapped; on a desktop it is always open. */
.lhead { display: grid; grid-template-columns: 58px 1fr; gap: 0 16px; align-items: start; }
.lbody { margin-left: 74px; }
.lhead .top .meta { flex: 1 1 auto; }
.lhead .top .state { display: inline-flex; gap: 8px; align-items: center; }
.todo { font-size: 11.5px; font-weight: 600; color: #8a5a00; }
.todo.done { color: var(--ok); }
.chev { display: none; }
.tabbar { display: none; }
.datestoggle { display: none; }
.datetile { align-self: start; width: 58px; text-align: center;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.datetile .mon { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; padding: 3px 0; }
.datetile .day { font-size: 24px; font-weight: 700; line-height: 1.1; padding-top: 4px; }
.datetile .wd { font-size: 11px; color: var(--muted); padding-bottom: 5px; }
.cardline .when { font-weight: 600; color: var(--ink); }
.monthhead { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.monthhead h3 { margin: 0; color: var(--accent); font-size: 16px; }
.monthhead .hint { margin-left: auto; }
.datesearch { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 10px; }
.datesearch > div { min-width: 150px; }
.cardline .top { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.cardline .top .merchant { font-weight: 700; }
.cardline .top .amt { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.cardline.refund .top .amt { color: #1d6b3d; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
/* Only the tile itself is a box - '.kpis div' also boxed the label and the number inside
   it, which drew a box inside a box (seen on desktop and phone, 2026-10-09/13). */
.kpis > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
  background: #fff; min-width: 140px; }
.kpis .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kpis .v { font-size: 20px; font-weight: 700; }

/* Issuer marks: drawn here, not image files. */
.issuer { display: inline-flex; align-items: center; justify-content: center; height: 16px; min-width: 16px;
  margin-right: 6px; padding: 0 4px; border-radius: 3px; font: 800 9px/1 Arial, sans-serif;
  letter-spacing: .04em; color: #fff; vertical-align: -3px; }
.issuer-amex { background: #006fcf; }
.issuer-westpac { background: #d5002b; font-size: 12px; font-style: italic; letter-spacing: -.02em; }
button.cardchip { display: inline-flex; align-items: center; }
button.cardchip.primary .issuer { box-shadow: 0 0 0 1.5px #fff; }

/* Admin overview */
.ovtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.ovtile { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; box-shadow: var(--shadow); }
.ovtile:hover { border-color: var(--accent); }
.ovtile .v { font-size: 26px; font-weight: 700; color: var(--accent); }
.ovtile .k { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.attn { display: flex; flex-direction: column; gap: 8px; }
.attnrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
.attnrow .n { min-width: 34px; text-align: center; font-weight: 700; border-radius: 999px; padding: 2px 8px;
  background: var(--warn-soft); color: var(--warn); }
.attnrow.k-post_failed .n, .attnrow.k-xero_issues .n { background: var(--err-soft); color: var(--err); }
.attnrow .t { flex: 1; }
table.setup .ok { color: var(--ok); }
table.setup .no { color: var(--err); font-weight: 600; }
.tabcount { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--err); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.filterbar { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.filterbar input[type=search] { max-width: 520px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; white-space: nowrap;
  font-size: 13px; color: var(--ink); }
@media (max-width: 900px) { .ovtiles { grid-template-columns: repeat(2, 1fr); } }

.newissuer { background: var(--accent-soft); border-radius: 8px; padding: 12px; margin-bottom: 12px; }

/* Type-to-search picker (admin office choosers). */
.spick { position: relative; }
.spick input { padding-right: 30px; }
.spick-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0;
  background: none; padding: 2px 6px; color: var(--muted); font-size: 16px; line-height: 1; }
.spick-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px;
  overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, .14); padding: 4px; }
.spick-opt { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.spick-opt.hi { background: var(--accent-soft); }
.spick-opt.on { font-weight: 700; color: var(--accent); }
.spick-none { padding: 8px 10px; color: var(--muted); font-size: 13px; }

/* ===================================================================================== */
/* PHONE: an app, not a shrunken web page (James, 2026-10-13).                          */
/* ===================================================================================== */
@media (max-width: 680px) {
  body { -webkit-tap-highlight-color: transparent; }
  body.has-tabbar { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .wrap { padding: 12px 12px 24px; }
  input, select, textarea { font-size: 16px; }          /* stops iOS zooming into a field */
  .kp-testbar { font-size: 11px !important; padding: 4px 8px !important; line-height: 1.4; }

  /* app bar */
  header.masthead { position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line); padding: 0; }
  header.masthead .wrap { flex-wrap: nowrap; gap: 10px; min-height: 52px; padding: 0 14px; }
  header.masthead .logo { height: 22px; }
  header.masthead h1 { order: 0; width: auto; padding-left: 10px; border-left: 1px solid var(--line);
    font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header.masthead .ref { display: none; }   /* the tab bar replaces the menu (one section: none needed) */

  /* bottom tab bar */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600; padding: 4px 0; }
  .tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--accent); }

  /* messages become a toast above the tab bar */
  #messages { position: fixed; left: 12px; right: 12px; z-index: 50;
    bottom: calc(76px + env(safe-area-inset-bottom)); }
  #messages .msg { margin: 0; box-shadow: 0 6px 24px rgba(16,24,40,.18); border-radius: 12px; }

  /* summary strip: four counts in one row */
  #intro { border: 0; box-shadow: none; background: transparent; margin-bottom: 8px; }
  #intro > h2, .introtext { display: none; }
  #intro .body { padding: 0; }
  .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 !important; }
  .kpis > div { min-width: 0; padding: 10px 4px; text-align: center; border-radius: 12px;
    border: 0; box-shadow: var(--shadow); }
  .kpis .k { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; line-height: 1.2;
    min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
  .kpis .v { font-size: 22px; line-height: 1.2; margin-top: 2px; }

  /* swipeable chips: cards, then statuses */
  .chiprow, .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .chiprow::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .chiprow button { white-space: nowrap; flex: none; border-radius: 999px; padding: 7px 12px; }
  .tabs { gap: 6px; border-bottom: 0; margin-bottom: 10px; padding-top: 6px; padding-bottom: 6px;
    position: sticky; top: 52px; z-index: 20; background: var(--bg); }
  .tabs button { flex: none; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px;
    padding: 7px 14px; background: #fff; font-size: 13px; }
  .tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

  /* search, with the dates behind a toggle */
  .datesearch { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
  .datesearch > div { min-width: 0; }
  .findbox label { display: none; }
  .findbox input { -webkit-appearance: none; appearance: none; border: 1px solid var(--line);
    border-radius: 12px; padding: 10px 12px; background: #fff; }
  .datestoggle { display: inline-block; border-radius: 12px; padding: 10px 14px; }
  .datesearch .dateonly { display: none; }
  .datesearch.showdates .dateonly { display: block; }
  .datesearch.showdates #clearfind { grid-column: 1 / -1; }

  /* Delegates: folded to one tappable row, like an app's settings row; tap to add or remove. */
  #delegates > h2 { display: flex; align-items: center; gap: 8px; cursor: pointer; border-bottom: 0;
    -webkit-tap-highlight-color: transparent; }
  #delegates > h2 .foldsum { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted);
    text-transform: none; letter-spacing: 0; }
  #delegates > h2 .chev { margin-left: 4px; }
  #delegates.open > h2 { border-bottom: 1px solid var(--line); }
  #delegates.open > h2 .chev { transform: rotate(-135deg); }
  #delegates .body { display: none; }
  #delegates.open .body { display: block; }

  /* month heading */
  .monthhead { margin: 14px 2px 8px; border-bottom: 0; padding-bottom: 0; }
  .monthhead h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }

  /* the transaction card */
  .cardline { border: 0; border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
  .lhead { grid-template-columns: 46px 1fr; gap: 0 12px; cursor: pointer; }
  .datetile { width: 46px; border-radius: 10px; }
  .datetile .mon { font-size: 10px; padding: 2px 0; }
  .datetile .day { font-size: 19px; padding-top: 2px; }
  .datetile .wd { font-size: 10px; padding-bottom: 3px; }
  .lhead .top { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; }
  /* the full description wraps - Amex text like "PAYPAL *OPENAI *CHATGPT 8002..." was cut off (James, 2026-10-22) */
  .lhead .top .merchant { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; font-size: 15px; }
  .lhead .top .amt { margin-left: 0; font-size: 15px; }
  .lhead .top .meta { grid-column: 1 / -1; font-size: 12px; }
  .lhead .top .meta .when { font-weight: 500; color: var(--muted); }
  .lhead .top .state { grid-column: 1 / -1; margin-top: 4px; }
  .chev { display: inline-block; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--faint);
    border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .15s; }
  .cardline.open .chev { transform: rotate(-135deg); }
  .lbody { display: none; margin-left: 0; border-top: 1px solid var(--line); margin-top: 12px; }
  .cardline.open .lbody { display: block; }
  .lbody .grid { grid-template-columns: 1fr !important; }
  .lbody .grid > div { grid-column: auto !important; }
  .lineactions { flex-direction: column; align-items: stretch; gap: 10px; }
  .lineactions .spacer { display: none; }
  .receiptbtn { width: 100%; padding: 13px; font-size: 15px; border-radius: 12px; border-style: dashed;
    border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .lineactions > button.primary, .lineactions > button { width: 100%; padding: 13px; font-size: 16px;
    border-radius: 12px; }
  .savednote { text-align: center; }
  ul.files li a { word-break: break-all; }

  /* approvals: each line a card, Approve pinned above the tab bar */
  .approvelist thead { display: none; }
  .approvelist, .approvelist tbody, .approvelist tr, .approvelist td { display: block; width: 100%; }
  .panel:has(.approvelist) { background: transparent; border: 0; box-shadow: none; }
  .panel:has(.approvelist) > h2 { padding: 4px 2px 10px; border: 0; }
  .panel:has(.approvelist) > .body { padding: 0; }
  .approvelist tr { position: relative; background: #fff; border-radius: 14px; box-shadow: var(--shadow);
    padding: 12px 12px 12px 44px; margin-bottom: 10px; display: flex !important; flex-direction: column; }
  .approvelist td.c-merchant { order: -2; }
  .approvelist td.c-who { order: -1; }
  .approvelist td { border: 0 !important; padding: 2px 0 !important; text-align: left !important; }
  .approvelist td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 86px;
    color: var(--faint); font-size: 12px; font-weight: 600; }
  .approvelist td.c-pick { position: absolute; left: 12px; top: 14px; width: auto; }
  .approvelist td.c-pick input { width: 20px; height: 20px; }
  .approvelist td.c-merchant { font-weight: 700; font-size: 15px; padding-right: 90px !important; }
  .approvelist td.c-merchant::before, .approvelist td.c-amt::before { display: none; }
  .approvelist td.c-amt { position: absolute; right: 12px; top: 12px; width: auto; font-size: 15px; }
  .approvelist td.c-act button { width: 100%; margin-top: 8px; border-radius: 10px; padding: 10px; }
  .approvebar { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 20;
    background: rgba(245,246,249,.97); padding: 8px 0; margin: 0 0 10px !important; }
  .approvebar #approve { flex: 1; padding: 12px; border-radius: 12px; font-size: 15px; }
}

/* 'Possibly personal' review (admin only) */
.flagmark { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: var(--warn-soft); color: var(--warn); border: 1px solid #f0dcb4; cursor: help; }
.attnrow.k-possibly_personal .n { background: var(--warn-soft); color: var(--warn); }

/* Combined portal admin: Reimbursements | Credit cards, above each section's own tabs. */
.sections { display: flex; gap: 8px; margin: 2px 0 14px; }
.sections button { border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px;
  border: 1px solid var(--line); background: #fff; color: var(--muted); }
.sections button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* the reimbursement admin's panels, split into its two tabs */
#claims-box[data-tab="claims"] #admins-panel { display: none !important; }
#claims-box[data-tab="claim-admins"] #search-panel, #claims-box[data-tab="claim-admins"] #results-panel,
#claims-box[data-tab="claim-admins"] #detail-panel { display: none !important; }

/* The Delegates fold is a phone thing; on a desktop the panel is always open. */
@media (min-width: 681px) { #delegates > h2 .foldsum, #delegates > h2 .chev { display: none; } }
