/* واجهة «مؤكد»: للهاتف أولاً. خلفية كريمية دافئة، نص 18 بكسل على الأقل، أرقام 28، وكل زر 56.
   اللون لا يكون الإشارة وحده: معه دائماً سهم أو أيقونة أو كلمة. */

@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/plex-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/plex-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/plex-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/plex-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* نهاري: كريمي دافئ، وفيروزي البرنامج، وذهبي الشروق */
  --bg: #f8f3ea;
  --card: #fffdf9;
  --card-2: #f3ecdf;
  --ink: #211e1a;
  --muted: #5f574d;
  --line: #e7ddce;
  --in: #16714d;        /* داخل: لي، قبضت */
  --in-soft: #ddf2e7;
  --in-ink: #ffffff;
  --out: #ad3730;       /* خارج: علي، دفعت */
  --out-soft: #fbe3df;
  --spend: #925708;     /* صرفت */
  --spend-soft: #f8ead6;
  --stock: #285c90;     /* البضاعة */
  --stock-soft: #e0ebf7;
  --work: #684897;      /* العمال */
  --work-soft: #ece4f8;
  --accent: #0a6d84;    /* لون البرنامج */
  --accent-2: #0e8199;
  --accent-soft: #d9eff3;
  --accent-ink: #ffffff;
  --gold: #946000;
  --sun: #c27400;
  --rec: #c4352b;
  --focus: #e8a419;
  --glow-1: rgba(20, 155, 178, 0.14);
  --glow-2: rgba(240, 180, 41, 0.16);
  --glow-3: rgba(255, 140, 90, 0.07);
  --shadow: 0 1px 2px rgba(60, 45, 20, 0.06), 0 6px 18px rgba(60, 45, 20, 0.07);
  --mic-glow: 0 0 0 6px rgba(20, 155, 178, 0.10), 0 8px 22px rgba(10, 109, 132, 0.35);
  --bar-shadow: 0 -6px 22px rgba(60, 45, 20, 0.07);
  --theme-btn: #fff1cf;
  --radius: 18px;
  --tap: 56px;
  --dock: 96px;
  --font: "Plex Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  color-scheme: light;
}
/* ليلي: ليل فيروزي عميق، وتوهج سماوي، وقمر ذهبي (يتبع الجهاز، أو زر الشمس والقمر فوق) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1318; --card: #12212a; --card-2: #192d38; --ink: #ecf4f6; --muted: #a0b7c0; --line: #24404c;
    --in: #62d8a6; --in-soft: #0f382b; --in-ink: #06261a; --out: #ff9187; --out-soft: #3f1f23; --spend: #f4b766; --spend-soft: #3a2a15;
    --stock: #93c6ff; --stock-soft: #13304b; --work: #cbaaff; --work-soft: #2d2448;
    --accent: #4fd0e3; --accent-2: #2aa6c4; --accent-soft: #103b46; --accent-ink: #04202a; --gold: #f6c453; --sun: #f6c453;
    --rec: #ff6b5e; --focus: #f6c453;
    --glow-1: rgba(79, 208, 227, 0.16); --glow-2: rgba(150, 120, 255, 0.12); --glow-3: rgba(246, 196, 83, 0.07);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.32);
    --mic-glow: 0 0 0 6px rgba(79, 208, 227, 0.10), 0 8px 26px rgba(79, 208, 227, 0.38);
    --bar-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35); --theme-btn: #192d38; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1318; --card: #12212a; --card-2: #192d38; --ink: #ecf4f6; --muted: #a0b7c0; --line: #24404c;
  --in: #62d8a6; --in-soft: #0f382b; --in-ink: #06261a; --out: #ff9187; --out-soft: #3f1f23; --spend: #f4b766; --spend-soft: #3a2a15;
  --stock: #93c6ff; --stock-soft: #13304b; --work: #cbaaff; --work-soft: #2d2448;
  --accent: #4fd0e3; --accent-2: #2aa6c4; --accent-soft: #103b46; --accent-ink: #04202a; --gold: #f6c453; --sun: #f6c453;
  --rec: #ff6b5e; --focus: #f6c453;
  --glow-1: rgba(79, 208, 227, 0.16); --glow-2: rgba(150, 120, 255, 0.12); --glow-3: rgba(246, 196, 83, 0.07);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.32);
  --mic-glow: 0 0 0 6px rgba(79, 208, 227, 0.10), 0 8px 26px rgba(79, 208, 227, 0.38);
  --bar-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35); --theme-btn: #192d38; color-scheme: dark;
}

* { box-sizing: border-box; }
/* كل شيء (الخطوط والأزرار والمسافات والعناصر) بـ80% من حجمه، بطلب صاحب البرنامج (0.22.1). zoom على الجذر يبقي الشريط
   السفلي والنوافذ بعرض الشاشة وارتفاعها (وحدات dvh وvw تملأ الشاشة)، والإحداثيات من getBoundingClientRect تتبعه */
html { -webkit-text-size-adjust: 100%; zoom: .8; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 18px; line-height: 1.6;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
/* توهج ناعم ثابت خلف كل شيء: فيروزي من فوق وذهبي من تحت (وبنفسجي خفيف بالليل) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70vmax 48vmax at 100% -8%, var(--glow-1), transparent 62%),
    radial-gradient(60vmax 44vmax at -10% 108%, var(--glow-2), transparent 60%),
    radial-gradient(40vmax 30vmax at 50% 55%, var(--glow-3), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
/* عناصر التصميم v3 (css/v3.css، 0.50.0) تُرسم في الصفحة نفسها، وهذا التصميم (v2) لا يُظهرها */
.mark3, .mic-label, .fab-label, .side-actions, .drawer-close, .login-hero, .login-hello { display: none; }
.marks { display: contents; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ الإطار */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top .back, .top .menu {
  width: 48px; height: 48px; border-radius: 14px; border: 0; background: transparent; display: grid; place-items: center; font-size: 24px;
}
.top .back:hover, .top .menu:hover { background: var(--card-2); }
.top .title { flex: 1; min-width: 0; }
.top h1 { margin: 0; font-size: 20px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .mark { width: 32px; height: 32px; }

/* زر النهار والليل: شمس بأشعة تدور، تصير هلالاً ذهبياً مع نجمتين */
:is(.top, .panel-actions) .theme {
  position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--theme-btn); color: var(--sun); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sun) 25%, transparent);
  transition: background-color .45s ease, color .45s ease, transform .2s ease;
}
:is(.top, .panel-actions) .theme:active { transform: scale(.92); }
.sunmoon { width: 28px; height: 28px; overflow: visible; }
.sunmoon * { transform-box: view-box; transform-origin: 12px 12px; transition: transform .6s cubic-bezier(.5, -0.3, .3, 1.4), opacity .4s ease; }
.sunmoon .core { fill: currentColor; stroke: none; }
.sunmoon .rays { stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sunmoon .cut { fill: var(--theme-btn); stroke: none; transform-origin: 17px 7px; transform: scale(0); transition: transform .6s cubic-bezier(.5, -0.3, .3, 1.4), fill .45s ease; }
.sunmoon .star { fill: currentColor; stroke: none; opacity: 0; transform: scale(0); }
:is(.top, .panel-actions) .theme.dark .sunmoon .core { transform: scale(1.75); }
:is(.top, .panel-actions) .theme.dark .sunmoon .cut { transform: scale(1); }
:is(.top, .panel-actions) .theme.dark .sunmoon .rays { transform: rotate(90deg) scale(0); opacity: 0; }
:is(.top, .panel-actions) .theme.dark .sunmoon .star { opacity: 1; transform: scale(1); }
:is(.top, .panel-actions) .theme.dark .sunmoon .star.s2 { transition-delay: .12s; }
@media (prefers-reduced-motion: reduce) { .sunmoon *, :is(.top, .panel-actions) .theme { transition: none; } }

/* تبديل الوضع: دائرة تكبر من الزر (حين يدعمها المتصفح)، وإلا تتلاشى الألوان بهدوء */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.theme-fade, :root.theme-fade * { transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease !important; }

main.view {
  width: 100%; max-width: 760px; margin: 0 auto; padding: 14px 16px calc(var(--dock) + 28px + env(safe-area-inset-bottom));
}
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 2px 10px; font-size: 20px; font-weight: 700; }
.section-title .more { margin-inline-start: auto; font-size: 17px; font-weight: 400; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.notice { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--spend-soft); color: var(--ink); border: 1px solid var(--line); }
.notice.err { background: var(--out-soft); }
.notice.ok { background: var(--in-soft); }

/* ------------------------------------------------------------ الشريط السفلي: الميكروفون دائماً في الوسط */
.dock {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: calc(var(--dock) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: var(--bar-shadow);
}
.dock .side { display: flex; justify-content: space-evenly; }
.dock .side button {
  min-width: var(--tap); height: var(--tap); padding: 0 6px; border: 0; background: transparent; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 13px; color: var(--muted);
}
.dock .side button svg { font-size: 26px; }
.dock .side button[aria-current="page"] { color: var(--accent); font-weight: 700; }
.mic {
  position: relative; width: 82px; height: 82px; margin-top: -30px; border-radius: 50%; border: 4px solid var(--card);
  background: linear-gradient(150deg, var(--accent-2), var(--accent)); color: var(--accent-ink); display: grid; place-items: center;
  box-shadow: var(--mic-glow);
  transition: transform .15s ease, background .15s ease;
}
.mic svg { width: 38px; height: 38px; }
.mic:active { transform: scale(.96); }
.mic .ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--rec); opacity: 0; transform: scale(var(--lvl, 1)); transition: transform .08s linear; }
.mic.recording { background: var(--rec); box-shadow: 0 6px 18px rgba(196, 53, 43, 0.4); }
.mic.recording .ring { opacity: .7; }
.mic.busy { background: var(--muted); }
.mic.busy svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .mic.busy svg { animation: none; } .mic .ring { transition: none; } }

/* ------------------------------------------------------------ الرئيسية: ستة مربعات كبيرة */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* عدد فردي من المربعات على الهاتف: الأخير بعرض الصف كله بدل أن يبقى وحده نصف صف (0.34.3) */
.tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.tile {
  position: relative; min-height: 136px; padding: 14px; border: 0; border-radius: var(--radius); text-align: start;
  background: linear-gradient(160deg, var(--card) 55%, color-mix(in srgb, var(--tone-soft, var(--accent-soft)) 70%, var(--card)));
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; color: var(--ink);
  border-inline-start: 6px solid var(--tone, var(--accent)); text-decoration: none;
}
.tile .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--tone-soft, var(--accent-soft)); color: var(--tone, var(--accent)); }
.tile .name { font-size: 18px; font-weight: 700; margin-top: 2px; }
.tile .val { font-size: 15px; color: var(--muted); line-height: 1.45; }
.tile .val b { color: var(--tone, var(--ink)); font-size: 22px; }
.tile:active { transform: scale(.99); }
.tone-money { --tone: var(--accent); --tone-soft: var(--accent-soft); }
.tone-in { --tone: var(--in); --tone-soft: var(--in-soft); }
.tone-out { --tone: var(--out); --tone-soft: var(--out-soft); }
.tone-stock { --tone: var(--stock); --tone-soft: var(--stock-soft); }
.tone-work { --tone: var(--work); --tone-soft: var(--work-soft); }
.tone-day { --tone: var(--gold); --tone-soft: var(--spend-soft); }
.tone-spend { --tone: var(--spend); --tone-soft: var(--spend-soft); }

