/*
 * Visual style: Notion — "warm paper notebook under afternoon sun".
 * Warm off-white canvas, white cards with hairline borders (no shadows),
 * one blue for the primary action, ink hierarchy built with alpha, flat fills.
 */
:root {
  /* Notion palette */
  --notion-blue: #2545ff;
  --notion-blue-hover: #1631d6;
  --paper: #f9f8f6;
  --white: #ffffff;
  --ink: #000000;
  --ink-95: rgba(0, 0, 0, .95);
  --ink-60: rgba(0, 0, 0, .6);
  --ink-40: rgba(0, 0, 0, .4);
  --graphite: #615d59;
  --stone: #757575;
  --sky-tint: #e6f3fe;
  --marigold: #ffb110;
  --saffron: #e89d01;
  --coral: #f64932;
  --vermillion: #e32d14;
  --peach: #f6d5b8;
  --midnight: #0c1754;
  --cream: #f0e9e1;
  --lavender: #eaebf8;

  /* Roles */
  --hair: rgba(0, 0, 0, .08);
  --hair-soft: rgba(0, 0, 0, .05);
  --hover: rgba(0, 0, 0, .04);
  --text: var(--ink-95);
  --muted: var(--graphite);
  --accent: var(--notion-blue);
  --danger: var(--vermillion);
  --ok: #2f9e44;
  --hl-fill: #fde1dc;
  --hl-stroke: var(--coral);
  --dim: var(--stone);
  --w-col: var(--notion-blue);
  --l-col: #d4380d;
  --band: var(--saffron);

  --r-card: 12px;
  --r-btn: 8px;
  --r-small: 4px;
  --ease: 200ms ease;
  --shadow-float: 0 4px 12px rgba(0, 0, 0, .1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Editorial display face for the home page and the article under each calculator. */
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.43 var(--font);
  font-feature-settings: "lnum";
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
/* The workspace fills the first screen; the SEO article sits below it. */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Top bar ---------- */
.topbar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--white);
  color: var(--ink);
  border-bottom: 1px solid var(--hair);
  box-shadow: 0 .7px 1.46px rgba(0,0,0,.015), 0 3px 9px rgba(0,0,0,.03);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; color: inherit; text-decoration: none; }
