/* Tectomight Mail, base: fonts, the Neon tokens (day and night), the crystal glass material, the aurora behind
   it, controls, toasts and sheets. Self-hosted only (CSP font-src 'self'). Logical properties everywhere, so
   Hebrew mirrors the whole layout. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/bricolage.woff2?v=9a643cbdfb18) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin.woff2?v=9a643cbdfb18) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-cyrillic.woff2?v=9a643cbdfb18) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Heebo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/heebo.woff2?v=9a643cbdfb18) format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }

:root {
  color-scheme: light;
  --shell: #FAF1FD; --panel: #FFFFFF; --raised: #F0E1F8; --text: #1D0A2A; --muted: #6E6178; --border: #ECE4F0;
  --accent: #B01FC4; --accent2: #0A7FA0; --good: #2F8A3A; --bad: #C62F3D; --warn: #8F5E00;
  --ink-on-accent: #FFFFFF;
  --btn-a: #C42AD8; --btn-b: #9216A6;
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-edge: rgba(255, 255, 255, .92);
  --glass-hair: rgba(110, 50, 140, .13);
  --line: rgba(29, 10, 42, .08);
  --hover: rgba(176, 31, 196, .055);
  --sel: rgba(176, 31, 196, .12);
  --field: rgba(255, 255, 255, .78);
  --shadow-1: 0 1px 2px rgba(64, 16, 84, .05), 0 10px 26px -14px rgba(110, 30, 150, .26);
  --shadow-2: 0 2px 6px rgba(64, 16, 84, .06), 0 30px 70px -28px rgba(110, 30, 150, .42);
  --shadow-3: 0 4px 12px rgba(64, 16, 84, .08), 0 48px 110px -30px rgba(96, 20, 140, .5);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 0 0 1px rgba(255, 255, 255, .35);
  --aurora-a: rgba(217, 70, 239, .26); --aurora-b: rgba(34, 211, 238, .22); --aurora-c: rgba(255, 186, 120, .18);
  --scroll-thumb: rgba(110, 50, 140, .22);
  --r-xl: 26px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --font: "Inter", "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Heebo", "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
[data-theme="dark"] {
  color-scheme: dark;
  --shell: #0B0614; --panel: #150C22; --raised: #20122F; --text: #FBEFFF; --muted: #B9A8C9; --border: #2C1C40;
  --accent: #D946EF; --accent2: #22D3EE; --good: #5FD47F; --bad: #FF7A88; --warn: #F2B84B;
  --ink-on-accent: #FFFFFF;
  --btn-a: #C026D3; --btn-b: #8B1AA0;
  --glass: rgba(24, 13, 38, .62);
  --glass-strong: rgba(26, 14, 42, .9);
  --glass-edge: rgba(255, 255, 255, .1);
  --glass-hair: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .07);
  --hover: rgba(217, 70, 239, .08);
  --sel: rgba(217, 70, 239, .17);
  --field: rgba(255, 255, 255, .05);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -14px rgba(0, 0, 0, .7);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .45), 0 30px 70px -28px rgba(120, 20, 160, .55);
  --shadow-3: 0 4px 14px rgba(0, 0, 0, .5), 0 48px 110px -30px rgba(150, 30, 200, .55);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 0 0 1px rgba(255, 255, 255, .03);
  --aurora-a: rgba(217, 70, 239, .2); --aurora-b: rgba(34, 211, 238, .13); --aurora-c: rgba(120, 60, 255, .16);
  --scroll-thumb: rgba(255, 255, 255, .16);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--shell); }
html, body { margin: 0; height: 100%; }
body {
  font: 400 15px/1.5 var(--font); color: var(--text); background: transparent;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation; overflow-x: hidden; overscroll-behavior: none;
  font-feature-settings: "cv11", "ss01";
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.015em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 10px; }
input, textarea, [contenteditable] { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 40px; text-align: center; }
[hidden] { display: none !important; }

/* ---- the aurora: slow magenta and cyan light behind the glass (time-driven, never scroll-driven) ---- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--shell); }
.aurora i { position: absolute; width: 78vmax; height: 78vmax; border-radius: 50%; will-change: transform;
  background: radial-gradient(closest-side, var(--aurora-a), transparent 72%); animation: tm-drift 38s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { inset-inline-start: -26vmax; top: -34vmax; }
.aurora i:nth-child(2) { background: radial-gradient(closest-side, var(--aurora-b), transparent 72%);
  inset-inline-end: -30vmax; top: 6vh; animation-duration: 46s; animation-delay: -14s; }
.aurora i:nth-child(3) { background: radial-gradient(closest-side, var(--aurora-c), transparent 72%);
  inset-inline-start: 18vw; bottom: -48vmax; animation-duration: 52s; animation-delay: -30s; }
@keyframes tm-drift { to { transform: translate3d(7vmax, 5vmax, 0) scale(1.14) rotate(16deg); } }
body.in-app .aurora i { opacity: .82; }

/* ---- crystal glass ---- */
.glass {
  position: relative; background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--inner);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
}
.glass.strong { background: var(--glass-strong); }
/* the gloss band: crosses a surface once when it opens */
.gloss { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 2; }
.gloss::after { content: ""; position: absolute; top: -30%; bottom: -30%; width: 42%; inset-inline-start: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .06) 30%, rgba(255, 255, 255, .55) 50%, rgba(255, 255, 255, .06) 70%, transparent);
  transform: skewX(-16deg); opacity: 0; }
