/* ARA Work — ARA Ai Solution
   Dark-first: staff are video editors working evenings on phones.
   One loud thing: the day's tally. Everything else stays quiet. */

:root {
  --ink:      #0B1322;
  --surface:  #121D30;
  --surface2: #19273E;
  --line:     #24364F;
  --paper:    #E6EDF7;
  --muted:    #8699B4;
  --gold:     #F2A900;
  --gold-dim: #8a6412;
  --sky:      #3FA9F5;
  --ok:       #3FD39B;

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --pad: 20px;
  --tabbar: 68px;

  --font-ui:  "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-num: "Sora", ui-sans-serif, system-ui, sans-serif;
}

:root[data-theme="light"] {
  --ink:      #F6F8FC;
  --surface:  #FFFFFF;
  --surface2: #EEF3FA;
  --line:     #DBE3EF;
  --paper:    #16233A;
  --muted:    #5B6E8A;
  --gold-dim: #F6DFAE;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The browser hides [hidden] with a user-agent rule, and ANY author rule
   that sets display beats it outright. Half this file sets display:flex,
   so `el.hidden = true` silently did nothing to: the tab bar on the
   sign-in screen, the Team tab for non-bosses, the install banner after
   it was dismissed, the top bar before sign-in, the migrate card and the
   leave segment.
   Staff were seeing a Team tab they had no business seeing — the data
   behind it was safe (row-level security), but the tab was not supposed
   to be there at all, and tapping it leads nowhere.
   !important is the correct tool here: this must outrank every later
   display rule, by design. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body {
  min-height: 100svh;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  max-width: 560px;
  margin-inline: auto;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 18px) var(--pad) 6px;
}

.hello     { font-size: 15px; color: var(--muted); }
.hello b   { color: var(--paper); font-weight: 600; }
.datestamp { font-size: 13px; color: var(--muted); margin-top: 1px; }

.topbtn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}

/* ---------------------------------------------------------------- screens */

.screen { display: none; padding: 0 var(--pad); }
.screen.on { display: block; }

h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 26px 0 10px;
  letter-spacing: .01em;
}

/* ------------------------------------------------------------- the tally */

.tally {
  margin-top: 18px;
  padding: 30px 20px 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(242,169,0,.11), transparent 62%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-align: center;
}

.tally .count {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(76px, 27vw, 118px);
  line-height: .84;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  display: block;
}

.tally .unit {
  display: block;
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}

.rate {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.rate .bar {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
}

.rate .fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  width: 0;
  transition: width .5s cubic-bezier(.2,.8,.3,1);
}

.rate .num {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex: none;
}

/* --------------------------------------------------------------- blocks */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px;
}

.brief-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.brief-row:last-child { border-bottom: none; }
.brief-row:first-child { padding-top: 2px; }

.brief-row .who { font-size: 15px; }
.brief-row .want {
  font-family: var(--font-num);
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.brief-row .want.met { color: var(--ok); }

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 16px 0 4px;
}

.log-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.log-item:last-child { border-bottom: none; }

.log-item .n {
  font-family: var(--font-num);
  font-weight: 600;
  font-size: 16px;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
}
.log-item .what { flex: 1; font-size: 15px; }
.log-item .what small { display: block; color: var(--muted); font-size: 12.5px; }
.log-item .at { font-size: 12.5px; color: var(--muted); flex: none; }

/* -------------------------------------------------------------- buttons */

.primary {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 17px;
  border-radius: var(--r);
  background: var(--gold);
  color: #221600;
  font-size: 16.5px;
  font-weight: 600;
  text-align: center;
}
.primary:active { transform: translateY(1px); }
.primary[disabled] { opacity: .4; }

.ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 15px;
  text-align: center;
}

/* ---------------------------------------------------------------- forms */

label.f { display: block; margin-top: 18px; }
label.f > span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
}

/* Match by exclusion, not by listing types. The old rule listed text,
   number and date and so missed input[type=email] — the sign-in field.
   Inputs inherit color: var(--paper) from the reset above, so that field
   rendered as near-white text on the browser's default white background:
   invisible, on the one control every single person has to use before
   they can do anything at all. Automated tests never caught it because
   setting a value directly never requires reading it. Listing types means
   the next type added silently repeats this. */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
select, textarea {
  width: 100%;
  padding: 14px;
  background: var(--surface);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 16px; /* keeps iOS from zooming on focus */
}

::placeholder { color: var(--muted); opacity: 1; }

