/* ==========================================================================
   L&T Finance Employee Gifting Portal — Design System
   One token file drives every screen. Rebranding = editing :root below.

   Brand colours are the official Larsen & Toubro corporate identity that
   L&T Finance inherits from its parent brand:

     L&T Blue  #003DA5   rgb(0, 61, 165)     symbol + wordmark
     L&T Gold  #FFC72C   rgb(255, 199, 44)   symbol background

   Contrast, measured (WCAG 2.1):
     white on #003DA5 ........ 9.5:1   AAA  → primary buttons, brand panels
     #003DA5 on white ........ 9.5:1   AAA  → headings, links
     #003DA5 on #FFC72C ...... 6.1:1   AA   → gold CTA text, gold cards
     white on #FFC72C ........ 1.6:1   FAIL → never used, anywhere
   ========================================================================== */

:root {
  /* --- Brand: official L&T identity ------------------------------------- */
  --brand-blue: #003DA5;         /* the brand. Primary actions, headings.   */
  --brand-gold: #FFC72C;         /* the accent. Never a background for text
                                    lighter than --brand-blue.              */

  /* Blue scale, all derived from #003DA5 so hovers stay on-brand. */
  --blue-600: #1454BE;           /* lift / hover on dark surfaces           */
  --blue-700: #003DA5;           /* = brand. Buttons, active nav, headings  */
  --blue-800: #00317F;           /* button hover                            */
  --blue-900: #002461;           /* button pressed, deep surfaces           */
  --blue-950: #001B47;           /* sidebar + brand panel base              */
  --blue-soft: #EDF3FC;          /* tinted surface                          */
  --blue-soft-border: #C7D9F5;

  /* Gold scale. Gold is an accent: rules, seals, checks, one CTA. */
  --gold-400: #FFD75E;           /* hover lift                              */
  --gold-500: #FFC72C;           /* = brand                                 */
  --gold-600: #E8AC00;           /* gold button hover                       */
  --gold-soft: #FFF7E0;          /* tinted surface                          */
  --gold-soft-border: #F4DFA2;

  /* Ink that sits *on* gold or on the blue panels. */
  --on-gold: #002461;
  --on-gold-soft: rgba(0, 36, 97, .74);
  --on-blue: #FFFFFF;
  --on-blue-soft: rgba(255, 255, 255, .78);
  --on-blue-faint: rgba(255, 255, 255, .55);

  /* --- Legacy aliases ---------------------------------------------------
     Every stylesheet in the project was written against these names. They now
     resolve to the official palette, so the rebrand is genuinely one file. */
  --brand-yellow: var(--gold-500);
  --brand-yellow-dark: var(--gold-600);
  --brand-yellow-soft: var(--gold-soft);
  --brand-blue-soft: var(--blue-soft);
  --navy-900: var(--blue-700);
  --navy-800: var(--blue-800);
  --navy-700: var(--blue-900);

  /* --- Neutrals — very slightly blue-tinted so they sit under the brand -- */
  --ink: #16223A;
  --muted: #566379;
  --muted-light: #8391A6;
  --surface: #FFFFFF;
  --surface-alt: #F5F7FB;
  --surface-sunken: #EDF1F7;
  --border: #E1E7F0;
  --border-strong: #C6D0E0;

  /* --- Semantic (status badges + flashes only) --------------------------- */
  --ok: #0F7A52;
  --ok-soft: #E6F5EE;
  --warn: #9A6400;
  --warn-soft: #FFF4DF;
  --danger: #C0392B;
  --danger-soft: #FDEDEB;
  --info: #00317F;
  --info-soft: var(--blue-soft);

  /* --- Shape ------------------------------------------------------------- */
  --radius-card: 12px;
  --radius-ctl: 10px;
  --radius-sm: 6px;
  --radius-pill: 999px;

  /* Shadows carry a blue tint rather than grey — keeps the UI from looking
     dusty against the brand blue. */
  --shadow-sm: 0 1px 2px rgba(0, 36, 97, .06);
  --shadow-md: 0 4px 14px rgba(0, 36, 97, .09);
  --shadow-lg: 0 14px 34px rgba(0, 36, 97, .13);
  --shadow-brand: 0 6px 18px rgba(0, 61, 165, .22);

  --scrim: rgba(0, 27, 71, .55);

  /* --- 8px spacing scale ------------------------------------------------ */
  --sp-05: 4px;
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-7: 56px;
  --sp-8: 64px;
  --sp-10: 80px;

  /* --- Type ------------------------------------------------------------- */
  /* System stack only — no webfont request. This ships to ~40,000 people on
     a burst, and a blocking font is the one asset that can make every screen
     render late. Segoe UI / SF / Roboto are close enough to Inter. */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-display: 34px;
  --fs-h1: 28px;
  --fs-h2: 21px;
  --fs-h3: 17px;
  --fs-body: 15px;
  --fs-sm: 13.5px;
  --fs-xs: 12px;

  --header-h: 68px;
  --sidebar-w: 252px;

  --focus: var(--brand-blue);
  --transition: .16s cubic-bezier(.4, 0, .2, 1);
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure { margin: 0; }
img { max-width: 100%; display: block; }
a { color: var(--blue-900); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  color: var(--brand-blue);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

/* Focus ring is brand blue on light surfaces — gold on white is 1.6:1 and
   effectively invisible. Dark panels flip it to gold (see --focus override). */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Any dark brand surface re-points the ring to gold, which reads ~6:1 there. */
.sidebar,
.register__brand,
.auth-brand,
.kpi--capacity { --focus: var(--brand-gold); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-blue);
  color: #fff;
  padding: var(--sp-1) var(--sp-2);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  z-index: 999;
}
.skip-link:focus { left: 0; top: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Honour the OS "reduce motion" setting — this portal has no animation that
   carries meaning, so all of it can go. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--sp-3);
}
.container--wide { max-width: 1400px; }
@media (max-width: 640px) { .container { padding: 0 var(--sp-2); } }

