/* =====================================================================
   «دفتر المزرعة» — طبقة الواجهة الجديدة فوق ui.css
   فكرة التصميم: ألوان الأرض (تربة، زرع، شمس)، صور كبيرة بدل الأيقونات الصغيرة،
   كلمات يومية بدل المصطلحات المحاسبية، وشريط عائم واحد على الجوال والكمبيوتر.
   ===================================================================== */

:root {
  --brand: #2f7d3b;
  --brand-700: #23632d;
  --brand-900: #173f1d;
  --brand-50: #eaf4e3;
  --brand-100: #d6eac9;
  --leaf: #6bb04a;
  --soil: #8a5a36;
  --soil-50: #f3e7d8;
  --sun: #f2b33d;
  --clay: #c8553d;
  --bg: #f6f1e6;
  --surface: #fffdf8;
  --text: #24301f;
  --muted: #6f7466;
  --border: #e8dfcd;
  --border-strong: #d6cab3;
  --success: #2f7d3b;
  --danger: #c8412d;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 0 rgba(90, 70, 30, .06), 0 6px 18px rgba(90, 70, 30, .07);
  --shadow-lg: 0 18px 50px rgba(50, 40, 10, .22);
  --dock-h: 76px;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}

/* ===== حجم الخط: ثلاث درجات يختارها المستخدم ===== */
html { font-size: 100%; }
html[data-fs="1"] { font-size: 112%; }
html[data-fs="2"] { font-size: 125%; }
body { font-size: 1.06rem; line-height: 1.65; background: var(--bg); }
.emo, .crop, .sun, .mood, .ph-emo { font-family: var(--emoji); line-height: 1; }

/* ===== الهيكل: لا قائمة جانبية — شريط علوي بسيط + شريط عائم سفلي ===== */
.sidebar { display: none !important; }
.shell {
  margin: 0 auto !important; max-width: 1180px; min-height: 100vh;
  padding: 1rem 1rem calc(var(--dock-h) + 2.2rem + var(--safe-b)) !important;
}
@media (min-width: 992px) { .shell { padding-inline: 2rem !important; } }

.topbar {
  display: flex !important; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 30;
  height: 64px; padding: 0 max(1rem, calc((100vw - 1180px) / 2 + 1rem));
  background: rgba(246, 241, 230, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.tb-farm { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 800; font-size: 1.08rem; min-width: 0; }
.tb-farm:hover { text-decoration: none; color: var(--text); }
.tb-logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--brand); font-size: 1.4rem; font-family: var(--emoji); flex-shrink: 0; }
.tb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-mid { flex: 1; text-align: center; color: var(--muted); font-weight: 700; font-size: .92rem; }
.tb-back {
  display: inline-flex; align-items: center; gap: .45rem; height: 46px; padding: 0 1rem 0 .9rem; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text); font-weight: 800; flex-shrink: 0;
}
.tb-back .arrow { font-size: 1.25rem; line-height: 1; }
.tb-back:hover { text-decoration: none; background: var(--brand-50); color: var(--brand-900); }
.tb-tools { display: flex; align-items: center; gap: .45rem; margin-inline-start: auto; flex-shrink: 0; }
.tb-btn {
  display: inline-flex; align-items: center; gap: .3rem; height: 44px; min-width: 44px; padding: 0 .75rem; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 800; cursor: pointer;
}
.tb-btn b { font-size: .85rem; line-height: 1; } .tb-btn b.big { font-size: 1.25rem; }
.tb-btn:hover { background: var(--brand-50); }
@media (max-width: 420px) { .tb-btn .lbl { display: none; } .tb-mid { display: none; } }
.tb-me {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--sun); color: #3a2800; font: inherit; font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}