/* Chrome paints autofilled fields with its own near-white background and
   will not let `background` override it. The inset shadow is the only
   way to cover it, and -webkit-text-fill-color the only way to set the
   text colour. Without these, the field goes white-on-white again the
   moment the browser offers to fill in a saved address. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--paper);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--paper);
  transition: background-color 9999s ease-in-out 0s;
}
textarea { min-height: 96px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 11px 15px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 14.5px;
}
.chip[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #221600;
  font-weight: 600;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: center;
  padding: 6px 0;
}
.stepper button {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 26px;
  color: var(--paper);
  display: grid;
  place-items: center;
}
.stepper button:active { background: var(--surface2); }
.stepper .val {
  font-family: var(--font-num);
  font-size: 48px;
  font-weight: 700;
  min-width: 78px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- tab bar */

.tabs {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  background: color-mix(in srgb, var(--ink) 94%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}

.tabs button {
  flex: 1;
  padding: 11px 2px 12px;
  color: var(--muted);
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.tabs button[aria-current="page"] { color: var(--gold); }
.tabs svg { width: 21px; height: 21px; stroke-width: 1.8; fill: none; stroke: currentColor; }

/* --------------------------------------------------------------- sheet */

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(4,8,15,.62);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.sheet.on { display: flex; }
.sheet > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 24px var(--pad) calc(28px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  animation: rise .26s cubic-bezier(.2,.9,.3,1);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet h3 { margin: 0 0 6px; font-size: 18px; }
.sheet p  { margin: 0 0 4px; color: var(--muted); font-size: 14.5px; }
.sheet ol { margin: 14px 0 0; padding-left: 20px; color: var(--paper); font-size: 15px; }
.sheet ol li { margin-bottom: 9px; }

/* --------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 16px);
  background: var(--ok);
  color: #04281B;
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 20px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 50;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- person */

.who-grid { display: grid; gap: 10px; margin-top: 20px; }
.who-grid button {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: left;
}
.who-grid .av {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-weight: 600;
  color: var(--gold);
  flex: none;
}
.who-grid .nm { font-size: 15.5px; }
.who-grid .rl { font-size: 13px; color: var(--muted); }

.signin { padding: 10vh var(--pad) 0; text-align: center; }
.signin img { width: 72px; height: 72px; border-radius: 18px; }
.signin h1 { font-family: var(--font-num); font-size: 25px; margin: 18px 0 4px; font-weight: 700; }
.signin p  { color: var(--muted); margin: 0; font-size: 15px; }

.meta { color: var(--muted); font-size: 13px; margin-top: 8px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.row .k { font-size: 15px; }
.row .v { color: var(--muted); font-size: 14px; }

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--muted);
}
.pill.ok   { background: rgba(63,211,155,.15); color: var(--ok); }
.pill.wait { background: rgba(242,169,0,.15);  color: var(--gold); }

/* install hint — an offer on the page, never a modal on arrival */
.install-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 12px 11px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.install-hint .ih-text { flex: 1; font-size: 14px; color: var(--muted); }
.install-hint .ih-go {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  padding: 5px 11px;
  border-radius: 99px;
  background: rgba(242,169,0,.12);
  flex: none;
}
/* 2px/4px of padding on a 20px glyph is roughly a 16x22 tap target.
   Both Apple and Google ask for 44x44. It was not unclickable, it was
   unhittable with a thumb — which is the same thing to the person
   holding the phone. */
.install-hint .ih-x {
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  flex: none;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px -4px -6px 0;   /* keeps the banner the same height */
}
.install-hint .ih-go { min-height: 40px; }

/* segmented control — Claims / Leave */
.seg {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  background: var(--surface2);
  border-radius: 99px;
}
.seg button {
  flex: 1;
  padding: 10px;
  border-radius: 99px;
  font-size: 14.5px;
  color: var(--muted);
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--paper);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.22);
}

/* leave balance */
.bal { display: flex; gap: 10px; }
.bal > div {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
}
.bal .n {
  font-family: var(--font-num);
  font-size: 27px;
  font-weight: 700;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.1;
}
.bal .n small { font-size: 14px; color: var(--muted); font-weight: 400; }
.bal .k { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; }

/* approval rows */
.appr {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 15px;
  margin-bottom: 10px;
}
.appr .hd { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.appr .who { font-size: 15px; font-weight: 600; }
.appr .amt {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  flex: none;
}
.appr .sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.appr .acts { display: flex; gap: 8px; margin-top: 12px; }
.appr .acts button {
  flex: 1;
  padding: 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--paper);
}
.appr .acts .yes { background: var(--ok); border-color: var(--ok); color: #04281B; }
