/*
 * Mangrove skin: the default desktop design of OnePlace.
 *
 * An override layer applied on top of the compiled Tailwind bundle, without
 * touching a single page component. Nothing here changes navigation order,
 * labels or behaviour: it restyles what is already on screen, and hides the
 * blocks marked data-mg-hide (section 7c).
 *
 * Loaded by resources/views/app.blade.php for every browser except one that
 * chose the classic design (cookie ui_skin=classic, account menu
 * "Classic design" / "New design", App\Support\UiSkin), and only with
 * media="screen and (min-width: 1024px)": the phone design (below the lg
 * breakpoint) and printed pages never see a single rule of this file. Keep
 * it that way: no @media print blocks here.
 *
 * The palette is "Mangrove": neutrals tinted with the company's own
 * green-teal, magenta kept strictly as the brand mark and primary action,
 * status colours reserved for status.
 */

:root {
  --mg-ink: #0d1f1e;
  --mg-ink-2: #2e4745;
  --mg-muted: #5f7876;
  --mg-faint: #829896;
  --mg-ground: #f4f7f6;
  --mg-surface: #ffffff;
  --mg-sunk: #e9efed;
  --mg-line: #dce5e3;
  --mg-line-2: #c5d3d0;
  --mg-brand: #b5195f;
  --mg-brand-ink: #8d1049;
  --mg-brand-wash: #fdf2f7;
  --mg-ok: #067647;
  --mg-ok-wash: #ecfdf3;
  --mg-warn: #b54708;
  --mg-warn-wash: #fffaeb;
  --mg-bad: #b42318;
  --mg-bad-wash: #fef3f2;
  --mg-info: #175cd3;
  --mg-info-wash: #eff8ff;
  --mg-radius: 10px;
  --mg-shadow: 0 1px 2px rgba(13, 31, 30, .06), 0 1px 3px rgba(13, 31, 30, .04);
  --mg-font: "Geist", "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mg-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ==========================================================================
   0. TYPE SCALE: bigger text, and the layout follows it
   The app is built almost entirely from two sizes, text-sm (3124 uses) and
   text-xs (2025), with a long tail of 10-11px labels, so at the browser's
   default 16px root most of the screen sat at 12-14px: small enough to tire
   the eyes on a full working day.
   Raising the ROOT is what scales every rem-based value Tailwind emits,
   type and spacing together, so boxes grow with their text instead of
   cramming bigger words into the same padding. The bottom of the scale is
   then lifted further, so the small labels gain more than the headline
   numbers: that is where the strain actually was.
   ========================================================================== */
html { font-size: 17.5px; }
body { line-height: 1.55; }

/* text-xs is this app's label size; lift it clear of the 12px floor. */
.text-xs { font-size: .8125rem !important; line-height: 1.45 !important; }
.text-sm { line-height: 1.5 !important; }

/* Sizes written in px in the markup do NOT follow the root, so the smallest
   ones are raised by hand. Without this they would stay at 8-11px and end
   up relatively smaller than everything around them. */
.text-2xs,
[class*="text-[8px]"], [class*="text-[9px]"],
[class*="text-[10px]"], [class*="text-[11px]"], [class*="text-[11.5px]"] {
  font-size: .75rem !important;
  line-height: 1.45 !important;
}
[class*="text-[12.5px]"], [class*="text-[13px]"], [class*="text-[14.5px]"] {
  font-size: .82rem !important;
}

/* ---------- 1. Typography: Geist instead of Figtree/Inter ---------- */
html, body, button, input, select, textarea, .font-sans {
  font-family: var(--mg-font) !important;
  -webkit-font-smoothing: antialiased;
}
body { background: var(--mg-ground) !important; color: var(--mg-ink) !important; }

/* Money and quantities line up. This is the single biggest readability win in
   a ledger, and it is why the app felt "off" when comparing two totals. */
td, th, .tabular, [class*="text-right"] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

h1, h2, h3, h4, h5 { letter-spacing: -.02em; }

/* ---------- 2. Neutrals: cool greys become Mangrove greys ---------- */
.bg-white, .bg-gray-50\/50 { background-color: var(--mg-surface) !important; }
.bg-gray-50, .bg-slate-50, .bg-neutral-50, .bg-zinc-50 { background-color: var(--mg-ground) !important; }
.bg-gray-100, .bg-slate-100, .bg-neutral-100 { background-color: var(--mg-sunk) !important; }

.text-gray-900, .text-slate-900, .text-neutral-900,
.text-gray-800, .text-slate-800 { color: var(--mg-ink) !important; }
.text-gray-700, .text-slate-700, .text-gray-600, .text-slate-600 { color: var(--mg-ink-2) !important; }

/* text-slate-400 / gray-400 are used ~942 times and fail contrast on white.
   Darkening them to a real muted tone is an accessibility fix, not a taste one. */
.text-gray-500, .text-slate-500, .text-gray-400, .text-slate-400,
.text-neutral-400, .text-zinc-400 { color: var(--mg-muted) !important; }

.border-gray-100, .border-slate-100 { border-color: var(--mg-line) !important; }
.border-gray-200, .border-slate-200, .border-gray-300, .border-slate-300 { border-color: var(--mg-line) !important; }
.divide-gray-200 > :not([hidden]) ~ :not([hidden]),
.divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--mg-line) !important; }