[data-theme="dark"] .gloss::after { background: linear-gradient(100deg, transparent, rgba(255, 220, 255, .03) 30%, rgba(255, 210, 255, .2) 50%, rgba(255, 220, 255, .03) 70%, transparent); }
.gloss.run::after { animation: tm-sweep 1.15s var(--ease) .08s both; }
[dir="rtl"] .gloss.run::after { animation-name: tm-sweep-rtl; }
@keyframes tm-sweep { from { opacity: 1; transform: translateX(0) skewX(-16deg); } to { opacity: 1; transform: translateX(420%) skewX(-16deg); } }
@keyframes tm-sweep-rtl { from { opacity: 1; transform: translateX(0) skewX(16deg); } to { opacity: 1; transform: translateX(-420%) skewX(16deg); } }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 14px; font-weight: 600; font-size: 15px; white-space: nowrap; user-select: none;
  transition: transform .18s var(--ease), background-color .2s, box-shadow .25s, color .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { position: relative; overflow: hidden; isolation: isolate; color: var(--ink-on-accent);
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 -1px 0 rgba(0, 0, 0, .12) inset, 0 10px 26px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary::before { content: ""; position: absolute; inset: 0 0 50% 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0)); }
.btn.primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 14px 34px -10px color-mix(in srgb, var(--accent) 85%, transparent); }
.btn.ghost { background: var(--field); border: 1px solid var(--glass-hair); color: var(--text); }
.btn.ghost:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.quiet { color: var(--text); }
.btn.quiet:hover { background: var(--hover); }
.btn.danger { color: #fff; background: linear-gradient(135deg, #D8374A, #A61E33); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: var(--muted); flex: none;
  transition: background-color .18s, color .18s, transform .18s var(--ease); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.on { color: var(--accent); }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 11px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
/* a 3D sheen that passes over the primary button now and then */
.gleam { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
/* moved by transform only (composited), from the start side to the end side in either direction */
.gleam::after { content: ""; position: absolute; top: 0; bottom: 0; width: 46%; inset-inline-start: 0;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent); transform: translateX(-160%) skewX(-18deg);
  animation: tm-gleam 6.5s cubic-bezier(.3, .6, .2, 1) 1.2s infinite; }
[dir="rtl"] .gleam::after { animation-name: tm-gleam-rtl; transform: translateX(160%) skewX(18deg); }
@keyframes tm-gleam { 0% { transform: translateX(-160%) skewX(-18deg); } 20%, 100% { transform: translateX(330%) skewX(-18deg); } }
@keyframes tm-gleam-rtl { 0% { transform: translateX(160%) skewX(18deg); } 20%, 100% { transform: translateX(-330%) skewX(18deg); } }

/* ---- fields ---- */
.field { display: grid; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.input { width: 100%; min-height: 50px; padding: 0 16px; font-size: 16px; border-radius: 14px; color: var(--text);
  background: var(--field); border: 1px solid var(--glass-hair); box-shadow: inset 0 1px 2px rgba(40, 10, 60, .05);
  transition: border-color .2s, box-shadow .2s, background-color .2s; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 82%, transparent); }
.input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); background: var(--glass-strong); }
.input.bad { border-color: var(--bad); }
textarea.input { padding: 12px 16px; min-height: 96px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; padding-inline-end: 38px; cursor: pointer; background-repeat: no-repeat; background-size: 18px;
  background-position: right 14px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
select.input:dir(rtl) { background-position: left 14px center; }
[data-theme="dark"] select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B9A8C9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
select.input option { color: var(--text); background: var(--panel); }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--field); border: 1px solid var(--glass-hair); flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg button svg { width: 17px; height: 17px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--raised); }