/* أزرار العمليات السريعة (الشاشات اليدوية) */
/* 12 عمودًا، وكل زر يأخذ نصيبه من صفّه (ui.quickGrid): لا زر وحيد في صف */
.quick { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.quick > * { grid-column: span 3; min-width: 0; }
.quick button, .quick a {
  min-height: 84px; text-decoration: none; border: 1px solid var(--line); border-radius: 16px; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 15px; font-weight: 700; color: var(--tone, var(--ink));
}
.quick button svg, .quick a svg { font-size: 26px; }

/* ------------------------------------------------------------ البطاقات */
.cards { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border: 1px solid var(--line); }
a.card, button.card { display: block; width: 100%; text-align: start; color: inherit; text-decoration: none; font: inherit; }
.card .row { display: flex; align-items: center; gap: 12px; }
.card .who { font-size: 20px; font-weight: 700; line-height: 1.35; }
.card .hint { font-size: 15px; color: var(--muted); }
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700;
  background: var(--tone-soft, var(--card-2)); color: var(--tone, var(--ink)); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.amt { font-size: 28px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.amt.small { font-size: 22px; }
.amt .cur { font-size: .62em; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.amt.in, .in-t { color: var(--in); }
.amt.out, .out-t { color: var(--out); }
.amts { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; }
.arrow { font-weight: 700; }
/* اتجاه المال بالكلمة (طلب المحاسب): «عليه لي» أخضر و«له عندي» أحمر، بجانب السهم والمبلغ */
.dir-line { align-items: center; gap: 4px 10px; margin-top: 2px; }
.dir-word { font-weight: 700; font-size: 14px; }
.dir-word.in { color: var(--in); }
.dir-word.out { color: var(--out); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: 15px; background: var(--card-2); color: var(--muted); }
.badge.warn { background: var(--out-soft); color: var(--out); }
.badge.ok { background: var(--in-soft); color: var(--in); }
.badge.pend { background: var(--spend-soft); color: var(--spend); }
.badge.bad { background: var(--out-soft); color: var(--out); }
.badge svg { width: 14px; height: 14px; }
/* لوحة التحكم: سطور الحساب، ورمز إعادة كلمة السر كبيرًا يُقرأ بسهولة */
.account-card .row { align-items: flex-start; }
.account-lines { margin-top: 8px; display: grid; gap: 2px; }
.account-lines a { color: var(--accent); }
.reset-code { font-size: 34px; font-weight: 800; letter-spacing: .18em; text-align: center; padding: 14px; margin: 8px 0;
  border: 2px dashed var(--accent); border-radius: 14px; background: var(--accent-soft); color: var(--ink); user-select: all; }

/* حركات صغيرة داخل البطاقة */
.moves { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px solid var(--line); }
.moves li { font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
.moves li:last-child { border-bottom: 0; }
.moves .what { flex: 1; min-width: 0; }
.moves .what small { display: block; color: var(--muted); font-size: 15px; }
.moves .m { font-weight: 700; white-space: nowrap; }
.moves .dir { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 18px; }
.moves .dir.in { background: var(--in-soft); color: var(--in); }
.moves .dir.out { background: var(--out-soft); color: var(--out); }

/* التبويبات */
.tabs { display: flex; gap: 6px; padding: 4px; background: var(--card-2); border-radius: 16px; margin-bottom: 14px; }
.tabs button { flex: 1; min-height: 48px; border: 0; border-radius: 12px; background: transparent; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* البحث */
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; min-height: var(--tap); background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 12px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 52px; }

/* العمال: أيام الأسبوع دوائر */
.days { display: flex; gap: 6px; margin-top: 10px; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.weeknav .btn { flex: none; padding: 0 12px; }
.weeknav .weeklabel { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 17px; }
.day { font-size: 12px; }
.day .day-date { font-size: 11px; opacity: .8; line-height: 1.1; }
.day .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--work); background: transparent; }
.day .dot.full { background: var(--work); }
.day .dot.half { background: linear-gradient(90deg, var(--work) 50%, transparent 50%); }
.day .dot.off { border-style: dashed; border-color: var(--line); }
/* الفترة: اسمها وتحته التاريخ بالأرقام؛ والشهر تقويم من الاثنين بدوائر أصغر */
.weeknav .weeklabel small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.days.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px 2px; }
.days.month .day { font-size: 11px; }
.days.month .day .dot { width: 24px; height: 24px; font-size: 10px; }
.days.month .day.head { font-weight: 700; }
.days.month .day.rest { opacity: .45; justify-content: flex-end; min-height: 24px; }
.hint.owed { color: var(--work); font-weight: 700; }

/* البضاعة */
.qty { font-size: 26px; font-weight: 700; }
.qty .u { font-size: 17px; font-weight: 400; color: var(--muted); margin-inline-start: 4px; }
.low { color: var(--out); }

/* ------------------------------------------------------------ الأزرار والحقول */
.btn {
  min-height: var(--tap); padding: 0 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--ink);
  text-decoration: none;
}
.btn.primary { background: linear-gradient(150deg, var(--accent-2), var(--accent)); border-color: var(--accent); color: var(--accent-ink); }
.btn.yes { background: var(--in); border-color: var(--in); color: var(--in-ink); }
.btn.no { background: var(--card); border-color: var(--out); color: var(--out); }
.btn.wide { width: 100%; }
.btn.small { min-height: 44px; font-size: 17px; padding: 0 14px; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 140px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field > .label { font-weight: 700; font-size: 17px; }
.field .hint { font-size: 15px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-size: 18px;
}
.input.big { font-size: 30px; font-weight: 700; text-align: center; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
/* خانة التاريخ (0.28.2، ui.dateBox): نصّنا «يوم/شهر/سنة» يُرى، والخانة الأصلية شفافة فوقه تفتح التقويم */
.date-box { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.date-box .date-text { font-weight: 700; font-variant-numeric: tabular-nums; }
.date-box .date-text.empty { color: var(--muted); font-weight: 400; }
.date-box svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.date-box > input.date-native { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer; font-size: 16px; }
.date-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.date-box[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); }

/* اختيار بأزرار كبيرة (مين؟ أي صندوق؟ أي عملة؟) */
/* أعرض خانة 200: بجانب الدائرة يبقى نحو 110 لنصّ الاسم، فتتّسع أطول كلمة («والمحروقات»، «والإصلاحات») ولا تخرج من مربّعها
   (0.60.0، ملاحظة المالك: كانت 150 فتصير ثلاث خانات على أكثر الهواتف ويخرج الاسم من مربّعه). على الهاتف خانتان، وأكثر على الحاسوب */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
/* الاسم يلتفّ في سطرين أو أكثر داخل مربّعه؛ وكلمة أطول من السطر كله (نادرة) تنكسر بدل أن تخرج منه */
.choice > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.choice {
  min-height: 64px; padding: 8px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  display: flex; align-items: center; gap: 10px; text-align: start; font-size: 17px; font-weight: 700;
}
.choice .avatar { width: 40px; height: 40px; font-size: 18px; }
.choice small { display: block; font-weight: 400; font-size: 15px; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
/* خيار مميز فوق القائمة («سلفة لعامل» بـ«دفعت»): بعرض الصف كله وبلون قسمه، فلا يختلط بأسماء التجار */
.choice.special { grid-column: 1 / -1; border-color: var(--tone); background: color-mix(in srgb, var(--tone-soft) 60%, var(--card)); }
.choice.special .avatar svg { width: 22px; height: 22px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1 1 0; min-height: var(--tap); border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* خطوات الشاشة اليدوية */
.steps { display: flex; gap: 6px; margin: 0 0 16px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--accent); }
.summary { font-size: 20px; line-height: 1.7; padding: 16px; border-radius: var(--radius); background: var(--card); border: 2px solid var(--accent); margin-bottom: 14px; }

/* ------------------------------------------------------------ اللوحة المنبثقة (المساعد والشاشات اليدوية) */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(20, 15, 10, .45); }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 41; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .2);
  padding-bottom: env(safe-area-inset-bottom); max-width: 760px; margin: 0 auto;
}
.sheet header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; }
.sheet header h2 { flex: 1; margin: 0; font-size: 20px; }
.sheet header button { width: 48px; height: 48px; border: 0; border-radius: 14px; background: var(--card-2); font-size: 22px; display: grid; place-items: center; }
/* «علّمني» في رأس كل نافذة (0.101.0): رمز وكلمة، والكلمة تختفي على الهاتف الضيق */
.sheet header .sheet-teach { width: auto; display: inline-flex; gap: 6px; padding: 0 12px; font-size: 15px; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
@media (max-width: 380px) { .sheet header .sheet-teach span { display: none; } }
.sheet .body { overflow: auto; padding: 4px 16px 16px; overscroll-behavior: contain; }
.sheet .foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); }

/* محادثة المساعد */
.said { font-size: 17px; color: var(--muted); margin: 10px 2px 4px; }
.said b { color: var(--ink); }
.reply { font-size: 18px; margin: 4px 2px 10px; white-space: pre-wrap; }
.reply.error { color: var(--out); }
.op-card { border-inline-start: 6px solid var(--tone, var(--accent)); }
.op-card .status { display: inline-block; margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--muted); }
.op-card .status.done { color: var(--in); }
.op-card .status.rejected, .op-card .status.undone { color: var(--out); }
.op-card .spoken { font-size: 17px; color: var(--muted); margin-top: 6px; }
.op-card .btns { margin-top: 12px; }
.talkbar { display: flex; gap: 8px; align-items: center; }
/* شريط الكتابة: الإرفاق والميكروفون صغيران عن يمين الخانة، و«أرسل» عن يسارها؛ وقائمة الإرفاق فوقه */
.talkbar-wrap { position: relative; }
.btn.round.mini { width: 40px; min-height: 40px; height: 40px; }
.btn.round.mini svg { width: 20px; height: 20px; }
.mic.mini { width: 44px; height: 44px; margin: 0; flex: none; border-width: 2px; box-shadow: none; }
.mic.mini svg { width: 22px; height: 22px; }
.mic.mini .ring { inset: -4px; border-width: 2px; }
.attach-menu { position: absolute; bottom: calc(100% + 8px); inset-inline-start: 0; z-index: 3; display: grid; gap: 2px;
  min-width: 200px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22); }
.attach-menu[hidden] { display: none; }
.attach-menu button { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border: 0;
  border-radius: 10px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-align: start; }
.attach-menu button:hover, .attach-menu button:focus-visible { background: var(--card-2); }
.attach-menu svg { width: 20px; height: 20px; color: var(--accent); }
/* بطاقة «فواتير من ملف»: سطر لكل فاتورة، والتي لن تُحفظ باهتة */
.bulk-list { max-height: 320px; overflow: auto; }
.bulk-list .dir.skip { background: var(--card-2); color: var(--muted); }
.bulk-list small { white-space: normal; }
.talkbar input { flex: 1; min-width: 0; }
.talkstate { text-align: center; color: var(--muted); font-size: 17px; min-height: 26px; }
.btn.round { width: var(--tap); padding: 0; border-radius: 50%; flex: none; }
.op-card .btns > .undo { flex: none; margin-inline-start: auto; }

