/* ==========================================================================
   Claim Management System — Design System
   Grounded in the subject: internal ops tool for a telco infrastructure
   company. The signature element is the "signal strip" — a meter (segment
   count varies per category/request_type's own approval chain length) that
   encodes progress through that chain, echoing the signal-bar readouts on
   the company's own equipment.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Color */
  --ink:        #12203A;
  --ink-2:      #1C2E4F;
  --ink-3:      #24395E;
  --slate:      #57657A;
  --slate-soft: #8792A3;
  --paper:      #F5F6F4;
  --card:       #FFFFFF;
  --line:       #DFE3E8;
  --line-soft:  #EBEDF0;

  --amber:      #E2993A;
  --amber-soft: #FBF1E1;
  --amber-ink:  #7A4E12;

  --teal:       #1C8C7C;
  --teal-soft:  #E4F3F0;
  --teal-ink:   #0F5148;

  --red:        #C4463B;
  --red-soft:   #FBEAE8;
  --red-ink:    #7A2A23;

  --blue:       #2F6FED;
  --blue-soft:  #EAF1FE;

  /* Type */
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(18, 32, 58, 0.06), 0 8px 24px -12px rgba(18, 32, 58, 0.12);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
  color: var(--ink);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* --------------------------------------------------------------------------
   Utility text
   -------------------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-soft);
}
.mono { font-family: var(--font-mono); }
.text-slate { color: var(--slate); }
.text-sm { font-size: 13px; }