/* ---------- 3. One card system instead of fourteen radii and ten shadows ---------- */
.rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl { border-radius: var(--mg-radius) !important; }
.shadow-sm, .shadow, .shadow-md, .shadow-lg { box-shadow: var(--mg-shadow) !important; }

/* ---------- 4. Tables: quieter headers, calmer rows ---------- */
thead th {
  font-size: .72rem !important;
  letter-spacing: .07em !important;
  text-transform: uppercase;
  color: var(--mg-faint) !important;
  font-weight: 600 !important;
  background: var(--mg-surface) !important;
  border-bottom: 1px solid var(--mg-line) !important;
}
tbody tr { border-color: var(--mg-line) !important; }
tbody tr:not([class*="bg-"]):hover { background: var(--mg-ground) !important; }

/* ---------- 5. Brand: magenta is the mark and the primary action, nothing else ---------- */
.bg-pink-600, .bg-pink-700, .bg-theme-600, .bg-theme-700,
.bg-fuchsia-600, .bg-rose-600 { background-color: var(--mg-brand) !important; }
.text-pink-600, .text-pink-700, .text-theme-600, .text-theme-700 { color: var(--mg-brand) !important; }
.border-pink-200, .border-pink-300, .border-theme-200 { border-color: var(--mg-line-2) !important; }

/* Decorative pink/red card borders stop shouting: red must mean danger only. */
.border-pink-100, .border-rose-100, .border-red-100 { border-color: var(--mg-line) !important; }

/* ---------- 6. Status colours mean status ---------- */
.text-green-600, .text-green-700, .text-emerald-600 { color: var(--mg-ok) !important; }
.bg-green-50, .bg-emerald-50 { background-color: var(--mg-ok-wash) !important; }
.text-amber-600, .text-amber-700, .text-yellow-700 { color: var(--mg-warn) !important; }
.bg-amber-50, .bg-yellow-50 { background-color: var(--mg-warn-wash) !important; }
.text-red-600, .text-red-700 { color: var(--mg-bad) !important; }
.bg-red-50 { background-color: var(--mg-bad-wash) !important; }
.text-blue-600, .text-blue-700 { color: var(--mg-info) !important; }
.bg-blue-50 { background-color: var(--mg-info-wash) !important; }

/* ---------- 7. Header: stop the taller face from wrapping the nav ---------- */
/* Geist is wider than Figtree at the same size, which pushed the logo and the
   Low Stock chip onto two lines. Keep every header control on one line and
   trim the nav a touch so the row fits again. */
nav a, nav button, nav span, header a, header button {
  white-space: nowrap !important;
}
/* The nav and the Quick Links rail read at the SAME size as the content.
   An earlier version kept them a step smaller so the row would fit, which
   just made the two menus look shrunken next to the page.
   A bare `nav { font-size }` does not reach them: .text-sm on each link
   beats an element selector, so the size is set on the links themselves. */
nav { font-size: .875rem; }
nav a, nav button, nav span,
nav .text-sm, nav .text-xs,
[class*="from-slate-700"][class*="to-slate-800"] a,
[class*="from-slate-700"][class*="to-slate-800"] span {
  font-size: .875rem !important;
}