/* المحادثات: ما قاله المالك فقاعة، والرد نص عادي تحتها، والبطاقات بعرض الشاشة */
.chat-feed { display: flex; flex-direction: column; }
.chat-turn { display: flex; flex-direction: column; margin: 4px 0 12px; }
.chat-turn .said {
  align-self: flex-start; max-width: 85%; margin: 0 0 8px; padding: 10px 14px; border-radius: 20px; border-start-start-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-size: 17px; line-height: 1.55; overflow-wrap: anywhere;
}
.chat-turn .said svg { vertical-align: -3px; color: inherit; }
.chat-turn .said b { color: inherit; }
.chat-turn .said .chat-time { color: color-mix(in srgb, var(--accent-ink) 75%, transparent); }
.chat-turn .said .linkish { color: inherit; text-decoration: underline; min-height: 32px; }
/* رد المساعد (0.36.0): فقاعة في الجهة الأخرى، بجانبها علامته ✦ */
.reply-row { display: flex; align-items: flex-end; gap: 8px; align-self: flex-end; max-width: 92%; margin: 0 0 4px; }
.chat-turn .reply {
  margin: 0; padding: 10px 14px; border-radius: 20px; border-end-end-radius: 6px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); font-size: 17px; line-height: 1.6; min-width: 0; overflow-wrap: anywhere;
}
.chat-turn .reply.error { color: var(--out); border-color: color-mix(in srgb, var(--out) 45%, var(--line)); }
.ai-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(150deg, var(--accent-2), var(--accent)); }
.ai-mark svg { width: 16px; height: 16px; }
.ai-mark.big { width: 56px; height: 56px; }
.ai-mark.big svg { width: 28px; height: 28px; }
.ai-window header .ai-mark { margin-inline-end: 2px; }
/* «يفكّر»: ثلاث نقاط تتحرك (وبلا حركة لمن طلب ذلك من جهازه) */
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } }
/* بداية المحادثة: ترحيب وأسئلة تُضغط فتُرسل */
.ai-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 4px 6px; }
.ai-welcome h3 { margin: 4px 0 0; font-size: 20px; }
.ai-welcome .hint { margin: 0 0 6px; max-width: 34ch; }
.ai-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ai-suggest button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--card); color: var(--ink);
  font: inherit; font-size: 16px; font-weight: 700;
}
.ai-suggest button:hover { background: var(--accent-soft); }
.ai-suggest button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ai-suggest svg { width: 18px; height: 18px; color: var(--accent); }
/* شريط الكتابة: خانة واحدة مستديرة فيها الإرفاق والميكروفون، و«أرسل» دائرة في طرفها */
.talkbar { padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.talkbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.talkbar input { border: 0; background: transparent; box-shadow: none; min-height: 44px; padding-inline: 6px; }
.talkbar input:focus { outline: none; box-shadow: none; }
.talkbar .btn.primary { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
.talkbar .btn.round.mini { border: 0; background: transparent; }
.chat-time { display: block; text-align: end; font-size: 13px; color: var(--muted); margin-top: 2px; }
.chat-day { text-align: center; margin: 12px 0 10px; }
.chat-day span { display: inline-block; padding: 2px 14px; border-radius: 99px; background: var(--card-2); color: var(--muted); font-size: 15px; }
.chat-photo { display: block; max-width: min(220px, 100%); max-height: 240px; border-radius: 14px; margin-bottom: 6px; object-fit: cover; }
.linkish {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 8px; border: 0; background: transparent;
  color: var(--accent); font-weight: 700;
}
.chat-head { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chat-foot {
  position: sticky; bottom: calc(var(--dock) + env(safe-area-inset-bottom)); z-index: 5; margin-top: 6px; padding: 8px 0 10px;
  background: var(--bg); border-top: 1px solid var(--line);
}
.card.chat-item { display: flex; align-items: center; gap: 12px; }
.chat-title {
  font-size: 18px; font-weight: 700; line-height: 1.4; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.chat-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* الاستيراد من برنامج تاني */
.dropzone {
  width: 100%; min-height: 150px; margin: 4px 0 12px; border: 2px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: var(--radius); background: color-mix(in srgb, var(--accent-soft) 55%, var(--card)); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit;
}
.dropzone svg { font-size: 40px; color: var(--accent); }
.dropzone b { font-size: 20px; }
.dropzone span { color: var(--muted); font-size: 15px; }
.dropzone.over { border-style: solid; background: var(--accent-soft); }
.thinking { text-align: center; padding: 36px 16px; }
.thinking .spin { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; border: 4px solid var(--accent-soft);
  border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .thinking .spin { animation-duration: 3s; } }
.import-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 12px 0; }
.import-tile .row { align-items: flex-start; }
.checks { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); font-size: 17px; }
.check svg { flex: none; margin-top: 4px; }
.check.ok { background: var(--in-soft); } .check.ok svg { color: var(--in); }
.check.warn { background: var(--spend-soft); } .check.warn svg { color: var(--spend); }
.part.off { opacity: .6; }
.part-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.import-list { margin: 8px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; font-size: 17px; max-height: 360px; overflow: auto; }
details.card summary { cursor: pointer; font-weight: 700; font-size: 17px; }
details.card { margin-bottom: 10px; }

/* «ابدأ العملية» في الاستيراد (0.103.0، screens/import-job.js): المراحل السبع وخلاصتها */
.job-bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin: 4px 0 12px; }
.job-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.job-stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.job-stage { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); }
.job-stage.waiting { opacity: .6; }
.job-stage.running { border-color: var(--accent); background: var(--accent-soft); }
.job-mark { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line);
  font-weight: 700; font-size: 15px; }
.job-stage.running .job-mark { background: var(--card); }
.job-stage.done .job-mark { background: var(--in-soft); color: var(--in); }
.job-stage.failed { border-color: var(--spend); }
.job-stage.failed .job-mark { background: var(--spend-soft); color: var(--spend); }
.job-text { min-width: 0; flex: 1; }
.job-text b { font-size: 17px; }
.job-text .hint { overflow-wrap: anywhere; }
.job-spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 1s linear infinite; }
.job-how { margin-top: 10px; }
.job-how summary { cursor: pointer; font-weight: 700; }
.job-how .job-stages { margin-top: 8px; }
@media (prefers-reduced-motion: reduce) { .job-spin { animation-duration: 3s; } .job-bar span { transition: none; } }

/* رسالة قصيرة أسفل الشاشة */
.toast {
  position: fixed; inset-inline: 16px; bottom: calc(var(--dock) + 16px + env(safe-area-inset-bottom)); z-index: 60; max-width: 560px; margin: 0 auto;
  padding: 14px 16px; border-radius: 16px; background: var(--ink); color: var(--bg); font-size: 17px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}
.toast button { margin-inline-start: auto; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid currentColor; background: transparent; color: inherit; font-weight: 700; }

/* القائمة الجانبية */
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 51; width: min(320px, 86vw); background: var(--bg); padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); overflow: auto; box-shadow: 0 0 30px rgba(0, 0, 0, .25); }
.drawer nav { display: grid; gap: 6px; }
.drawer nav a, .drawer nav button {
  min-height: var(--tap); display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 14px; text-decoration: none;
  color: var(--ink); background: transparent; border: 0; font-size: 18px; text-align: start; width: 100%;
}
.drawer nav a:hover, .drawer nav button:hover { background: var(--card-2); }
.drawer nav svg { font-size: 24px; color: var(--muted); }
.drawer .who { padding: 8px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
/* أقسام القائمة بأسمائها (0.96.0): عنوان صغير هادئ فوق روابط كل قسم، وخط فاصل خفيف قبله */
.drawer nav .nav-group { font-size: 14px; font-weight: 700; color: var(--muted); margin: 12px 12px 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* الدخول */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .box { width: 100%; max-width: 420px; }
.login .brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 18px; text-align: center; }
.login .brand img { width: 84px; height: 84px; }
.login .brand h1 { margin: 0; font-size: 26px; }
/* شاشات الحساب (account.js): روابط تحت الصندوق، وفخ البرامج الآلية خارج الشاشة، وخانة الرمز */
.center { text-align: center; }
.login-links { margin-top: 14px; }
.login-links p { margin: 8px 0 0; }
.login .box > .center { margin-top: 14px; }
.trap { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.code-input { letter-spacing: .25em; font-weight: 700; text-transform: uppercase; text-align: center; }
.btns.stack > .btn { flex-basis: 100%; }
/* «لم يُحفظ» مع طريق الحل (0.98.0): أزرار تحت رسالة الخطأ، لكل صنف ناقص سطر */
.fix-box { margin: -4px 0 12px; display: grid; gap: 10px; }
.fix-item .who { margin-bottom: 6px; }
.fix-btns > .btn { flex: 1 1 120px; min-height: 48px; }
.seg.thirds button { flex: 1 1 calc(33.3% - 8px); }

/* شاشة التحميل */
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.skel { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* زر «اقرأ لي» */
.readme { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 17px; font-weight: 700; color: var(--accent); }

/* الشاشات العريضة */
@media (min-width: 700px) {
  /* ثلاثة في الصف على 6 أعمدة؛ والباقي (مربع أو اثنان) يمتد ليملأ صفه */
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .tiles > *, .tiles > :last-child:nth-child(odd) { grid-column: span 2; }
  .tiles > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
  .tiles > :nth-last-child(2):nth-child(3n+1), .tiles > :last-child:nth-child(3n+2) { grid-column: span 3; }
  .cards.two { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 359px) {
  body { font-size: 17px; }
  /* أضيق الهواتف (280px): زر «علّمني» في الشريط (0.98.0) يأخذ مكانه من المسافات بين الأزرار، لا من عرض الصفحة */
  .top { gap: 2px; padding-inline: 6px; }
  .tile { min-height: 124px; padding: 12px; }
  .amt { font-size: 26px; }
}
@media print { .dock, .top .menu, .readme { display: none; } }

/* «وقّف الصوت»: فوق كل شي طول ما في قراءة، بنص أعلى الشاشة (ما بيغطي خانة الكتابة ولا الميكروفون) */
.stop-voice {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 20px; border: 0; border-radius: 999px;
  background: #b3261e; color: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; /* أحمر غامق بالنهاري والليلي: الأبيض عليه واضح */
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28); animation: stop-voice-in .18s ease-out;
}
.stop-voice[hidden] { display: none; }
.stop-voice svg { width: 20px; height: 20px; }
.stop-voice:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes stop-voice-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .stop-voice { animation: none; } }

/* زر المساعد (0.28.1): أعلى الصفحة في مكانه من الشريط العلوي (.fab-slot) بجانب زر النهار والليل، فلا يغطي رقمًا ولا خانة.
   ثابت فوق مكانه لا داخله: يبقى فوق التغبيش ونافذة المساعد. مكانه من طرف الشريط: الحاشية 12 + القائمة 48 + 10 + زر النهار
   48 + 10 = 128px؛ مفتوح = ✕ */
.top .fab-slot { flex: none; width: 48px; height: 48px; }
.ai-fab {
  position: fixed; z-index: 46; inset-inline-end: 128px; top: max(8px, env(safe-area-inset-top));
  width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: var(--accent-ink);
  background: linear-gradient(150deg, var(--accent-2), var(--accent)); box-shadow: 0 4px 12px rgba(0, 0, 0, .22); /* ألوان الميكروفون نفسها */
  transition: transform .15s ease;
}
.ai-fab:active { transform: scale(.94); }
.ai-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.ai-fab svg { width: 24px; height: 24px; }
.ai-fab .when-open, .ai-fab[aria-expanded="true"] .when-closed { display: none; }
.ai-fab[aria-expanded="true"] .when-open { display: grid; }
.ai-fab .when-closed, .ai-fab .when-open { place-items: center; }
.ai-fab .when-closed { display: grid; }

/* خلف نافذة المساعد: الصفحة كلها مغبّشة (حتى الشريط العلوي والسفلي) ما دامت مفتوحة، وتعود طبيعية لحظة إغلاقها.
   فوق كل شيء ما عدا النافذة والزر العائم و«أوقف الصوت»؛ الضغط عليها يغلق النافذة */
.ai-back { position: fixed; inset: 0; z-index: 44; background: color-mix(in srgb, var(--bg) 25%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: ai-back-in .18s ease-out; }
.ai-back[hidden] { display: none; }
@keyframes ai-back-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ai-back { animation: none; } }

/* نافذة المساعد: فوق الصفحة المغبّشة، وتحت زره؛ تنزل من تحت الشريط العلوي حيث زره */
.ai-window {
  position: fixed; z-index: 45; inset-inline-end: 16px; top: calc(max(8px, env(safe-area-inset-top)) + 58px);
  width: min(440px, calc(100vw - 32px)); height: min(660px, calc(100dvh - var(--dock) - 86px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  display: flex; flex-direction: column; background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: 0 22px 60px rgba(0, 0, 0, .32); overflow: hidden; animation: ai-window-in .18s ease-out;
}
.ai-window[hidden] { display: none; }
.ai-window header { display: flex; align-items: center; gap: 6px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.ai-window header h2 { flex: 1; margin: 0; font-size: 20px; }
.ai-window header button { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--card-2); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; }
.ai-window header button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.ai-window .body { flex: 1; overflow: auto; padding: 8px 14px 12px; overscroll-behavior: contain; }
.ai-window .foot { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.ai-window .ai-controls { display: flex; justify-content: center; align-items: center; gap: 18px; }
.ai-list .chat-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); cursor: pointer; font: inherit; color: inherit; }
.ai-list .chat-title { display: block; font-weight: 700; }
@keyframes ai-window-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ai-window { animation: none; } }
@media (max-width: 600px) {
  .ai-window { inset-inline: 8px; width: auto; top: calc(max(8px, env(safe-area-inset-top)) + 58px); height: auto;
    bottom: calc(var(--dock) + 10px + env(safe-area-inset-bottom)); }
}

/* العمال (0.15.0): يوم ونص ويومين جوّا الدائرة، وحسبة الجمعة، وأيام نموذج «جمعته» */
.day .dot { display: grid; place-items: center; font-size: 12px; font-weight: 800; line-height: 1; color: var(--card); }
.moves.calc li { padding: 7px 0; }
/* فاتورة بطاقة المساعد (0.28.4): أسطرها ومجموعها وطريقة الدفع، بلا «سيصبح هكذا» */
.inv-lines { margin: 4px 0 8px; }
.inv-lines .moves { margin-top: 4px; }
.inv-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0 2px;
  border-top: 2px solid var(--line); font-size: 17px; }
.inv-total b { font-size: 20px; }
/* «أموالي» (0.28.3): الصناديق صندوق تحت صندوق، والضغط يفتح صفحة الصندوق بكل حركاته */
.box-list { display: grid; gap: 10px; }
.box-list .box-row { display: block; color: inherit; text-decoration: none; padding: 14px 16px; }
.box-list .box-row:active { transform: scale(.99); }
.box-row .chev { color: var(--muted); display: grid; place-items: center; }
.box-row .chev svg { width: 22px; height: 22px; transform: scaleX(-1); }
.moves.calc li.total { font-size: 20px; font-weight: 800; border-top: 2px solid var(--line); }
.moves.calc li.total .m { font-size: 22px; }
.day-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; }
.day-row .label { font-weight: 700; margin-bottom: 6px; }
.seg.day-seg { gap: 6px; flex-wrap: nowrap; }
.seg.day-seg button { min-width: 0; padding: 0 4px; font-size: 15px; }
a.row.row-link { color: inherit; text-decoration: none; }