.brand-name { margin: 0; font: inherit; }
.brand-icon { width: 24px; height: 24px; fill: var(--ink); stroke: none; }
.topbar-sep { width: 1px; height: 22px; background: var(--hair); margin: 0 4px; }
/* Project name: green-bordered field with a pencil to rename. */
.project-wrap {
  display: flex; align-items: center; min-width: 0; flex: 0 1 240px; height: 34px;
  border: 1.5px solid var(--ok); border-radius: var(--r-btn); background: var(--white);
  transition: box-shadow var(--ease);
}
.project-wrap:focus-within { box-shadow: 0 0 0 3px rgba(47, 158, 68, .18); }
.project-name {
  flex: 1; min-width: 0; height: 100%;
  background: transparent; border: 0; color: var(--ink-95);
  font-weight: 500; padding-block: 0; padding-inline: 10px 4px;
}
.project-name:focus { outline: none; }
.rename-btn {
  flex: none; width: 30px; height: 100%; border: 0; background: none; color: var(--ok);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0; border-start-end-radius: var(--r-btn); border-end-end-radius: var(--r-btn);
}
.rename-btn:hover { background: rgba(47, 158, 68, .1); }
.rename-btn svg { width: 16px; height: 16px; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 6px 15px; border: 0; border-radius: var(--r-btn);
  font-size: 14px; font-weight: 500; background: transparent; color: var(--ink-95);
  transition: background var(--ease), color var(--ease);
}
.btn:hover { background: var(--hover); }
.topbar .btn { white-space: nowrap; flex: none; }
.btn svg { width: 16px; height: 16px; }
/* The single filled, chromatic button of the screen. */
.btn-primary { background: var(--notion-blue); color: var(--white); }
.btn-primary:hover { background: var(--notion-blue-hover); }
.btn-primary.busy { opacity: .75; pointer-events: none; }
.btn-primary.busy svg { animation: spin .8s linear infinite; }
.btn-primary.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,117,222,.55); } 50% { box-shadow: 0 0 0 6px rgba(0,117,222,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-ghost { background: var(--sky-tint); color: var(--notion-blue); }
.btn-ghost:hover { background: #d3e9fd; }
.btn-group { position: relative; display: flex; gap: 2px; }
.btn-group .btn:first-child { border-radius: 0; border-start-start-radius: var(--r-btn); border-end-start-radius: var(--r-btn); }
.btn-caret { padding: 0 9px; border-radius: 0; border-start-end-radius: var(--r-btn); border-end-end-radius: var(--r-btn); }

.dropdown {
  position: absolute; inset-inline-end: 0; top: 40px; z-index: 50;
  min-width: 230px; padding: 6px;
  background: var(--white); color: var(--text);
  border: 1px solid var(--hair); border-radius: var(--r-card);
  box-shadow: var(--shadow-float);
  display: none;
}
.dropdown.open { display: block; animation: pop var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown button {
  display: block; width: 100%; text-align: start;
  padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: inherit;
}
.dropdown button:hover { background: var(--hover); }
.dropdown hr { border: 0; border-top: 1px solid var(--hair); margin: 5px 4px; }
.dropdown.floating { position: fixed; top: 0; right: auto; left: auto; }

/* ---------- Layout ---------- */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 470px minmax(0, 1fr) 440px;
  grid-template-rows: minmax(0, 1fr);
}
.col-left, .col-center, .col-right { min-height: 0; }
.col-left { grid-area: 1 / 1; }
.col-center { grid-area: 1 / 2; }
.col-right { grid-area: 1 / 3; }
.col-left, .col-right { overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.18) transparent; }
.col-center { display: flex; flex-direction: column; min-width: 0; position: relative; padding: 12px 0; }

/* ---------- Cards (collapsible boxes) ---------- */
.box {
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.box-head {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding-block: 0; padding-inline: 16px 12px;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink);
  cursor: pointer; user-select: none;
  transition: background var(--ease);
}
.box-head:hover { background: rgba(0,0,0,.02); }
.box-icon { width: 18px; height: 18px; color: var(--ink-40); }
.box-head .chev { width: 18px; height: 18px; margin-inline-start: auto; color: var(--ink-40); transition: transform var(--ease); }
.box.collapsed .chev { transform: rotate(-90deg); }
[dir="rtl"] .box.collapsed .chev { transform: rotate(90deg); }
.box.collapsed .box-body { display: none; }
.box-body { border-top: 1px solid var(--hair-soft); }

.stat-box .box-body { padding: 10px 16px 14px; }
.stat-box.danger { border-color: rgba(227, 45, 20, .25); }
.stat-box.danger .box-head { color: var(--vermillion); }
.stat-box.danger .box-head::before {
  content: ""; width: 8px; height: 8px; border-radius: 9999px; background: var(--coral);
}

/* ---------- Input grids ---------- */
.grid-wrap { overflow-x: auto; background: var(--white); }
.grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 380px; }
.grid col.c-num, .grid col.c-int { width: 22%; }
.grid col.c-int { width: 15%; }
.grid col.c-text { width: 26%; }
.grid col.c-bool { width: 52px; }
.grid col.c-edges { width: 96px; }
.grid col.c-act { width: 84px; }
.grid th {
  text-align: start; font-size: 12px; font-weight: 500; letter-spacing: .01em; color: var(--ink-60);
  padding: 8px 10px; background: var(--white);
  border-bottom: 1px solid var(--hair); border-inline-end: 1px solid var(--hair-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid th.th-menu { text-align: end; padding: 2px 6px; border-inline-end: 0; }
.grid td { padding: 0; border-bottom: 1px solid var(--hair-soft); border-inline-end: 1px solid var(--hair-soft); height: 32px; background: var(--white); }
.grid td:last-child { border-inline-end: 0; }
.grid td input:not([type=checkbox]) {
  width: 100%; height: 32px; padding: 0 10px;
  border: 0; background: transparent; color: var(--ink-95);
}
.grid td input:focus { outline: 2px solid var(--notion-blue); outline-offset: -2px; background: var(--white); border-radius: var(--r-small); }
.grid td input.invalid { background: #fdecea; outline: 1px solid var(--danger); outline-offset: -1px; }
.grid td.td-bool { text-align: center; }
.grid td.td-bool input { accent-color: var(--notion-blue); width: 16px; height: 16px; vertical-align: middle; }
.grid td.td-edges { text-align: center; line-height: 0; }
.grid tr.new td input::placeholder { color: var(--ink-40); }
.grid tr.disabled td input { color: var(--ink-40); }
.edge-pick { width: 44px; height: 26px; vertical-align: middle; }
.edge-pick rect { fill: var(--paper); stroke: none; }
.edge-pick .side { stroke: rgba(0,0,0,.16); stroke-width: 3; stroke-linecap: square; }
.edge-pick .side.on { stroke: var(--band); stroke-width: 4; }
.edge-pick .hit { stroke: transparent; stroke-width: 10; cursor: pointer; }
.edge-pick g:hover .side:not(.on) { stroke: var(--marigold); }
/* The action column stays pinned on the right while the grid scrolls sideways. */
.grid td.td-act, .grid th.th-menu { position: sticky; inset-inline-end: 0; z-index: 1; }
.grid td.td-act { text-align: center; white-space: nowrap; box-shadow: -1px 0 0 var(--hair-soft); }
[dir="rtl"] .grid td.td-act { box-shadow: 1px 0 0 var(--hair-soft); }
.grid tr.new .td-act button { visibility: hidden; }
.grid tbody tr.row-hl td, .grid tbody tr[data-id]:not([data-id=""]):hover td { background: var(--sky-tint); }
.act-toggle, .act-del, .icon-btn {
  border: 0; background: none; padding: 3px; line-height: 0; vertical-align: middle; border-radius: 6px;
  transition: background var(--ease), color var(--ease);
}
.act-toggle:hover, .act-del:hover, .icon-btn:hover { background: rgba(0,0,0,.06); }
.act-toggle svg, .act-del svg, .icon-btn svg { width: 18px; height: 18px; }
.act-toggle { color: var(--ok); }
.act-toggle:hover { background: rgba(47, 158, 68, .12); }
.grid tr.disabled .act-toggle { color: var(--ink-40); }
.act-del { color: var(--vermillion); }
.act-del:hover { background: rgba(227, 45, 20, .1); }
.act-del svg { stroke-width: 2; }
.icon-btn { color: var(--ink-60); }

/* ---------- Options ---------- */
.options { padding: 10px 16px 14px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 7px 0; color: var(--ink-95); }
.opt + .opt { border-top: 1px solid var(--hair-soft); }
.opt > input, .opt > select { flex: none; }
.opt[hidden] { display: none; }
.opt-sub { color: var(--graphite); font-size: 13px; padding-inline-start: 14px; }
.kerf {
  width: 76px; height: 30px; padding: 0 8px;
  border: 1px solid var(--hair); border-radius: var(--r-btn); background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.kerf-wide { width: auto; max-width: 190px; }
.kerf:hover { border-color: rgba(0,0,0,.16); }
.kerf:focus { outline: none; border-color: var(--notion-blue); box-shadow: 0 0 0 3px var(--sky-tint); }
.kerf.invalid { border-color: var(--danger); background: #fdecea; }
.switch {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 20px; border-radius: 9999px; margin: 0;
  background: rgba(0,0,0,.14); position: relative; cursor: pointer; transition: background var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: inset-inline-start var(--ease);
}
.switch:checked { background: var(--notion-blue); }
.switch:checked::after { inset-inline-start: 18px; }
.switch:focus-visible { outline: 2px solid var(--notion-blue); outline-offset: 2px; }

/* ---------- Toolbar & canvas ---------- */
.toolbar {
  display: flex; align-items: center; gap: 2px;
  height: 44px; padding: 0 8px; flex: none; margin: 0 12px 8px;
  background: var(--white); border: 1px solid var(--hair); border-radius: var(--r-card);
}
.toolbar button {
  width: 34px; height: 32px; border: 0; background: none; color: var(--ink-60); border-radius: var(--r-btn);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.toolbar button:hover { background: var(--hover); color: var(--ink); }
.toolbar button.active { color: var(--notion-blue); background: var(--sky-tint); }
.toolbar button svg { width: 19px; height: 19px; }
.toolbar .tb-text { font-weight: 700; font-size: 15px; }
.toolbar .tb-text sup { font-size: 10px; }
.tb-sep { width: 1px; height: 20px; background: var(--hair); margin: 0 6px; }
.tb-status { margin-inline-start: auto; color: var(--graphite); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-block: 0; padding-inline: 10px 8px; }
.tb-status b { color: var(--vermillion); font-weight: 600; }

.canvas {
  flex: 1; overflow-x: auto; overflow-y: scroll; padding: 12px 20px 40px; position: relative;
  scrollbar-width: auto; scrollbar-color: rgba(0,0,0,.22) transparent;
}
/* The drawings keep a left-to-right coordinate system in every language. */
[dir="rtl"] .canvas { direction: ltr; }
[dir="rtl"] .canvas .empty { direction: rtl; }
.canvas::-webkit-scrollbar { width: 14px; height: 14px; }
.canvas::-webkit-scrollbar-track { background: transparent; }
.canvas::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 9999px; border: 4px solid var(--paper); min-height: 40px; }
.canvas::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.35); }
.stale-banner {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%); z-index: 5;
  padding: 6px 14px; border-radius: 9999px; white-space: nowrap; pointer-events: none;
  background: var(--peach); color: var(--ink); font-size: 13px; font-weight: 500;
}
.stale-banner[hidden] { display: none; }

/* Search progress (over the inputs column, like the original) */
.busy-overlay {
  grid-area: 1 / 1; z-index: 30;
  background: rgba(246, 245, 244, .72);
  backdrop-filter: blur(1px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 330px 24px 0;
}
.busy-overlay[hidden] { display: none; }
.busy-card {
  width: 100%; max-width: 390px; min-height: 72px;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px; background: var(--white); color: var(--ink-95); font-size: 14px; font-weight: 500;
  border: 1px solid var(--hair); border-radius: var(--r-card); box-shadow: var(--shadow-float);
  transition: background var(--ease);
}
.busy-overlay.can-stop .busy-card { cursor: pointer; }
.busy-overlay.can-stop .busy-card:hover { background: #fbfbfa; }
.busy-hint { color: var(--notion-blue); font-weight: 400; font-size: 13px; }
.spinner {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  border: 4px solid var(--sky-tint); border-top-color: var(--notion-blue);
  animation: spin .9s linear infinite;
}

/* Sheet navigation in the "Sheet statistics" header */
.sheet-nav {
  display: inline-flex; align-items: center; gap: 2px; margin-inline-start: 6px;
  padding: 1px 4px; border-radius: 9999px; background: var(--paper);
  font-size: 13px; font-weight: 500; color: var(--ink-60);
}
.sheet-nav[hidden] { display: none; }
.sheet-nav button { border: 0; background: none; color: var(--ink-60); padding: 2px; line-height: 0; border-radius: 9999px; }
.sheet-nav button:hover { background: rgba(0,0,0,.08); color: var(--ink); }
.sheet-nav svg { width: 16px; height: 16px; stroke-width: 2.5; }

.canvas.stale .sheet { opacity: .5; }
.empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--graphite); text-align: center; gap: 8px;
}
.empty svg { width: 56px; height: 56px; stroke-width: 1.3; color: rgba(0,0,0,.2); }
.empty b { color: var(--ink); font-size: 20px; font-weight: 600; letter-spacing: -.01em; }

/* Each sheet sits on the canvas like a white card. */
.sheet {
  display: block; margin: 0 auto 20px; width: fit-content; cursor: pointer;
  background: var(--white); border: 1px solid var(--hair); border-radius: var(--r-card);
  padding: 12px 14px 10px; transition: border-color var(--ease);
}
.sheet:hover { border-color: rgba(0,0,0,.16); }
.sheet.selected { border-color: var(--notion-blue); box-shadow: 0 0 0 3px var(--sky-tint); }
.sheet svg { display: block; stroke: none; fill: initial; overflow: visible; }
.sheet .sheet-border { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.sheet .sheet-bg { fill: var(--paper); }
/* Layered shadow under the sheet (stacked rects, see sheetSVG). */
.sheet .sheet-shadow rect { fill: rgba(0, 0, 0, .028); }
.sheet text { font-family: var(--font); font-variant-numeric: tabular-nums; }
/* Width numbers in blue, length numbers in vermillion — same colors as their dimension lines. */
.sheet .part text.tw { fill: var(--w-col); font-weight: 600; }
.sheet .part text.tl { fill: var(--l-col); font-weight: 600; }
.sheet .dim-w .dimline { stroke: var(--w-col); }
.sheet .dim-w .dimtext { fill: var(--w-col); }
.sheet .dim-l .dimline { stroke: var(--l-col); }
.sheet .dim-l .dimtext { fill: var(--l-col); }
.sheet.ov-on .dims-total { display: none; }
.sheet .ov .dimline { stroke-width: 1.5; }
.sheet .ov .dimtext { font-weight: 600; }
/* Cut preview (hover a row of the Cuts table) */
.sheet.cut-mode .part, .sheet.cut-mode .waste { opacity: .3; }
.sheet .ov .cut-rect { fill: rgba(255,255,255,.35); stroke: var(--ink); stroke-width: 2; }
.sheet .ov .cut-a { fill: rgba(0,117,222,.22); }
.sheet .ov .cut-line { stroke: var(--coral); stroke-width: 3; stroke-linecap: round; }
.cuts tbody tr[data-cut] { cursor: default; transition: background var(--ease); }
.cuts tbody tr[data-cut]:hover, .cuts tbody tr.cut-hl { background: var(--sky-tint); }
.sheet .part rect { stroke: rgba(0,0,0,.55); stroke-width: 1; }
.sheet .part text { fill: var(--ink-95); }
.sheet .part:hover rect { stroke: var(--ink); stroke-width: 1.6; }
.sheet .part .band { fill: none; stroke: var(--band); stroke-width: 3; stroke-linecap: round; }
.sheet .part .plabel { font-weight: 600; fill: var(--ink); }
.sheet .waste rect { fill: var(--paper); stroke: rgba(0,0,0,.12); stroke-width: .6; stroke-dasharray: 3 3; }
.sheet .waste text { fill: var(--ink-40); }
.sheet .title { fill: var(--ink); font-weight: 600; }
.sheet .title-sub { fill: var(--graphite); }
.sheet .dimline { stroke: var(--dim); stroke-width: 1; fill: none; }
.sheet .dimtext { fill: var(--dim); font-weight: 500; }
.canvas.hl-mode .part:not(.hl) { opacity: .4; }
.sheet .part.hl rect { fill: var(--hl-fill) !important; stroke: var(--hl-stroke); stroke-width: 2; }

/* ---------- Stats tables ---------- */
.stats { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats th { text-align: start; font-weight: 400; color: var(--graphite); padding: 6px 0; width: 50%; }
.stats td { padding: 6px 0; color: var(--ink-95); font-weight: 500; }
.stats tr + tr th, .stats tr + tr td { border-top: 1px solid var(--hair-soft); }
.stats small {
  display: inline-block; font-size: 11.5px; font-weight: 500; color: var(--notion-blue);
  background: var(--sky-tint); border-radius: 9999px; padding: 0 7px; margin-inline-start: 2px; line-height: 18px;
}
.stats b small { background: none; padding: 0; color: var(--graphite); }
.stats td > small:last-child:not(:only-child) { margin-inline-start: 4px; }
.stats .sep { display: none; }
.stats .note { color: var(--graphite); font-weight: 400; font-size: 12px; }
.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.list th { text-align: start; font-size: 12px; font-weight: 500; color: var(--ink-60); padding: 6px 4px; border-bottom: 1px solid var(--hair); }
.list td { padding: 7px 4px; border-bottom: 1px solid var(--hair-soft); }
.list tr:last-child td { border-bottom: 0; }
.cuts td { padding: 4px; font-variant-numeric: tabular-nums; }
.cuts .muted { color: var(--ink-40); }
.cuts td:first-child { font-weight: 600; width: 32px; color: var(--ink-40); }
.placeholder { color: var(--ink-40); padding: 4px 0; }
.unfit-note { color: var(--graphite); font-size: 13px; line-height: 1.5; padding-top: 10px !important; }
.btn-sm { height: 28px; padding: 4px 10px; font-size: 13px; margin-top: 8px; }
.all-ok { color: var(--ok); }

/* ---------- Tooltip, toast, modal ---------- */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--midnight); color: var(--white); font-size: 12.5px;
  padding: 6px 10px; border-radius: var(--r-btn); white-space: nowrap; display: none;
}
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #111; color: var(--white); padding: 9px 16px; border-radius: 9999px;
  box-shadow: var(--shadow-float); font-size: 13.5px; font-weight: 500; animation: toastIn var(--ease);
}
.toast.error { background: var(--vermillion); }
.toast.warn { background: var(--marigold); color: var(--ink); }
.toast.ok { background: var(--midnight); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.modal { position: fixed; inset: 0; background: rgba(2, 9, 58, .25); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--white); border: 1px solid var(--hair); border-radius: var(--r-card); width: 460px; max-width: 100%; max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow-float); }
.modal-card header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--hair); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.modal-card header .icon-btn { font-size: 22px; line-height: 1; padding: 2px 8px; }
.modal-body { overflow-y: auto; padding: 6px; }
.proj-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-btn); }
.proj-row:hover { background: var(--hover); }
.proj-row .pname { flex: 1; font-weight: 500; cursor: pointer; }
.proj-row .pdate { color: var(--ink-40); font-size: 12px; }