/* At that size the padding, not the words, is what stops the row fitting.
   Measured at a 1024px window: the row wanted 1031px of a 1010px bar, so
   it wrapped over 21px. These values give it back about 28px, enough to
   stay on one line there, and it still wraps rather than clips on anything
   genuinely narrower. */
nav .px-3 { padding-left: .28rem !important; padding-right: .28rem !important; }
nav .gap-2 { gap: .28rem !important; }
nav .gap-1 { gap: .15rem !important; }
[class*="from-slate-700"][class*="to-slate-800"] .px-3 {
  padding-left: .45rem !important;
  padding-right: .45rem !important;
}

/* When a window still cannot hold a row, it WRAPS onto a second line.
   Not scrolling: a scroll container clips the account dropdown, which is
   absolutely positioned inside the nav row (Dropdown.jsx: `absolute z-50`),
   and an overflow value on one axis forces the other to compute to auto, so
   the menu was cut off and appeared not to open at all. Wrapping also keeps
   every link reachable instead of hiding some off the edge. */
nav > div > div {
  flex-wrap: wrap;
  height: auto;
  min-height: 3.5rem;
  row-gap: .25rem;
  align-content: center;
}
[class*="from-slate-700"][class*="to-slate-800"] > div > div {
  overflow-x: visible;
  flex-wrap: wrap;
  height: auto;
  min-height: 2.5rem;
  row-gap: .2rem;
  padding-block: .25rem;
}
[class*="from-slate-700"][class*="to-slate-800"] > div > div > * { flex: 0 1 auto; }
[class*="from-slate-700"][class*="to-slate-800"] > div > div > div { flex-wrap: wrap; row-gap: .2rem; }

/* The Quick Links row lives OUTSIDE <nav>, so the rule above never reached it
   and "Petty Cash", "Knowledge Base", "Pending Payments", "Assets Mng" and
   "Job Tracking" each broke onto two lines. These chrome controls are all
   short labels on a single flex row, so they should never wrap. */
a.flex.items-center, button.flex.items-center {
  white-space: nowrap !important;
}

/* NOTE, deliberately not restyled:
   The attention bars already carry bg-red-600 / amber in the app, and the
   "work done, not paid" strip is the company's most expensive problem, so it
   keeps its full-strength red. An earlier version of this file matched them
   with [class*="bg-red-5"] and friends, which was far too greedy: it bleached
   that strip AND the red Low Stock button into a pale wash, the opposite of
   what they are for. Blunt attribute selectors have no place here. */

/* ==========================================================================
   7b. THE LOUD PARTS
   The first version of this file only repainted the quiet surfaces, so the
   page looked unchanged: everything that actually dominates the screen is
   built from brand gradients and custom module tints, not from the grey
   utilities. These are those elements.
   ========================================================================== */

/* The magenta gradient slab across the KPI row. Magenta is the company's mark,
   not a wall to paint a whole strip with: it becomes a quiet card and the
   numbers inside become readable ink instead of white-on-magenta. */
[class*="from-theme"][class*="to-theme-dark"] {
  background-image: none !important;
  background-color: var(--mg-surface) !important;
  border: 1px solid var(--mg-line) !important;
  box-shadow: var(--mg-shadow) !important;
}
[class*="from-theme"][class*="to-theme-dark"],
[class*="from-theme"][class*="to-theme-dark"] * {
  color: var(--mg-ink) !important;
}
[class*="from-theme"][class*="to-theme-dark"] .opacity-75,
[class*="from-theme"][class*="to-theme-dark"] [class*="opacity-"] {
  color: var(--mg-muted) !important;
  opacity: 1 !important;
}

/* The Quick Links rail was a dark navy slab competing with the nav above it.
   It becomes a quiet shelf, and its slate-300 labels become real text. */
[class*="from-slate-700"][class*="to-slate-800"] {
  background-image: none !important;
  background-color: var(--mg-sunk) !important;
  border-bottom: 1px solid var(--mg-line) !important;
  box-shadow: none !important;
}
[class*="from-slate-700"] a,
[class*="from-slate-700"] span,
[class*="from-slate-700"] .text-slate-300 { color: var(--mg-ink-2) !important; }
[class*="from-slate-700"] a:hover { background-color: var(--mg-surface) !important; }