/* ---- avatars: initials on a magenta to cyan crystal ---- */
.avatar { --hue: 0deg; position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  flex: none; color: #fff; font: 700 14px/1 var(--font); letter-spacing: .02em; text-transform: uppercase; overflow: hidden;
  background: linear-gradient(140deg, #D946EF, #8B5CF6 52%, #22D3EE); filter: hue-rotate(var(--hue));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .55), inset 0 -3px 8px rgba(40, 0, 80, .3), 0 4px 12px -4px rgba(140, 40, 200, .5); }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, .55), transparent 46%); }
.avatar > span { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(50, 0, 80, .35); filter: hue-rotate(calc(var(--hue) * -1)); }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 90; inset-inline: 0; bottom: calc(18px + var(--sab)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; min-height: 50px; max-width: min(560px, 100%);
  padding: 6px 8px 6px 18px; padding-inline: 18px 8px; border-radius: 16px; color: #FBEFFF; font-weight: 500;
  background: rgba(29, 10, 42, .9); border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 18px 40px -14px rgba(40, 0, 70, .55); animation: tm-toast-in .42s var(--ease) both; }
[data-theme="dark"] .toast { background: rgba(44, 24, 66, .92); }
.toast.out { animation: tm-toast-out .28s ease-in both; }
.toast .t-text { flex: 1; min-width: 0; padding-block: 8px; }
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; background: #5FD47F; box-shadow: 0 0 10px #5FD47F; flex: none; }
.toast.bad .t-dot { background: #FF7A88; box-shadow: 0 0 10px #FF7A88; }
.toast button { min-height: 38px; padding: 0 14px; border-radius: 11px; font-weight: 700; color: #F0ABFC; }
.toast button:hover { background: rgba(255, 255, 255, .08); }
@keyframes tm-toast-in { from { opacity: 0; transform: perspective(600px) translateZ(-60px) rotateX(18deg); } }
@keyframes tm-toast-out { to { opacity: 0; transform: perspective(600px) translateZ(-40px) scale(.96); } }

/* ---- banner (offline) ---- */
.banner { position: fixed; z-index: 95; top: calc(10px + var(--sat)); inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; padding-inline: 16px 8px; border-radius: 14px;
  background: #3B1D0A; color: #FFE8CC; font-weight: 500; box-shadow: var(--shadow-2); animation: tm-toast-in .4s var(--ease) both; }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner button { min-height: 34px; padding: 0 12px; border-radius: 10px; color: #FFD08A; font-weight: 700; }

/* ---- sheets (glass dialogs) and the lightbox ---- */
.scrim { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 6, 32, .34); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: tm-fade .25s ease both; }
.scrim.closing { animation: tm-fade .2s ease reverse both; }
@keyframes tm-fade { from { opacity: 0; } }
.sheet { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 26px; border-radius: var(--r-xl);
  background: var(--glass-strong); animation: tm-rise .5s var(--ease) both; box-shadow: var(--shadow-3), var(--inner); }
.sheet h2 { font-size: 24px; font-weight: 800; margin-block-end: 8px; overflow-wrap: anywhere; }
.sheet .sheet-subject { display: inline-block; max-width: 100%; margin-block: -2px 12px; padding: 5px 12px; border-radius: 999px; font-weight: 650; font-size: 14.5px;
  overflow-wrap: anywhere; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
.sheet .sheet-text { color: var(--muted); margin-block-end: 18px; }
.sheet .sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-block-start: 22px; flex-wrap: wrap; }
@keyframes tm-rise { from { opacity: 0; transform: perspective(900px) translateZ(-90px) rotateX(10deg); } }
.lightbox { position: fixed; inset: 0; z-index: 85; display: grid; grid-template-rows: auto 1fr; background: rgba(12, 4, 20, .86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: tm-fade .2s ease both; color: #fff; }
.lightbox header { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) 12px 8px; }
.lightbox header .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.lightbox .lb-stage { display: grid; place-items: center; padding: 12px 12px calc(20px + var(--sab)); min-height: 0; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: tm-rise .45s var(--ease) both; }

/* ---- popover menus ---- */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 16px;
  background: var(--glass-strong); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-3), var(--inner);
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); animation: tm-menu .22s var(--ease) both; }
@keyframes tm-menu { from { opacity: 0; transform: scale(.96) translateZ(0); } }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 11px; text-align: start; font-weight: 500; }
.menu button svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 5px 8px; }

/* ---- skeletons ---- */
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--accent) 9%, transparent), var(--line));
  background-size: 300% 100%; animation: tm-shimmer 1.6s ease-in-out infinite; }
@keyframes tm-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- full-page states (API down) ---- */
.full-state { min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; }
.full-state .glass { padding: 34px 30px; max-width: 460px; display: grid; gap: 14px; justify-items: center; }
.full-state h1 { font-size: 26px; font-weight: 800; }
.full-state p { color: var(--muted); }
.full-state .art { width: 150px; height: 112px; }

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