/* ---------- Account, upgrade and menus ---------- */
.btn-upgrade { background: var(--white); border: 1px solid var(--hair); color: var(--ink-95); padding: 6px 13px; }
.btn-upgrade svg { color: var(--saffron); }
.btn-upgrade:hover { background: #fbfaf9; border-color: rgba(0,0,0,.16); }
.btn-plain { color: var(--ink-95); }
.btn[hidden] { display: none; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary[disabled] { opacity: .6; }
.usage-chip {
  font-size: 12px; font-weight: 500; color: var(--graphite); white-space: nowrap;
  padding: 3px 9px; border-radius: 9999px; background: var(--white); border: 1px solid var(--hair);
}
.usage-chip.low { color: var(--vermillion); border-color: #f6c9c1; background: #fdf1ee; }
.acct { position: relative; display: flex; align-items: center; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 0; padding: 0;
  background: var(--midnight); color: var(--white); font-weight: 600; font-size: 14px;
}
.avatar.paid { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--marigold); }
.avatar[hidden] { display: none; }
.acct-menu { min-width: 260px; }
.acct-head { padding: 8px 10px 6px; }
.acct-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-mail { color: var(--graphite); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.acct-plan { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--graphite); }
.plan-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 9999px; background: var(--hover); color: var(--ink-95); }
.plan-badge.pro { background: var(--sky-tint); color: var(--notion-blue); }
.plan-badge.lifetime { background: #fff3d6; color: #8a5a00; }
.more-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: var(--r-btn); }
.more-btn:hover { background: var(--hover); }
.more-btn svg { width: 18px; height: 18px; stroke: none; }
.menu-icons button { display: flex; align-items: center; gap: 10px; }
.menu-icons button svg { width: 16px; height: 16px; flex: none; color: var(--ink-60); }
.announce { background: var(--midnight); color: var(--white); text-align: center; font-size: 13px; padding: 7px 16px; }
.announce[hidden] { display: none; }

/* Dialogs (sign in, upgrade, report, about) */
.modal-card.dlg-narrow { width: 440px; }
.modal-card.dlg-wide { width: 900px; max-height: 92vh; }
.dlg-body { padding: 18px 20px 20px; overflow-y: auto; }
.dlg-lead { margin: 0 0 16px; color: var(--graphite); }
.dlg-note { margin: 0 0 16px; padding: 10px 12px; border-radius: var(--r-btn); background: #fff6e6; color: #6b4a00; font-size: 13.5px; }
.dlg-fine { margin: 16px 0 0; font-size: 12.5px; color: var(--stone); text-align: center; }
.dlg-msg { margin: 14px 0 0; font-size: 13.5px; color: var(--graphite); }
.dlg-msg.error { color: var(--vermillion); }
.dlg-msg.ok { color: var(--ok); }
.dlg-msg[hidden] { display: none; }
.dlg-form { display: flex; flex-direction: column; gap: 6px; }
.dlg-form label { font-size: 13px; font-weight: 500; color: var(--ink-95); margin-top: 6px; }
.dlg-form input[type=email], .dlg-form input[type=text], .dlg-form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--hair); border-radius: var(--r-btn); background: var(--white);
  font: inherit; resize: vertical; transition: border-color var(--ease), box-shadow var(--ease);
}
.dlg-form input:focus, .dlg-form textarea:focus { outline: none; border-color: var(--notion-blue); box-shadow: 0 0 0 3px var(--sky-tint); }
.dlg-form .chk { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--graphite); margin: 8px 0 6px; }
.dlg-form button[type=submit] { margin-top: 10px; }
.btn-block { width: 100%; justify-content: center; }
.btn-oauth { width: 100%; justify-content: center; gap: 10px; border: 1px solid var(--hair); background: var(--white); height: 40px; }
.btn-oauth:hover { background: #fbfaf9; }
.g-btn { display: flex; justify-content: center; min-height: 40px; color-scheme: light; }
.btn-oauth svg.g { width: 18px; height: 18px; stroke: none; }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; color: var(--stone); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--hair); }
.muted { color: var(--stone); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--hair); border-radius: var(--r-card); background: var(--white); }
.plan.featured { border-color: var(--notion-blue); box-shadow: 0 0 0 1px var(--notion-blue); }
.plan-tag { position: absolute; top: -10px; inset-inline-end: 14px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 9999px; background: var(--notion-blue); color: var(--white); }
.plan-name { font-weight: 600; font-size: 15px; }
.plan-price { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--graphite); margin-inline-start: 4px; letter-spacing: 0; }
.plan-feat { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan-feat li { display: flex; gap: 8px; font-size: 13.5px; color: var(--ink-95); }
.plan-feat svg { width: 16px; height: 16px; flex: none; color: var(--ok); margin-top: 2px; }
.pp-box { min-height: 40px; margin-top: 6px; }
.pp-loading { display: block; text-align: center; font-size: 12.5px; color: var(--stone); padding: 10px 0; }
.about-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.about-brand .brand-icon { width: 34px; height: 34px; }
.about-brand div { display: flex; flex-direction: column; }
.about-brand span { color: var(--stone); font-size: 12.5px; }
.about p { color: var(--graphite); margin: 0 0 12px; }
.about a { color: var(--notion-blue); }
@media (max-width: 760px) {
  .plans { grid-template-columns: 1fr; }
  .usage-chip { display: none; }
}
@media (max-width: 520px) {
  .btn-upgrade span, #btnSignIn { font-size: 13px; }
  .btn-upgrade { padding: 6px 9px; }
  .btn-upgrade span { display: none; }
  #btnSignIn { padding: 6px 8px; }
}

/* ---------- SEO article (below the workspace) ----------
   Editorial style (Officevibe reference): warm canvas, cream hairlines, serif display
   headings with an italic accent, 16px cards and 24px photos. */
.seo { border-top: 1px solid var(--cream); padding: 88px 24px 96px; background: var(--paper); }
.seo-inner { max-width: 1120px; margin: 0 auto; color: var(--ink-95); font-size: 16px; line-height: 1.6; }
.seo h1 { font-family: var(--serif); font-weight: 400; font-size: 54px; line-height: 1.04; letter-spacing: -.01em; color: var(--ink); margin: 0 0 20px; }
.seo h2 { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.1; letter-spacing: -.005em; color: var(--ink); margin: 80px 0 20px; }
.seo h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; }
.seo p { margin: 0 0 12px; color: var(--graphite); }
.seo-eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--midnight); background: var(--lavender); border-radius: 100px; padding: 5px 12px; margin: 0 0 20px !important; }
.seo-lead { font-size: 18px; line-height: 1.6; color: var(--graphite); max-width: 620px; }
.seo-lead strong { color: var(--ink-95); font-weight: 600; }
.seo-up { display: inline-flex; margin-top: 12px; font-weight: 600; font-size: 15px; color: var(--notion-blue); text-decoration: none; }
.seo-up:hover { text-decoration: underline; }
.seo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.seo figure { margin: 0; }

