/* Chappa Facturare — shared foundation for the public site, the app, the
   portal and the small standalone pages.

   Palette named after the material it stands for:
     desk   — the surface documents lie on
     paper  — documents, and anything that is one
     ink    — text
     tuș    — stamp and pen ink: actions, links, focus
     brand  — Chappa red, for the mark only
   Motion: transform and opacity only; durations and curves below. */

@font-face {
  font-family: "Facturare Sans";
  src: url(/assets/fonts/facturare-sans.woff2?v=641b7eff61) format("woff2");
  font-weight: 350 700;
  font-stretch: 85% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Facturare Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --desk: #eceeea;
  --desk-2: #e3e6e1;
  --paper: #ffffff;
  --paper-2: #f5f6f4;
  --rule: #d8dcd5;
  --rule-2: #c2c8c0;
  --ink: #141716;
  --ink-2: #48504b;
  --ink-3: #616964;
  --brand: #ca2c2c;
  --tus: #2340a0;
  --tus-2: #1a3283;
  --tus-wash: #e6ebf8;
  --on-tus: #ffffff;
  --ok: #1d6b44;
  --ok-wash: #e1efe6;
  --warn: #855000;
  --warn-wash: #f7ebd5;
  --bad: #b3261e;
  --bad-wash: #f9e5e2;
  --shadow-paper: 0 1px 0 rgb(20 23 22 / .05), 0 12px 32px -20px rgb(20 23 22 / .45);
  --shadow-lift: 0 2px 4px rgb(20 23 22 / .06), 0 18px 40px -16px rgb(20 23 22 / .35);

  --r-1: 3px;
  --r-2: 6px;
  --r-3: 10px;
  /* Set by an integrator's look (js/look.js): buttons and fields' corners
     (--r-ctl, else --r-2) and a spacing factor (--dens, else 1). */

  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.5, 0, .75, 0);
  /* damped spring, ~3% overshoot */
  --spring: linear(0, .1711, .4726, .7317, .9006, .9886, 1.0228, 1.0281, 1.0218, 1.0132, 1.0064, 1.0021, 1, .9993, .9992, .9994, .9997, .9999, 1);
  /* livelier, ~12% overshoot — the stamp */
  --spring-2: linear(0, .1632, .4869, .7948, 1.0052, 1.1066, 1.1252, 1.0978, 1.0559, 1.0191, .9955, .9853, .9846, .9887, .994, .9984, 1.001, 1.002, 1.0016, 1.0009, 1);
  --t-1: 110ms;
  --t-2: 180ms;
  --t-3: 280ms;
  --t-4: 460ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --desk: #0f1211;
    --desk-2: #151917;
    --paper: #1a1f1c;
    --paper-2: #212723;
    --rule: #2e3531;
    --rule-2: #414a45;
    --ink: #e8ebe8;
    --ink-2: #b0b8b3;
    --ink-3: #8e9792;
    --brand: #e5484d;
    --tus: #94abff;
    --tus-2: #b3c3ff;
    --tus-wash: #1d2747;
    --on-tus: #0c1330;
    --ok: #74d39c;
    --ok-wash: #142a1e;
    --warn: #eab14f;
    --warn-wash: #2d2410;
    --bad: #ff8d82;
    --bad-wash: #36191a;
    --shadow-paper: 0 1px 0 rgb(0 0 0 / .4), 0 14px 36px -20px rgb(0 0 0 / .9);
    --shadow-lift: 0 2px 6px rgb(0 0 0 / .4), 0 20px 44px -16px rgb(0 0 0 / .9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --desk: #0f1211;
  --desk-2: #151917;
  --paper: #1a1f1c;
  --paper-2: #212723;
  --rule: #2e3531;
  --rule-2: #414a45;
  --ink: #e8ebe8;
  --ink-2: #b0b8b3;
  --ink-3: #8e9792;
  --brand: #e5484d;
  --tus: #94abff;
  --tus-2: #b3c3ff;
  --tus-wash: #1d2747;
  --on-tus: #0c1330;
  --ok: #74d39c;
  --ok-wash: #142a1e;
  --warn: #eab14f;
  --warn-wash: #2d2410;
  --bad: #ff8d82;
  --bad-wash: #36191a;
  --shadow-paper: 0 1px 0 rgb(0 0 0 / .4), 0 14px 36px -20px rgb(0 0 0 / .9);
  --shadow-lift: 0 2px 6px rgb(0 0 0 / .4), 0 20px 44px -16px rgb(0 0 0 / .9);
}

/* ─── Reset and type ────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
/* `hidden` always wins over a component's display (show()/hide() rely on it). */
[hidden] { display: none !important; }