/* العملية الواحدة (0.16.0): الحركات بالقوائم روابط لصفحتها */
.moves a.what { color: inherit; text-decoration: none; }
.moves a.what:hover, .moves a.what:focus-visible { text-decoration: underline; }
.moves .m a { color: var(--accent); }

/* التقارير (0.17.0) */
.card.report .readme { flex: none; }
.card.report .moves.calc { margin-top: 4px; }

/* صفحة الطباعة (0.18.0): ورقة بيضاء مرتبة؛ وقت الطباعة بس الورقة (لا الشريط ولا الأزرار ولا زر المساعد) */
.print-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.print-tools .hint { flex-basis: 100%; margin: 0; }
.print-doc { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; padding: 22px 18px;
  font-size: 14px; line-height: 1.6; }
.print-doc header { border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 14px; }
.print-company { font-weight: 800; font-size: 18px; }
.print-doc h1 { font-size: 22px; margin: 4px 0; }
.print-doc h2 { font-size: 16px; margin: 16px 0 6px; }
.print-sub, .print-note { margin: 2px 0 8px; color: #333; }
.print-cancelled { display: inline-block; border: 2px solid #b3261e; color: #b3261e; font-weight: 800; padding: 2px 12px;
  border-radius: 8px; margin: 6px 0 0; }
.print-doc table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.print-doc th, .print-doc td { border: 1px solid #999; padding: 5px 7px; text-align: start; vertical-align: top; }
.print-doc thead th { background: #eee; font-weight: 700; }
.print-doc td.cell-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; }
.print-doc tr.total td, .print-doc tr.total th { font-weight: 800; background: #f4f4f4; }
.print-kv th { width: 30%; background: #f6f6f6; font-weight: 700; }
.print-words { font-weight: 700; border: 1px dashed #666; padding: 8px 10px; border-radius: 8px; }
.print-sign { display: flex; justify-content: space-between; margin: 36px 8px 8px; }
.print-sign span { border-top: 1px solid #111; padding-top: 4px; min-width: 120px; text-align: center; }
.print-doc footer { margin-top: 16px; font-size: 12px; color: #555; }
@media print {
  @page { margin: 12mm; }
  body.print-page { background: #fff !important; }
  body.print-page header.top, body.print-page .dock, body.print-page .ai-fab, body.print-page .ai-window, body.print-page .stop-voice,
  body.print-page .print-tools, body.print-page .toast, body.print-page .drawer { display: none !important; }
  body.print-page main, body.print-page #view { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .print-doc { border: 0; padding: 0; border-radius: 0; }
}

.choices a.choice { text-decoration: none; color: inherit; }
.print-sheet { overflow-x: auto; }
@media print { .print-sheet { overflow: visible; } .print-doc table { font-size: 11px; } }

/* «شو صار»: يوم أو فترة بين تاريخين (0.21.0) */
.range-pick { margin-bottom: 14px; }
.range-row { display: flex; gap: 10px; flex-wrap: wrap; }
.range-row label { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; font-weight: 700; }

/* أقسام البضاعة (0.21.0): تبويبات بعددها، وعناوين بالقوائم */
.group-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); }
.group-tabs button { padding: 4px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.2; white-space: normal; }
.group-tabs button small { font-weight: 400; font-size: 13px; }
.group-title small { margin-inline-start: 6px; font-weight: 400; color: var(--muted); font-size: 15px; }
.choices .choice-group { grid-column: 1 / -1; font-weight: 800; color: var(--muted); margin: 10px 2px 2px; font-size: 15px; }


/* «رح يصير هيك»: أثر العملية قبل ما تنحفظ (البطاقة و«متأكد؟») */
.effects { margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--line); }
.effects .label { font-weight: 700; margin-bottom: 4px; }
.effects ul { list-style: none; margin: 0; padding: 0; }
.effects li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding: 3px 0; }
.effects li span { color: var(--muted); }

/* فترة الحركات (0.32.0، period.js): أربعة أزرار فوق حركات الشخص والصندوق، ومع «من يوم إلى يوم» خانتا تاريخ و«اعرض» */
.period .tabs { margin-bottom: 8px; }
.period-tabs button { min-height: 44px; font-size: 15px; padding: 0 6px; line-height: 1.25; }
.period-span { margin: -2px 4px 10px; font-size: 14px; color: var(--muted); }
.period-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.period-dates[hidden] { display: none; }
.period-dates label { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; font-size: 15px; color: var(--muted); }
/* اسم الصنف رابط إلى تفاصيله (0.33.0) بلون النص نفسه */
.card a.who { display: block; color: inherit; text-decoration: none; }

/* «المزيد» (0.34.4، ui.moreButton): قائمة سطور من أسفل الشاشة، والإلغاء والتراجع في آخرها بالأحمر بعد خط */
.more-list { display: grid; gap: 2px; }
.more-item { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 6px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font: inherit; font-size: 18px; font-weight: 700; text-align: start; text-decoration: none; cursor: pointer; }
.more-item:hover, .more-item:focus-visible { background: var(--card-2); }
.more-item svg { width: 24px; height: 24px; flex: none; color: var(--muted); }
.more-item small { display: block; font-size: 15px; font-weight: 400; color: var(--muted); }
.more-item.danger, .more-item.danger svg { color: var(--out); }
.more-sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
/* ثلاثة أزرار في صف (الرئيسي ثم الثاني ثم «المزيد»)، بعرض متساوٍ، و«استمع» أيقونة في طرف البطاقة */
.btns.three { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; } /* زران أو ثلاثة بعرض متساوٍ */
.btns.three > * { min-width: 0; padding-inline: 8px; }
.btns.three > .btn { flex: none; }
.readme.icon-only { width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; align-self: flex-start; }
.readme.icon-only svg { width: 22px; height: 22px; }

/* الرئيسية (0.34.6): «معك الآن» بخط كبير، و«لي» و«عليّ» متجاوران، وشريط «اليوم» من ثلاث بطاقات صغيرة */
.home-hero .hero-link { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.hero-amt { font-size: 34px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.hero-amt small, .stat-val small { font-size: 15px; font-weight: 400; color: var(--muted); }
.home-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.home-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-card { display: block; min-width: 0; padding: 12px 14px; color: inherit; text-decoration: none; }
.stat-card.small { padding: 10px 12px; }
.stat-val { font-size: 22px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card.small .stat-val { font-size: 17px; }
.stat-val.in { color: var(--in); } .stat-val.out { color: var(--out); } .stat-val.spend { color: var(--spend); }
.moves .m.stock { color: var(--stock); } .moves .m.work { color: var(--work); } .moves .m.out { color: var(--out); }

/* ------------------------------------------------------------ الحاسوب (0.34.7، الخطوة 5 من مراجعة الواجهة)
   من عرض 1100 فما فوق: قائمة جانبية ثابتة بدل القائمة المنزلقة، وشريط الميكروفون في أسفلها، والصفحة أعرض، وصفحات التفاصيل
   بعمودين (البطاقة ثابتة والحركات بجانبها)، ونافذة المساعد عمود عند الطرف بلا تغبيش. الهاتف والجهاز اللوحي كما هما */
.sidenav { display: none; }
.home-grid { display: block; }
@media (min-width: 1100px) {
  :root { --side: 280px; }
  #app.shell { padding-inline-start: var(--side); }
  #app.shell .top .menu { display: none; }
  /* زر المساعد في مكانه بجانب زر النهار والليل: بلا زر القائمة صار مكانه أقرب إلى الطرف (الحاشية 12 + زر النهار 48 + 10) */
  .ai-fab { inset-inline-end: 70px; }
  .sidenav {
    display: flex; flex-direction: column; position: fixed; z-index: 25; inset-block-start: 0; inset-inline-start: 0; width: var(--side);
    bottom: calc(var(--dock) + env(safe-area-inset-bottom)); overflow: auto; padding: 14px 12px 40px;
    background: var(--card); border-inline-end: 1px solid var(--line);
  }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
  .side-brand img { width: 32px; height: 32px; }
  .side-brand b { display: block; font-size: 17px; line-height: 1.3; }
  .side-brand small { display: block; font-size: 13px; color: var(--muted); }
  .sidenav nav { display: grid; gap: 2px; }
  .sidenav nav a, .sidenav nav button {
    min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border-radius: 12px; text-decoration: none;
    color: var(--ink); background: transparent; border: 0; font: inherit; font-size: 17px; text-align: start; width: 100%; cursor: pointer;
  }
  .sidenav nav a:hover, .sidenav nav button:hover { background: var(--card-2); }
  .sidenav nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
  .sidenav nav svg { font-size: 20px; color: var(--muted); }
  .sidenav nav a[aria-current="page"] svg { color: var(--accent); }
  .sidenav .section-title { font-size: 15px; margin: 12px 10px 4px; color: var(--muted); }
  /* شريط الميكروفون نفسه في أسفل القائمة الجانبية (لا تتغير طريقة عمله) */
  .dock { inset-inline-end: auto; inset-inline-start: 0; width: var(--side); border-inline-end: 1px solid var(--line); box-shadow: none; }
  .dock .side button { min-width: 44px; padding: 0 2px; font-size: 12px; }
  main.view { max-width: 1180px; padding-bottom: 40px; }
  .toast { inset-inline-start: calc(var(--side) + 16px); bottom: 24px; }
  .chat-foot { bottom: 0; }
  /* الرئيسية بعمودين */
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .home-b > .section-title:first-child { margin-top: 0; }
  /* صفحات التفاصيل بعمودين: البطاقة الأولى ثابتة في عمودها، والباقي (الحركات) بجانبها */
  body:not(.ai-open) main.view:is([data-screen="person"], [data-screen="item"], [data-screen="box"], [data-screen="worker"], [data-screen="op"]) {
    display: grid; grid-template-columns: 420px minmax(0, 1fr); column-gap: 24px; align-items: start;
  }
  body:not(.ai-open) main.view:is([data-screen="person"], [data-screen="item"], [data-screen="box"], [data-screen="worker"], [data-screen="op"]) > :first-child {
    grid-column: 1; grid-row: 1 / span 40; position: sticky; top: 84px;
  }
  body:not(.ai-open) main.view:is([data-screen="person"], [data-screen="item"], [data-screen="box"], [data-screen="worker"], [data-screen="op"]) > :not(:first-child) {
    grid-column: 2; min-width: 0;
  }
  body:not(.ai-open) main.view:is([data-screen="person"], [data-screen="item"], [data-screen="box"], [data-screen="worker"], [data-screen="op"]) > :nth-child(2) {
    margin-top: 0;
  }
  /* نافذة المساعد: عمود عند الطرف تحت الشريط العلوي، والصفحة تبقى ظاهرة بلا تغبيش؛ تُغلق بزر المساعد (✕) */
  .ai-back { display: none !important; }
  .ai-window {
    inset-inline-end: 0; top: 65px; bottom: 0; height: auto; width: 400px; border-radius: 0; border-block: 0; border-inline-end: 0;
    box-shadow: 8px 0 24px rgba(0, 0, 0, .08);
  }
  body.ai-open #app.shell main.view { width: auto; margin-inline-end: 416px; } /* تضيق الصفحة بجانب النافذة ولا تمر تحتها */
}

/* ------------------------------------------------------------ زر التصميم المؤقت (0.35.0، js/design.js)
   «التصميم الجديد | التصميم القديم» معلّق في منتصف الحافة السفلى للشريط العلوي: لا يضيّق العنوان ولا يحرّك زر المساعد،
   ويبقى مع الشريط عند التمرير. يُحذف مع نسخة /easy-old/ حين نختار تصميمًا واحدًا */
.top.with-design { margin-bottom: 22px; }
.design-switch {
  position: absolute; z-index: 1; top: calc(100% - 1px); left: 50%; transform: translateX(-50%); display: flex; gap: 2px;
  padding: 3px; border-radius: 0 0 14px 14px; background: var(--card); border: 1px solid var(--line); border-top: 0;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .14); white-space: nowrap;
}
.design-switch button {
  min-height: 30px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.design-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); cursor: default; }
.design-switch button[aria-pressed="false"]:hover { background: var(--card-2); color: var(--ink); }
.design-switch button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media print { .design-switch { display: none; } .top.with-design { margin-bottom: 0; } }

/* ------------------------------------------------------------ 0.47.0 (ملاحظات المحاسب)
   «ملاحظاتي»: خانة كتابة، وملاحظات تنتظر الإرسال بيومها، و«أرسلها للمساعد»، والمرسلة مع رابط محادثتها */
.note-form .label { display: block; font-weight: 700; font-size: 17px; margin-bottom: 6px; }
textarea.note-input { min-height: 88px; resize: vertical; line-height: 1.6; }
.note-form .btns { margin-top: 10px; }
.section-title.small { font-size: 15px; margin: 12px 4px 6px; color: var(--muted); }
ul.notes { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
ul.notes .note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; }
ul.notes .note-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
ul.notes .note-text small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; white-space: normal; }
ul.notes .note-acts { display: flex; gap: 6px; flex: none; }
.btn.icon-only { width: 44px; padding: 0; flex: none; }
.btn.icon-only svg { width: 20px; height: 20px; }
ul.notes.sent { margin-top: 8px; }
ul.notes.sent .note { background: var(--card-2); border: 0; padding: 8px 10px; }
ul.notes.sent .note-text { font-size: 16px; }
.send-box, .sent-notes { margin-top: 12px; }
.send-notes { min-height: 56px; font-size: 19px; }
/* الملاحظات كما وصلت إلى المساعد في المحادثة */
.notes-said b { display: inline-flex; align-items: center; gap: 6px; }
.notes-said b svg { width: 18px; height: 18px; }
.notes-said ol { margin: 6px 0 0; padding-inline-start: 24px; color: var(--ink); }
.notes-said li { margin: 3px 0; }
.notes-said li small { color: var(--muted); }
/* «احفظها كلها»: بعد بطاقتين أو أكثر تنتظر في رد واحد */
.save-all { margin: 6px 0 10px; }
.save-all[hidden] { display: none; }

/* كشف حساب حي برابط (صفحة الشخص): الرابط وزر إرساله، وردود كل رابط (موافق أو معترض) بكل ما يثبتها */
.live-links { margin-top: 14px; }
.live-links ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.live-link { padding: 10px 12px; border-radius: 12px; background: var(--card-2); }
.live-link .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-link .head b { flex: 1; min-width: 0; }
.live-link .tag { font-size: 14px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--card); color: var(--muted); }
.live-link .tag.agree { background: var(--in-soft); color: var(--in); }
.live-link .tag.dispute { background: var(--out-soft); color: var(--out); }
.live-link .tag.open { background: var(--accent-soft); color: var(--accent); }
.live-link .proof { margin: 6px 0 0; font-size: 14px; color: var(--muted); display: grid; gap: 2px; }
.live-link .proof .note { color: var(--ink); font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.link-box { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.link-box input { flex: 1; min-width: 0; direction: ltr; font-size: 15px; }

/* التقارير بعملة: أزرار العملات فوق الأرقام */
.report-currency { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 2px 12px; }
.report-currency .label { font-weight: 700; color: var(--muted); }
.report-currency .seg { flex: 1 1 220px; }
.report-currency + .hint { margin: -6px 4px 12px; }

/* امسح كل شيء (الإعدادات) */
.danger-zone { border-color: var(--out); }
.danger-zone h2 { color: var(--out); }
.wiped-box { border-color: var(--accent); }

/* ------------------------------------------------------------ الإشعارات (0.48.0، js/notices.js)
   رقم الجديد على زر القائمة وفي القائمة، وبطاقة «إشعارات جديدة» في الرئيسية، وشاشة «الإشعارات» */
.top .menu { position: relative; }
.notice-badge {
  position: absolute; top: 3px; inset-inline-end: 1px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--out); color: #fff; font: 700 12px/20px var(--font); text-align: center; pointer-events: none;
}
.notice-badge[hidden] { display: none; }
/* زر الإشعارات في الشريط العلوي (0.51.0، طلب المالك): بجانب زر المساعد في كل الشاشات، وعليه عدد الجديد */
.top .top-bell {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  color: var(--ink); text-decoration: none;
}
.top .top-bell:hover { background: var(--card-2); }
.top .top-bell[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.top .top-teach { flex: none; height: 48px; border-radius: 14px; display: flex; align-items: center; gap: 8px; padding: 0 14px; font-size: 16px; font-weight: 700; color: var(--ink); background: var(--brand-soft); border: none; }
.top .top-teach:hover { background: var(--brand-2); }
/* على الشاشات الصغيرة: أيقونة فقط بدون نص لتوفير المساحة */
@media (max-width: 640px) {
  .top .top-teach { padding: 0 12px; font-size: 20px; gap: 0; }
  .top .top-teach .top-teach-word { display: none; }
}
.drawer nav .notice-badge, .sidenav nav .notice-badge { position: static; margin-inline-start: auto; }
.notice-list { display: grid; gap: 8px; }
.notice-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; color: inherit; text-decoration: none;
}
.notice-item.new { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.notice-item .notice-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notice-item .notice-text span { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.notice-item .notice-text small { color: var(--muted); font-size: 13px; }
.notices-home { margin-bottom: 14px; border-color: var(--accent); }
.notices-home > .row svg { color: var(--accent); width: 22px; height: 22px; }

/* ===== 0.49.0: البرنامج على الهاتف (pwa.js): بطاقة إشعارات الجهاز، والتثبيت، وخطوات الآيفون ===== */
.device-card { margin-bottom: 12px; }
.device-card > p:first-child { margin-top: 0; }
.device-title { display: flex; align-items: center; gap: 6px; font-weight: 700; margin: 0 0 6px; }
.device-title svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.device-title.ok svg { color: var(--in); }
.device-card .check { margin: 8px 0 0; }
.ios-steps { margin: 8px 0 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.7; }
.ios-steps svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--accent); }
.install-card { margin-bottom: 14px; border-color: var(--accent); }
.install-card .install-icon { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.pwa-live:empty { display: none; }
/* «ملاحظاتي» بلا إنترنت (offline.js): على الهاتف حتى يعود الاتصال */
ul.notes .note.local { border-style: dashed; border-color: var(--sun); }
ul.notes .note .local-tag { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; color: var(--sun); font-weight: 700; }
ul.notes .note .local-tag svg { width: 14px; height: 14px; }
ul.notes .note .local-err { color: var(--out); font-weight: 700; }
.notice.offline-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.notice.offline-note svg { width: 20px; height: 20px; flex: none; margin-top: 3px; }
/* «شارك إلى مؤكد» (screens/share.js) */
.share-list { list-style: none; padding: 8px 12px; margin: 0 0 12px; display: grid; gap: 8px; }
.share-item { display: flex; align-items: center; gap: 12px; }
.share-item b { display: block; overflow-wrap: anywhere; }
.share-item small { color: var(--muted); font-size: 13px; }
.share-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.share-ico { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.share-ico svg { width: 28px; height: 28px; }
.share-text { margin-bottom: 12px; }
.share-actions { display: grid; gap: 8px; margin: 12px 0; justify-items: stretch; }
.share-actions > .btn.small { justify-self: center; }

/* قفل البرنامج برمز PIN (0.56.6) */
.pin-lock { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: grid; place-items: center; padding: 24px 16px;
  overflow: auto; animation: pin-in .18s ease; }
@keyframes pin-in { from { opacity: 0; } to { opacity: 1; } }
.pin-inner { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pin-brand img { width: 64px; height: 64px; }
.pin-lock h1 { font-size: 22px; margin: 6px 0 0; }
.pin-ask { color: var(--muted); margin: 0 0 6px; }
/* الرمز في خانة واحدة بلوحة أرقام الهاتف (0.60.0، طلب المالك؛ كانت أزرار أرقام خاصة) */
.pin-field { width: 100%; max-width: 260px; text-align: center; font-size: 28px; letter-spacing: 12px; padding: 12px 14px; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; }
.pin-field:disabled { opacity: .5; }
.pin-field.shake { animation: pin-shake .4s; }
@keyframes pin-shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.pin-err { color: var(--out); min-height: 20px; margin: 2px 0; font-size: 15px; }
.pin-open { max-width: 260px; margin-top: 4px; }
.pin-forgot { margin-top: 18px; }
/* «نسيت الرمز؟» داخل شاشة القفل (0.77.0): كلمة السر والرمز الجديد وتأكيده */
.pin-new { width: 100%; max-width: 260px; text-align: center; }
/* اختيار المدة في شاشة وضع الرمز */
.pin-timeouts { display: flex; flex-wrap: wrap; gap: 8px; }
.pin-to { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; cursor: pointer; }
.pin-to.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* وضع التعليم «علّمني كيف» (0.58.0) */
.teach-banner { position: fixed; top: 0; inset-inline: 0; z-index: 1500; display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; box-shadow: var(--shadow); }
.teach-banner svg { width: 20px; height: 20px; flex: none; }
.teach-banner-text { flex: 1; font-size: 15px; }
.teach-exit { background: rgba(255,255,255,.22); color: inherit; border: 0; border-radius: 99px; padding: 5px 16px; font-weight: 700; cursor: pointer; }
.teach-layer { position: fixed; inset: 0; z-index: 1600; pointer-events: none; }
.teach-ring { position: fixed; border: 3px solid var(--accent); border-radius: 12px; box-shadow: 0 0 0 4000px rgba(0,0,0,.4); transition: top .15s, left .15s, width .15s, height .15s; }
.teach-bubble { position: fixed; inset-inline: 16px; max-width: 440px; margin-inline: auto; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); pointer-events: auto; }
.teach-bubble { transform: translate(var(--dx, 0px), var(--dy, 0px)); }
/* 0.101.0: لا يطول المربع عن الشاشة أبدًا: نصّه يُمرَّر داخله، وأزراره ظاهرة دائمًا */
.teach-bubble { max-height: calc(100dvh - 16px); display: flex; flex-direction: column; }
.teach-bubble > p { overflow-y: auto; min-height: 0; flex: 0 1 auto; }
.teach-head { cursor: grab; touch-action: none; }
.teach-bubble.center { top: 50% !important; transform: translate(var(--dx, 0px), calc(-50% + var(--dy, 0px))); }
/* 0.96.0: رأس الفقاعة: العدّاد، وعلامة التحريك في الزاوية (يُمسك بها المربع ويُسحب حيث يشاء) */
.teach-head { display: flex; align-items: center; gap: 8px; margin: -4px -6px 2px 0; }
.teach-head .teach-count { flex: 1; margin: 0; }
.teach-drag { margin-inline-start: auto; width: 40px; height: 40px; border: 0; border-radius: 12px; cursor: grab; touch-action: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 22px; line-height: 1; }
.teach-drag:active { cursor: grabbing; }
.teach-bubble p { margin: 0 0 10px; font-size: 18px; line-height: 1.6; }  /* 0.67.0: أكبر، يُقرأ بلا جهد */
/* 0.67.0: عدّاد الخطوات، ويد تنقر على العنصر المُضاء */
.teach-count { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--accent); }
.teach-hand { position: fixed; width: 34px; height: 34px; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
  animation: teach-tap 1.1s ease-in-out infinite; transform-origin: 20% 10%; }
@keyframes teach-tap { 0%, 100% { transform: translate(0, 0) scale(1); } 45% { transform: translate(-3px, -6px) scale(.94); } }
@media (prefers-reduced-motion: reduce) { .teach-hand { animation: none; } }
.teach-acts { display: flex; gap: 8px; justify-content: flex-end; }
/* button.card (easy.css) يجعلها block: تُرفع الخصوصية لتبقى صفًّا فيه النجمة ثم السؤال بمسافة (0.63.0) */
button.teach-pick { display: flex; align-items: center; gap: 10px; text-align: start; font-weight: 700; cursor: pointer; width: 100%; }
.teach-pick svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
/* المرحلة الثانية (0.59.0): سؤال بالكلام، والعرض التلقائي */
.teach-ask { display: flex; gap: 8px; align-items: stretch; }
.teach-ask .input { flex: 1; min-width: 0; }
/* 0.69.0 (المرحلة C): السؤال بالصوت، وقراءة الفقاعة بصوت وزرّ إطفائها */
.teach-ask .mic.mini { align-self: center; }
.teach-heard { margin: 8px 2px 0; font-weight: 700; color: var(--ink); }
.teach-acts { align-items: center; }
.teach-voice { margin-inline-end: auto; width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card-2, var(--card)); color: var(--muted); cursor: pointer; padding: 0; }
.teach-voice[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.teach-voice svg { width: 22px; height: 22px; }
.teach-voice:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* 0.71.0 (المرحلة E): «لم أفهم؟ اسألني» بجانب «أرني الطريق من الرئيسية»، ونافذة السؤال الجانبي */
.teach-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; }
.teach-links .teach-home, .teach-links .teach-what { margin: 0 0 4px; }
.teach-step-quote { margin: 0 0 10px; padding-inline-start: 10px; border-inline-start: 3px solid var(--line); color: var(--muted);
  font-size: 15px; line-height: 1.6; }
.teach-asking .teach-ask { margin-bottom: 8px; }
.teach-asking .teach-acts { justify-content: flex-start; }
/* «هل أريك كيف؟» (0.71.0، struggle.js): سطرٌ صغير فوق الشريط السفلي، لا يغطي العملية */
/* فوق الشريط السفلي وزرّ «تكلّم» البارز فوقه، وعلى الحاسوب (لا شريط سفلي في v3 من 1100px) في أسفل الصفحة */
.struggle-bar { position: fixed; inset-inline: 12px; bottom: calc(126px + env(safe-area-inset-bottom, 0px)); z-index: 1200; max-width: 520px;
  margin-inline: auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--card);
  color: var(--ink); border: 1px solid var(--accent); box-shadow: var(--shadow); animation: struggle-in .18s ease-out; }
.struggle-bar span { flex: 1; font-weight: 700; line-height: 1.5; }
@keyframes struggle-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 1100px) { .v3 .struggle-bar { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .struggle-bar { animation: none; } }
/* زرّ «أوقف الصوت» العائم لا يظهر في الشرح: في الفقاعة زرّها، فلا يغطي العنصر المُضاء */
html.teaching .stop-voice { display: none !important; }
/* 0.65.0: في وضع التعليم مساحة فارغة أسفل الصفحة، فيرتفع آخر زرّ فيها فوق الشريط السفلي حين يُضاء (teach.js: reveal) */
html.teaching #view { padding-bottom: 40vh; }
.teach-done { margin: 6px 0 12px; padding-inline-start: 22px; line-height: 1.7; }
.teach-done li { margin-bottom: 4px; }
.teach-done small { color: var(--muted); }
/* 0.61.0: الشريط لا يغطّي الشريط العلويّ (وفيه زرّ القائمة ☰ الذي يُبرزه الشرح): تُزاح الصفحة تحته بارتفاعه */
.teach-banner { height: 44px; box-sizing: border-box; padding-block: 0; }
html.teaching body { padding-top: 44px; }
html.teaching .top { top: 44px; }
html.teaching .ai-fab { margin-top: 44px; }
html.teaching .sidenav { top: 44px; }
/* والقائمة المنزلقة تحت الشريط: v2 من أعلى الصفحة (يُزاح أعلاها)، وv3 من أسفلها (يقصر أعلى ارتفاعها) */
html.teaching:not(.v3) .drawer { top: 44px; }
html.teaching.v3 .drawer { max-height: calc(92 * var(--vh) - 44px); }
.teach-acts .teach-prev:disabled { opacity: .45; }
/* سؤالٌ بزرّين (0.97.0): «نعم، أضف زبونًا» قد يطول، فيلتفّ الصف ولا يضيق الزر */
.teach-acts.teach-choice { flex-wrap: wrap; }
.teach-acts.teach-choice .teach-yes { flex: 1 1 auto; white-space: nowrap; }
/* 0.62.0: الشرح من مكان المستخدم، وفي أول خطوة «أرني الطريق من الرئيسية» لمن يريد الطريق كاملًا */
.teach-home, .teach-what { display: block; margin: 0 0 6px; padding: 6px 0; background: none; border: 0; color: var(--accent); font: inherit; min-height: 40px;
  font-size: 14px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ======================================================= 0.60.0: صورة الصنف، والبطاقة كلها زرّ */
/* المصغّرة مكان دائرة الحرف الأول: مربّع بحواف مستديرة أكبر قليلًا منها، فتبقى الأسماء على خطّ واحد (طلب المالك) */
.item-thumb { width: 56px; height: 56px; flex: none; border-radius: 14px; object-fit: cover; background: var(--card-2); border: 1px solid var(--line); display: block; }
.item-thumb.big { width: 84px; height: 84px; border-radius: 18px; }
.item-thumb-btn { padding: 0; border: 0; background: none; flex: none; cursor: zoom-in; border-radius: 18px; }
.item-photo-big { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: 16px; background: var(--card-2); margin: 0 0 12px; }
/* البطاقة كلها تفتح التفاصيل (stock.js: tapCard) */
.card.tap-card { cursor: pointer; }
.card.tap-card:active { background: var(--card-2); }

/* «الميزانية العمومية» و«جدول النتائج» (0.60.0، screens/statements.js) */
.statement .moves li.st-head { min-height: 0; padding-top: 14px; border-bottom: 0; font-weight: 800; color: var(--muted); font-size: 15px; }
.statement .moves li.st-group .what { font-weight: 700; }
.statement .moves li:not(.st-group):not(.total):not(.st-head) .what { font-weight: 400; }
.statement .moves li.total.st-sub { font-size: 17px; border-top: 1px solid var(--line); }
.statement .moves li.total.st-sub .m { font-size: 17px; }
.statement + .statement { margin-top: 12px; }

/* «شاهد شرح هذا القسم» (0.60.0، videos.js): زرّ مستطيل بعرض الشاشة أول كل قسم، مكان فيديو الشرح. هادئ حتى لا يزاحم القسم */
.video-help { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; margin: 0 0 12px; padding: 8px 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 55%, var(--card));
  color: var(--ink); text-align: start; font: inherit; font-weight: 700; cursor: pointer; }
.video-help .vh-ico { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.video-help .vh-ico svg { width: 16px; height: 16px; }
.video-help .vh-text { flex: 1; min-width: 0; }
.video-help small { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
.video-help-player { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }

/* ======================================================= 0.64.0: الإعدادات قوائم مجمّعة (كإعدادات الهاتف)
   كل مجموعة: عنوان صغير ثم بطاقة واحدة فيها الأسطر بفواصل رفيعة. السطر: أيقونة ملوّنة، الاسم، القيمة الحالية تحته، ثم سهم
   (أو مفتاح أو زر). ارتفاعه 64px على الأقل، فيُضغط بالإبهام بسهولة. السهم يشير إلى اليسار (إلى الأمام في العربية) */
.set-group { margin: 0 0 24px; max-width: 760px; }  /* على الحاسوب لا يبتعد السهم عن الاسم */
.set-title { margin: 0 6px 8px; font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.set-list { background: var(--surface, var(--card)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.set-list > * + * { border-top: 1px solid var(--line); }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 14px; margin: 0; box-sizing: border-box;
  background: none; border: 0; border-radius: 0; font: inherit; color: inherit; text-align: start; text-decoration: none; }
.set-row.toggle { cursor: pointer; }
a.set-row, a.set-row:visited, .v3 a.set-row { color: var(--ink); }  /* سطر «إشعارات هذا الجهاز» رابط: بلون النص لا لون الروابط */
.set-row.go { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .15s; }
.set-row.go:hover { background: var(--surface-2, var(--card-2)); }
.set-row.go:active { background: var(--surface-3, var(--card-2)); }
.set-row.go:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.set-row.go::after { content: ''; flex: none; width: 8px; height: 8px; margin-inline-start: 2px; border-left: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg); opacity: .7; }
.set-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.set-ico svg { width: 20px; height: 20px; }
.set-ico.in { background: var(--in-soft); color: var(--in); }
.set-ico.out { background: var(--out-soft); color: var(--out); }
.set-ico.spend { background: var(--spend-soft); color: var(--spend); }
.set-ico.stock { background: var(--stock-soft); color: var(--stock); }
.set-ico.work { background: var(--work-soft); color: var(--work); }
.set-text { flex: 1; min-width: 0; }
.set-text b { display: block; font-size: 16px; font-weight: 700; line-height: 1.45; }
.set-text small { display: block; margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.set-row.danger b { color: var(--out); }
.set-row .btn.small { flex: none; }
/* سطرٌ يُختار في مكانه: الاسم فوق، والأزرار المتلاصقة تحته بعرض البطاقة */
.set-block { padding: 12px 14px 14px; }
.set-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.set-block .seg button { min-height: 48px; }
/* المفتاح: يمين = مُطفأ، يسار = مُفعَّل (اتجاه العربية) */
.set-switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 52px; height: 32px; margin: 0; border-radius: 99px;
  background: var(--line); cursor: pointer; transition: background-color .2s; }
.set-switch::before { content: ''; position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.set-switch:checked { background: var(--in); }
.set-switch:checked::before { transform: translateX(-20px); }
.set-switch:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.set-switch:disabled { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .set-switch, .set-switch::before, .set-row.go { transition: none; } }
/* نافذة الخيارات: كل خيار سطرٌ بدائرة اختيار، والمختار بلون البرنامج */
.set-opts { display: grid; gap: 8px; }
.set-opt { display: flex; align-items: flex-start; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; box-sizing: border-box; border: 2px solid var(--line);
  border-radius: 14px; background: var(--surface, var(--card)); font: inherit; color: inherit; text-align: start; cursor: pointer; }
.set-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.set-opt:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.set-radio { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.set-opt.on .set-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px); }

/* ------------------------------------------------------------ السجل (0.75.0): «كامل السجل» و«العمليات المسجلة» بأبوابها
   (screens/log.js وoperations.js). أزرار الانتقال روابطُ بشكل أزرار .tabs نفسه */
.tabs a { flex: 1; min-height: 48px; display: grid; place-items: center; padding: 4px 8px; border-radius: 12px; text-decoration: none;
  font-weight: 700; color: var(--muted); text-align: center; line-height: 1.3; }
.tabs a[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.log-choices { display: grid; gap: 12px; }
@media (min-width: 760px) { .log-choices { grid-template-columns: 1fr 1fr; } }
.log-choice { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; color: inherit; text-decoration: none; }
.log-choice:hover { border-color: var(--accent); }
.log-choice-ico { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft);
  color: var(--accent); font-size: 26px; }
.log-choice-text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.log-choice-text b { font-size: 19px; }
.log-choice-text small { color: var(--muted); font-size: 15px; line-height: 1.7; }
.log-choice .row3-chev { flex: none; color: var(--muted); display: grid; }
.ops-groups { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-top: 6px; }
.ops-group { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ico text" "ico n"; column-gap: 12px; row-gap: 2px;
  align-items: center; min-width: 0; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; color: inherit;
  text-decoration: none; }
.ops-group:hover { border-color: var(--tone); }
.ops-group-ico { grid-area: ico; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--tone-soft);
  color: var(--tone); font-size: 22px; }
.ops-group-text { grid-area: text; display: grid; gap: 2px; min-width: 0; }
.ops-group-text b { font-size: 17px; }
.ops-group-text small { color: var(--muted); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.ops-group-n { grid-area: n; font-size: 14px; font-weight: 700; color: var(--tone); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.search-row { display: flex; gap: 8px; margin: 10px 0; }
.search-row .input { flex: 1; min-width: 0; }
.search-row .btn { flex: none; }
.ops-sub { margin: 0 2px 8px; }

/* لغات الواجهة (0.79.0، i18n.js): الصفحة مخفية حتى يصل قاموس اللغة (لا يومض نص عربي)، وأزرار اللغة في شاشة الدخول */
html.i18n-wait body { visibility: hidden; }
.lang-pick { justify-content: center; margin-top: 18px; }
.lang-pick button, .seg[data-i18n="off"] button { font-family: inherit; }
/* من اليسار إلى اليمين: أيقونات الاتجاه تنقلب (الرجوع يشير يسارًا، والسهم في آخر السطر يمينًا، وطائرة الإرسال يمينًا) */
[dir="ltr"] svg[data-icon="back"], [dir="ltr"] svg[data-icon="chevron"], [dir="ltr"] svg[data-icon="send"] { transform: scaleX(-1); }
[dir="ltr"] .box-row .chev svg { transform: none; }
[dir="ltr"] .set-row.go::after { transform: rotate(-135deg); }
/* المفتاح من اليسار إلى اليمين: يسار = مُطفأ، يمين = مُفعَّل (عكس العربية) */
[dir="ltr"] .set-switch::before { right: auto; left: 3px; }
[dir="ltr"] .set-switch:checked::before { transform: translateX(20px); }
/* «العمليات المسجلة» (0.80.0): الأبواب تبويبات تلتفّ على أكثر من سطر، في كلٍّ منها أيقونته واسمه وعدد عملياته */
.tabs.ops-tabs { flex-wrap: wrap; }
.tabs.ops-tabs a { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 12px; white-space: nowrap; }
.tabs.ops-tabs a svg { width: 18px; height: 18px; flex: none; }
.tabs.ops-tabs a small { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--card-2); color: var(--muted); }
.tabs.ops-tabs a[aria-selected="true"] small { background: var(--in-soft, var(--card-2)); color: var(--in, var(--ink)); }
.tabs.ops-tabs a.none { opacity: .6; }
/* تقييم الرد (0.80.0، talk.js): إبهامان صغيران في الفراغ بجانب فقاعة المساعد، بموضع مطلق فلا يتغيّر حجم شيء ولا مكانه.
   باهتان حتى يُلمسا، والمختار يتلوّن والآخر يختفي */
.reply-row { position: relative; }
.rate { position: absolute; inset-inline-end: calc(100% + 2px); bottom: 2px; display: flex; flex-direction: column; gap: 0; }
.rate button { appearance: none; border: 0; background: none; margin: 0; padding: 3px; width: 24px; height: 22px; display: grid; place-items: center;
  color: var(--muted); opacity: .38; cursor: pointer; border-radius: 8px; transition: opacity .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.rate button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rate button.down svg { transform: rotate(180deg); }
.rate button:hover, .rate button:focus-visible { opacity: 1; }
.rate button:focus-visible { outline: 2px solid var(--focus); }
.rate.rated button { opacity: 0; pointer-events: none; }
.rate.rated button[aria-pressed="true"] { opacity: 1; pointer-events: auto; }
.rate button.up[aria-pressed="true"] { color: var(--in); }
.rate button.down[aria-pressed="true"] { color: var(--out); }
/* «افحص دفاتري» (screens/audit.js): بطاقة لكل ملاحظة بلون درجتها على حافتها، وتحتها «أين حدثت؟» قائمة تُفتح */
.audit-head h2 { margin: 0 0 6px; font-size: 21px; display: flex; align-items: center; gap: 8px; }
.audit-head h2 svg { width: 24px; height: 24px; flex: none; }
.audit-head.clean h2 { color: var(--in); }
.audit-head.high h2 { color: var(--out); }
.audit-head .hint { margin: 0 0 10px; }
.audit-level { display: flex; align-items: center; gap: 8px; margin: 16px 2px 8px; }
.audit-card { margin-bottom: 12px; border-inline-start: 5px solid var(--line); }
.audit-card.high { border-inline-start-color: var(--out); }
.audit-card.medium { border-inline-start-color: var(--spend); }
.audit-card.info { border-inline-start-color: var(--muted); }
.audit-card h3 { margin: 0 0 6px; font-size: 19px; line-height: 1.4; }
.audit-card p { margin: 0 0 8px; line-height: 1.7; }
.audit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.audit-trace { border-top: 1px solid var(--line); margin-top: 4px; }
.audit-trace summary { min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; list-style: none; }
.audit-trace summary::-webkit-details-marker { display: none; }
.audit-trace summary svg { width: 18px; height: 18px; flex: none; }
.audit-trace summary::after { content: ""; width: 8px; height: 8px; margin-inline-start: auto; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .15s; }
.audit-trace[open] summary::after { transform: rotate(-135deg); }
.audit-trace ul { list-style: none; margin: 0; padding: 0; }
.audit-trace li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line);
  font-size: 16px; font-variant-numeric: tabular-nums; }
.audit-trace li.first .what { font-weight: 700; }
.audit-trace li small { grid-column: 1 / -1; color: var(--muted); font-size: 15px; line-height: 1.6; }
.audit-trace li .open { grid-column: 1 / -1; justify-self: start; min-height: 32px; display: inline-flex; align-items: center; font-size: 15px; }
.audit-trace li.usual { background: var(--card-2); border-radius: 10px; padding: 8px 10px; border-top: 0; margin-top: 6px; }
/* الرسالة السريعة تُسحب إلى الأسفل لتختفي (0.80.0، ui.js): السحب العمودي عليها لها لا للصفحة */
.toast { touch-action: pan-x; transition: transform .12s, opacity .12s; }

/* «التقارير المرئية» (screens/charts.js وchart.js): كل قسم بطاقة فيها رقمه ورسمه وجدول أرقامه. ألوان الرسوم من متغيرات
   البرنامج وحدها (data-tone)، فتتبع النهاري والليلي والتصميمين؛ والنص بلون النص لا بلون السلسلة. بلا حركة. */
.charts-note { margin: -4px 4px 12px; font-size: 15px; color: var(--muted); }
.chart-card { margin-bottom: 14px; min-width: 0; }
.chart-card h2 { margin: 0 0 2px; font-size: 21px; line-height: 1.4; }
.chart-card h3 { margin: 18px 0 2px; font-size: 18px; line-height: 1.4; }
.chart-card > .hint { margin: 2px 0 6px; line-height: 1.6; }
.chart-card .empty { margin-top: 8px; padding: 18px 12px; }
.chart-stats { display: flex; flex-wrap: wrap; gap: 4px 26px; margin: 6px 0 10px; }
.chart-stat small { display: block; font-size: 15px; color: var(--muted); }
.chart-stat b { font-size: 26px; line-height: 1.3; }
.chart-stat .ch-unit { font-size: 16px; font-weight: 400; color: var(--muted); }
.chart-toggle { margin: 6px 0 8px; }
.chart-toggle button { min-height: 44px; font-size: 15px; }
.chart { min-width: 0; }
.chart-box { width: 100%; min-width: 0; overflow: hidden; }
.chart [data-tone="accent"] { --tone: var(--accent); }
.chart [data-tone="gold"] { --tone: var(--gold); }
.chart [data-tone="in"] { --tone: var(--in); }
.chart [data-tone="out"] { --tone: var(--out); }
.chart [data-tone="spend"] { --tone: var(--spend); }
.chart [data-tone="stock"] { --tone: var(--stock); }
.chart [data-tone="work"] { --tone: var(--work); }
.ch-svg { display: block; max-width: 100%; touch-action: pan-y; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.ch-svg:focus { outline: none; }
.ch-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ch-fill { fill: var(--tone); }
.ch-hatch { fill: var(--card); opacity: .6; }
.ch-line { fill: none; stroke: var(--tone); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--tone); opacity: .1; }
.ch-dot { fill: var(--tone); stroke: var(--card); stroke-width: 2.5; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-zero { stroke: var(--muted); stroke-width: 1; }
.ch-track { fill: var(--card-2); }
.ch-band { fill: var(--accent-soft); }
.ch-hit { fill: transparent; cursor: pointer; }
.ch-tick { fill: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.ch-name { fill: var(--ink); font-size: 17px; }
.ch-row.other .ch-name { fill: var(--muted); }
.ch-row.other .ch-fill { fill: var(--muted); opacity: .6; }
.ch-num { fill: var(--ink); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 4px; font-size: 15px; color: var(--muted); }
.ch-leg, .ch-val { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ch-key { flex: none; width: 13px; height: 13px; border-radius: 3px; background: var(--tone); }
.ch-key.line { width: 18px; height: 3px; border-radius: 2px; }
.ch-key.hatched { background: repeating-linear-gradient(45deg, var(--tone) 0 3px, var(--card) 3px 5px); outline: 1px solid var(--tone); }
.chart-read { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; min-height: 38px; margin-top: 6px; padding: 5px 10px;
  font-size: 15px; background: var(--card-2); border-radius: 10px; }
.chart-read .ch-hint { color: var(--muted); }
.chart-read .ch-when { overflow-wrap: anywhere; }
.chart-nums { margin-top: 8px; border-top: 1px solid var(--line); }
.chart-nums summary { min-height: 46px; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); cursor: pointer; list-style: none; }
.chart-nums summary::-webkit-details-marker { display: none; }
.chart-nums summary::after { content: ""; width: 8px; height: 8px; margin-inline-start: auto; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); }
.chart-nums[open] summary::after { transform: rotate(-135deg); }
.chart-table { overflow-x: auto; max-width: 100%; }
.chart-table table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: start; font-weight: 400; }
.chart-table thead th { font-weight: 700; color: var(--muted); white-space: nowrap; }
.chart-table td.n, .chart-table thead th:not(:first-child) { text-align: end; white-space: nowrap; }
.chart-table tbody th { overflow-wrap: anywhere; }
.chart-table tr.total th, .chart-table tr.total td { font-weight: 700; border-bottom: 0; }
@media (min-width: 1000px) {
  .chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
  .chart-grid .chart-card { margin-bottom: 0; }
  .chart-grid .chart-card.wide { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .ch-svg * { transition: none; animation: none; } }

/* وصول الدعم (المرحلة 1، js/support.js وscreens/support.js): الشريط الثابت أعلى البرنامج ما دام الدعم داخلًا، وشاشاته الثلاث.
   الشريط فوق كل شيء إلا قفل الرمز، وما هو مثبّت أعلى الصفحة ينزل تحته بارتفاعه (--support-bar يضبطه support.js). */
.support-bar { position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 1900; display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 14px; padding-top: calc(6px + env(safe-area-inset-top)); font-size: 15px; line-height: 1.5;
  background: var(--out-soft); color: var(--ink); border-block-end: 2px solid var(--out); }
.support-bar.mine { background: #a3261f; color: #fff; border-block-end-color: #7d1a15; }
.support-bar .support-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.support-bar svg { flex: none; width: 20px; height: 20px; }
.support-bar .support-left { white-space: nowrap; font-variant-numeric: tabular-nums; }
.support-end { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border-radius: 99px;
  border: 2px solid var(--out); background: var(--card); color: var(--out); font: inherit; font-weight: 700; cursor: pointer; }
.support-bar.mine .support-end { border-color: #fff; background: #fff; color: #a3261f; }
.support-end svg { width: 16px; height: 16px; }
html.has-support-bar body { padding-block-start: var(--support-bar, 48px); }
html.has-support-bar .top { top: var(--support-bar, 48px); }
html.has-support-bar .sidenav { inset-block-start: var(--support-bar, 48px); }
html.has-support-bar :is(.ai-fab, .stop-voice, .teach-banner) { translate: 0 var(--support-bar, 48px); }
@media (min-width: 1100px) {  /* نافذة المساعد على الحاسوب (v3) عمود من تحت الشريط العلوي إلى آخر الصفحة */
  html.v3.has-support-bar .ai-window { top: calc(64 * var(--f) + 1px + var(--support-bar, 48px)); }
}
/* الدعم لا يكلّم المساعد ولا يكتب ملاحظات في حساب غيره (الخادم يرفضها): لا أزرار لها */
html.support-session :is(.ai-fab, .fab-slot, .dock .mic, .struggle-bar, .side-actions .btn.primary, .hero3-talk, .hero3-tip) { display: none !important; }
/* «يرى فقط»: لا أزرار تسجيل */
html.support-view :is(.side-actions, .hero3-btns) { display: none !important; }
.support-over { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.support-over .card { max-width: 440px; text-align: center; }
.support-over h1 { margin: 0 0 8px; font-size: 24px; }
.support-card { margin-bottom: 14px; }
.support-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 20px; }
.support-card h2 svg { flex: none; width: 22px; height: 22px; color: var(--out); }
.support-card.waiting { border: 2px solid var(--spend); }
.support-card.live { border: 2px solid var(--out); }
.support-line { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-block-end: 1px solid var(--line); }
.support-line:last-of-type { border-block-end: 0; }
.support-line > span { flex: none; min-width: 92px; color: var(--muted); font-size: 15px; }
.support-line > b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-code { margin: 6px 0 10px; padding: 18px 8px; border-radius: 16px; background: var(--card-2); text-align: center;
  font-size: clamp(34px, 11vw, 52px); font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.support-sections { margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.support-sections .set-row { min-height: 54px; }
.support-past { margin-bottom: 10px; }
.support-past p { margin: 8px 0 4px; overflow-wrap: anywhere; }

/* «غيّر الأسماء» (0.86.0، names.js): شريط ثابت في الأسفل فوق شريط الأقسام (في الأعلى كان يغطي العنوان وأزرار الشريط
   العلوي، وهي مما يُعاد تسميته)، وكل ما يُضغط عليه يظهر بخط متقطع */
.names-bar {
  position: fixed; inset-inline: 10px; bottom: calc(var(--dock, 0px) + 10px + env(safe-area-inset-bottom)); z-index: 39; /* تحت النوافذ (40) وفوق شريط الأقسام (30) */
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px;
  background: var(--accent); color: #fff; box-shadow: 0 8px 28px rgba(0, 0, 0, .22); font-weight: 700; line-height: 1.5;
}
.names-bar > span { flex: 1; }
.names-bar .btn { background: #fff; color: var(--accent); border-color: #fff; min-height: 44px; }
html.names-editing #app :is(button, a, h1, h2, h3, label, .set-text b) { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* رقم العملية (0.90.0): شارة صغيرة في الزاوية اليمنى العليا من العملية، والرقم نفسه في كل مكان تظهر فيه */
.opno { display: inline-block; unicode-bidi: isolate; padding: 0 8px; margin-inline-end: 6px; border-radius: 99px; font-size: 13px;
  font-weight: 700; line-height: 22px; vertical-align: 2px; background: var(--card-2); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.opno.big { font-size: 15px; line-height: 26px; padding: 0 10px; }
.op-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* عنوان القائمة وزر ترتيبها («الأحدث أولًا» أو «الأقدم أولًا») */
.list-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-head .section-title { flex: 1; min-width: 0; }
.list-head .order-btn { margin: 14px 0 2px; }
.order-row { display: flex; justify-content: flex-end; margin: 0 0 8px; }
/* رسالة قصيرة («تم الحفظ») ونافذة من الأسفل مفتوحة معًا (0.90.0، «هل تغيّر سعر البيع؟» بعد الحفظ): الرسالة في الأعلى فلا تغطي خانات النافذة */
body:has(.sheet) .toast { top: 76px; bottom: auto; }

/* «شجرة الحسابات (دفتر الأستاذ)» (0.91.0): الحساب ورمزه، ورصيده بكل عملة (مدين أو دائن) */
.bk-tree details { margin: 0; }
.bk-tree details > summary { list-style: none; cursor: pointer; }
.bk-tree details > summary::-webkit-details-marker { display: none; }
.bk-tree details > summary .bk-name::before { content: '▸'; display: inline-block; width: 16px; color: var(--muted); }
.bk-tree details[open] > summary .bk-name::before { content: '▾'; }
.bk-tree details > :not(summary) { margin-inline-start: 16px; }
.bk-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 16px; }
.bk-row .bk-name { flex: 1; min-width: 0; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.bk-group > .bk-name, details > summary > .bk-row .bk-name { font-weight: 700; }
.bk-code { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bk-bal { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.bk-bal .m, .bk-dc { font-variant-numeric: tabular-nums; }
.dr { color: var(--in); } .cr { color: var(--out); }
.bk-dc { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }

/* «علّمني» في الشاشات خارج الإطار (0.101.0، help.js): زرّ صغير أعلى الصندوق، وخطوات الشاشة في نافذة فوق كل شيء */
.login .box, .pin-lock { position: relative; }
.help-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font: 700 15px var(--font); cursor: pointer; }
.login .box > .help-btn { float: inline-end; margin-bottom: 6px; }
.pin-lock > .help-btn { position: absolute; top: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; }
.top .help-btn { margin-inline-start: auto; }
.sheet-back.over-lock { z-index: 2100; }
.sheet.over-lock { z-index: 2101; }
.help-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.help-step { width: 100%; text-align: start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card);
  color: var(--ink); font: 16px/1.6 var(--font); cursor: pointer; }
.help-flash { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; animation: help-flash 1s ease-in-out 3; }
@keyframes help-flash { 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .help-flash { animation: none; } }

/* اسم المنشأة بكل لغة (0.104.0): خانة لكل لغة وقبلها اسم اللغة */
.name-langs { display: grid; gap: 8px; }
.name-lang { display: flex; align-items: center; gap: 8px; }
.name-lang-tag { flex: 0 0 68px; font-size: 13px; font-weight: 700; color: var(--muted); }
.name-lang .input { flex: 1 1 auto; min-width: 0; }
