/* FinanceNMT – dark grey surface, white text, dark purple accents */
:root {
  --bg: #1f2124;
  --bg-soft: #26282c;
  --card: #2a2d31;
  --card-2: #31343a;
  --line: #3a3e45;
  --text: #ffffff;
  --muted: #a9adb6;
  --purple: #4c1d95;
  --purple-500: #6d28d9;
  --purple-300: #a78bfa;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
/* Plain text stays selectable/copyable on every device (explicit for Android
   WebViews); only controls are not. */
html, body, p, span, td, th, li, h1, h2, h3, div { -webkit-user-select: text; user-select: text; }
button, .btn, a, [role="button"], summary { -webkit-user-select: none; user-select: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.card-2 { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--purple); color: #fff; border: none; border-radius: 12px;
  padding: .75rem 1rem; font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
/* Every button and title in Title Case (report 0f89ccf0). Labels, table
   headers and stat keys are already upper-case. */
.btn, button, h1, h2, h3, h4, .chip, .nav-grid a, summary { text-transform: capitalize; }
.btn:hover { background: var(--purple-500); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--card-2); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .45rem .7rem; font-size: .8rem; border-radius: 10px; }

.input, .select, .textarea {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .85rem; font-size: 1rem; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--purple-300); }
.input::placeholder, .textarea::placeholder { color: #767b85; }
/* Finalize/confirm screens (report b4f77cd2): the quantity a worker must check
   and may change stands out in amber; the fixed one reads as plain text. */
.line-item .input:disabled { background: transparent; border-style: dashed; color: var(--muted); }
.line-item .input[data-line] { border: 2px solid #f59e0b; background: rgba(245, 158, 11, .10); color: #fcd34d; font-weight: 700; }
.line-item .input[data-line]:focus { border-color: #fcd34d; }
.label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.chip-purple { background: rgba(109, 40, 217, .22); color: var(--purple-300); }
.chip-red { background: rgba(185, 28, 28, .22); color: #fca5a5; }
.chip-green { background: rgba(21, 128, 61, .22); color: #86efac; }
.chip-amber { background: rgba(180, 83, 9, .22); color: #fcd34d; }
.chip-grey { background: rgba(255, 255, 255, .08); color: var(--muted); }

.money { font-variant-numeric: tabular-nums; }
.pos { color: #86efac; }
.neg { color: #fca5a5; }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .6rem; border-bottom: 1px solid rgba(58,62,69,.6); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* report 7857fe86: long tables show their first rows until "Show all" is tapped */
table.data:not(.show-all) tr.fold-row { display: none !important; }
table.data tr.fold-toggle td { text-align: center; }
.fold-group > summary .chip { vertical-align: middle; }
/* report 149cdef5: a page introduction shows one line until More info is tapped */
.page-intro .intro-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; line-clamp: 1; overflow: hidden; }
.page-intro.open .intro-text { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
.page-intro .intro-text br { display: none; }
.page-intro.open .intro-text br { display: inline; }
/* report 5753f803: wide tables become one short card per row on phones */
@media (max-width: 640px) {
  table.data.as-cards thead { display: none; }
  table.data.as-cards, table.data.as-cards tbody { display: block; }
  table.data.as-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .75rem; padding: .6rem .7rem; border-bottom: 1px solid rgba(58,62,69,.6); }
  table.data.as-cards tr:last-child { border-bottom: none; }
  table.data.as-cards td { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .12rem 0; border: none; text-align: right; }
  table.data.as-cards td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; text-align: left; flex-shrink: 0; }
  table.data.as-cards td[data-label=""]::before { content: none; }
  table.data.as-cards td[data-label=""] { justify-content: flex-end; }
  table.data.as-cards td.card-title { grid-column: 1; grid-row: 1; display: block; text-align: left; font-weight: 700; padding-bottom: .3rem; }
  table.data.as-cards td.card-title::before { content: none; }
  table.data.as-cards td.card-key { grid-column: 2; grid-row: 1; display: block; font-weight: 700; padding-bottom: .3rem; }
  table.data.as-cards td.card-key::before { display: block; font-weight: 400; font-size: .65rem; text-align: right; }
}

.view-enter { animation: fade .18s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(1rem + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 120; pointer-events: none; padding: 0 1rem; }
.toast { pointer-events: auto; max-width: 32rem; width: 100%; background: var(--card-2); border: 1px solid var(--line); border-left: 4px solid var(--purple-500); border-radius: 12px; padding: .75rem .9rem; font-size: .875rem; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: fade .18s ease both; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 30rem; max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; animation: fade .18s ease both; }
/* report d8a68bd1: a message from the leaders fills the whole screen */
.message-full { padding: 0; z-index: 110; }
.message-full .modal { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; padding: 2rem 1.25rem; display: flex; flex-direction: column; justify-content: center; }
.message-full .modal > * { width: 100%; max-width: 40rem; margin-left: auto; margin-right: auto; }

.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.line-item { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; background: var(--bg-soft); }

.nav-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 640px) { .nav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nav-grid.hidden { display: none; } /* report 14446f95: folded menu section */

.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .85rem; }
.stat .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 1.35rem; font-weight: 800; margin-top: .2rem; font-variant-numeric: tabular-nums; }

/* Personal settings (report 7066b742): colour theme and background per user,
   set as data-theme / data-bg on <html> by App.applySettings. */
html[data-theme="blue"]   { --purple: #1e3a8a; --purple-500: #2563eb; --purple-300: #93c5fd; }
html[data-theme="green"]  { --purple: #14532d; --purple-500: #16a34a; --purple-300: #86efac; }
html[data-theme="red"]    { --purple: #7f1d1d; --purple-500: #dc2626; --purple-300: #fca5a5; }
html[data-theme="orange"] { --purple: #7c2d12; --purple-500: #ea580c; --purple-300: #fdba74; }
html[data-theme="pink"]   { --purple: #831843; --purple-500: #db2777; --purple-300: #f9a8d4; }
html[data-bg="black"]  { --bg: #000000; --bg-soft: #0a0a0a; --card: #141414; --card-2: #1c1c1c; --line: #2a2a2a; }
html[data-bg="navy"]   { --bg: #0f172a; --bg-soft: #131c33; --card: #1e293b; --card-2: #26334a; --line: #334155; }
html[data-bg="plum"]   { --bg: #1a1025; --bg-soft: #21152e; --card: #2a1d3a; --card-2: #332545; --line: #43335a; }
html[data-bg="forest"] { --bg: #0f1a14; --bg-soft: #13211a; --card: #1b2b22; --card-2: #22352a; --line: #2f4639; }
.chip-purple { background: color-mix(in srgb, var(--purple-500) 22%, transparent); }
.swatch { height: 2.5rem; border-radius: 10px; border: 2px solid var(--line); cursor: pointer; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--purple-300); }

/* Screenshot protection: while the app is in the background or loses focus the
   screen is covered (recent-apps thumbnails, screen grabbers); printing is off. */
#privacy-shield { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--bg); }
html.noshot.shielded #privacy-shield { display: grid; place-items: center; }
@media print { html.noshot body { display: none !important; } }
/* Report 47272bf3: a printed page (Crypto Summary) leaves out the header and the buttons. */
@media print { header, .no-print { display: none !important; } }

/* Report 9536bb02: the main tasks of a role stand out on the home screen. */
.card.menu-main {
  background: linear-gradient(135deg, var(--purple), var(--purple-500));
  border-color: var(--purple-300);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.card.menu-main svg { color: #fff; }

/* Report dd2bdee4: the Starting Point part of a payslip in its own colour (teal),
   so a worker tells it apart from the app figures at a glance. */
.slip-starting { background: rgba(45, 212, 191, .08); border: 1px solid rgba(45, 212, 191, .45); }
.slip-starting-title, .slip-starting-line, .slip-starting-line .money { color: #5eead4; }

/* Reports 70117de1, 7f911d5a, 1a201f1e, 6f0d7731: inside a tab of a grouped FINANCE page
   the tab button already names the page, so its own title is not repeated. */
.fin-tab-body > .view-enter > .mb-4:first-child > h2 { display: none; }

/* Reports 7d67f66e / df11fe9c: the extra weight for a bad batch glows, so it is not missed. */
.bad-glow { color: #fcd34d; font-weight: 600; text-shadow: 0 0 6px rgba(252, 211, 77, .65); animation: bad-glow 1.6s ease-in-out infinite; }
@keyframes bad-glow { 50% { text-shadow: 0 0 14px rgba(252, 211, 77, 1), 0 0 2px rgba(252, 211, 77, .9); } }