/* --------------------------------------------------------------------------
   Auth screens (login / reset) — split panel
   -------------------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 240px; }
}

.auth-brand {
  background: radial-gradient(circle at 15% 15%, var(--ink-3), var(--ink) 65%);
  color: #EDF1F7;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  /* faint route-line grid, evokes network infrastructure diagrams */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(237, 241, 247, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 241, 247, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.brand-mark__bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.brand-mark__bars span {
  display: block;
  width: 5px;
  background: var(--amber);
  border-radius: 2px;
}
.brand-mark__bars span:nth-child(1) { height: 40%; }
.brand-mark__bars span:nth-child(2) { height: 65%; }
.brand-mark__bars span:nth-child(3) { height: 100%; background: #EDF1F7; }
.brand-mark__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand-mark__name small {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #9FADC4;
  text-transform: uppercase;
  margin-top: 2px;
}

.auth-copy { position: relative; max-width: 380px; }
.auth-copy h1 { color: #fff; font-size: 30px; line-height: 1.2; margin-bottom: 14px; }
.auth-copy p { color: #B7C2D6; font-size: 14.5px; }

.auth-footnote {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #7C8AA6;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-footnote .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(28, 140, 124, 0.25);
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-form-wrap { width: 100%; max-width: 360px; }
.auth-form-wrap h2 { font-size: 22px; margin-bottom: 6px; }
.auth-form-wrap .lede { color: var(--slate); font-size: 13.5px; margin-bottom: 28px; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group > label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
}
/* Hints appear outside .form-group too (the travel card's guidance lines, the
   patient picker's roster note), so the look is defined on the class itself
   and .form-group only adds its spacing. */
.hint { font-size: 12px; color: var(--slate-soft); display: block; }
.form-group .hint { margin-top: 4px; }

/* FIX (v18): small red asterisk on every required field's label. On the claim
   form it is added/removed by markRequiredFields() in app.js, so it follows
   fields whose `required` flips at runtime (overseas trip, vehicle ownership,
   Advance Requests attachment). Login/reset carry it statically. */
.req-star {
  color: var(--red);
  font-weight: 700;
  font-size: 0.95em;
  margin-left: 3px;
  line-height: 1;
}
.hint .req-star { margin-left: 0; margin-right: 3px; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { font-family: var(--font-body); resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  outline: none;
}
input[readonly] { background: var(--line-soft); color: var(--slate); cursor: not-allowed; }

/* Show/hide password (eye) button — markup injected by assets/js/password_toggle.js
   on login and reset. The input keeps its normal look; right padding leaves
   room for the button so text never runs under it. */
.password-field { position: relative; }
.password-field input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-soft);
  cursor: pointer;
}
.password-toggle:hover { color: var(--ink); background: var(--line-soft); }
.password-toggle:focus-visible { outline: none; color: var(--ink); box-shadow: 0 0 0 3px var(--blue-soft); }
/* Hide Edge's built-in reveal button so there aren't two eyes. */
input::-ms-reveal, input::-ms-clear { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--ink-2); text-decoration: none; }
.btn-approve { background: var(--teal); color: #fff; }
.btn-approve:hover { background: var(--teal-ink); text-decoration: none; }
.btn-reject { background: #fff; color: var(--red); border-color: var(--red); }
.btn-reject:hover { background: var(--red-soft); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--slate); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); text-decoration: none; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; display: flex; }

.error-message {
  background: var(--red-soft);
  color: var(--red-ink);
  border: 1px solid rgba(196, 70, 59, 0.25);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
}
.notice {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border: 1px solid rgba(226, 153, 58, 0.3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   App shell — sidebar + topbar
   -------------------------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--ink);
  color: #D9E0EC;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  /* Pinned to the viewport so Sign out stays reachable without scrolling
     to the bottom of a long claims list. */
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.sidebar .brand-mark__name { font-size: 14.5px; }
.sidebar .brand-mark__name small { color: #8493B0; }

.sidebar-section .eyebrow { color: #7080A0; padding: 0 8px; margin-bottom: 8px; display: block; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  color: #C4CDE0;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar-nav a:hover { background: rgba(237, 241, 247, 0.06); text-decoration: none; color: #fff; }
.sidebar-nav a.active { background: rgba(226, 153, 58, 0.14); color: #F3D8AC; }
.sidebar-nav a .tick { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.6; }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(237, 241, 247, 0.08);
  padding-top: 14px;
}
.sidebar-foot a { color: #93A1BE; font-size: 12.5px; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Floating "back to top" — appears once the page is scrolled down so users
   can jump back to the new-claim form without scrolling all the way up. */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #F3D8AC;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(18, 32, 58, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.15s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--ink-3); }
.back-to-top:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
@media (max-width: 600px) {
  .back-to-top { right: 14px; bottom: 16px; width: 40px; height: 40px; }
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; }
.topbar .who { font-size: 12.5px; color: var(--slate); margin-top: 2px; }
.role-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--line-soft);
  color: var(--slate);
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

/* --------------------------------------------------------------------------
   Notification bell (req #4) — polled live, see assets/js/app.js
   -------------------------------------------------------------------------- */
.notif-bell-wrap { position: relative; }
.notif-bell {
  position: relative;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-bell:hover { background: var(--line); }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 30;
  overflow: hidden;
}
.notif-dropdown.is-open { display: block; }
.notif-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.notif-dropdown__list { max-height: 360px; overflow-y: auto; }
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
}
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread { background: var(--amber-soft); }
.notif-item .notif-time { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--slate); }

.content { padding: 28px 32px 48px; max-width: 1180px; }

/* --------------------------------------------------------------------------
   IT Department credit
   --------------------------------------------------------------------------
   Sits inline against the "internal system" line, small enough to read as a
   mark rather than as a second heading. It stays faded so it never competes
   with the line it belongs to; pointing at it floats it up and names the
   department in full. Not clickable by design — the tooltip is the whole
   payload.
   -------------------------------------------------------------------------- */
.it-credit {
  --tip-bg: #12203A;
  --tip-fg: #E7ECF4;
  display: inline-flex;
  vertical-align: middle;
}
/* On the dark brand panels the artwork is the light variant, so the tooltip
   flips too — an ink bubble on an ink panel would disappear. */
.it-credit--light {
  --tip-bg: #EDF1F7;
  --tip-fg: #12203A;
}

.it-credit__mark {
  position: relative;
  display: inline-flex;
  outline: none;
  cursor: default;
}
.it-credit__mark img {
  display: block;
  height: 26px;
  width: auto;
  opacity: .7;
  transition: transform .28s cubic-bezier(.22, .68, .3, 1.02),
              opacity .28s ease,
              filter .28s ease;
}
.it-credit__mark:hover img,
.it-credit__mark:focus-visible img {
  transform: translateY(-4px) scale(1.07);
  opacity: 1;
  filter: drop-shadow(0 7px 11px rgba(18, 32, 58, .28));
}
.it-credit--light .it-credit__mark img { opacity: .82; }
.it-credit--light .it-credit__mark:hover img,
.it-credit--light .it-credit__mark:focus-visible img {
  filter: drop-shadow(0 7px 12px rgba(0, 0, 0, .45));
}

.it-credit__tip {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  width: max-content;
  max-width: min(72vw, 290px);
  text-align: center;
  background: var(--tip-bg);
  color: var(--tip-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .03em;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px -8px rgba(18, 32, 58, .45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -5px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 40;
}
.it-credit__tip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--tip-bg);
}
.it-credit__mark:hover .it-credit__tip,
.it-credit__mark:focus-visible .it-credit__tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* --up: open above instead, for a credit that sits at the bottom of a panel
   with nothing below it to open into. */
.it-credit--up .it-credit__tip {
  top: auto;
  bottom: calc(100% + 9px);
  transform: translate(-50%, 5px);
}
.it-credit--up .it-credit__tip::after {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: var(--tip-bg);
}
.it-credit--up .it-credit__mark:hover .it-credit__tip,
.it-credit--up .it-credit__mark:focus-visible .it-credit__tip { transform: translate(-50%, 0); }

/* --start: hang the bubble from the mark's left edge. A centred bubble on a
   mark this close to the left margin would run off the page. */
.it-credit--start .it-credit__tip {
  left: 0;
  text-align: left;
  transform: translate(0, -5px);
}
.it-credit--start .it-credit__tip::after { left: 18px; transform: none; }
.it-credit--start .it-credit__mark:hover .it-credit__tip,
.it-credit--start .it-credit__mark:focus-visible .it-credit__tip { transform: translate(0, 0); }
.it-credit--up.it-credit--start .it-credit__tip { transform: translate(0, 5px); }
.it-credit--up.it-credit--start .it-credit__mark:hover .it-credit__tip,
.it-credit--up.it-credit--start .it-credit__mark:focus-visible .it-credit__tip { transform: translate(0, 0); }

@media (prefers-reduced-motion: reduce) {
  .it-credit__mark:hover img,
  .it-credit__mark:focus-visible img { transform: none; }
}

/* The mark leads the "internal system" line on the auth panels, taking over
   from the status dot that used to sit there. */
.auth-footnote { gap: 10px; }

/* Same lockup at the foot of the dashboard sidebar. */
.sidebar-org {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #7080A0;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  margin-bottom: 24px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-head h3 { font-size: 16px; }

/* --------------------------------------------------------------------------
   Category sub-form panels
   -------------------------------------------------------------------------- */
.category-fields {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
}
.category-fields h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin-bottom: 16px;
}
/* FIX (v16): Medical and Travel repeat at the card level — a claim can carry
   several visits or travel days, so the cards stack and each header carries
   its own add/remove controls. */
.card-stack { display: flex; flex-direction: column; gap: 14px; }

.category-fields h4.has-action { justify-content: space-between; margin-bottom: 16px; }
.category-fields h4 .cat-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.category-fields h4 .card-index {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--slate);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: none;
  white-space: nowrap;
}
.category-fields h4 .card-index:empty { display: none; }

.card-actions { display: inline-flex; align-items: center; gap: 8px; flex: none; }

/* Removing a whole visit/travel day throws away everything typed into it, so
   it reads as the destructive sibling of "+ Add": same pill silhouette, but
   muted until hovered, when it commits to red. The x is drawn by CSS rather
   than written into all four places the button is emitted. */
.btn-card-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--slate);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-card-remove::before {
  content: '\00d7';
  font-size: 15px;
  line-height: 1;
  margin-top: -1px;
}
.btn-card-remove:hover {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red-ink);
}
.btn-card-remove:active { background: #F6DAD6; }
.btn-card-remove:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Matching silhouette so the two controls sit together as a pair. */
.card-actions .btn-add-row { border-radius: 999px; padding: 5px 12px; line-height: 1.5; }

.card-subtotal {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  text-align: right;
}
.card-subtotal-value { color: var(--ink); }

/* Medical & dental entitlement (views/category/medical.php) — a slim strip
   as wide as the visit cards below it, figures from `users_limit`. */
.limit-panel-wrap { margin-bottom: 14px; }
.limit-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
}
.limit-panel__tiles { display: flex; gap: 8px; flex-wrap: wrap; }
.limit-tile {
  flex: 1 1 220px;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.limit-tile__label { grid-column: 1; grid-row: 1; font-size: 12px; font-weight: 600; color: var(--slate); }
.limit-tile__total { grid-column: 1; grid-row: 2; font-size: 11px; color: var(--slate-soft); font-family: var(--font-mono); }
.limit-tile__note  { grid-column: 1; grid-row: 3; font-size: 11px; color: var(--slate); }
.limit-tile__balance {
  grid-column: 2;
  grid-row: 1 / 4;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--teal-ink);
  white-space: nowrap;
}
.limit-tile__balance small { font-size: 11px; font-weight: 500; color: var(--slate); }
.limit-tile__bar { grid-column: 1 / -1; grid-row: 4; height: 3px; border-radius: 999px; background: var(--line); margin-top: 5px; overflow: hidden; }
.limit-tile__bar span { display: block; height: 100%; background: var(--teal); border-radius: 999px; }

.limit-tile.is-empty .limit-tile__balance { color: var(--slate-soft); }
.limit-tile.is-low .limit-tile__balance { color: var(--amber-ink); }
.limit-tile.is-low .limit-tile__bar span { background: var(--amber); }
.limit-tile.is-low .limit-tile__note { color: var(--amber-ink); }
.limit-tile.is-over { background: var(--red-soft); }
.limit-tile.is-over .limit-tile__balance,
.limit-tile.is-over .limit-tile__note { color: var(--red-ink); }
.limit-tile.is-over .limit-tile__bar span { background: var(--red); }

/* The live projection under the tiles. Three tones, because the line now says
   three different kinds of thing as the amounts are typed: what will be left
   (neutral), that it is nearly gone (amber), and that the claim overshoots
   (red). Amber is the default so an unstyled fallback still reads as caution. */
.limit-panel__warn {
  margin-top: 8px;
  font-size: 12px;
  color: var(--amber-ink);
  background: var(--amber-soft);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.limit-panel__warn.is-info {
  color: var(--slate);
  background: var(--paper);
}
.limit-panel__warn.is-low {
  color: var(--amber-ink);
  background: var(--amber-soft);
}
.limit-panel__warn.is-over {
  color: var(--red-ink);
  background: var(--red-soft);
  font-weight: 500;
}
.limit-panel__warn[hidden] { display: none; }

/* Edit mode only: explains why the balance above is higher than the dashboard
   shows — this claim's own reservation has been added back into it. */
.limit-panel__note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--slate-soft);
  padding: 0 2px;
}

