/* ==========================================================================
   KAMNI Sales data — styles for the password screen (login.html) and the app (app.html).
   The KAMNI Boutique tokens (../kamni-boutique/styles.css): offwhite on deep blue, 1 px offwhite
   fields with a 5 px radius, display lines in caps. Self-contained: system fonts only (a serif for
   display, Arial for text), no images, no external files. Fields are 16 px, so iOS never zooms in.
   ========================================================================== */

:root {
  --deep-blue: #000a30;
  --surface: #050f38;
  --surface-raised: #0a1745;
  --offwhite: #fffcee;
  --offwhite-80: rgba(255, 252, 238, 0.8);
  --offwhite-60: rgba(255, 252, 238, 0.6);
  --offwhite-50: rgba(255, 252, 238, 0.5);
  --offwhite-40: rgba(255, 252, 238, 0.4);
  --offwhite-20: rgba(255, 252, 238, 0.2);
  --offwhite-12: rgba(255, 252, 238, 0.12);
  --offwhite-06: rgba(255, 252, 238, 0.06);
  --ok: #8fd6a9;
  --ok-bg: rgba(143, 214, 169, 0.12);
  --warn: #f2c46d;
  --warn-bg: rgba(242, 196, 109, 0.12);
  --err: #ff9b8f;
  --err-bg: rgba(255, 155, 143, 0.12);
  --font-display: Georgia, "Times New Roman", serif;
  --font-text: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 5px;
  --gutter: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--deep-blue); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--deep-blue);
  color: var(--offwhite);
  font: 16px/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: var(--offwhite); }
p { margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--offwhite); outline-offset: 2px; }

/* The KAMNI lockup. */
.logo { display: block; width: 220px; height: 30.4px; max-width: 100%; color: var(--offwhite); }
.logo--top { width: 112px; height: 15.5px; flex: none; }

/* ---- type ---- */
.display, .card__title, .hero__title, .top__title, .login__title, .dialog__title, .month__title, .result__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.eyebrow {
  font-size: 12px; line-height: 14px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--offwhite-60);
}

/* ---- password screen ---- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px var(--gutter) calc(40px + env(safe-area-inset-bottom));
}
.login__box { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.login__title { margin-top: 24px; font-size: 24px; line-height: 29px; text-align: center; }
.rule { width: 200px; max-width: 80%; height: 1px; margin: 18px auto 0; background: var(--offwhite); }
.login__lead { margin-top: 18px; font-size: 14px; color: var(--offwhite-80); text-align: center; }
.login__form { width: 100%; margin-top: 36px; display: flex; flex-direction: column; gap: 16px; }

/* ---- fields ---- */
.field { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.field__label {
  display: block;
  font-size: 12px; line-height: 14px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--offwhite);
}
.field__optional { margin-left: 6px; letter-spacing: 0; text-transform: none; color: var(--offwhite-50); }
.field__hint { font-size: 13px; line-height: 18px; color: var(--offwhite-60); }
.field__hint:empty { display: none; }
.field__error { font-size: 13px; line-height: 18px; color: var(--err); }
.field__error:empty { display: none; }

.input, .select {
  display: block;
  width: 100%; min-height: 50px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--offwhite-50);
  border-radius: var(--radius);
  background: transparent;
  color: var(--offwhite);
  caret-color: var(--offwhite);
  font: 16px/24px var(--font-text);
  -webkit-appearance: none; appearance: none;
  outline: none;
}
.input:hover, .select:hover { border-color: var(--offwhite-80); }
.input:focus-visible, .select:focus-visible { border-color: var(--offwhite); box-shadow: 0 0 0 1px var(--offwhite); }
.input[aria-invalid="true"] { border-color: var(--err); }
.input::placeholder { color: var(--offwhite-40); opacity: 1; }
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--offwhite);
  -webkit-box-shadow: 0 0 0 1000px var(--deep-blue) inset;
  transition: background-color 600000s 0s;
}
.textarea { min-height: 50px; resize: vertical; }
.select { padding-right: 44px; cursor: pointer; }
.select option { color: var(--deep-blue); background: var(--offwhite); }
.select-wrap { position: relative; }
.chevron { position: absolute; top: 17px; right: 14px; width: 16px; height: 16px; color: var(--offwhite); pointer-events: none; }

/* Net sales: a minus sign in front of the field when the amount is negative. */
.amount { position: relative; }
.amount__sign {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--warn); pointer-events: none;
}
.amount__input--negative { padding-left: 30px; border-color: var(--warn); }

.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.check__box { width: 22px; height: 22px; margin: 0; accent-color: var(--offwhite); flex: none; }

