/* بسيط للأدوات — نظام التصميم الموحد. الأساس مأخوذ من تصميم «التذكيرات» (rem): hero متدرج، كروت، تابات، FAB، sheet.
   كل أداة تأخذ لونها بـ <body data-tool="..."> فقط (--brand / --brand-2 / --brand-soft). لا ألوان خارج هذا الملف. */
:root {
  --bg: #f3f6f7; --card: #ffffff; --ink: #14201f; --muted: #627371; --line: #dde6e6; --field: #f6f9f9;
  --amber: #b45309; --amber-soft: #fff1d6; --green: #047857; --green-soft: #d8f5e8; --red: #dc2626; --red-soft: #fde8e8;
  --shadow: 0 1px 2px rgba(20, 40, 50, .06), 0 6px 20px rgba(20, 40, 50, .07);
  --r: 18px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); --nav-h: 64px;
  /* accent: hub default */
  --brand: #334155; --brand-2: #64748b; --brand-soft: #e5eaf0; --glow: 51, 65, 85;
}
[data-tool="wa"]    { --brand: #15803d; --brand-2: #22c55e; --brand-soft: #dcf5e6; --glow: 21, 128, 61; }
[data-tool="rem"]   { --brand: #0f766e; --brand-2: #14b8a6; --brand-soft: #dff4f1; --glow: 15, 118, 110; }
[data-tool="send"]  { --brand: #c2410c; --brand-2: #f97316; --brand-soft: #ffe9dc; --glow: 194, 65, 12; }
[data-tool="ideas"] { --brand: #4338ca; --brand-2: #7c3aed; --brand-soft: #eceafd; --glow: 67, 56, 202; }
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1415; --card: #171e20; --ink: #e8f0f0; --muted: #94a6a8; --line: #263234; --field: #11181a;
    --amber: #fbbf24; --amber-soft: #3a2d10; --green: #34d399; --green-soft: #12332a; --red: #f87171; --red-soft: #3a1b1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
    --brand: #94a3b8; --brand-2: #64748b; --brand-soft: #1e2630;
  }
  [data-tool="wa"]    { --brand: #4ade80; --brand-2: #16a34a; --brand-soft: #123524; }
  [data-tool="rem"]   { --brand: #2dd4bf; --brand-2: #14b8a6; --brand-soft: #123532; }
  [data-tool="send"]  { --brand: #fb923c; --brand-2: #ea580c; --brand-soft: #3a2012; }
  [data-tool="ideas"] { --brand: #8b83ff; --brand-2: #a78bfa; --brand-soft: #26234a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, -apple-system, sans-serif; font-size: 16px; line-height: 1.55; min-height: 100vh; overscroll-behavior-y: contain; }
body.lock { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 40px + var(--safe-b)); }

/* hero */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; padding: calc(16px + var(--safe-t)) 0 22px; border-radius: 0 0 28px 28px; }
@media (prefers-color-scheme: dark) { .hero { color: #0b1112; } .hero .icon-btn, .hero .pill { color: #0b1112; } }
.hero .wrap { padding-bottom: 0; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero h1 { margin: 0; font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.hero h1 .logo { width: 36px; height: 36px; border-radius: 12px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 20px; }
.hero p { margin: 8px 0 10px; opacity: .92; font-size: 14.5px; }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; background: rgba(255, 255, 255, .2); font-size: 19px; display: grid; place-items: center; color: inherit; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .2); color: inherit; font-size: 13px; }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: #9ca3af; }
.pill.ok i { background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .3); } .pill.warn i { background: #fbbf24; } .pill.bad i { background: #f87171; }

/* tabs / cards / chips / buttons */
.tabs { display: flex; gap: 8px; margin: 16px 0 12px; overflow-x: auto; }
.tabs button { flex: 1; min-width: max-content; padding: 10px 12px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--muted); font-weight: 600; font-size: 14.5px; border: 2px solid transparent; }
.tabs button em { font-style: normal; margin-inline-start: 6px; background: var(--line); border-radius: 99px; padding: 1px 8px; font-size: 12.5px; }
.tabs button.on { color: var(--brand); border-color: var(--brand); } .tabs button.on em { background: var(--brand-soft); }
.list { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 6px solid var(--brand-2); }
.card.late { border-inline-start-color: var(--red); } .card.done { border-inline-start-color: var(--line); opacity: .85; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; color: var(--muted); font-size: 14.5px; } .meta b { color: var(--ink); }
.errline { margin-top: 6px; color: var(--red); font-size: 13px; word-break: break-word; }
.foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; } .sp { flex: 1; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.chip.ok { background: var(--green-soft); color: var(--green); } .chip.warn { background: var(--amber-soft); color: var(--amber); } .chip.bad { background: var(--red-soft); color: var(--red); } .chip.brand { background: var(--brand-soft); color: var(--brand); }
.mini { padding: 7px 11px; border-radius: 11px; background: var(--field); border: 1px solid var(--line); font-size: 13.5px; }
.mini.bad { color: var(--red); }
.btn { padding: 12px 18px; border-radius: 14px; background: var(--brand); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .btn { color: #0b1112; } }
.btn.ghost { background: var(--field); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .55; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; line-height: 2; }
.fab { position: fixed; inset-inline-start: 20px; bottom: calc(var(--nav-h) + 18px + var(--safe-b)); width: 62px; height: 62px; border-radius: 22px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-size: 32px; box-shadow: 0 8px 24px rgba(var(--glow), .45); z-index: 20; }

/* tool tiles (home) */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.tile { display: block; text-decoration: none; color: inherit; background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); border-inline-start: 6px solid var(--brand-2); min-height: 132px; }
.tile .ic { width: 46px; height: 46px; border-radius: 15px; background: var(--brand-soft); display: grid; place-items: center; font-size: 24px; }
.tile b { display: block; margin-top: 10px; font-size: 17px; } .tile small { color: var(--muted); font-size: 13px; line-height: 1.4; display: block; margin-top: 2px; }
.tile.soon { opacity: .6; } .tile:active { transform: scale(.98); }

/* forms + sheet */
.field { display: grid; gap: 6px; margin: 12px 0; } .field label { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 12px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--field); outline: none; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sheet-bg { position: fixed; inset: 0; background: rgba(5, 20, 18, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; opacity: 0; transition: opacity .18s; }
.sheet-bg.on { opacity: 1; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); transform: translateY(30px); transition: transform .2s; }
.sheet-bg.on .sheet { transform: none; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 26px; } }
.grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { margin: 4px 0 12px; font-size: 20px; }
#toast { position: fixed; inset-inline: 16px; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); margin: 0 auto; max-width: 420px; background: #111827; color: #fff; padding: 12px 16px; border-radius: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; }
#toast.on { opacity: 1; }

/* the shared bottom bar: switch between the hub and every tool (shell.js) */
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(6px + var(--safe-b)); box-shadow: 0 -4px 18px rgba(20, 40, 50, .06); }
.nav a { flex: 1; max-width: 120px; text-decoration: none; color: var(--muted); text-align: center; font-size: 11.5px; font-weight: 600; padding: 4px 2px; border-radius: 12px; display: grid; gap: 1px; justify-items: center; }
.nav a span { font-size: 21px; line-height: 1.2; }
.nav a.on { color: var(--c, var(--brand)); background: var(--cs, var(--brand-soft)); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 380px; background: var(--card); border-radius: 26px; box-shadow: var(--shadow); padding: 26px 22px; }
.login h1 { margin: 0 0 4px; font-size: 24px; } .login p { margin: 0 0 14px; color: var(--muted); }
.login .err { color: var(--red); min-height: 22px; font-size: 14px; }
.qrbox { text-align: center; padding: 10px; } .qrbox img { width: 260px; max-width: 100%; border-radius: 16px; background: #fff; padding: 8px; }