.category-fields .cat-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--ink);
  color: #fff;
}
.field-row { display: flex; gap: 12px; }
.field-row .form-group { flex: 1; }
.amount-callout {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.amount-callout label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate-soft); margin-bottom: 4px; }
.amount-callout input { font-family: var(--font-mono); font-weight: 600; font-size: 16px; border: none; padding: 2px 0; background: transparent; }
.chip-toggle {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
}
/* A hint that explains the .chip-toggle directly above it. Spaced as a pair
   here rather than by a negative margin at each call site: .chip-toggle has no
   bottom margin of its own, so "pull the hint up a bit" lands it inside the
   chip's border instead of under it. */
.chip-toggle + .hint { margin: 6px 0 14px; }

/* Travel day with none of Travel / Other Expenses / Meal ticked — Submit is
   blocked (app.js: toggleTravelSections), so show the user where to look. */
.claim-card.travel-none-picked .chip-toggle { border-color: var(--red); background: var(--red-soft); }
.claim-card.travel-none-picked h4 + .hint { color: var(--red); font-weight: 600; }

.radio-pill { display: inline-flex; gap: 14px; align-items: center; }
.radio-pill label { font-weight: 500; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-soft);
  background: var(--paper);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink);
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr.row-editing td { background: var(--blue-soft); }
table.data-table .amount { font-family: var(--font-mono); font-weight: 600; }
table.data-table .empty-row td { text-align: center; color: var(--slate-soft); padding: 28px; }