/* The rail is one non-wrapping row of eight links, and Geist is wider than
   Figtree, so at exactly the lg breakpoint (1024px, where the rail appears)
   it ran 53px past the viewport and scrolled the whole PAGE sideways.
   Measured: 888px unskinned, 995px skinned. Scroll the row inside its own
   bar instead, the same trick the KPI banner already uses, and keep the
   children at their natural width so they are not squashed instead. */
[class*="from-slate-700"][class*="to-slate-800"] > div > div {
  overflow-x: auto;
  scrollbar-width: none;
}
[class*="from-slate-700"][class*="to-slate-800"] > div > div::-webkit-scrollbar { display: none; }
[class*="from-slate-700"][class*="to-slate-800"] > div > div > * { flex: 0 0 auto; }

/* The staging banner is a marker, not a billboard. Only the banner (the
   sticky strip at the top, rendered only when APP_ENV is not production, so
   this rule matches nothing on production): the "Next 5 days" payment bar
   and its detail header are amber too and keep their colours. */
.bg-amber-500.sticky.top-0 {
  background-color: var(--mg-warn-wash) !important;
  color: var(--mg-warn) !important;
}

/* Four pastel module tiles in a row read as four unrelated things. One neutral
   surface, and let the numbers carry the meaning. */
[class*="bg-theme/5"], [class*="bg-finance/5"], [class*="bg-quotation/5"],
[class*="bg-client/5"], [class*="bg-sales/5"], [class*="bg-operation/5"],
[class*="bg-hr/5"], [class*="bg-inventory/5"] {
  background-color: var(--mg-sunk) !important;
}
[class*="border-theme/10"], [class*="border-finance/10"], [class*="border-quotation/10"],
[class*="border-client/10"], [class*="border-sales/10"], [class*="border-operation/10"],
[class*="border-hr/10"] { border-color: var(--mg-line) !important; }

/* Chart bars were pale brand pink, which said "brand" where it should say
   "data". A single deep teal reads as a measurement. */
[class*="bg-theme/40"], [class*="bg-theme/30"], [class*="bg-theme/20"] {
  background-color: #2e7d74 !important;
}

/* Decorative pink borders on neutral comparison cards: red and pink must mean
   something is wrong, and these cards are not wrong. */
.border-pink-100, .border-pink-200, .border-rose-100, .border-rose-200,
.border-theme\/10, [class*="border-theme/"] { border-color: var(--mg-line) !important; }

/* Module identity: the two collisions the audit found. AI was byte-identical
   to Operation's purple, Inventory to Finance's teal, so colour stopped
   telling you where you were. AI becomes graphite (it is infrastructure,
   not a line of business) and Inventory becomes green. */
.text-purple-600, .text-purple-700 { color: #475467 !important; }
.bg-purple-50 { background-color: var(--mg-sunk) !important; }
.text-teal-600, .text-teal-700 { color: #3f7e0e !important; }
.bg-teal-50 { background-color: #f2f8ec !important; }

/* ==========================================================================
   7c. REDUNDANCY: blocks that restate a number already on the same screen
   Each hidden block carries data-mg-hide="<why>" in the markup. In the
   classic design and on the phone the attribute does nothing (no rule
   targets it there, this file is not applied); under this skin the block
   is removed so every fact has one owner. Nothing is reordered or
   relabelled: what remains keeps its position. Verified per block in the
   staging preview (September 2026).
   ========================================================================== */
[data-mg-hide] { display: none !important; }

/* Tailwind's space-y-* puts the gap on every sibling after the first, and a
   display:none first child still counts as "the first", so the next visible
   block would keep a phantom top margin. Only the first-child case needs it:
   a hidden block in the middle still separates its two visible neighbours. */
[class*="space-y"] > [data-mg-hide]:first-child + * { margin-top: 0 !important; }

/* ---------- 8. Interaction: focus you can actually see ---------- */
:focus-visible {
  outline: 2px solid var(--mg-brand) !important;
  outline-offset: 2px !important;
}
button, a, [role="button"] { transition: background-color .18s ease, color .18s ease, border-color .18s ease; }
