/* 02-base.css — Reset, document defaults, form controls, and the few pieces
   shared by every page that loads this file (app, login, admin): the ambient
   page light, the theme menu, and the theme cross-fade.
   TradePad · design system v2. */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:var(--fs-md);line-height:1.6;font-feature-settings:"tnum" 1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overscroll-behavior-y:none;position:relative;isolation:isolate}

/* Ambient light: two soft glows fixed behind everything. A fixed pseudo
   element rather than background-attachment:fixed, which mobile Safari
   ignores and which repaints on every scroll elsewhere. The time-of-day
   theme drifts --amb-1/--amb-2 through dawn, day, sunset and night. */
body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
  background:
    radial-gradient(70vmax 48vmax at 8% -12%,var(--amb-1),transparent 62%),
    radial-gradient(60vmax 40vmax at 100% -8%,var(--amb-2),transparent 58%);
  transition:background .8s var(--ease)}

button,input,select,textarea{font:inherit;color:inherit;min-width:0}
button{cursor:pointer;border:0;background:none;padding:0}
input,textarea,select{max-width:100%}
a{color:var(--acc)}
:focus-visible{outline:2px solid color-mix(in srgb,var(--acc) 70%,transparent);outline-offset:2px;border-radius:var(--r-xs)}
::selection{background:var(--acc-fill);color:var(--acc-ink)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--line2);border-radius:99px;border:3px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--mute);background-clip:content-box}
*{scrollbar-width:thin;scrollbar-color:var(--line2) transparent}

.ic{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}

/* Numbers, prices and money: always the mono face with tabular figures and
   Latin digits, in every language — traders compare these against their
   broker, and tabular-nums only aligns within one digit set. */
.num{font-family:var(--mono);font-variant-numeric:tabular-nums;direction:ltr;unicode-bidi:isolate;letter-spacing:-.01em}
.trunc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.hide{display:none!important}

/* ── Form controls ── */
.inp{width:100%;height:var(--fh);padding:0 14px;font-size:var(--fs-md);font-family:var(--sans);background:var(--surf2);border:1px solid var(--line);border-radius:var(--fr);color:var(--ink);text-align:center;font-variant-numeric:tabular-nums;transition:border-color var(--t1) var(--ease),box-shadow var(--t2) var(--ease),background var(--t1);-webkit-appearance:none;appearance:none}
.inp::placeholder{color:var(--mute);opacity:1}
.inp:hover{border-color:var(--line2)}
.inp:focus{outline:none;border-color:var(--acc);background:var(--surf);box-shadow:var(--ring)}
.inp.mono,input[type="number"].inp{font-family:var(--mono);direction:ltr;text-align:center}
textarea.inp{height:auto;min-height:92px;padding:12px 14px;resize:vertical;font-family:var(--sans);line-height:1.75;text-align:center}
select.inp{text-align:center;text-align-last:center;direction:rtl;padding-inline:36px;background-color:var(--surf2);cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A93A3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:14px center}
html[dir="ltr"] select.inp{background-position:calc(100% - 14px) center}
input[type="date"].inp,input[type="time"].inp{text-align:center;direction:ltr;padding-inline:14px;font-family:var(--mono)}
input[type="date"].inp::-webkit-calendar-picker-indicator,input[type="time"].inp::-webkit-calendar-picker-indicator{filter:invert(.7);cursor:pointer}
html[data-theme="light"] input[type="date"].inp::-webkit-calendar-picker-indicator,html[data-theme="light"] input[type="time"].inp::-webkit-calendar-picker-indicator{filter:none}
input[type="number"].inp::-webkit-outer-spin-button,input[type="number"].inp::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
input[type="number"].inp{-moz-appearance:textfield}

/* ── Theme menu (topbar + login page) — built by TPTheme.menu() ── */
.theme-menu{position:fixed;z-index:160;min-width:224px;padding:6px;background:var(--surf);border:1px solid var(--line2);border-radius:var(--r-lg);box-shadow:var(--sh-3),var(--hl);opacity:0;transform:translateY(-6px) scale(.98);transform-origin:top;transition:opacity var(--t2) var(--ease),transform var(--t2) var(--ease-out);pointer-events:none}
.theme-menu.open{opacity:1;transform:none;pointer-events:auto}
.theme-menu .tm-head{padding:8px 10px 6px;font-size:var(--fs-2xs);color:var(--mute);font-weight:600}
.theme-menu .tm-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border-radius:var(--r-sm);font-size:var(--fs-sm);color:var(--dim);text-align:start;transition:background var(--t1),color var(--t1)}
.theme-menu .tm-item:hover{background:var(--hover);color:var(--ink)}
.theme-menu .tm-item[aria-checked="true"]{color:var(--ink);background:var(--acc-dim)}
.theme-menu .tm-ic{width:32px;height:32px;display:grid;place-items:center;border-radius:var(--r-sm);background:var(--surf2);border:1px solid var(--line);color:var(--dim);flex:0 0 auto}
.theme-menu .tm-item[aria-checked="true"] .tm-ic{color:var(--acc);border-color:color-mix(in srgb,var(--acc) 40%,var(--line))}
.theme-menu .tm-ic .ic{width:16px;height:16px}
.theme-menu .tm-txt{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;line-height:1.35}
.theme-menu .tm-txt small{font-size:var(--fs-2xs);color:var(--mute)}
.theme-menu .tm-check{width:16px;height:16px;color:var(--acc);opacity:0}
.theme-menu .tm-item[aria-checked="true"] .tm-check{opacity:1}

/* Cross-fade while the scheme swaps (a user pick, or the time-of-day theme
   crossing sunrise/sunset). Only on during the swap itself — a permanent
   transition on every element would tax every hover and re-render. */
html.theme-anim,html.theme-anim *,html.theme-anim *::before,html.theme-anim *::after{transition:background-color .6s var(--ease),border-color .6s var(--ease),color .6s var(--ease),fill .6s var(--ease),stroke .6s var(--ease),box-shadow .6s var(--ease)!important}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
}
