/* Ramonik theme 2 — white paper, soft mist pastels, one dark panel, black capsule navigation.
   Scoped to body.t2 so pages move to it one by one. Every colour, font, radius, space and duration is a token.
   Animations: html[data-anim] = full | light (no drifting mist / orbit) | off (none); prefers-reduced-motion = off. */

@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  /* colour */
  --t-paper: #ffffff; --t-soft: #f5f5f7; --t-ink: #0a0a0b; --t-muted: #6b6b72; --t-hair: rgba(10, 10, 11, .09);
  --t-nav: #0a0a0b; --t-nav-edge: transparent;
  --t-panel: #161617; --t-panel-ink: #f4f4f5; --t-panel-muted: #a1a1a8; --t-panel-hair: rgba(255, 255, 255, .1);
  --p-lilac: #ebe5ff; --p-lilac-ink: #4a3b8c; --p-pink: #fde5ee; --p-pink-ink: #8a2f55;
  --p-peach: #ffe8d9; --p-peach-ink: #8a4317; --p-mint: #dcf4e8; --p-mint-ink: #1d6146;
  --p-blue: #e1ebff; --p-blue-ink: #24468a;
  --t-focus: color-mix(in srgb, var(--brand, #6d5bd0) 55%, transparent);
  --mist: radial-gradient(40% 60% at 20% 30%, #e6dcff 0, transparent 70%), radial-gradient(35% 55% at 78% 22%, #ffdfe9 0, transparent 70%),
          radial-gradient(40% 60% at 70% 85%, #ffe6d3 0, transparent 70%), radial-gradient(30% 45% at 30% 90%, #d9f3e6 0, transparent 70%);
  /* type */
  --f-sans: "Vazirmatn", "Inter", system-ui, "Segoe UI", sans-serif;
  --fs-body: .875rem; --fs-small: .78rem; --fs-l: 1.375rem; --fs-xl: clamp(2.25rem, 1.4rem + 4vw, 4.25rem);
  --track-tight: -.035em;
  /* shape + space (8px grid) */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px;
  --r-s: 12px; --r-m: 20px; --r-l: 32px; --r-pill: 999px; --h-control: 44px;
  --lift: 0 2px 6px rgba(10, 10, 11, .05), 0 16px 32px -12px rgba(10, 10, 11, .14);
  /* motion */
  --e-out: cubic-bezier(.2, .8, .2, 1); --d-1: 200ms; --d-2: 320ms; --d-3: 500ms; --d-stagger: 60ms; --d-mist: 48s; --d-orbit: 90s;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --t-paper: #0d0d0f; --t-soft: #17171a; --t-ink: #f3f3f5; --t-muted: #9d9da6; --t-hair: rgba(255, 255, 255, .1);
    --t-nav: #1f1f23; --t-nav-edge: rgba(255, 255, 255, .14);
    --t-panel: #f3f3f5; --t-panel-ink: #111113; --t-panel-muted: #5f5f66; --t-panel-hair: rgba(10, 10, 11, .1);
    --p-lilac: #241f3a; --p-lilac-ink: #cbbfff; --p-pink: #34202a; --p-pink-ink: #ffb8d2;
    --p-peach: #35251b; --p-peach-ink: #ffc59d; --p-mint: #172f26; --p-mint-ink: #9fe6c4;
    --p-blue: #1a2539; --p-blue-ink: #b1c9ff;
    --mist: radial-gradient(40% 60% at 20% 30%, #2c2350 0, transparent 70%), radial-gradient(35% 55% at 78% 22%, #3d1f2e 0, transparent 70%),
            radial-gradient(40% 60% at 70% 85%, #3a2617 0, transparent 70%), radial-gradient(30% 45% at 30% 90%, #15362a 0, transparent 70%);
    --lift: 0 2px 6px rgba(0, 0, 0, .4), 0 16px 32px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --t-paper: #0d0d0f; --t-soft: #17171a; --t-ink: #f3f3f5; --t-muted: #9d9da6; --t-hair: rgba(255, 255, 255, .1);
  --t-nav: #1f1f23; --t-nav-edge: rgba(255, 255, 255, .14);
  --t-panel: #f3f3f5; --t-panel-ink: #111113; --t-panel-muted: #5f5f66; --t-panel-hair: rgba(10, 10, 11, .1);
  --p-lilac: #241f3a; --p-lilac-ink: #cbbfff; --p-pink: #34202a; --p-pink-ink: #ffb8d2;
  --p-peach: #35251b; --p-peach-ink: #ffc59d; --p-mint: #172f26; --p-mint-ink: #9fe6c4;
  --p-blue: #1a2539; --p-blue-ink: #b1c9ff;
  --mist: radial-gradient(40% 60% at 20% 30%, #2c2350 0, transparent 70%), radial-gradient(35% 55% at 78% 22%, #3d1f2e 0, transparent 70%),
          radial-gradient(40% 60% at 70% 85%, #3a2617 0, transparent 70%), radial-gradient(30% 45% at 30% 90%, #15362a 0, transparent 70%);
  --lift: 0 2px 6px rgba(0, 0, 0, .4), 0 16px 32px -12px rgba(0, 0, 0, .6);
}

/* ---------- page + type ---------- */
body.t2 { background: var(--t-paper); color: var(--t-ink); font: 400 var(--fs-body)/1.65 var(--f-sans); }
[dir="rtl"] body.t2 { font-family: var(--f-sans); }
.t2 a { color: inherit; }
.t2 a:hover { text-decoration: none; }
.t2 :focus-visible { outline: 2px solid var(--t-ink); outline-offset: 3px; border-radius: inherit; }
.t2 .display { font-size: var(--fs-xl); font-weight: 800; line-height: 1.02; letter-spacing: var(--track-tight); margin: 0 0 var(--s2); }
.t2 .title-l { font-size: var(--fs-l); font-weight: 800; letter-spacing: -.02em; margin: 0; }
[dir="rtl"] .t2 .display, [dir="rtl"] .t2 .title-l { letter-spacing: 0; line-height: 1.2; } /* spacing breaks joined Persian letters */
.t2 .lead { color: var(--t-muted); font-size: 1rem; margin: 0 0 var(--s3); max-width: 46ch; }
.t2 .hint { color: var(--t-muted); font-size: var(--fs-small); }
.t2 .num-ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }

/* ---------- chrome: brand + actions on top, black capsule navigation ---------- */
.t2 .topbar { background: color-mix(in srgb, var(--t-paper) 80%, transparent); border-bottom: 0; padding: var(--s2); gap: var(--s1); }
.t2 .brand { color: var(--t-ink); font-weight: 800; }
.t2 .brand .logo { border-radius: var(--r-s); background: var(--t-ink); color: var(--t-paper); }
.t2 .brand small { color: var(--t-muted); }
.t2 .icon-btn { width: var(--h-control); height: var(--h-control); border-radius: var(--r-pill); border-color: var(--t-hair); color: var(--t-ink); }
.t2 .icon-btn:hover { background: var(--t-soft); }
.t2 .bell-n { background: var(--t-ink); color: var(--t-paper); }
.t2 .bottomnav {
  inset: auto var(--s2) calc(var(--s2) + env(safe-area-inset-bottom)) var(--s2); padding: 6px; gap: 2px;
  background: var(--t-nav); border: 1px solid var(--t-nav-edge); border-radius: var(--r-pill); box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .45);
}
.t2 .bottomnav a { color: #a1a1a8; border-radius: var(--r-pill); font-size: .72rem; padding: 6px 0; }
.t2 .bottomnav a.active { color: #0a0a0b; background: #ffffff; }
.t2 .bottomnav a.active svg { transform: none; }
.t2 main { max-width: 1160px; padding: var(--s1) var(--s2) 120px; }
@media (min-width: 900px) {
  .t2 .topbar { padding: var(--s2) var(--s4); }
  .t2 .shell { display: block; }
  .t2 .sidebar {
    position: fixed; z-index: 21; top: var(--s2); left: 50%; transform: translateX(-50%); height: auto; width: auto;
    flex-direction: row; align-items: center; gap: 2px; padding: 4px; background: var(--t-nav); border: 1px solid var(--t-nav-edge);
    border-radius: var(--r-pill); box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .4);
  }
  .t2 .sidebar > div { display: none; }
  .t2 .sidebar a { white-space: nowrap; color: #b4b4bb; font-size: var(--fs-small); font-weight: 500; padding: 0 var(--s2); height: 40px; border-radius: var(--r-pill); gap: 6px; }
  .t2 .sidebar a svg { width: 16px; height: 16px; }
  .t2 .sidebar a:hover, [dir="rtl"] .t2 .sidebar a:hover { background: rgba(255, 255, 255, .1); color: #fff; transform: none; }
  .t2 .sidebar a.active { background: #ffffff; color: #0a0a0b; }
  .t2 main { padding: var(--s3) var(--s4) var(--s6); }
}
@media (min-width: 900px) and (max-width: 1180px) { .t2 .sidebar a span { display: none; } .t2 .sidebar a { padding: 0 12px; } }

/* ---------- buttons: pills, all the same height ---------- */
.t2 .pills { display: flex; flex-wrap: wrap; gap: var(--s1); align-items: center; }
.t2 .pill { display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); height: var(--h-control);
  padding: 0 var(--s3); border-radius: var(--r-pill); font-weight: 700; font-size: var(--fs-body); white-space: nowrap;
  border: 1px solid var(--t-ink); transition: transform var(--d-1) var(--e-out), background var(--d-1), color var(--d-1); }
.t2 .pill svg { width: 16px; height: 16px; }
.t2 .pill.solid { background: var(--t-ink); color: var(--t-paper); }
.t2 .pill.line { background: transparent; color: var(--t-ink); border-color: color-mix(in srgb, var(--t-ink) 25%, transparent); }
.t2 .pill.line:hover { border-color: var(--t-ink); }
.t2 .pill:hover { transform: translateY(-1px); }
.t2 .pill:active { transform: scale(.97); }
.t2 .pill.small { height: 40px; padding: 0 var(--s2); font-size: var(--fs-small); }

/* ---------- hero with drifting mist + orbit ---------- */
.t2 .hero { position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r-l); padding: var(--s5) var(--s3);
  display: grid; gap: var(--s3); align-items: center; background: var(--t-soft); }
.t2 .mist::before { content: ""; position: absolute; inset: -30%; z-index: -1; background: var(--mist); filter: blur(24px);
  animation: drift var(--d-mist) ease-in-out infinite alternate; }
@keyframes drift { 0% { transform: translate3d(-4%, -2%, 0) rotate(0deg) scale(1); } 50% { transform: translate3d(3%, 3%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(5%, -3%, 0) rotate(-6deg) scale(1.02); } }
.t2 .orbit { position: relative; width: min(220px, 56vw); aspect-ratio: 1; justify-self: center; display: grid; place-items: center; }
.t2 .orbit svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.t2 .orbit ellipse { fill: none; stroke: color-mix(in srgb, var(--t-ink) 22%, transparent); stroke-width: 1; }
.t2 .orbit circle { fill: var(--t-ink); }
.t2 .ring { transform-origin: 100px 100px; animation: spin-slow var(--d-orbit) linear infinite; }
.t2 .ring.r2 { animation-duration: calc(var(--d-orbit) * 1.4); animation-direction: reverse; }
.t2 .ring.r3 { animation-duration: calc(var(--d-orbit) * 1.9); }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.t2 .core { position: relative; width: 46%; aspect-ratio: 1; border-radius: 50%; background: var(--t-ink); color: var(--t-paper);
  display: grid; place-content: center; text-align: center; transition: transform var(--d-2) var(--e-out); }
.t2 .orbit:hover .core { transform: scale(1.05); }
.t2 .core b { font-size: 2rem; font-weight: 800; line-height: 1; }
.t2 .core small { font-size: .7rem; opacity: .7; padding: 0 var(--s1); line-height: 1.3; margin-top: 4px; }
@media (min-width: 760px) { .t2 .hero { grid-template-columns: 1fr auto; padding: var(--s6) var(--s5); } .t2 .orbit { width: 240px; } }

/* ---------- sections ---------- */
.t2 .block { margin-top: var(--s5); }
.t2 .block-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); flex-wrap: wrap; }

/* form-type cards: own pastel each + a small dark preview inside */
.t2 .type-grid { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.t2 .type-card { position: relative; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s3); border-radius: var(--r-m);
  background: var(--tone); color: var(--tone-ink); min-height: 176px;
  transition: transform var(--d-2) var(--e-out), box-shadow var(--d-2) var(--e-out); }
.t2 .type-card:hover { transform: translateY(-4px); box-shadow: var(--lift); }
.t2 .type-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s1); }
.t2 .type-title { font-size: 1.15rem; font-weight: 800; line-height: 1.3; color: var(--t-ink); overflow-wrap: anywhere; }
.t2 .type-plus { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--t-paper);
  color: var(--t-ink); transition: transform var(--d-2) var(--e-out); }
.t2 .type-plus svg { width: 16px; height: 16px; }
.t2 .type-card:hover .type-plus { transform: rotate(90deg); }
.t2 .mini { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--r-s); background: var(--t-panel); color: var(--t-panel-ink); }
.t2 .mini > span { display: flex; flex-direction: column; padding: 10px var(--s2); min-width: 0; }
.t2 .mini > span + span { border-inline-start: 1px solid var(--t-panel-hair); }
.t2 .mini small { font-size: .75rem; color: var(--t-panel-muted); }
.t2 .mini b { font-size: 1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2 .tone-lilac { --tone: var(--p-lilac); --tone-ink: var(--p-lilac-ink); }
.t2 .tone-pink { --tone: var(--p-pink); --tone-ink: var(--p-pink-ink); }
.t2 .tone-peach { --tone: var(--p-peach); --tone-ink: var(--p-peach-ink); }
.t2 .tone-mint { --tone: var(--p-mint); --tone-ink: var(--p-mint-ink); }
.t2 .tone-blue { --tone: var(--p-blue); --tone-ink: var(--p-blue-ink); }

/* numbered steps (a real sequence) with a progress bar */
.t2 .steps-progress { height: 4px; border-radius: var(--r-pill); background: var(--t-hair); overflow: hidden; margin-bottom: var(--s2); }
.t2 .steps-progress span { display: block; height: 100%; width: 100%; background: var(--t-ink); transform: scaleX(var(--p)); transform-origin: left;
  animation: fill var(--d-3) var(--e-out) both; }
[dir="rtl"] .t2 .steps-progress span { transform-origin: right; }
@keyframes fill { from { transform: scaleX(0); } }
.t2 .steps { list-style: none; margin: 0; padding: 0 0 4px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr);
  gap: var(--s2); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.t2 .steps li { scroll-snap-align: start; }
.t2 .steps a { display: flex; flex-direction: column; gap: var(--s1); height: 100%; padding: var(--s3); border-radius: var(--r-m);
  border: 1px solid var(--t-hair); transition: transform var(--d-2) var(--e-out), box-shadow var(--d-2), border-color var(--d-2); }
.t2 .steps a:hover { transform: translateY(-3px); box-shadow: var(--lift); border-color: transparent; }
.t2 .step-no { font-size: 1.75rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.t2 .step-no small { font-size: .8rem; font-weight: 500; color: var(--t-muted); }
.t2 .step-title { font-weight: 700; }
.t2 .step-state { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-small); color: var(--t-muted); margin-top: auto; }
.t2 .step-state svg { width: 14px; height: 14px; }
.t2 .steps li.ok a { background: var(--t-soft); }
.t2 .steps li.ok .step-state { color: var(--p-mint-ink); }

/* the one dark panel: latest documents */
.t2 .panel { margin-top: var(--s5); padding: var(--s3); border-radius: var(--r-l); background: var(--t-panel); color: var(--t-panel-ink); }
.t2 .panel .title-l { color: var(--t-panel-ink); }
.t2 .plist { display: flex; flex-direction: column; }
.t2 .prow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s2); padding: 14px 0;
  border-top: 1px solid var(--t-panel-hair); transition: padding var(--d-2) var(--e-out); }
.t2 .prow:hover { padding-inline-start: var(--s1); }
.t2 .pno { font-weight: 700; font-size: var(--fs-small); padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--t-panel-hair); }
.t2 .pmain { min-width: 0; display: flex; flex-direction: column; }
.t2 .ptitle { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2 .psub, .t2 .pdate { font-size: var(--fs-small); color: var(--t-panel-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2 .pend { display: flex; flex-direction: column; align-items: flex-end; text-align: end; }
.t2 .pmoney { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t2 .pempty { color: var(--t-panel-muted); padding: var(--s3) 0; }
@media (min-width: 760px) { .t2 .panel { padding: var(--s4) var(--s5); } }
@media (max-width: 480px) {
  .t2 .prow { grid-template-columns: auto 1fr; grid-template-areas: "no end" "main main"; row-gap: var(--s1); }
  .t2 .pno { grid-area: no; justify-self: start; } .t2 .pend { grid-area: end; } .t2 .pmain { grid-area: main; }
}
@media (max-width: 759px) {
  .t2 .topbar { gap: 4px; padding: var(--s1) var(--s2); }
  .t2 .icon-btn { width: 40px; height: 40px; }
  .t2 .hero { grid-template-columns: 1fr; padding: var(--s3); gap: var(--s2); }
  .t2 .orbit { width: 168px; justify-self: start; order: -1; margin-bottom: calc(var(--s1) * -1); }
  .t2 .type-card { min-height: 0; gap: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s3); }
  [dir="rtl"] .t2 .type-card { padding: var(--s2) var(--s3) var(--s2) var(--s2); }
}

/* ---------- motion: staggered rise, page slide ---------- */
.t2 .rise { animation: t2rise var(--d-3) var(--e-out) both; animation-delay: calc(var(--i, 0) * var(--d-stagger)); }
@keyframes t2rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: var(--d-2) var(--e-out) both t2out; }
::view-transition-new(root) { animation: var(--d-2) var(--e-out) both t2in; }
@keyframes t2out { to { opacity: 0; transform: translateX(-12px); } }
@keyframes t2in { from { opacity: 0; transform: translateX(12px); } }

html[data-anim="light"] .t2 .mist::before, html[data-anim="light"] .t2 .ring { animation: none; }
html[data-anim="off"] .t2 *, html[data-anim="off"] .t2 *::before, html[data-anim="off"] .t2 *::after { animation: none !important; transition: none !important; }
html[data-anim="off"]::view-transition-old(root), html[data-anim="off"]::view-transition-new(root) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .t2 *, .t2 *::before, .t2 *::after { animation: none !important; transition: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* =====================================================================================================
   Serious palette (company setting branding.palette = "serious"): the same layout, quiet stone and slate
   instead of pastels, grey mist. Chosen per company from the hub / console.
   ===================================================================================================== */
html[data-palette="serious"] {
  --p-lilac: #e8e9ef; --p-lilac-ink: #2f3447; --p-pink: #ece8e9; --p-pink-ink: #4a3a3f;
  --p-peach: #ede9e3; --p-peach-ink: #4a3f33; --p-mint: #e4eae7; --p-mint-ink: #2f453c;
  --p-blue: #e3e8ef; --p-blue-ink: #2b3a52;
  --mist: radial-gradient(45% 60% at 20% 30%, #e3e6ee 0, transparent 70%), radial-gradient(40% 55% at 80% 25%, #ecebef 0, transparent 70%),
          radial-gradient(45% 60% at 70% 85%, #e6e9ec 0, transparent 70%);
}
@media (prefers-color-scheme: dark) {
  html[data-palette="serious"]:not([data-theme="light"]) {
    --p-lilac: #1e2029; --p-lilac-ink: #c3c8da; --p-pink: #241f21; --p-pink-ink: #d6c6cb;
    --p-peach: #24211d; --p-peach-ink: #d8cbbb; --p-mint: #1c2320; --p-mint-ink: #bcd0c6;
    --p-blue: #1b2029; --p-blue-ink: #bccadf;
    --mist: radial-gradient(45% 60% at 20% 30%, #1f2330 0, transparent 70%), radial-gradient(40% 55% at 80% 25%, #23232a 0, transparent 70%),
            radial-gradient(45% 60% at 70% 85%, #1c2226 0, transparent 70%);
  }
}
html[data-palette="serious"][data-theme="dark"] {
  --p-lilac: #1e2029; --p-lilac-ink: #c3c8da; --p-pink: #241f21; --p-pink-ink: #d6c6cb;
  --p-peach: #24211d; --p-peach-ink: #d8cbbb; --p-mint: #1c2320; --p-mint-ink: #bcd0c6;
  --p-blue: #1b2029; --p-blue-ink: #bccadf;
  --mist: radial-gradient(45% 60% at 20% 30%, #1f2330 0, transparent 70%), radial-gradient(40% 55% at 80% 25%, #23232a 0, transparent 70%),
          radial-gradient(45% 60% at 70% 85%, #1c2226 0, transparent 70%);
}

/* =====================================================================================================
   Every page: the old component names (card, btn, row, badge, field…) drawn with the new tokens.
   Work pages stay plain: white, hairlines, no mist. The company colour (if any) only marks focus,
   links and the selected state; main buttons stay black.
   ===================================================================================================== */
:root { --t-accent: var(--t-ink); --t-accent-ink: var(--t-paper); --t-accent-soft: var(--t-soft); --t-field: rgba(10, 10, 11, .24); }
:root[data-brand] { --t-accent: var(--accent); --t-accent-ink: var(--accent-ink); --t-accent-soft: var(--accent-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --t-field: rgba(255, 255, 255, .26); } }
:root[data-theme="dark"] { --t-field: rgba(255, 255, 255, .26); }
body.t2 {
  --bg: var(--t-paper); --surface: var(--t-paper); --surface-2: var(--t-soft); --text: var(--t-ink); --muted: var(--t-muted);
  --line: var(--t-hair); --accent: var(--t-accent); --accent-2: var(--t-accent); --accent-ink: var(--t-accent-ink);
  --accent-soft: var(--t-accent-soft); --shadow: none; --radius: var(--r-m); --ease: var(--e-out);
}
.t2 h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
.t2 h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
[dir="rtl"] .t2 h1, [dir="rtl"] .t2 h2 { letter-spacing: 0; }
.t2 .page-head { gap: var(--s2); margin-bottom: var(--s3); }
.t2 .crumbs, .t2 .muted { color: var(--t-muted); }

/* cards: plain paper with a hairline */
.t2 .card { border: 1px solid var(--t-hair); border-radius: var(--r-m); padding: var(--s3); background: var(--t-paper); }
.t2 .card + .card { margin-top: var(--s2); }
.t2 .card h2 svg { color: var(--t-ink); }
.t2 .grid { gap: var(--s2); }
.t2 a.card { transition: transform var(--d-2) var(--e-out), box-shadow var(--d-2) var(--e-out); text-decoration: none; }
.t2 a.card:hover { transform: translateY(-3px); box-shadow: var(--lift); }
.t2 .stat .v { font-size: 1.75rem; font-weight: 800; }

/* rows + tables: hairlines */
.t2 .row { border-radius: var(--r-s); border-bottom-color: var(--t-hair); padding: 12px var(--s1); }
.t2 a.row:hover { background: var(--t-soft); }
.t2 .avatar { background: var(--t-soft); color: var(--t-ink); }
.t2 th { text-transform: none; letter-spacing: 0; font-size: var(--fs-small); color: var(--t-muted); }
.t2 th, .t2 td { border-bottom-color: var(--t-hair); padding: 10px var(--s1); }

/* buttons: pills, one height */
.t2 .btn { height: var(--h-control); min-height: var(--h-control); padding: 0 var(--s3); border-radius: var(--r-pill);
  border: 1px solid var(--t-field); background: transparent; color: var(--t-ink); font-weight: 700; font-size: var(--fs-body); }
.t2 .btn:hover { background: transparent; border-color: var(--t-ink); }
.t2 .btn.primary { background: var(--t-ink); color: var(--t-paper); border-color: var(--t-ink); box-shadow: none; }
.t2 .btn.primary:hover { background: var(--t-ink); filter: none; transform: translateY(-1px); }
.t2 .btn.small { height: 40px; min-height: 40px; padding: 0 var(--s2); font-size: var(--fs-small); }
.t2 .btn.ghost { border-color: transparent; }
.t2 .btn.ghost:hover { background: var(--t-soft); border-color: transparent; }
.t2 .btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.t2 .btn.big { height: 58px; border-radius: var(--r-pill); }
.t2 .btn.big.on_my_way, .t2 .btn.big.check_out { border-color: transparent; }
.t2 .actions { gap: var(--s1); }
.t2 .fab { border-radius: 50%; background: var(--t-ink); color: var(--t-paper); box-shadow: var(--lift); bottom: calc(96px + env(safe-area-inset-bottom)); }

/* form fields: light, thin border, clear focus; same height as buttons */
.t2 label { font-weight: 700; font-size: var(--fs-small); margin-bottom: 6px; color: var(--t-ink); }
.t2 .field { margin-bottom: var(--s2); }
.t2 input, .t2 select, .t2 textarea { min-height: var(--h-control); border-radius: var(--r-s); border: 1px solid var(--t-field);
  background-color: var(--t-paper); color: var(--t-ink); padding: 10px 14px; }
.t2 input[type="checkbox"], .t2 input[type="radio"] { min-height: 0; accent-color: var(--t-ink); padding: 0; }
.t2 input[type="color"] { padding: 4px; }
.t2 input:hover, .t2 select:hover, .t2 textarea:hover { border-color: color-mix(in srgb, var(--t-ink) 45%, transparent); }
.t2 input:focus, .t2 select:focus, .t2 textarea:focus { border-color: var(--t-ink); box-shadow: 0 0 0 3px var(--t-focus); outline: none; }
.t2 select:not([multiple]) { appearance: none; -webkit-appearance: none; padding-inline-end: 40px; background-repeat: no-repeat;
  background-size: 12px; background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 12 8%22%3E%3Cpath d=%22M1 1l5 5 5-5%22 fill=%22none%22 stroke=%22%23888890%22 stroke-width=%221.6%22/%3E%3C/svg%3E"); }
[dir="rtl"] .t2 select:not([multiple]) { background-position: left 14px center; }
.t2 option { background: var(--t-paper); color: var(--t-ink); }
.t2 .form-grid { gap: 0 var(--s2); }
.t2 input[type="file"] { padding: 6px; }
.t2 input[type="file"]::file-selector-button { font: inherit; font-weight: 700; height: 32px; padding: 0 var(--s2); margin-inline-end: var(--s1);
  border-radius: var(--r-pill); border: 1px solid var(--t-field); background: var(--t-soft); color: var(--t-ink); cursor: pointer; }

/* small pieces */
.t2 .badge { border-radius: var(--r-pill); font-weight: 700; padding: 3px 10px; }
.t2 .badge.draft { background: var(--t-soft); color: var(--t-muted); }
.t2 .tabs { gap: var(--s1); }
.t2 .tabs a { height: 36px; display: inline-flex; align-items: center; padding: 0 var(--s2); border-color: var(--t-field); color: var(--t-ink); background: transparent; }
.t2 .tabs a.active { background: var(--t-ink); color: var(--t-paper); border-color: var(--t-ink); }
.t2 .chip span { border-color: var(--t-field); }
.t2 .chip input:checked + span { background: var(--t-ink); color: var(--t-paper); }
.t2 .flash { background: var(--t-ink); color: var(--t-paper); border-radius: var(--r-pill); padding: 12px var(--s3); top: 76px; box-shadow: var(--lift); }
.t2 .flash.error { background: var(--danger); color: #fff; }
.t2 .error-box, .t2 .demo-box { border-radius: var(--r-s); }
.t2 .demo-box { background: var(--t-soft); }
.t2 .tile { border-radius: var(--r-m); background: var(--t-soft); border: 0; }
.t2 .tile-code { color: var(--t-muted); }
.t2 .section-card { border-color: var(--t-hair); border-radius: var(--r-m); }
.t2 .sticky-save { border-color: var(--t-hair); border-radius: var(--r-pill); bottom: calc(96px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--t-paper) 92%, transparent); box-shadow: var(--lift); padding: var(--s1); }
@media (min-width: 900px) { .t2 .sticky-save { bottom: var(--s2); } .t2 .fab { bottom: var(--s3); } }
.t2 .totals .grand { border-top-color: var(--t-ink); }
.t2 .day, .t2 .tcard { box-shadow: none; border-color: var(--t-hair); }
.t2 .doc { box-shadow: var(--lift); border-radius: var(--r-m); }
.t2 .public-top { background: var(--t-paper); border-bottom-color: var(--t-hair); }
.t2 .stagger > *, .t2 .fade-in { animation-name: t2rise; animation-duration: var(--d-2); }

/* a form type's own pastel on its pages (sales: list, view, edit) */
.t2 .tone-head { background: var(--tone); color: var(--t-ink); border-radius: var(--r-m); padding: var(--s3); }
.t2 .tone-bar { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--tone); color: var(--tone-ink); font-weight: 700; font-size: var(--fs-small); white-space: nowrap; }
.t2 .tone-dot { display: inline-block; vertical-align: middle; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: inset 0 0 0 1px var(--t-field); flex: none; }

/* ---------- sign-in: mist + orbit, plain card ---------- */
.t2 .auth { position: relative; overflow: hidden; isolation: isolate; background: var(--t-paper); }
.t2 .auth::before { content: ""; position: absolute; inset: -20%; z-index: -1; background: var(--mist); filter: blur(30px);
  animation: drift var(--d-mist) ease-in-out infinite alternate; }
.t2 .auth .card { max-width: 420px; padding: var(--s5) var(--s4); border-radius: var(--r-l); border-color: transparent;
  background: color-mix(in srgb, var(--t-paper) 86%, transparent); backdrop-filter: blur(16px); box-shadow: var(--lift);
  animation: t2rise var(--d-3) var(--e-out) both; }
.t2 .auth h1 { font-size: 2rem; }
.t2 .auth .brand .logo { background: var(--t-ink); color: var(--t-paper); border-radius: 50%; width: 48px; height: 48px; }
.t2 .auth-orbit { position: absolute; z-index: -1; width: min(760px, 150vw); aspect-ratio: 1; left: 50%; top: 50%;
  transform: translate(-50%, -50%); pointer-events: none; overflow: visible; }
.t2 .auth-orbit ellipse { fill: none; stroke: color-mix(in srgb, var(--t-ink) 14%, transparent); stroke-width: .6; }
.t2 .auth-orbit circle { fill: var(--t-ink); opacity: .45; }
@media (max-width: 480px) { .t2 .auth .card { padding: var(--s4) var(--s3); } }
html[data-anim="light"] .t2 .auth::before { animation: none; }

/* ---------- saving / sending: the envelope folds (button.busy, added by app.js) ---------- */
.t2 .btn.busy { opacity: 1; pointer-events: none; }
.t2 .btn.busy::after { content: none; }
.t2 .btn.busy > svg { display: none; }
.env { position: relative; width: 22px; height: 15px; flex: none; display: inline-block; perspective: 60px; }
.env::before { content: ""; position: absolute; inset: 0; border-radius: 3px; border: 1.6px solid currentColor; }
.env b { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 8px; border-radius: 1px; background: currentColor; opacity: .45;
  animation: env-letter var(--d-3) cubic-bezier(.6, 0, .3, 1) infinite alternate; }
.env i { position: absolute; inset: 0 0 auto; height: 9px; transform-origin: top center;
  animation: env-fold var(--d-3) cubic-bezier(.6, 0, .3, 1) infinite alternate; }
.env i::before { content: ""; position: absolute; inset: 0; background: currentColor; clip-path: polygon(0 0, 100% 0, 50% 100%); }
@keyframes env-fold { from { transform: rotateX(180deg); } to { transform: rotateX(0deg); } }
@keyframes env-letter { from { transform: translateY(-5px); } to { transform: translateY(1px); } }
@media (prefers-reduced-motion: reduce) { .env i, .env b { animation: none; } }
html[data-anim="off"] .env i, html[data-anim="off"] .env b { animation: none; }

/* Team list: access level + active switch next to the name; on phones they go under it */
body.t2 .user-row { flex-wrap: wrap; }
body.t2 .user-row .main { flex: 1 1 10rem; min-width: 0; }
body.t2 .user-row .acts { display: flex; align-items: center; gap: var(--s1, 8px); }
body.t2 .user-row .acts select { min-height: 40px; width: auto; }
@media (max-width: 560px) { body.t2 .user-row .acts { flex-basis: 100%; padding-inline-start: 48px; } }