/* Password: the field with a show / hide button inside its right edge. */
.password { position: relative; }
.input--password { padding-right: 52px; }
.password__toggle {
  position: absolute; top: 1px; right: 1px; bottom: 1px; width: 48px;
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0; border: 0; border-radius: 0 4px 4px 0;
  background: transparent; color: var(--offwhite-50); cursor: pointer;
}
.password__toggle svg { display: block; width: 18px; height: 18px; }
.password__toggle:hover, .password__toggle[aria-pressed="true"] { color: var(--offwhite); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: 400 14px/17px var(--font-display);
  letter-spacing: 0.08em; text-transform: uppercase;
  text-align: center; text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.btn--primary { background: var(--offwhite); color: var(--deep-blue); }
.btn--primary:hover { background: #ffffff; }
.btn--outline { background: transparent; color: var(--offwhite); border-color: var(--offwhite); }
.btn--outline:hover { background: var(--offwhite-06); }
.btn--block { width: 100%; }
.btn--small { min-height: 44px; padding: 0 16px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.75; }

.form-status { font-size: 14px; line-height: 20px; color: var(--offwhite); }
.form-status:empty { display: none; }
.form-status--ok { color: var(--ok); }
.form-status--warn { color: var(--warn); }
.form-status--err { color: var(--err); }

/* ---- the app's frame ---- */
.env-banner {
  position: sticky; top: 0; z-index: 20;
  padding: 10px var(--gutter);
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--warn); color: var(--deep-blue);
  font-size: 13px; line-height: 18px; font-weight: 700;
  letter-spacing: 0.04em; text-align: center;
}
.top { border-bottom: 1px solid var(--offwhite-12); }
.top__inner {
  max-width: 920px; margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.top__brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.top__names { border-left: 1px solid var(--offwhite-20); padding-left: 16px; }
.top__title { font-size: 16px; line-height: 20px; }
.top__unit { font-size: 12px; line-height: 16px; color: var(--offwhite-60); }
.top__right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top__clock { font-size: 13px; color: var(--offwhite-80); font-variant-numeric: tabular-nums; }
.env-tag {
  display: inline-block;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; line-height: 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.env-tag--test { background: var(--warn); color: var(--deep-blue); }
.env-tag--live { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }

.wrap { max-width: 920px; margin: 0 auto; padding: 8px var(--gutter) 24px; }
.loading { padding: 48px 0; text-align: center; color: var(--offwhite-60); }

.notice {
  margin-top: 16px; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid;
  font-size: 14px; line-height: 20px;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
}
.notice--warn { border-color: var(--warn); background: var(--warn-bg); color: var(--offwhite); }
.notice--err { border-color: var(--err); background: var(--err-bg); color: var(--offwhite); }
/* The month that is due at Emaar now (1st to 5th): text and its button side by side where there is room. */
.notice--due { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.notice--due p { flex: 1 1 320px; }
.card > .notice { margin-top: 14px; }

/* ---- yesterday ---- */
.hero {
  margin-top: 16px; padding: 22px;
  border: 1px solid var(--offwhite-20); border-radius: 8px;
  background: var(--surface-raised);
  display: flex; gap: 20px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap;
}
.hero__text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 320px; }
.hero__title { font-size: 26px; line-height: 32px; }
.hero__state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero__detail { font-size: 15px; color: var(--offwhite-80); }
.hero__deadline { font-size: 15px; color: var(--offwhite); font-variant-numeric: tabular-nums; }
.hero__deadline--late { color: var(--warn); }
.hero__aside { display: flex; flex-direction: column; gap: 10px; align-items: stretch; flex: 0 1 300px; }
.hero__backlog { font-size: 13px; line-height: 18px; color: var(--offwhite-60); }

/* ---- cards ---- */
.card {
  margin-top: 16px; padding: 22px;
  border: 1px solid var(--offwhite-12); border-radius: 8px;
  background: var(--surface);
}
.card--quiet { background: transparent; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.card__title { font-size: 18px; line-height: 22px; }
.card__meta { font-size: 13px; color: var(--offwhite-60); }
.card__hint { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--offwhite-80); }

.form { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: -6px; }
.form__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.form__actions .btn { flex: 1 1 200px; }

/* ---- status chips ---- */
.chip {
  display: inline-flex; align-items: center;
  min-height: 24px; padding: 2px 10px;
  border-radius: 999px; border: 1px solid;
  font-size: 12px; line-height: 16px; white-space: nowrap;
}
.chip--ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.chip--warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.chip--err { color: var(--err); border-color: var(--err); background: var(--err-bg); }
.chip--muted { color: var(--offwhite-80); border-color: var(--offwhite-40); }

/* ---- the answer from Emaar ---- */
.result {
  margin-top: 16px; padding: 22px;
  border-radius: 8px; border: 1px solid var(--offwhite-20); border-left-width: 4px;
  background: var(--surface-raised);
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  outline: none;
}
.result--ok { border-color: var(--ok); }
.result--warn { border-color: var(--warn); }
.result--err { border-color: var(--err); }
.result__title { font-size: 18px; line-height: 24px; }
.result__text { font-size: 15px; }
.result__emaar {
  margin: 0; padding: 12px 14px; width: 100%;
  border-radius: var(--radius); background: var(--err-bg);
  font: 14px/20px var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.result__help { font-size: 14px; line-height: 20px; color: var(--warn); }

/* ---- facts (label / value pairs) ---- */
.facts { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.facts__item { display: contents; }
.facts dt { color: var(--offwhite-60); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.facts--grid .facts__item { display: flex; flex-direction: column; gap: 2px; }
.facts--grid dt { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---- every day ---- */
.days { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--offwhite-12); }
.days__item { border-bottom: 1px solid var(--offwhite-12); }
.days__toggle { margin-top: 14px; }
.day {
  display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; margin: 0; padding: 10px 8px;
  border: 0; background: transparent; color: var(--offwhite);
  font: inherit; text-align: left; cursor: pointer;
}
.day:hover { background: var(--offwhite-06); }
.day--selected { background: var(--offwhite-12); }
.day__date, .day__fig { display: flex; flex-direction: column; min-width: 0; }
.day__d { font-variant-numeric: tabular-nums; }
.day__wd, .day__count { font-size: 12px; color: var(--offwhite-60); }
.day__net { font-variant-numeric: tabular-nums; }
.day__none { color: var(--offwhite-40); font-size: 14px; }
.day__status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.day__error { margin: -4px 8px 10px; font-size: 13px; line-height: 18px; color: var(--err); overflow-wrap: anywhere; }

/* ---- months ---- */
.months { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.month {
  padding: 18px; border-radius: 8px; border: 1px solid var(--offwhite-20);
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
.month__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.month__title { font-size: 16px; line-height: 20px; }
.month .facts { width: 100%; }
.month__ok { font-size: 14px; color: var(--ok); }
.month__warn, .month__note { font-size: 14px; line-height: 20px; color: var(--warn); }
.month__err { font-size: 14px; line-height: 20px; color: var(--err); overflow-wrap: anywhere; }

.rules { margin: 12px 0 0; padding-left: 20px; font-size: 14px; line-height: 21px; color: var(--offwhite-80); }
.rules li + li { margin-top: 6px; }

/* ---- footer ---- */
.foot {
  max-width: 920px; margin: 0 auto;
  padding: 8px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
}
.foot__meta { flex-basis: 100%; font-size: 12px; color: var(--offwhite-50); }
.signout {
  min-height: 44px; padding: 0 8px; border: 0; background: transparent;
  font: 12px/14px var(--font-text); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--offwhite-60); cursor: pointer;
}
.signout:hover { color: var(--offwhite); }

/* ---- the confirmation ---- */
.dialog {
  width: min(600px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 32px);
  margin: auto; padding: 0;
  border: 1px solid var(--offwhite-40); border-radius: 10px;
  background: var(--deep-blue); color: var(--offwhite);
  overflow: auto;
}
.dialog::backdrop { background: rgba(0, 4, 20, 0.75); }
.dialog--fallback { position: fixed; inset: 16px; z-index: 50; }
.dialog__body { padding: 24px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.dialog__body .env-tag { align-self: flex-start; }
.dialog__title { font-size: 20px; line-height: 26px; outline: none; }
.dialog__body .notice { margin-top: 0; }
.dialog__send { display: flex; flex-direction: column; gap: 16px; }
.dialog__endpoint { font: 13px/18px var(--font-mono); color: var(--offwhite-80); overflow-wrap: anywhere; margin-top: -8px; }
.dialog__small { font-size: 12px; line-height: 16px; color: var(--offwhite-50); margin-top: -8px; }
.dialog__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dialog__actions .btn { flex: 1 1 180px; }
.code {
  margin: 0; padding: 12px 14px;
  border-radius: var(--radius); background: var(--offwhite-06); border: 1px solid var(--offwhite-12);
  font: 13px/19px var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all;
}
.warnings { margin: 0; padding: 12px 14px 12px 32px; border-radius: var(--radius); background: var(--warn-bg); color: var(--offwhite); font-size: 14px; line-height: 20px; }
.warnings li + li { margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 60; padding: 12px 20px; border-radius: 999px;
  background: var(--offwhite); color: var(--deep-blue);
  font-size: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ---- narrow screens (phones) ---- */
@media (max-width: 640px) {
  .form__row { grid-template-columns: 1fr; }
  .hero, .card { padding: 18px 16px; }
  .hero__title { font-size: 22px; line-height: 28px; }
  .hero__aside { flex: 1 1 100%; }
  .day { grid-template-columns: 1fr auto; grid-template-areas: "date fig" "status status"; row-gap: 6px; }
  .day__date { grid-area: date; }
  .day__fig { grid-area: fig; align-items: flex-end; text-align: right; }
  .day__status { grid-area: status; justify-content: flex-start; }
  .facts--grid { grid-template-columns: 1fr 1fr; }
  .top__inner { padding: 14px var(--gutter); }
  .dialog__body { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .input:-webkit-autofill { transition: none; }
  html { scroll-behavior: auto; }
}