.seo-head { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.seo-hero { position: relative; aspect-ratio: 4 / 3.2; }
.seo-hero::before { content: ""; position: absolute; inset: 18px -18px -18px 18px; background: var(--midnight); border-radius: 24px; transform: rotate(3deg); }
.seo-hero img { position: relative; border-radius: 24px; box-shadow: 0 4px 24px rgba(12, 23, 84, .08); }

.seo-how { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; margin-top: 24px; }
.seo-side { aspect-ratio: 4 / 4.2; border-radius: 24px; overflow: hidden; }
.seo-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 12px; color: var(--graphite); }
.seo-steps li { counter-increment: step; position: relative; background: var(--white); border: 1px solid var(--cream); border-radius: 16px; padding: 18px 20px 18px 68px; }
.seo-steps li::before { content: counter(step); position: absolute; inset-inline-start: 20px; top: 16px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--notion-blue); color: var(--white); font-weight: 600; font-size: 14px; }
.seo-steps li:first-child { background: var(--midnight); border-color: var(--midnight); color: rgba(255, 255, 255, .78); }
.seo-steps li:first-child strong { color: var(--white); }
.seo-steps strong { display: block; color: var(--ink-95); font-weight: 600; margin-bottom: 2px; }
html[dir="rtl"] .seo-steps li { padding: 18px 68px 18px 20px; }