/* الشريط العائم */
.bottomnav { display: none !important; }
.dock {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b)); width: min(560px, calc(100% - 20px)); height: var(--dock-h);
  display: flex; align-items: stretch; justify-content: space-around; padding: 0 .4rem;
  background: rgba(255, 253, 248, .97); border: 1px solid var(--border); border-radius: 26px;
  box-shadow: 0 10px 30px rgba(50, 40, 10, .18); backdrop-filter: blur(8px);
}
.dk-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); background: none; border: 0; font: inherit; font-weight: 800; font-size: .78rem; cursor: pointer; border-radius: 18px; margin: 6px 2px;
}
.dk-item .emo { font-size: 1.6rem; filter: grayscale(.35); transition: transform .15s, filter .15s; }
.dk-item:hover { text-decoration: none; color: var(--text); }
.dk-item.active { color: var(--brand-900); background: var(--brand-50); }
.dk-item.active .emo, .dk-item:hover .emo { filter: none; transform: scale(1.1); }
.dk-add { margin-top: -26px; }
.dk-add .plus {
  display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(160deg, var(--leaf), var(--brand)); color: #fff; font-size: 2.4rem; font-weight: 400; line-height: 1;
  border: 5px solid var(--bg); box-shadow: 0 8px 20px rgba(47, 125, 59, .45);
  animation: breathe 3.2s ease-in-out infinite;
}
.dk-add .lbl { color: var(--brand-900); }
@keyframes breathe { 0%, 100% { box-shadow: 0 8px 20px rgba(47, 125, 59, .45), 0 0 0 0 rgba(107, 176, 74, .45); } 50% { box-shadow: 0 8px 20px rgba(47, 125, 59, .45), 0 0 0 10px rgba(107, 176, 74, 0); } }
@media (prefers-reduced-motion: reduce) { .dk-add .plus { animation: none; } }

/* ===== رأس الصفحات الداخلية ===== */
.page-head { gap: .7rem; margin-bottom: 1.2rem; align-items: center; }
.page-head h1 { font-size: 1.5rem !important; width: auto !important; flex: 1; min-width: 0; }
.ph-emo { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); font-size: 1.8rem; flex-shrink: 0; box-shadow: var(--shadow); }
.ph-back { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text); font-size: 1.3rem; font-weight: 800; flex-shrink: 0; }
.ph-back:hover { text-decoration: none; background: var(--brand-50); }
.page-actions { width: 100%; }
.page-actions .btn-sm { min-height: 46px; padding-inline: 1rem; font-size: .98rem; border-radius: 14px; }
@media (max-width: 991.98px) { .page-head h1 { font-size: 1.3rem !important; } }

