/* شاشة الإدخال السريع وعناصر المحاسب */
.sg-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.sg-head label { display: grid; gap: 2px; font-size: .8rem; color: var(--ink-2); }
.sg-head select:disabled { opacity: .55; }
.sg-year { font-family: var(--font-num); font-weight: 600; font-size: 1.05rem; padding-bottom: 6px; }
.sg-state { display: inline-flex; gap: 6px; padding-bottom: 6px; }
.sg-keys { flex: 1 1 260px; padding-bottom: 6px; line-height: 1.5; }
.sg-wrap { position: relative; overflow-x: auto; }
.sg-grid { min-width: 1180px; font-size: .9rem; table-layout: fixed; width: 100%; }
.sg-grid td, .sg-grid th { padding: 3px 6px; }
.sg-grid .c-p { width: 70px; } .sg-grid .c-d { width: 96px; } .sg-grid .c-a { width: 80px; } .sg-grid .c-t { width: 200px; } .sg-grid .c-r { width: 130px; } .sg-grid .c-m { width: 118px; } .sg-grid .c-x { width: 30px; text-align: center; }
/* المرجع والبيان والطرف على سطر واحد مع قص النص الطويل (النص الكامل يظهر عند المرور بالفأرة) */
.sg-grid td.nw { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-grid tr.sg-old td { padding-top: 4px; padding-bottom: 4px; }
.sg-grid tr.sg-old.on td { outline: 2px solid var(--stamp); outline-offset: -2px; }
.sg-status { display: grid; gap: 4px; background: var(--ledger-soft); border: 1px solid color-mix(in srgb, var(--ledger) 30%, transparent); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: .95rem; }
.sg-status .k { display: inline-block; min-width: 86px; color: var(--ink-2); font-size: .8rem; }
.sg-status strong.is-d { color: var(--ledger); } .sg-status strong.is-c { color: var(--red); }
.sg-grid input { width: 100%; border: 1px solid transparent; background: transparent; padding: 4px 5px; border-radius: 4px; font: inherit; color: inherit; }
.sg-grid input:focus { border-color: var(--stamp); background: var(--surface); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--stamp) 18%, transparent); }
.sg-grid input:disabled { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--rule) 4px 5px); opacity: .5; }
.sg-grid input.amt, .sg-grid .num { text-align: end; font-family: var(--font-num); direction: ltr; }
.sg-grid tr.sg-cur { background: color-mix(in srgb, var(--amber-soft) 45%, transparent); }
.sg-grid tr.sg-old.is-draft { background: color-mix(in srgb, var(--amber-soft) 25%, transparent); }
.sg-grid tr.sg-old.is-valid { cursor: pointer; }
.sg-grid .c-n { width: 34px; color: var(--ink-3); font-family: var(--font-num); font-size: .78rem; text-align: center; background: color-mix(in srgb, var(--rule) 35%, transparent); }
/* سطر فارغ كامل بين كل قطعتين، كما في برامج المحاسبين */
.sg-grid tr.sg-sep td { height: 30px; background: color-mix(in srgb, var(--rule) 22%, transparent); border-inline: 0; }
.sg-grid tr.sg-first td { border-top: 2px solid var(--rule-strong); }
.sg-grid tfoot .sg-unbal td, .sg-grid tfoot .sg-unbal th { color: var(--red); font-weight: 600; }
.sg-grid .lock { font-size: .75rem; opacity: .6; }
.sg-ac { position: absolute; z-index: 30; min-width: 320px; max-width: 480px; max-height: 300px; overflow-y: auto; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.sg-ac-i { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; font-size: .88rem; }
.sg-ac-i span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-ac-i em { font-style: normal; color: var(--ink-3); font-family: var(--font-num); font-size: .8rem; direction: ltr; }
.sg-ac-i.on { background: var(--ledger-soft); }
.sg-panel { margin-top: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 14px 14px; }
.sg-panel .tabs { margin-bottom: 10px; }
.sg-panel input#stdQ { width: 100%; max-width: 420px; margin-bottom: 8px; }
.sg-panel tr.on td { background: var(--ledger-soft); }
.sg-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: .9rem; }
.sg-dl dt { color: var(--ink-2); }
.sg-dl dd { margin: 0; }
.alert-list { margin: 8px 0; padding-inline-start: 18px; display: grid; gap: 6px; line-height: 1.55; }
.alert-list .warn { color: var(--amber); }
.toast { white-space: pre-line; }
.user-chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .8rem; color: inherit; opacity: .9; margin-top: 6px; }
.setup.login .form-grid { max-width: 360px; margin-inline: auto; grid-template-columns: 1fr; }
.row-act > * + * { margin-inline-start: 4px; }
input.sm { width: 80px; }
fieldset { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
@media print { .sg-head, .sg-panel, .sg-ac { display: none !important; } }
/* الجداول العريضة تتمرر أفقيا داخل الصفحة بدل أن تدفع القائمة الجانبية */
.main { min-width: 0; overflow-x: auto; }
/* لوحة اليومية المختارة أسفل القائمة */
.j-list tr.on td { background: var(--ledger-soft); }
.j-panel { margin-top: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 14px 14px; }
.j-panel .tabs { margin-bottom: 10px; }
.sg-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.sg-actions .grow { flex: 1; }
.sg-actions kbd { font-family: var(--font-num); font-size: .7rem; opacity: .7; margin-inline-start: 4px; }
.sg-cards { display: grid; grid-template-columns: 1.3fr 1.3fr .8fr; gap: 12px; }
.sg-card { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--paper); }
.sg-card-h { font-size: .78rem; color: var(--ink-2); margin-bottom: 4px; }
.sg-card-t { font-size: .95rem; margin-bottom: 8px; }
.sg-card-n { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sg-card-n > div { display: grid; gap: 2px; }
.sg-card-n span { font-size: .72rem; color: var(--ink-3); }
.sg-card-n strong { font-family: var(--font-num); font-size: 1.05rem; direction: ltr; display: inline-block; }
.sg-card-n .is-c strong { color: var(--red); } .sg-card-n .is-d strong { color: var(--ledger); }
.sg-card-n small { font-family: var(--font); font-size: .72rem; font-weight: 400; }
.sg-card-ref .big { font-size: 1.3rem; font-weight: 600; }
@media screen and (max-width: 980px) { .sg-cards { grid-template-columns: 1fr; } }
/* ألوان المحاسب: المدين أخضر، الدائن أصفر، الخطأ أحمر */
.sg-grid th.c-deb, .sg-grid td.c-deb { background: #e3f2e6; }
.sg-grid th.c-cre, .sg-grid td.c-cre { background: #fbf3c4; }
.sg-grid tr.sg-cur td.c-deb { background: #d6ecd9; } .sg-grid tr.sg-cur td.c-cre { background: #f7ecad; }
.sg-grid th.c-deb { color: #1E5B4A; } .sg-grid th.c-cre { color: #7a5c00; }
.sg-grid tfoot td.c-deb, .sg-grid tfoot td.c-cre { font-weight: 600; }
.sg-grid input.is-err, .sg-grid input.is-err:focus { border-color: var(--red); background: #fde7e5; box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 25%, transparent); }
.sg-grid tr.has-err td.c-n { background: var(--red); color: #fff; }
.sg-grid tfoot .sg-unbal td { background: #fde7e5; }