.seo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.seo-card { background: var(--white); border: 1px solid var(--cream); border-radius: 16px; padding: 28px; }
.seo-card p { margin: 0; font-size: 15px; line-height: 1.6; }
.seo-table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--cream); border-radius: 16px; }
.seo-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.seo-table th, .seo-table td { text-align: start; padding: 14px 24px; border-bottom: 1px solid var(--cream); white-space: nowrap; }
.seo-table th { color: var(--stone); font-weight: 500; font-size: 13px; background: #fcfbfa; }
.seo-table tbody tr:last-child td { border-bottom: 0; }
.seo-faq { background: var(--white); border: 0; border-bottom: 1px solid var(--cream); border-radius: 0; margin: 0; padding: 0 4px; }
.seo-faq:first-of-type { border-top: 1px solid var(--cream); }
.seo-faq summary { cursor: pointer; padding: 22px 36px 22px 0; font-weight: 500; font-size: 17px; color: var(--ink); list-style: none; position: relative; }
.seo-faq summary::-webkit-details-marker { display: none; }
.seo-faq summary::after { content: ""; position: absolute; inset-inline-end: 6px; top: 50%; width: 9px; height: 9px; border: solid var(--graphite); border-width: 0 1.6px 1.6px 0; transform: translateY(-70%) rotate(45deg); transition: transform var(--ease); }
.seo-faq[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
html[dir="rtl"] .seo-faq summary { padding: 22px 0 22px 36px; }
.seo-faq p { padding-bottom: 18px; max-width: 760px; }
.seo-inner > .seo-faq { max-width: 860px; }
.seo-inner > .seo-faq, .seo-inner > .seo-faq + .seo-faq { background: transparent; }

/* Calculator cards with a photo: home page grid and "More cutting calculators". */
.calc-card, .seo-more-card { display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--cream); border-radius: 16px; overflow: hidden; text-decoration: none; color: inherit; transition: transform var(--ease), box-shadow var(--ease); }
.calc-card:hover, .seo-more-card:hover { transform: translateY(-3px); box-shadow: 0 10px 32px rgba(12, 23, 84, .1); }
.calc-img { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--cream); }
.calc-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.calc-card:hover .calc-img img, .seo-more-card:hover .calc-img img { transform: scale(1.04); }
.calc-body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; text-align: start; }
.calc-tag { align-self: flex-start; font-size: 12px; font-weight: 500; color: var(--midnight); background: var(--lavender); border-radius: 100px; padding: 4px 10px; margin-bottom: 14px; }
.calc-title { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--ink); margin-bottom: 8px; }
.calc-text { font-size: 14.5px; line-height: 1.6; color: var(--graphite); margin-bottom: 20px; flex: 1; }
.calc-go { font-size: 14px; font-weight: 600; color: var(--notion-blue); }
.seo-more { margin-top: 24px; }
.seo-more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; }