/* ===== المكونات العامة: أكبر وأوضح ===== */
.card { background: var(--surface); border-color: var(--border); border-radius: var(--radius); }
.card-header { font-size: 1.05rem; }
.btn { min-height: 50px; border-radius: 14px; font-size: 1.02rem; }
.btn-sm { min-height: 42px; font-size: .92rem; border-radius: 12px; }
.btn-lg { min-height: 58px; font-size: 1.15rem; }
.btn-success { background: var(--brand); }
.btn-success:hover { background: var(--brand-700); }
.form-label { font-size: 1rem; color: var(--text); margin-bottom: .4rem; }
.form-control, .form-select { min-height: 54px; font-size: 1.08rem; border-radius: 14px; border-width: 1.5px; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(107, 176, 74, .22); }
.form-control-sm, .form-select-sm { min-height: 44px; font-size: 1rem; }
.form-text { font-size: .9rem; }
.form-check-input { width: 1.5rem; height: 1.5rem; }
details.more { border-radius: var(--radius-sm); background: rgba(255, 255, 255, .5); }
.table { font-size: 1rem; }
.table thead th { background: #f4eee2; color: #5d5a4c; font-size: .88rem; }
.filters { background: var(--surface); }
@media (max-width: 991.98px) {
  .form-actions { bottom: calc(var(--dock-h) + 10px + var(--safe-b)) !important; background: rgba(255, 253, 248, .97) !important; }
  .table.cards tr { background: var(--surface); border-radius: 18px; }
  .table.cards td:first-child { font-size: 1.1rem; }
  .table.cards td::before { font-size: .8rem; }
}
.badge { font-size: .82rem; }

/* رسالة النجاح بعد الحفظ */
.alert { border-radius: 16px; font-size: 1.02rem; }
.toast-ok { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; font-weight: 700; animation: pop .35s ease-out; }
.ok-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 1.3rem; font-weight: 800; flex-shrink: 0; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== النوافذ المنبثقة ===== */
.sheet-panel { background: var(--bg); border-radius: 28px 28px 0 0; }
@media (min-width: 992px) { .sheet-panel { border-radius: 28px; width: min(720px, 92vw); max-height: 86vh; } }
.sheet-title { font-size: 1.3rem; }
.sheet-title small { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); }
.sheet-title .who { display: flex; align-items: center; gap: .7rem; }
.sheet-title .who .tb-me { cursor: default; }
.sheet-close { width: 44px; height: 44px; background: var(--surface); border: 1px solid var(--border); }
.menu-group { font-size: .95rem; color: var(--text); margin: 1.1rem .2rem .5rem; }
.menu-list { display: grid; gap: .45rem; }
@media (min-width: 768px) { .menu-list { grid-template-columns: 1fr 1fr; } }
.menu-row {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; min-height: 64px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; color: var(--text);
}
.menu-row:hover { text-decoration: none; color: var(--text); border-color: var(--leaf); background: #fff; }
.menu-row.active { border-color: var(--brand); box-shadow: inset -4px 0 0 var(--brand); }
.menu-row .emo { font-size: 1.8rem; width: 44px; text-align: center; }
.menu-row .tx { flex: 1; min-width: 0; line-height: 1.35; }
.menu-row .tx > b { display: block; font-size: 1.05rem; }
.menu-row .tx small { color: var(--muted); font-size: .85rem; }
.menu-row .go { color: var(--muted); font-size: 1.2rem; }
.menu-row.danger b { color: var(--danger); }

/* ===== بطاقات «ماذا حدث؟» ===== */
.tiles { gap: .75rem; }
.tile {
  position: relative; min-height: 120px; gap: .35rem; padding: 1rem .6rem; border-radius: 22px; border: 1.5px solid transparent;
  font-size: 1rem; box-shadow: var(--shadow); background: var(--surface); overflow: hidden;
}
.tile:hover { transform: translateY(-2px); border-color: rgba(0, 0, 0, .08); }
.tile:active { transform: scale(.97); }
.tile .emo { font-size: 2.3rem; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .12)); }
.tile .tl { font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.tile .th { color: var(--muted); font-size: .8rem; font-weight: 500; line-height: 1.3; }
.tile.t-red { background: #fdeee9; } .tile.t-green { background: #eaf4e3; } .tile.t-blue { background: #e8f1fb; }
.tile.t-amber { background: #fdf3dc; } .tile.t-teal { background: #e3f4f1; } .tile.t-purple { background: #f1ebfa; } .tile.t-slate { background: #eeece5; }
.sheet .tile { box-shadow: none; }
.tiles.big { grid-template-columns: repeat(2, 1fr); gap: .85rem; }
.tiles.big .tile { min-height: 158px; }
.tiles.big .tile .emo { font-size: 3.2rem; }
.tiles.big .tile .tl { font-size: 1.2rem; }
.tiles.big .tile .th { font-size: .88rem; }
@media (min-width: 768px) { .tiles.big { grid-template-columns: repeat(4, 1fr); } .tiles.big .tile { min-height: 180px; } }
.tiles.pick { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 520px) { .tiles.pick { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px) { .tiles.pick { grid-template-columns: repeat(4, 1fr); } .sheet .tiles.pick { grid-template-columns: repeat(3, 1fr); } }

/* ===== الرئيسية ===== */
.sky {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.4rem 1.3rem 3.2rem; border-radius: 28px; margin-bottom: 1rem; color: #1f2a1a;
  background: linear-gradient(180deg, #bfe3f5 0%, #e7f4ea 100%);
}
.sky-noon { background: linear-gradient(180deg, #9fd3f1 0%, #e9f6e8 100%); }
.sky-evening { background: linear-gradient(180deg, #f6c08a 0%, #f9e3c4 100%); }
.sky-night { background: linear-gradient(180deg, #2c3b63 0%, #51608a 100%); color: #fff; }
.sky .sun { font-size: 3.2rem; animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .sky .sun { animation: none; } }
.sky-text { flex: 1 1 calc(100% - 5rem); min-width: 0; position: relative; z-index: 1; }
@media (min-width: 700px) { .sky-text { flex: 1 1 0; } }
@media (max-width: 699.98px) { .say-btn { margin-inline-start: 4.2rem; } }
.sky h1 { font-size: 1.65rem; margin: 0; }
.sky .date { font-size: .98rem; opacity: .8; font-weight: 600; }
.hills {
  position: absolute; inset-inline: 0; bottom: 0; height: 46px; pointer-events: none;
  background:
    radial-gradient(120% 90px at 25% 100%, #7cbf5a 60%, transparent 61%),
    radial-gradient(110% 80px at 85% 100%, #5ea544 60%, transparent 61%);
}
.say-btn {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .45rem; height: 50px; padding: 0 1.2rem;
  border-radius: 999px; border: 0; background: rgba(255, 255, 255, .85); color: #1f2a1a; font: inherit; font-weight: 800; font-size: 1.02rem; cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}
.say-btn span { font-family: var(--emoji); font-size: 1.3rem; }
.say-btn.on { background: var(--sun); }

.install-banner { background: linear-gradient(135deg, var(--brand), var(--leaf)); border-radius: 20px; }
.install-banner .emo { font-size: 2rem; }

/* المحفظة: حساب الشهر بجملة بسيطة وأشرطة */
.purse { background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 1.15rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.purse-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.purse-head .mood { font-size: 2.6rem; }
.purse-title { font-weight: 800; font-size: 1.15rem; }
.purse-say { color: var(--muted); font-weight: 600; }
.flow { display: grid; gap: .55rem; }
.flow-row { display: grid; grid-template-columns: 7.2rem 1fr auto; align-items: center; gap: .7rem; color: var(--text); padding: .35rem .2rem; border-radius: 12px; }
.flow-row:hover { text-decoration: none; color: var(--text); background: #faf6ee; }
.fl-lbl { font-weight: 800; white-space: nowrap; }
.fl-lbl span { font-family: var(--emoji); }
.fl-bar { height: 18px; background: #f1ebde; border-radius: 99px; overflow: hidden; }
.fl-bar i { display: block; height: 100%; border-radius: 99px; min-width: 6px; }
.in .fl-bar i { background: linear-gradient(90deg, var(--brand), var(--leaf)); }
.out .fl-bar i { background: linear-gradient(90deg, var(--clay), #e58a5f); }
.fl-val { font-weight: 800; font-size: 1.1rem; min-width: 6.5rem; text-align: end; }
.net { display: flex; align-items: center; justify-content: space-between; margin-top: .8rem; padding: .85rem 1rem; border-radius: 18px; font-weight: 800; }
.net b { font-size: 1.55rem; } .net small { font-size: .9rem; }
.net.pos { background: var(--brand-50); color: var(--brand-900); }
.net.neg { background: #fbe6e0; color: #8f2a1a; }
.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; margin-top: .8rem; }
@media (min-width: 768px) { .chips { grid-template-columns: repeat(4, 1fr); } }
.purse > .chips:first-child { margin-top: 0; }
.chip { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border-radius: 16px; background: #faf6ee; border: 1px solid var(--border); color: var(--text); line-height: 1.3; font-size: .9rem; font-weight: 600; }
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--leaf); }
.chip > span:first-child { font-family: var(--emoji); font-size: 1.6rem; }
.chip b { display: block; font-size: 1.1rem; font-weight: 800; }

.ask { font-size: 1.6rem; margin: 1.6rem 0 .1rem; }
.ask-sub { color: var(--muted); margin-bottom: .9rem; font-weight: 600; }
.more-acts { margin-top: .8rem; }
.more-acts > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 56px;
  border-radius: 18px; border: 2px dashed var(--border-strong); font-weight: 800; font-size: 1.05rem; color: var(--brand-900); margin-bottom: .8rem;
}
.more-acts > summary::-webkit-details-marker { display: none; }
.more-acts > summary::before { content: '＋'; font-size: 1.2rem; }
.more-acts[open] > summary::before { content: '－'; }
.more-acts .cnt { background: var(--brand-50); padding: 0 .55rem; border-radius: 99px; font-size: .9rem; }

.sec { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; margin: 1.8rem 0 .8rem; }
.sec > span:first-child { font-family: var(--emoji); }
.sec .pill { background: var(--clay); color: #fff; font-size: .85rem; padding: .05rem .55rem; border-radius: 99px; }
.sec-link { margin-inline-start: auto; font-size: .95rem; font-weight: 700; }

.notes { display: grid; gap: .6rem; }
@media (min-width: 768px) { .notes { grid-template-columns: 1fr 1fr; } }
.note {
  display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; border-radius: 20px; background: var(--surface);
  border: 1px solid var(--border); border-inline-start: 6px solid var(--sun); color: var(--text); box-shadow: var(--shadow);
}
.note:hover { text-decoration: none; color: var(--text); }
.note-danger { border-inline-start-color: var(--clay); }
.note-info { border-inline-start-color: #5b9bd5; }
.note .emo { font-size: 2rem; }
.note .tx { flex: 1; min-width: 0; line-height: 1.4; }
.note .tx > b { display: block; font-size: 1.05rem; }
.note .tx small { color: var(--muted); font-size: .9rem; }
.note .go { font-size: 1.3rem; color: var(--muted); }
.calm { margin-top: 1.4rem; padding: 1rem 1.1rem; border-radius: 20px; background: var(--brand-50); color: var(--brand-900); font-weight: 800; }
.calm span { font-family: var(--emoji); }

/* خريطة المزرعة: كل حقل قطعة أرض */
.farm-map { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 768px) { .farm-map { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .farm-map { grid-template-columns: repeat(4, 1fr); } }
.plot {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .15rem; min-height: 170px;
  padding: .9rem; border-radius: 22px; color: var(--text); border: 2px solid rgba(0, 0, 0, .04); box-shadow: var(--shadow);
}
.plot:hover { text-decoration: none; color: var(--text); transform: translateY(-2px); }
.plot .soil { position: absolute; inset: 0; z-index: 0; opacity: .9; }
.plot > :not(.soil) { position: relative; z-index: 1; }
.plot-growing .soil { background: repeating-linear-gradient(-12deg, #dcefcf 0 14px, #cbe5b8 14px 28px); }
.plot-harvesting .soil { background: repeating-linear-gradient(-12deg, #f8e7b4 0 14px, #f1d891 14px 28px); }
.plot-planned .soil { background: repeating-linear-gradient(-12deg, #efdfca 0 14px, #e5d0b4 14px 28px); }
.plot-rest .soil { background: radial-gradient(circle, #e6d8c2 1.5px, transparent 2px) 0 0 / 14px 14px, #f3ebdd; }
.plot-empty { border: 2px dashed var(--border-strong); box-shadow: none; }
.plot-empty .soil { background: #fbf8f1; }
.plot .crop { font-size: 2.4rem; margin-bottom: .2rem; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .15)); }
.pl-name { font-weight: 800; font-size: 1.12rem; line-height: 1.3; }
.pl-meta { font-size: .9rem; font-weight: 600; color: #4f5545; }
.pl-foot { margin-top: auto; padding-top: .4rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; font-size: .85rem; }
.pl-foot .area { background: rgba(255, 255, 255, .7); padding: .1rem .5rem; border-radius: 99px; font-weight: 700; }
.pl-profit { font-weight: 800; background: rgba(255, 255, 255, .8); padding: .1rem .5rem; border-radius: 99px; }
.pos { color: var(--brand-700); } .neg { color: var(--danger); }
.legend { margin-top: .6rem; color: var(--muted); font-size: .9rem; }
.legend span { font-weight: 800; margin-inline-end: .5rem; }

.timeline { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: .4rem 1rem; }
.tl-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px dashed var(--border); }
.tl-item:last-child { border-bottom: 0; }
.tl-item .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--clay); flex-shrink: 0; }
.tl-item .tx { flex: 1; min-width: 0; } .tl-item .tx b { display: block; } .tl-item .tx small { color: var(--muted); }
.tl-item .amt { font-weight: 800; font-size: 1.05rem; }

details.deep { margin-top: 2rem; }
details.deep > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: 1rem 1.1rem; min-height: 58px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; font-weight: 800; font-size: 1.05rem;
}
details.deep > summary::-webkit-details-marker { display: none; }
details.deep > summary small { color: var(--muted); font-weight: 500; margin-inline-start: auto; }
details.deep > summary::after { content: '⌄'; font-size: 1.3rem; line-height: 1; }
details.deep[open] > summary::after { content: '⌃'; }
details.deep > summary span { font-family: var(--emoji); }

/* ===== الإدخال بالصوت ===== */
.mic-wrap { position: relative; display: block; }
.mic-wrap > .form-control { padding-inline-end: 3.6rem; }
.mic-btn {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: var(--brand-50); cursor: pointer; font-size: 1.3rem; font-family: var(--emoji); display: grid; place-items: center;
}
textarea + .mic-btn, .mic-wrap.tall .mic-btn { top: 6px; transform: none; }
.mic-btn.on { background: var(--clay); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(200, 85, 61, .2); } }

/* ===== الدخول ===== */
.auth { background: linear-gradient(180deg, #bfe3f5 0%, #eef6e4 45%, var(--bg) 100%); }
.auth > * { max-width: 440px; }
.gate { width: 100%; }
.gate-sky { text-align: center; margin-bottom: -18px; position: relative; z-index: 1; }
.gate-sky .sun { display: block; font-size: 4rem; animation: float 6s ease-in-out infinite; }
.gate-sky .field-art { font-family: var(--emoji); font-size: 2rem; letter-spacing: .2rem; }
.gate-card { background: var(--surface); border-radius: 30px; padding: 2rem 1.4rem 1.4rem; box-shadow: var(--shadow-lg); }
.gate-card h1 { text-align: center; font-size: 1.6rem; margin-bottom: .2rem; }
.gate-sub { text-align: center; color: var(--muted); font-weight: 600; margin-bottom: 1.3rem; }
.gate-field {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .9rem; margin-bottom: .8rem; min-height: 72px;
  background: #fff; border: 2px solid var(--border-strong); border-radius: 20px; cursor: text;
}
.gate-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(107, 176, 74, .2); }
.gate-field .emo { font-size: 1.8rem; }
.gate-field .in { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gate-field .lb { font-size: .85rem; font-weight: 800; color: var(--muted); }
.gate-field input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.25rem; font-weight: 700; padding: 0; width: 100%; color: var(--text); text-align: right; }
.gate-field .peek { border: 0; background: var(--brand-50); width: 46px; height: 46px; border-radius: 14px; font-size: 1.3rem; cursor: pointer; font-family: var(--emoji); }
.gate-go {
  width: 100%; min-height: 64px; border: 0; border-radius: 20px; cursor: pointer; margin-top: .4rem;
  background: linear-gradient(160deg, var(--leaf), var(--brand)); color: #fff; font: inherit; font-size: 1.3rem; font-weight: 800;
  box-shadow: 0 8px 20px rgba(47, 125, 59, .35);
}
.gate-go:active { transform: translateY(1px); }

/* ===== الطباعة ===== */
@media print {
  .dock, .topbar, .sky .say-btn, .ph-back, .ph-emo { display: none !important; }
  .shell { padding: 0 !important; }
}

/* ===== نوافذ الإضافة المنبثقة ===== */
.sheet-frame { z-index: 70; }
.sheet-frame .sheet-panel {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; height: 92vh; height: 92dvh; max-height: none;
}
@media (min-width: 992px) { .sheet-frame .sheet-panel { width: min(820px, 94vw); height: 88vh; } }
.frame-head {
  display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem .8rem .8rem; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.frame-head::before { content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 44px; height: 5px; border-radius: 9px; background: #d8ccb6; }
@media (min-width: 992px) { .frame-head::before { display: none; } }
.frame-title { flex: 1; min-width: 0; font-weight: 800; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-body { position: relative; flex: 1; min-height: 0; }
.frame-body iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }
.frame-loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 800; color: var(--muted); background: var(--bg);
}
.frame-loader .seed { font-family: var(--emoji); font-size: 2.6rem; animation: grow 1s ease-in-out infinite alternate; }
@keyframes grow { from { transform: scale(.8); } to { transform: scale(1.15); } }

/* الصفحة عندما تُعرض داخل النافذة: بدون الشريط العلوي والسفلي */
html.in-frame .topbar, html.in-frame .dock, html.in-frame .ph-back, html.in-frame .install-banner { display: none !important; }
html.in-frame .page-head { display: none; }
html.in-frame .shell { padding: 1rem 1rem 0 !important; min-height: 0; }
html.in-frame .shell > form.card, html.in-frame .shell > .card { border: 0; box-shadow: none; background: transparent; }
html.in-frame .shell > form.card > .card-body, html.in-frame .shell > form.card-body { padding: 0; }
html.in-frame .form-narrow { max-width: none; }
html.in-frame .form-actions {
  position: sticky !important; bottom: 0 !important; z-index: 20; margin: 1.2rem -1rem 0 !important; padding: .8rem 1rem calc(.8rem + var(--safe-b)) !important;
  background: rgba(255, 253, 248, .97) !important; border-top: 1px solid var(--border); border-radius: 0 !important;
}
html.in-frame .form-actions .btn { flex: 1 1 0; min-height: 56px; font-size: 1.1rem; }

/* رسالة نجاح عائمة بعد الحفظ */
.float-toast {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(74px + env(safe-area-inset-top, 0px));
  width: min(520px, calc(100% - 24px)); display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem;
  background: var(--brand-900); color: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); font-weight: 700;
  animation: drop .35s ease-out;
}
.float-toast .ok-mark { background: var(--leaf); }
.float-toast .tx { flex: 1; min-width: 0; }
.float-toast .btn { min-height: 40px; background: #fff; color: var(--brand-900); }
.float-toast .x { border: 0; background: transparent; color: #fff; opacity: .7; font-size: 1.1rem; cursor: pointer; padding: .3rem; }
.float-toast.out { opacity: 0; transform: translate(-50%, -12px); transition: .35s; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== أزرار التعديل والحذف الموحّدة ===== */
.acts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; vertical-align: middle; }
.act-form { display: inline; margin: 0; }
.act {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 40px; padding: .3rem .8rem; border-radius: 12px;
  font: inherit; font-size: .92rem; font-weight: 800; line-height: 1.2; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s, transform .05s;
}
.act:active { transform: scale(.97); }
.act .ae { font-family: var(--emoji); font-size: 1.05rem; }
.act-edit { background: #e8f1fb; color: #1f4f86; border-color: #c9ddf3; }
.act-edit:hover { background: #d9e8f8; color: #163d69; }
.act-del { background: #fdeee9; color: #a3321f; border-color: #f4cbbf; }
.act-del:hover { background: #fbdcd2; color: #8a2615; }
.page-actions .act { min-height: 46px; padding-inline: 1rem; font-size: .98rem; }
.table td .acts { gap: .35rem; }
@media (max-width: 991.98px) {
  .table.cards td.no-print .acts { width: 100%; }
  .table.cards td.no-print .act, .table.cards td.no-print .act-form { flex: 1 1 0; }
  .table.cards td.no-print .act { justify-content: center; width: 100%; min-height: 46px; }
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a8321f; color: #fff; }

/* نافذة التأكيد */
.ask-box { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 1rem; }
.ask-backdrop { position: absolute; inset: 0; background: rgba(20, 20, 10, .5); animation: fadeIn .15s; }
.ask-panel {
  position: relative; width: min(420px, 100%); background: var(--surface); border-radius: 26px; padding: 1.5rem 1.3rem 1.2rem;
  text-align: center; box-shadow: var(--shadow-lg); animation: pop .2s ease-out;
}
.ask-ico { font-family: var(--emoji); font-size: 3rem; line-height: 1; margin-bottom: .6rem; }
.ask-msg { font-size: 1.15rem; font-weight: 700; line-height: 1.6; margin-bottom: 1.2rem; }
.ask-btns { display: grid; gap: .6rem; }
.ask-btns .btn { min-height: 56px; font-size: 1.1rem; width: 100%; }