.id-tag { font-family: var(--font-mono); font-size: 12.5px; color: var(--slate); }
.category-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--slate);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Signal strip — the signature status meter.
   Segment count = however many approval stages this claim's own
   category/request_type chain has. Filled segments show progress; amber
   pulse marks the stage currently pending; red state replaces the strip
   entirely to make a rejection unmistakable.
   -------------------------------------------------------------------------- */
.signal-status { display: inline-flex; flex-direction: column; gap: 5px; }
.signal-strip { display: flex; gap: 3px; }
.signal-strip i {
  display: block;
  width: 16px;
  height: 6px;
  border-radius: 2px;
  background: var(--line);
}
.signal-strip i.on { background: var(--teal); }
.signal-strip i.pending { background: var(--amber); animation: pulse 1.8s ease-in-out infinite; }
.signal-strip.is-rejected i { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.status-label { font-size: 11.5px; font-weight: 600; }
.status-label.pending { color: var(--amber-ink); }
.status-label.approved { color: var(--teal-ink); }
.status-label.rejected { color: var(--red-ink); }
.status-next { font-size: 11px; color: var(--slate); line-height: 1.3; max-width: 180px; }
.status-remark { font-size: 11.5px; color: var(--red-ink); margin-top: 2px; max-width: 220px; }

/* --------------------------------------------------------------------------
   HR valuation / action cells
   -------------------------------------------------------------------------- */
.hr-audit-box {
  background: var(--teal-soft);
  border: 1px solid rgba(28, 140, 124, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.hr-audit-box label { font-size: 11.5px; font-weight: 700; color: var(--teal-ink); text-transform: uppercase; letter-spacing: 0.03em; display: block; margin-bottom: 6px; }
.hr-audit-box input[type="number"] { width: 100px; padding: 6px 8px; margin-bottom: 8px; }
.action-stack { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.reject-inline { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.reject-inline textarea {
  width: 100%;
  min-width: 240px;
  min-height: 72px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
}
.reject-inline .btn-reject { align-self: flex-end; }

/* --------------------------------------------------------------------------
   Empty / callouts
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate);
}
.empty-state .eyebrow { display: block; margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Repeatable entry rows (travel petrol/toll/parking, medical patients)
   -------------------------------------------------------------------------- */
.entry-group { margin-bottom: 16px; }
.entry-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.entry-group__head label { font-weight: 600; font-size: 13px; color: var(--ink); }
/* Tinted blue so the add/copy controls read as buttons, not faint outlines
   that users were scrolling past. */
.btn-add-row {
  background: var(--blue-soft);
  border: 1px solid #BCD0F8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-add-row:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-add-row:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* The two stack-level buttons under the day/visit cards ("Copy as above",
   "+ Add travel day" / "+ Add clinic / visit") are the main way to grow the
   form, so they get a bit more size than the per-row add buttons. */
.card-stack-actions .btn-add-row { font-size: 13px; padding: 8px 14px; }

.entry-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.entry-row .entry-amount,
.entry-row .entry-qty { font-family: var(--font-mono); }
.entry-row .entry-note { flex: 1; }
.row-remove {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--red);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.row-remove:hover { background: var(--red-soft); border-color: var(--red); }

/* Medical patient rows: a dropdown of the employee + their registered
   dependants, which yields part of its width to a free-text box only when
   "Other" is picked. Both are laid out here rather than with inline styles so
   the PHP-rendered row and the JS-added row cannot drift apart. */
.patient-row .patient-select { flex: 1.4; min-width: 0; }
.patient-row .patient-other { display: none; }
.patient-row.is-other .patient-select { flex: 0 1 190px; }
.patient-row.is-other .patient-other { display: block; flex: 1.4; min-width: 0; }

/* --------------------------------------------------------------------------
   OT AM/PM time picker
   -------------------------------------------------------------------------- */
.time-picker {
  display: flex;
  align-items: center;
  gap: 4px;
}
.time-picker select { padding: 10px 8px; }
.time-picker span { color: var(--slate-soft); font-weight: 600; }

/* --------------------------------------------------------------------------
   Manager dashboard: total banner + category/employee accordion
   -------------------------------------------------------------------------- */
.total-banner {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}
.total-banner__amount {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.total-banner__count { font-size: 14px; color: #B7C2D6; font-family: var(--font-mono); }

.accordion-card { padding: 0; overflow: hidden; }
.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: none;
  padding: 18px 22px;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, transform 0.12s ease;
}
.accordion-toggle:hover { background: var(--paper); }
.accordion-toggle__left { display: flex; align-items: center; gap: 12px; }
.accordion-toggle__right { display: flex; align-items: center; gap: 12px; }
.accordion-chevron {
  display: inline-block;
  font-size: 10px;
  color: var(--slate-soft);
  transition: transform 0.18s ease;
}
.accordion-toggle.is-open .accordion-chevron { transform: rotate(180deg); }
.accordion-toggle.is-open { background: var(--paper); }

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.22s ease;
}
.accordion-panel__inner { padding: 4px 22px 18px; }

.accordion-sub {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.accordion-sub:hover { transform: translateY(-1px); box-shadow: 0 4px 14px -8px rgba(18,32,58,0.25); }
.accordion-toggle--sub { padding: 13px 16px; background: transparent; }
.accordion-toggle--sub:hover { background: rgba(18,32,58,0.03); }
.accordion-sub .accordion-panel__inner { padding: 0 14px 14px; }
.accordion-sub .table-wrap { border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------
   Category landing cards (manager dashboard) — clickable links into a single
   category's detail page, replacing the old always-expanded per-category
   accordion so the landing view stays compact when there are many claims.
   -------------------------------------------------------------------------- */
.category-link-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: none;
  padding: 18px 22px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: background 0.14s ease;
}
.category-link-card:hover { background: var(--paper); text-decoration: none; }
.category-link-card__arrow { font-size: 16px; color: var(--slate-soft); }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   Company filter — narrows a list to the claims filed under one company.
   Rendered only when the list actually spans more than one, so it is absent
   entirely for anyone who only ever sees a single company's claims.
   -------------------------------------------------------------------------- */
.company-filter { margin: 0 0 16px; }
.card-head + .company-filter { margin-top: 16px; }
.company-filter__pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.company-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--slate);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.company-pill:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }

.company-pill__count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--slate);
}

.company-pill.is-active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.company-pill.is-active:hover { background: var(--ink-2); color: #FFFFFF; }
.company-pill.is-active .company-pill__count { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }

/* --------------------------------------------------------------------------
   Priority section — medical/travel claims submitted (not the claim's
   chosen date) between the 1st and 6th of the month, surfaced first and
   called out in amber so they can't be missed.
   -------------------------------------------------------------------------- */
.section-divider { font-size: 12px; color: var(--slate-soft); text-transform: uppercase; letter-spacing: 0.06em; margin: 22px 0 10px; font-weight: 700; }
.priority-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--amber-soft); color: var(--amber-ink);
  border: 1px solid rgba(226, 153, 58, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 700; font-size: 13px;
  margin: 4px 0 12px;
}
.priority-badge {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--amber); color: #3D2703;
  padding: 3px 8px; border-radius: 999px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Claim details modal — professional entrance animation
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 32, 58, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 92%;
  /* Was 560px — widened for the ruled claim grid the modal now renders (see
     .modal-claim-grid). This is the only modal in the app. */
  max-width: 880px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(18, 32, 58, 0.45);
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.modal-overlay.is-open .modal-card { transform: translateY(0) scale(1); opacity: 1; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  background: var(--line-soft);
  border: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 17px;
  color: var(--slate);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }

.modal-body { padding: 20px 22px 24px; overflow-y: auto; }

.modal-amount-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--teal-soft);
  color: var(--teal-ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 600;
}
.modal-amount-banner strong { font-family: var(--font-mono); font-size: 18px; }

.modal-field-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.modal-field-row:last-child { border-bottom: none; }
.modal-field-label { color: var(--slate); flex-shrink: 0; }
.modal-field-value { color: var(--ink); text-align: right; font-weight: 500; }

.modal-subtable { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.modal-subtable table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.modal-subtable th {
  background: var(--paper);
  text-align: left;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-soft);
  border-bottom: 1px solid var(--line);
}
.modal-subtable td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.modal-subtable tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------------------
   FIX (v20): the claim-details modal renders the same document the PDF does —
   plain "Label : value" meta lines above a hard-ruled grid. Styled to match
   views/pdfgen.php deliberately: the whole point is that the popup and the
   printout are recognisably one sheet.
   --------------------------------------------------------------------------- */
.modal-claim-meta { font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.modal-claim-meta__row { display: flex; gap: 8px; padding: 2px 0; }
.modal-claim-meta__label { color: var(--slate); font-weight: 600; flex-shrink: 0; }
.modal-claim-meta__value { color: var(--ink); min-width: 0; }

/* Travel carries 12 columns — more than any popup is wide. The grid keeps its
   real column widths and scrolls sideways instead of crushing them. */
.modal-claim-gridwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.modal-claim-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.35;
}
.modal-claim-grid th,
.modal-claim-grid td {
  border: 1px solid var(--line);
  padding: 5px 7px;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.modal-claim-grid thead th,
.modal-claim-grid tfoot th,
.modal-claim-grid tfoot td {
  background: var(--paper);
  font-weight: 600;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: normal;
}
.modal-claim-grid tfoot th, .modal-claim-grid tfoot td { font-weight: 700; }
.modal-claim-grid .grid-line { display: block; }
.modal-claim-grid .grid-sub { display: block; color: var(--slate); font-size: 0.92em; }
.modal-claim-grid .grid-line + .grid-sub { margin-top: 2px; }
.modal-claim-grid .ta-left { text-align: left; }
.modal-claim-grid .ta-center { text-align: center; }
.modal-claim-grid .ta-right {
  text-align: right;
  font-family: var(--font-mono);
  /* A money figure must never split across two lines. */
  word-break: normal;
  overflow-wrap: normal;
}
/* The dense (travel) grid needs a floor under its width, or 12 columns share
   560px and every one of them wraps to a single character per line. */
.modal-claim-grid--dense { font-size: 11.5px; min-width: 940px; }
.modal-claim-grid--dense th, .modal-claim-grid--dense td { padding: 3px 5px; }
.modal-claim-grid--dense thead th { font-size: 10.5px; }
.modal-claim-grid--dense td.ta-center { word-break: normal; overflow-wrap: normal; }

/* ==========================================================================
   Responsive — tablet & phone
   --------------------------------------------------------------------------
   CSS only, on top of the desktop layout above: no markup changes, so every
   page picks this up from the one stylesheet. Two steps:
     ≤ 900px  tablet — sidebar folds into a sticky top bar, gutters tighten.
     ≤ 600px  phone  — rows stack, modal becomes a bottom sheet, form
                       controls go 16px so iOS doesn't zoom on focus.
   Wide tables keep their columns and scroll sideways inside .table-wrap
   rather than being crushed.
   ========================================================================== */

@media (max-width: 1100px) {
  .content { padding: 24px 24px 40px; }
  .topbar { padding: 16px 24px; }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  /* Sidebar -> top bar: brand + sign-out on the first line, the nav as a
     sideways-scrolling row of tabs beneath. */
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 20px 10px;
    position: sticky;
    top: 0;
    z-index: 60;
    height: auto;
  }
  .sidebar-section { order: 3; flex: 1 1 100%; min-width: 0; }
  .sidebar-section .eyebrow { display: none; }
  .sidebar-nav {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-nav a { white-space: nowrap; flex: none; padding: 8px 12px; }

  .sidebar-foot {
    margin: 0 0 0 auto;
    border-top: none;
    padding-top: 0;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .sidebar-foot a { white-space: nowrap; }
  .sidebar-org { margin: 0; }
  .sidebar-org > span:last-child { display: none; }
  .sidebar .it-credit__mark img { height: 22px; }

  /* The credit's tooltip opens upward from the old sidebar foot; at the top
     of the screen that would be off-page, so drop it down, right-aligned. */
  .sidebar .it-credit.it-credit--up .it-credit__tip {
    top: calc(100% + 9px);
    bottom: auto;
    left: auto;
    right: 0;
    text-align: right;
    transform: translate(0, -5px);
  }
  .sidebar .it-credit.it-credit--up .it-credit__mark:hover .it-credit__tip,
  .sidebar .it-credit.it-credit--up .it-credit__mark:focus-visible .it-credit__tip {
    transform: translate(0, 0);
  }
  .sidebar .it-credit.it-credit--up .it-credit__tip::after {
    top: auto;
    bottom: 100%;
    left: auto;
    right: 12px;
    transform: none;
    border-top-color: transparent;
    border-bottom-color: var(--tip-bg);
  }

  .topbar { padding: 14px 20px; gap: 12px; }
  .content { padding: 20px 20px 40px; max-width: none; }

  .modal-card { width: 94%; max-height: 88vh; }
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  html, body { font-size: 14.5px; }

  /* iOS Safari zooms into any focused control under 16px. */
  input[type="text"],
  input[type="password"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  input[type="month"],
  input[type="file"],
  select,
  textarea { font-size: 16px; }
  input[type="month"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    font-family: var(--font-body);
    color: var(--ink);
  }

  /* Shell */
  .sidebar { padding: 10px 14px 8px; }
  .sidebar .brand-mark__name small { display: none; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 14px 12px 32px; }

  /* Notification dropdown: the bell sits 14px in from the right edge, so
     this spans the screen minus that gutter on both sides. */
  .notif-bell { width: 38px; height: 38px; }
  .notif-dropdown {
    width: calc(100vw - 28px);
    max-width: none;
  }
  .notif-dropdown__list { max-height: 60vh; }

  /* Cards */
  .card { padding: 16px; margin-bottom: 16px; border-radius: var(--radius-md); }
  .card-head { flex-wrap: wrap; margin-bottom: 14px; }
  .user-workspace .card[style*="padding:0"] .card-head { padding: 16px 16px 0 !important; }
  .user-workspace .card[style*="padding:0"] > div[style*="padding:14px 24px"] { padding: 12px 16px 0 !important; }

  /* Claim form */
  .category-fields { padding: 12px; }
  .category-fields h4.has-action { flex-wrap: wrap; row-gap: 8px; }
  .travel-subsection,
  .other-expense-subsection,
  .meal-subsection { padding: 10px !important; }

  .field-row { flex-direction: column; gap: 0; }
  .field-row .form-group { margin-bottom: 14px !important; }
  .field-row .form-group:last-child { margin-bottom: 0 !important; }

  .radio-pill { flex-wrap: wrap; row-gap: 8px; }
  .entry-group__head { flex-wrap: wrap; gap: 8px; }

  .entry-row { flex-wrap: wrap; }
  .entry-row > * { min-width: 0; }
  .entry-row .entry-amount { max-width: 110px !important; flex: 0 0 110px; }
  .entry-row .entry-note { flex: 1 1 120px; }
  .row-remove { width: 38px; height: 38px; }
  /* Destination on its own line, purpose + remove on the next. */
  .rows-travel-legs .entry-row > input:first-child { flex: 1 1 100%; }
  /* Medical: with "Other" picked, the dropdown takes a full line and the
     typed name + amount share the next. */
  .patient-row.is-other .patient-select { flex: 1 1 100%; }

  /* Requisition items table: keep its columns and scroll sideways. */
  #window_request .table-wrap { -webkit-overflow-scrolling: touch; }
  #window_request table.data-table { min-width: 560px; }

  /* Submit / Save as draft full width (their inline width:auto needs the
     !important). */
  #master_claim_form .btn { width: 100% !important; }

  /* Tables */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data-table th { padding: 10px 12px; }
  table.data-table td { padding: 10px 12px; }

  /* Manager dashboard */
  .total-banner { flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 18px; margin-bottom: 16px; }
  .total-banner__amount { font-size: 20px; }
  .category-link-card,
  .accordion-toggle { padding: 14px 16px; flex-wrap: wrap; }
  .accordion-toggle__left { flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
  .accordion-toggle--sub { padding: 12px 14px; }
  .accordion-panel__inner { padding: 4px 12px 14px; }
  .accordion-sub .accordion-panel__inner { padding: 0 10px 10px; }
  .accordion-sub:hover { transform: none; }
  .priority-banner { flex-wrap: wrap; }

  /* Modal -> bottom sheet */
  .modal-overlay { align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(40px);
  }
  .modal-head { padding: 14px 16px; }
  .modal-close { width: 36px; height: 36px; }
  .modal-body { padding: 14px 16px 20px; }
  .modal-field-row { flex-wrap: wrap; gap: 2px 12px; }
  .modal-field-value { text-align: left; }
  .modal-claim-meta__row { flex-wrap: wrap; gap: 0 8px; }

  /* Login / reset */
  .auth-brand { padding: 28px 22px; min-height: 0; gap: 22px; }
  .auth-copy h1 { font-size: 22px; margin-bottom: 8px; }
  .auth-copy p { font-size: 13.5px; }
  .auth-form-side { padding: 28px 18px 36px; }
}

/* --------------------------------------------------------------------------
   Receipt image viewer (assets/js/app.js: openImageViewer). Full-screen
   overlay with rotate / zoom / pan for uploaded JPG/PNG receipts.
   -------------------------------------------------------------------------- */
.imgv-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  flex-direction: column;
  background: rgba(10, 16, 28, 0.94);
  color: #E7ECF4;
}
.imgv-overlay.is-open { display: flex; }
.imgv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
}
.imgv-title { font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.imgv-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.imgv-actions button,
.imgv-actions a {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #E7ECF4;
  font: 600 16px/36px var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.imgv-actions a { font-size: 13px; }
.imgv-actions button:hover:not(:disabled),
.imgv-actions a:hover { background: rgba(255, 255, 255, 0.2); }
.imgv-actions button:disabled { opacity: 0.35; cursor: default; }
.imgv-actions .imgv-close { font-size: 22px; }
.imgv-actions .imgv-close:hover { background: var(--red); border-color: var(--red); }
.imgv-sep { width: 1px; height: 22px; margin: 0 4px; background: rgba(255, 255, 255, 0.18); }
.imgv-overlay.is-single [data-imgv="prev"],
.imgv-overlay.is-single [data-imgv="next"],
.imgv-overlay.is-single .imgv-sep:first-of-type { display: none; }
.imgv-stage { position: relative; flex: 1; overflow: hidden; }
.imgv-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center center;
  transition: transform 0.2s ease;
  touch-action: none;
  user-select: none;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.imgv-stage img.is-dragging { transition: none; cursor: grabbing !important; }

@media (max-width: 640px) {
  .imgv-toolbar { padding: 8px 10px; }
  .imgv-title { width: 100%; }
  .imgv-actions button, .imgv-actions a { min-width: 34px; height: 34px; line-height: 32px; padding: 0 8px; }
}