@media (max-width: 900px) {
  .seo { padding: 56px 20px 64px; }
  .seo-head, .seo-how { grid-template-columns: 1fr; gap: 36px; }
  .seo-hero::before { inset: 10px -8px -10px 10px; }
  .seo-side { aspect-ratio: 16 / 10; }
  .seo-grid, .seo-more-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .seo { padding: 44px 16px 56px; }
  .seo h1 { font-size: 38px; }
  .seo h2 { font-size: 30px; margin-top: 56px; }
  .seo-lead { font-size: 16px; }
  .seo-grid, .seo-more-grid { grid-template-columns: 1fr; }
  .seo-card { padding: 22px; }
  .seo-table th, .seo-table td { padding: 12px 16px; }
}
/* Display serif: italics carry the accent; Arabic uses a Naskh face and no italics. */
.seo h1 em, .seo h2 em { font-style: italic; }
html[lang="ar"] { --serif: "Noto Naskh Arabic", "Instrument Serif", serif; }
html[lang="ar"] .seo h1, html[lang="ar"] .seo h2 { line-height: 1.35; letter-spacing: 0; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) { .layout { grid-template-columns: 410px minmax(0, 1fr) 360px; } }
@media (max-width: 1100px) {
  .app { display: block; height: auto; overflow: visible; }
  .topbar { position: sticky; top: 0; z-index: 40; }
  .layout { display: block; }
  .col-left, .col-right { overflow: visible; }
  .busy-overlay { position: fixed; inset: 0; padding-top: 40vh; }
  .col-center { height: 85vh; }
  .canvas { overflow: auto; }
  .brand-name { display: none; }
  .project-wrap { flex-basis: 150px; }
}
@media (max-width: 520px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-sep { display: none; }
  .btn { padding: 0 11px; }
  #btnSave span { display: none; }
  .tb-status { display: none; }
  .col-left, .col-right { padding: 10px; }
  .toolbar { margin: 0 10px 8px; }
  .canvas { padding: 10px 10px 30px; }
  .sheet { padding: 10px; }
}
/* Narrow screens: the project name gets its own full-width row, so the buttons fit and it stays editable.
   Longer translations need it up to 1280px. */