.stack > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-3); }

.muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: 48px;
  padding: 0 var(--sp-3);
  border: 1px solid transparent;
  border-radius: var(--radius-ctl);
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
/* A 1px press is the whole feedback story — no scaling, no bounce. */
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { background: var(--blue-800); box-shadow: var(--shadow-brand); }
.btn--primary:active { background: var(--blue-900); box-shadow: var(--shadow-sm); }

/* Gold variant, reserved for the single highest-intent action on a screen
   (Place Order). Blue text on gold is 6.1:1 — white would be 1.6:1. */
.btn--accent {
  background: var(--brand-gold);
  color: var(--blue-900);
  box-shadow: var(--shadow-sm);
}
.btn--accent:hover { background: var(--gold-600); box-shadow: 0 6px 18px rgba(232, 172, 0, .3); }
.btn--accent:active { background: var(--gold-600); box-shadow: var(--shadow-sm); }

.btn--secondary {
  background: var(--surface);
  color: var(--brand-blue);
  border-color: var(--border-strong);
}
.btn--secondary:hover {
  background: var(--blue-soft);
  border-color: var(--blue-soft-border);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  min-height: 40px;
  padding: 0 var(--sp-2);
}
.btn--ghost:hover { background: var(--surface-alt); color: var(--brand-blue); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #a53125; }

.btn--sm { min-height: 36px; padding: 0 var(--sp-2); font-size: var(--fs-sm); }
.btn--block { width: 100%; }

.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--surface-sunken);
  color: var(--muted-light);
  border-color: var(--border);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: var(--sp-3); }
.card__header {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.card__header h2, .card__header h3 { font-size: var(--fs-h3); }
.card__footer {
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: var(--sp-3); }

.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--blue-900);
  margin-bottom: var(--sp-1);
}
.field__label .req { color: var(--danger); margin-left: 2px; }