html {
  font-family: var(--font);
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-kerning: normal;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  text-wrap: balance;
}

p, li, dd { text-wrap: pretty; }
p { margin: 0 0 1em; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
table { border-collapse: collapse; width: 100%; }
b, strong { font-weight: 600; }

a {
  color: var(--tus);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color var(--t-1);
}
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--tus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

::selection { background: var(--tus-wash); color: var(--ink); }

code, kbd, samp, pre, .code {
  font-family: var(--mono);
  font-size: .9em;
  font-variant-numeric: normal;
}

.skip {
  position: absolute;
  left: .75rem;
  top: -3rem;
  z-index: 100;
  padding: .5rem .8rem;
  background: var(--tus);
  color: var(--on-tus);
  border-radius: var(--r-2);
  text-decoration: none;
  transition: transform var(--t-2) var(--ease-out);
}
.skip:focus { transform: translateY(3.75rem); }

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

/* ─── Mark ─────────────────────────────────────────────────────────────── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  line-height: 1;
  white-space: nowrap;
}
.logo { display: block; height: 2.05rem; width: auto; flex: none; }
.logo path { fill-rule: evenodd; }
.logo .r { fill: #ca2c2c; }
.logo .w { fill: currentColor; }
.brand-product { font-weight: 400; color: var(--ink-2); }

/* ─── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  min-height: calc(2.5rem * (1 + (var(--dens, 1) - 1) / 2));
  padding: 0 1rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-ctl, var(--r-2));
  background: var(--paper);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 550;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-1), border-color var(--t-1), color var(--t-1), transform var(--t-1) var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
.btn:active:not([disabled]) { transform: translateY(1px) scale(.985); }
.btn.primary { background: var(--tus); border-color: var(--tus); color: var(--on-tus); }
.btn.primary:hover { background: var(--tus-2); border-color: var(--tus-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--paper); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--desk-2); color: var(--ink); }
.btn.sm { min-height: calc(2rem * (1 + (var(--dens, 1) - 1) / 2)); padding: 0 .7rem; font-size: .875rem; }
.btn.xs { min-height: 1.75rem; padding: 0 .55rem; font-size: .8125rem; font-weight: 500; }
.btn.lg { min-height: 3rem; padding: 0 1.35rem; font-size: 1.0625rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--tus);
  font-weight: 550;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: .18em;
}

.link-strong {
  font-weight: 600;
  text-decoration-thickness: 1.5px;
}

.btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1rem;
  height: 1rem;
  margin: -.5rem 0 0 -.5rem;
  border: 2px solid currentColor;
  border-color: var(--ink-3) var(--ink-3) transparent transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.primary[aria-busy="true"]::after { border-color: var(--on-tus) var(--on-tus) transparent transparent; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ─── Fields ───────────────────────────────────────────────────────────── */

input[type="text"], input[type="email"], input[type="search"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="password"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%;
  min-height: calc(2.5rem * (1 + (var(--dens, 1) - 1) / 2));
  padding: .45rem .7rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-ctl, var(--r-2));
  background: var(--paper);
  color: var(--ink);
  font-size: .9375rem;
  line-height: 1.35;
  transition: border-color var(--t-1), box-shadow var(--t-2);
}
textarea { resize: vertical; min-height: 4.5rem; border-radius: min(var(--r-ctl, var(--r-2)), 12px); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--tus);
  box-shadow: 0 0 0 3px var(--tus-wash);
}
input[readonly] { background: var(--paper-2); }
input[disabled], select[disabled], textarea[disabled] { background: var(--paper-2); color: var(--ink-3); cursor: not-allowed; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--tus); width: 1.05rem; height: 1.05rem; margin: 0; flex: none; }
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
::placeholder { color: var(--ink-3); opacity: .85; }

/* ─── Tags (state labels) ──────────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .12rem .5rem .14rem;
  border-radius: var(--r-1);
  background: var(--desk-2);
  color: var(--ink-2);
  font-size: .8125rem;
  font-weight: 550;
  line-height: 1.35;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex: none;
}
.tag.info { background: var(--tus-wash); color: var(--tus); }
.tag.info::before { background: currentColor; border-radius: 1px; transform: rotate(45deg) scale(.85); }
.tag.ok { background: var(--ok-wash); color: var(--ok); }
.tag.ok::before { background: currentColor; }
.tag.warn { background: var(--warn-wash); color: var(--warn); }
.tag.warn::before { border-radius: 1px; }
.tag.bad { background: var(--bad-wash); color: var(--bad); }
.tag.bad::before { background: currentColor; border-radius: 1px; }
.tag.plain::before { display: none; }