@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding-block: 8px; row-gap: 8px; }
  .topbar .project-wrap { order: 10; flex: 1 1 100%; }
  .btn-upgrade span { display: none; }
  .btn-upgrade { padding: 6px 9px; }
}
@media (min-width: 1101px) and (max-width: 1280px) {
  html:not([lang="en"]) .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding-block: 8px; row-gap: 8px; }
  html:not([lang="en"]) .topbar .project-wrap { order: 10; flex: 1 1 100%; }
}
/* Long translations ("Se connecter") wrap instead of pushing the menu to a new row. */
@media (max-width: 520px) {
  #btnSignIn { white-space: normal; max-width: 80px; line-height: 1.1; text-align: center; }
}
@media (max-width: 400px) {
  .topbar { column-gap: 4px; }
  .topbar .btn { padding-inline: 9px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .app { height: auto; display: block; overflow: visible; }
  .seo { display: none; }
  .topbar, .col-left, .toolbar, .toasts, .stat-box.danger, .stale-banner { display: none !important; }
  .layout { display: block; }
  .col-center, .canvas { overflow: visible; }
  .col-right { page-break-before: always; }
  .canvas.hl-mode .part { opacity: 1; }
  .sheet { page-break-inside: avoid; border: 0; box-shadow: none; }
}

/* ---------- Sign in / Sign up dialog ---------- */
.dlg-auth .dlg-body { padding-top: 16px; }
.dlg-auth .dlg-form { gap: 4px; }
.ig { position: relative; display: flex; align-items: stretch; border: 1px solid var(--hair); border-radius: var(--r-btn); background: var(--white); margin-bottom: 8px; }
.ig:focus-within { border-color: var(--notion-blue); box-shadow: 0 0 0 3px var(--sky-tint); }
.ig-i { display: flex; align-items: center; justify-content: center; width: 40px; background: #fbfaf9; border-inline-end: 1px solid var(--hair); border-start-start-radius: var(--r-btn); border-end-start-radius: var(--r-btn); color: var(--stone); }
.ig-i svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dlg-auth .ig input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 0 !important; box-shadow: none !important; background: transparent; font: inherit; border-radius: 0; border-start-end-radius: var(--r-btn); border-end-end-radius: var(--r-btn); }
.dlg-auth .ig input:focus { outline: none; }
.ig-eye { width: 38px; border: 0; background: none; color: var(--stone); display: flex; align-items: center; justify-content: center; border-start-end-radius: var(--r-btn); border-end-end-radius: var(--r-btn); }
.ig-eye:hover { color: var(--ink-95); background: var(--hover); }
.ig-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.pw-meter { display: flex; align-items: center; gap: 10px; margin: -2px 0 8px; }
.pw-meter[hidden] { display: none; }
.pw-bars { display: flex; gap: 4px; flex: 1; }
.pw-bars i { flex: 1; height: 4px; border-radius: 4px; background: rgba(0,0,0,.08); transition: background .15s; }
.pw-meter[data-s="1"] .pw-bars i.on { background: var(--vermillion); }
.pw-meter[data-s="2"] .pw-bars i.on { background: var(--saffron); }
.pw-meter[data-s="3"] .pw-bars i.on, .pw-meter[data-s="4"] .pw-bars i.on { background: var(--ok); }
.pw-meter[data-s="0"] .pw-bars i.on { background: var(--vermillion); }
.pw-label { font-size: 12px; color: var(--graphite); min-width: 62px; text-align: end; }
.auth-legal { margin: 4px 0 2px; font-size: 12.5px; color: var(--stone); }
.auth-legal a, .auth-foot a, .dlg-msg a, .link-btn { color: var(--notion-blue); }
.link-btn { display: block; margin: 10px auto 0; border: 0; background: none; font-size: 13px; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.auth-foot { margin: 16px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--hair); background: #fbfaf9; text-align: center; font-size: 13px; line-height: 1.8; border-radius: 0 0 var(--r-card) var(--r-card); }
.auth-foot a { text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.auth-check { text-align: center; padding: 6px 0 4px; }
.auth-check svg { width: 44px; height: 44px; fill: none; stroke: var(--notion-blue); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.auth-check p { margin: 10px 0; }
.dlg-auth .btn-oauth { margin-top: 2px; }
@media (max-width: 640px) { #btnSignUp { display: none; } }

.site-foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; padding: 18px 20px 28px; border-top: 1px solid var(--hair); color: var(--stone); font-size: 13px; }
.site-foot a { color: var(--graphite); text-decoration: none; }
.site-foot a:hover { color: var(--notion-blue); text-decoration: underline; }
@media print { .site-foot { display: none; } }

/* ---------- Language menu ---------- */
.lang { position: relative; display: flex; align-items: center; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px;
  border: 0; border-radius: var(--r-btn); background: none; color: var(--ink-60);
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.lang-btn svg { width: 17px; height: 17px; stroke-width: 1.7; }
.lang-menu { min-width: 220px; }
.lang-head { padding: 6px 10px 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--stone); }
.lang-menu a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--ink-95); text-decoration: none; font-size: 14px; line-height: 1.3;
}
.lang-menu a:hover { background: var(--hover); }
.lang-flag { flex: none; width: 22px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--stone); }
.lang-menu a.on { background: var(--sky-tint); color: var(--notion-blue); font-weight: 500; }
.lang-menu a.on .lang-flag { color: var(--notion-blue); }
.lang-menu a.on::after { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--notion-blue); margin-inline-start: auto; }
/* Phones: the language list moves into the ⋮ menu. */
.lang-inline { display: none; }
.lang-inline .lang-menu { display: block; position: static; min-width: 0; padding: 0; border: 0; box-shadow: none; animation: none; }
@media (max-width: 520px) {
  .topbar .lang { display: none; }
  .lang-inline { display: block; }
  .topbar .btn { white-space: normal; flex: initial; line-height: 1.15; }
  /* Upgrade stays in the ⋮ menu; longer translations need the room. */
  #btnUpgrade { display: none; }
}

/* ---------- Arabic (right to left) ---------- */
html[lang="ar"] { --font: "Inter", "Noto Sans Arabic", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif; }
/* Letter spacing breaks the joined Arabic letters. */
html[lang="ar"] body, html[lang="ar"] body * { letter-spacing: 0 !important; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.35; }