.field__control {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  /* 16px minimum stops iOS Safari zooming the viewport on focus. */
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-ctl);
  transition: border-color var(--transition), box-shadow var(--transition),
              background-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.field__control::placeholder { color: var(--muted-light); }

.field__control:hover { border-color: var(--muted-light); }
.field__control:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 61, 165, .16);
  background: var(--surface);
}

textarea.field__control { min-height: 96px; resize: vertical; line-height: 1.5; }

select.field__control {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23566379' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.field__hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: 6px;
  font-weight: 500;
}
.field__error svg { flex: none; margin-top: 2px; }

.field--error .field__control { border-color: var(--danger); background: #FFFCFC; }
.field--error .field__control:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, .14); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--sp-2);
}
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* Input with a trailing control inside it (password reveal). The button is
   absolutely placed so the input keeps its full clickable width. */
.input-wrap { position: relative; }
.input-wrap .field__control { padding-right: 48px; }
.input-affix {
  position: absolute;
  top: 0; right: 0;
  width: 46px;
  height: 48px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-ctl);
}
.input-affix:hover { color: var(--brand-blue); }

/* Checkbox */
.check {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.check input {
  width: 18px; height: 18px;
  flex: none;
  accent-color: var(--brand-blue);
  cursor: pointer;
}

/* ==========================================================================
   Status badges — the only place semantic colour appears
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge--placed      { background: var(--surface-sunken);  color: var(--blue-900); }
.badge--processing  { background: var(--warn-soft);       color: var(--warn); }
.badge--dispatched  { background: var(--gold-soft);       color: #8A5A00; }
.badge--transit     { background: var(--blue-soft);       color: var(--info); }
.badge--delivered   { background: var(--ok-soft);         color: var(--ok); }
.badge--cancelled,
.badge--failed,
.badge--returned    { background: var(--danger-soft);     color: var(--danger); }
.badge--yes         { background: var(--ok-soft);         color: var(--ok); }
.badge--no          { background: var(--surface-sunken);  color: var(--muted); }

/* Small inline colourway dot. Shared by the employee summary/order pages and
   the admin orders table, so it lives here rather than in either stylesheet. */
.swatch-dot {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--sw, #ccc);
  border: 1px solid rgba(0, 36, 97, .18);
  vertical-align: -1px;
  margin-right: 5px;
  flex: none;
}

/* ==========================================================================
   Flash messages
   ========================================================================== */

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-1);
  padding: 12px var(--sp-2);
  border-radius: var(--radius-ctl);
  border: 1px solid;
  border-left-width: 4px;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-2);
}
.flash svg { flex: none; margin-top: 2px; }
.flash--success { background: var(--ok-soft);     border-color: #BFE5D5; color: #0A5F41; }
.flash--error   { background: var(--danger-soft); border-color: #F3C9C4; color: #96271C; }
.flash--warning { background: var(--warn-soft);   border-color: var(--gold-soft-border); color: #7A5000; }
.flash--info    { background: var(--blue-soft);   border-color: var(--blue-soft-border); color: var(--blue-800); }

/* ==========================================================================
   Brand marks
   ========================================================================== */

/* Clear space around the logo is enforced with padding rather than margins so
   it holds inside flex/grid parents. */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.brand-lockup__logo { height: 36px; width: auto; }
.brand-lockup__divider { width: 1px; height: 26px; background: var(--border); }
.brand-lockup__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-blue);
  letter-spacing: .01em;
  line-height: 1.2;
}
.brand-lockup--onDark .brand-lockup__label { color: var(--on-blue-soft); }
.brand-lockup--onDark .brand-lockup__divider { background: rgba(255,255,255,.24); }
.brand-lockup--lg .brand-lockup__logo { height: 48px; }

/* The signature brand cue: a gold rule under a header. */
.brand-rule { height: 3px; background: var(--brand-gold); }

/* Eyebrow / section kicker, used on both sides of the product. */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
  a[href]::after { content: ""; }
}
