/* الكوثر - نظام التصميم */
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E; }
@font-face { font-family: "Plex Arabic"; font-weight: 400; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex Arabic"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex Arabic"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Plex Arabic"; font-weight: 700; font-display: swap; src: url(fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

@font-face { font-family: "Amiri"; font-weight: 400; font-display: swap; src: url(fonts/amiri-arabic-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Amiri"; font-weight: 700; font-display: swap; src: url(fonts/amiri-arabic-700-normal.woff2) format("woff2"); }

:root {
  --bg: #f3f1ec;
  --panel: #ffffff;
  --panel-2: #faf8f4;
  --ink: #1c1a16;
  --ink-2: #4a463e;
  --muted: #7b7568;
  --line: #e7e2d8;
  --line-2: #d8d1c3;
  --gold: #a9802a;
  --gold-2: #c9a24a;
  --gold-3: #e7cc85;
  --gold-soft: #f7efdb;
  --brand-ink: #7d5c17;
  --bar-h: 58px;
  --bar-bg: #b8913a;
  --bar-ink: #1f1708;
  --bar-line: rgba(31, 23, 8, .28);
  --gold-grad: linear-gradient(135deg, #d8b45e 0%, #b48a2f 55%, #94701f 100%);
  --side: #141210;
  --side-2: #1e1b17;
  --side-line: #2c2822;
  --side-ink: #d9d1c0;
  --side-muted: #8d8574;
  --green: #18794a;
  --green-soft: #e3f3ea;
  --red: #b42318;
  --red-soft: #fdecea;
  --blue: #1f5ea8;
  --blue-soft: #e6eefa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 26, 22, .05), 0 2px 8px rgba(28, 26, 22, .04);
  --shadow-lg: 0 24px 60px rgba(20, 16, 10, .28);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Plex Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg); color: var(--ink); display: flex; flex-direction: column; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold-3); }

/* ------------ sidebar */
.sidebar {
  width: 268px; flex-shrink: 0; height: calc(100vh - var(--bar-h)); position: sticky; top: var(--bar-h); display: flex; flex-direction: column;
  background: var(--side);
  color: var(--side-ink); border-left: 1px solid #000;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 16px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(160deg, #26221c, #15130f); border: 1px solid #3a3328; box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.brand-mark img { width: 34px; height: 34px; object-fit: contain; }
.brand-name {
  font-size: 16px; font-weight: 600; color: #e9dcbc;
}
.brand-sub { font-size: 12px; color: var(--side-muted); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav { display: flex; flex-direction: column; padding: 6px 10px 12px; gap: 1px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #3a3328 transparent; }
.nav-group { font-size: 12.5px; font-weight: 600; color: var(--side-muted); padding: 14px 12px 6px; letter-spacing: .3px; }
#nav a {
  display: flex; align-items: center; gap: 12px; color: var(--side-ink); text-decoration: none; padding: 10px 14px; border-radius: 9px;
  font-size: 16px; font-weight: 500; transition: background .15s, color .15s; position: relative;
}
#nav a:hover { background: var(--side-2); color: #fff; }
#nav a.active { background: linear-gradient(90deg, rgba(201,162,74,.08), rgba(201,162,74,.2)); color: #f4dc98; font-weight: 600; }
#nav a.active::before { content: ""; position: absolute; right: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gold-2); }
.ic { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.sidebar-foot {
  border-top: 1px solid var(--side-line); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; font-size: 13px;
}
.sidebar-foot a { color: var(--gold-3); text-decoration: none; }
.who { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-grad); color: #1c1a16; font-weight: 700; font-size: 13px; }
.muted-dark { color: var(--side-muted); }

/* ------------ main + topbar */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line-2); }
.tb-date { color: var(--muted); font-size: 13.5px; }
.tb-date b { color: var(--ink-2); font-weight: 600; margin-left: 4px; }
.tb-prices { display: flex; gap: 8px; margin-right: auto; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--panel);
  border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap;
}
.chip b { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
a.chip:hover { border-color: var(--gold-2); }
.chip.scale b { direction: ltr; }
.chip.scale.ok { border-color: #9fd3b5; background: var(--green-soft); }
main { padding: 22px 28px 64px; overflow-x: hidden; }

h1 { font-size: 23px; font-weight: 700; margin: 0 0 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; letter-spacing: -.2px; }
h1 .spacer { flex: 1; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; color: var(--ink); }
h3 { font-size: 14.5px; font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1150px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid.cols-2 { grid-template-columns: 1fr; } .sidebar { width: 210px; } }

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.gold { background: linear-gradient(160deg, #fffaf0, var(--gold-soft)); border-color: #ead9ae; }
.stat.gold::after {
  content: ""; position: absolute; left: -30px; bottom: -30px; width: 110px; height: 110px; opacity: .1;
  background: url(assets/logo-mark.svg) center / contain no-repeat;
}
.stat.gold .value { color: #7a5914; }

/* ------------ forms */
.form { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 11px; background: #fff; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: #c4baa6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 74, .22); }
input[type=number] { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }
input.big { font-size: 18px; padding: 11px 14px; border-width: 1.5px; }
input.big:focus { box-shadow: 0 0 0 4px rgba(201, 162, 74, .2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.btn {
  border: 1px solid var(--line-2); background: #fff; border-radius: var(--radius-sm); padding: 8px 15px; cursor: pointer; white-space: nowrap;
  font-weight: 500; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; line-height: 1.4;
}
.btn:hover { background: var(--panel-2); border-color: #c4baa6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold-grad); border-color: #9b7522; color: #fff; font-weight: 600; text-shadow: 0 1px 0 rgba(0,0,0,.15); box-shadow: 0 1px 2px rgba(120, 90, 20, .3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--red); border-color: #efc2bd; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 4px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
a.btn.primary { color: #fff; }

/* ------------ tables */
.table-wrap { overflow-x: auto; }
.panel.table-wrap { padding: 0; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fdfbf6; }
tbody tr:last-child td { border-bottom: none; }
tfoot td { font-weight: 600; background: var(--panel-2); border-top: 1px solid var(--line); }
td.num, th.num { text-align: left; direction: ltr; }
td input { padding: 5px 8px; }
td input[type=number] { width: 112px; }
td a { color: var(--blue); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; background: #efece5; color: var(--ink-2); font-weight: 500; white-space: nowrap; text-decoration: none; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gold { background: var(--gold-soft); color: #7a5914; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.strike td { color: var(--muted); }
.strike td:not(:last-child) { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }

.totals { display: grid; grid-template-columns: auto auto; gap: 7px 22px; justify-content: end; font-variant-numeric: tabular-nums; }
.totals .k { color: var(--muted); }
.totals .v { text-align: left; direction: ltr; font-weight: 600; }
.totals .grand { font-size: 21px; color: #7a5914; }

/* ------------ modal */
.modal-back { position: fixed; inset: 0; background: rgba(18, 15, 10, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: min(840px, 100%); max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal.wide { width: min(1120px, 100%); }
.modal header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal header h2 { margin: 0; flex: 1; font-size: 17px; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--panel-2); }
.x { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; padding: 0 4px; border-radius: 6px; }
.x:hover { color: var(--ink); background: var(--panel-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ------------ login */
.login-screen { background: #0f0d0a url(assets/login-bg.jpg) center / cover no-repeat; backdrop-filter: none; }
.login-screen .modal { background: rgba(22, 19, 15, .8); border: 1px solid rgba(201, 162, 74, .3); color: var(--side-ink); backdrop-filter: blur(14px); }
.login-screen .modal header { background: transparent; border-color: rgba(201, 162, 74, .2); justify-content: center; flex-direction: column; gap: 8px; padding-top: 26px; }
.login-screen .modal header img { width: 64px; height: 64px; }
.login-screen .modal header h2 { color: #f4dc98; text-align: center; }
.login-screen input { background: rgba(255,255,255,.06); border-color: rgba(201, 162, 74, .35); color: #fff; }
.login-screen .field label, .login-screen .hint { color: var(--side-muted); }

/* ------------ toasts */
#toasts { position: fixed; bottom: 22px; left: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1c1a16; color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.22); max-width: 400px; animation: pop .2s ease-out; border-right: 4px solid var(--gold-2); }
.toast.error { background: #3b1410; border-right-color: #f2766a; }
.toast.ok { background: #10291c; border-right-color: #4cc38a; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; background: #e9e5dc; padding: 4px; border-radius: 11px; width: fit-content; }
.tabs button { border: none; background: transparent; border-radius: 8px; padding: 7px 16px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.hint { font-size: 12.5px; color: var(--muted); }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* ------------ photos */
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.photo { width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; background: #111; display: block; margin-bottom: 6px; }

main ::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 10px; height: 10px; }
main ::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: #d4ccbb; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ------------ الفروع */
.branch-sel { width: auto; padding: 5px 12px; border-radius: 99px; font-weight: 600; background: var(--gold-soft); border-color: #ead9ae; color: #7a5914; }
.branch-sel.all { background: var(--blue-soft); color: var(--blue); border-color: #b9cff0; }
body.all-branches .topbar { box-shadow: inset 0 -3px 0 var(--blue); }

/* ------------ group B */
.star { border: none; background: none; cursor: pointer; font-size: 18px; color: #c9c1b0; padding: 0 2px; line-height: 1; }
.star.on, .star:hover { color: var(--gold-2); }
#flag-count { color: var(--red); border-color: #efc2bd; }

/* ------------ الوضع الليلي */
.theme-btn { border: 1px solid var(--side-line); background: var(--side-2); color: var(--gold-3); border-radius: 8px; width: 30px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1; }
.theme-btn:hover { border-color: var(--gold-2); }
html[data-theme="dark"] {
  --brand-ink: #dcbd6e;
  --bar-bg: #a6812f;
  --bar-ink: #160f03;
  --bg: #12110e; --panel: #1b1915; --panel-2: #211e19; --ink: #ece6d8; --ink-2: #cfc7b6; --muted: #9a9282;
  --line: #2f2b24; --line-2: #3d3830; --gold-soft: #2b2416; --green-soft: #12291c; --red-soft: #33150f; --blue-soft: #142338;
  --green: #5fcf93; --red: #f2857a; --blue: #7fb2f0;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea,
html[data-theme="dark"] .btn, html[data-theme="dark"] .chip, html[data-theme="dark"] .tabs button.active { background: #24211b; color: var(--ink); border-color: var(--line-2); }
html[data-theme="dark"] .btn:hover { background: #2c2821; }
html[data-theme="dark"] .btn.primary { background: var(--gold-grad); color: #1c1a16; text-shadow: none; }
html[data-theme="dark"] .modal, html[data-theme="dark"] .modal header { background: var(--panel); }
html[data-theme="dark"] .topbar { background: var(--panel); }
html[data-theme="dark"] tbody tr:hover { background: #221f19; }
html[data-theme="dark"] .tabs { background: #24211b; }
html[data-theme="dark"] .badge { background: #2a2620; color: var(--ink-2); }
html[data-theme="dark"] .badge.gold, html[data-theme="dark"] .stat.gold .value, html[data-theme="dark"] .totals .grand { color: var(--gold-3); }
html[data-theme="dark"] .stat.gold { background: linear-gradient(160deg, #241f15, #2b2416); border-color: #4a3d22; }
html[data-theme="dark"] .panel[style*="#fff8e6"], html[data-theme="dark"] .panel[style*="#faf8f3"], html[data-theme="dark"] .panel[style*="fbe7e5"] { background: var(--panel-2) !important; border-color: var(--line-2) !important; }
html[data-theme="dark"] code { background: #24211b; }
html[data-theme="dark"] main ::-webkit-scrollbar-thumb { background: #3d3830; }
#conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: #8a1c12; color: #fff; padding: 10px 20px; text-align: center; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
#restart-banner { position: fixed; bottom: 0; left: 0; right: 0; z-index: 190; background: #7a5914; color: #fff; padding: 10px 20px; text-align: center; font-weight: 600; }
.toast.busy { border-right-color: var(--gold-2); opacity: .95; }

.batch-mode .nb { display: none; }

/* ------------ رأس الصفحة: هوية النظام وأسعار اليوم */
.mast { display: flex; align-items: center; gap: 22px; padding: 10px 28px 9px; border-bottom: 2px solid var(--gold); }
.mast-id { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.mast-mark { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.mast-name { font-family: "Amiri", "Plex Arabic", serif; font-weight: 700; font-size: 30px; line-height: 1; color: var(--brand-ink); padding-bottom: 4px; }
.mast-desc { display: flex; flex-direction: column; gap: 1px; padding-right: 14px; margin-right: 2px; border-right: 1px solid var(--line-2); min-width: 0; }
.mast-title { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.mast-ctx { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mast-page { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; justify-content: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.mast-page .pg-name { color: var(--ink); font-weight: 600; font-size: 14px; }
.mast-page .pg-sep { color: var(--line-2); }
.mast-side { display: flex; align-items: center; gap: 16px; }
.tb-date { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; color: var(--muted); font-size: 12.5px; }
.tb-date .d-main b { color: var(--ink); font-weight: 600; margin-left: 4px; }
.tb-date .d-sub { font-size: 11.5px; }
.ratebar { display: flex; align-items: stretch; gap: 0; padding: 0 28px; background: var(--panel-2); min-height: 34px; }
.rb-label { display: flex; align-items: center; font-size: 11.5px; font-weight: 600; color: var(--gold); padding-left: 16px; letter-spacing: .2px; }
.ratebar .tb-prices { display: flex; margin: 0; gap: 0; flex-wrap: nowrap; }
.rate { display: flex; align-items: baseline; gap: 6px; padding: 7px 16px; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; text-decoration: none; white-space: nowrap; }
.rate b { color: var(--ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate i { font-style: normal; font-size: 11px; }
a.rate:hover b { color: var(--gold); }
.ratebar .tb-scale { margin-right: auto; display: flex; }
.rate.scale b { direction: ltr; }
.rate.scale.ok b { color: var(--green); }
.branch-sel { border-radius: var(--radius-sm); padding: 5px 10px; }
body.all-branches .mast { border-bottom-color: var(--blue); }
body.all-branches .topbar { box-shadow: none; }
@media (max-width: 1100px) { .mast-page { display: none; } }
@media (max-width: 860px) { .mast-desc, .rb-label { display: none; } .mast { gap: 12px; padding: 8px 16px; } .ratebar { padding: 0 16px; overflow-x: auto; } }

/* ------------ أسفل القائمة: المستخدم وتسجيل الخروج */
.sidebar-foot { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 14px 16px; font-size: 14px; }
.sidebar-foot .who { color: #e9dcbc; }
.who-name { font-weight: 600; }
.logout-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid #4a4134; color: #f0d9a3 !important; font-size: 14.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.logout-btn:hover { background: #2a251e; border-color: var(--gold-2); }
.logout-btn .ic { width: 18px; height: 18px; }

/* ------------ الشريط الذهبي بعرض النافذة */
.goldbar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); flex-shrink: 0; display: flex; align-items: center; gap: 18px;
  padding: 0 20px; background: var(--bar-bg); color: var(--bar-ink); border-bottom: 1px solid rgba(0, 0, 0, .25); }
.gb-id { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; }
.gb-name { font-family: "Amiri", "Plex Arabic", serif; font-weight: 700; font-size: 32px; line-height: 1; padding-bottom: 5px; }
.gb-shop { display: flex; flex-direction: column; line-height: 1.3; padding-right: 14px; border-right: 1px solid var(--bar-line); font-size: 12px; min-width: 0; }
.gb-shop b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.gb-shop span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-shop span:empty { display: none; }
.gb-space { flex: 1; }
.gb-rates, .gb-scale { display: flex; align-items: center; }
.gb-rate { display: flex; align-items: baseline; gap: 6px; padding: 0 14px; border-right: 1px solid var(--bar-line); color: inherit; text-decoration: none; font-size: 12px; white-space: nowrap; }
.gb-rates .gb-rate:first-child { border-right: 0; }
.gb-rate b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
a.gb-rate:hover b { text-decoration: underline; text-underline-offset: 4px; }
.gb-rate.scale b { direction: ltr; }
.gb-rate.scale.ok b { color: #0b4d2a; }
.gb-date { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; font-size: 12px; padding-right: 16px; border-right: 1px solid var(--bar-line); white-space: nowrap; }
.gb-date .d-main b { font-weight: 700; margin-left: 4px; }
.gb-date .d-sub { font-size: 11px; }
.goldbar .branch-sel { background: rgba(255, 255, 255, .28); border: 1px solid var(--bar-line); color: var(--bar-ink); font-weight: 600; }
.goldbar .branch-sel.all { background: #fff; color: var(--blue); }
.goldbar .chip { background: rgba(255, 255, 255, .28); border-color: var(--bar-line); color: var(--bar-ink); }
.goldbar .chip b { color: var(--bar-ink); }
body.all-branches .goldbar { background: #1f4f8a; color: #fff; --bar-line: rgba(255, 255, 255, .3); }
.app-row { display: flex; flex: 1; min-height: 0; }
.main-wrap main { padding-top: 24px; }
@media (max-width: 1100px) { .gb-date .d-sub, .gb-shop span { display: none; } }
@media (max-width: 860px) { .gb-shop, .gb-date { display: none; } .goldbar { gap: 10px; padding: 0 12px; overflow-x: auto; } .gb-name { font-size: 26px; } }

/* ------------ الترخيص */
.lic-pill { border: 1px solid var(--bar-line); background: rgba(255,255,255,.3); color: var(--bar-ink); border-radius: var(--radius-sm); padding: 5px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.lic-pill:hover { background: rgba(255,255,255,.5); }
.lic-pill.urgent { background: #7a1d14; color: #fff; border-color: #7a1d14; }
#lic-banner { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: #fdecea; color: #7a1d14; border-bottom: 1px solid #f3c2bc; font-size: 14px; position: sticky; top: var(--bar-h); z-index: 25; }
#lic-banner span { flex: 1; }
html[data-theme="dark"] #lic-banner { background: #33150f; color: #f6c3bb; border-color: #5a2219; }
.lic-code { direction: ltr; font-family: Consolas, monospace; font-size: 15px; letter-spacing: 1px; padding: 4px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.lic-state { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 14px; }
.lic-state.ok { background: var(--green-soft); border-color: #9fd3b5; }
.lic-state.bad { background: var(--red-soft); border-color: #f3c2bc; }
.gb-id { flex-shrink: 1; overflow: hidden; }
.gb-shop b { overflow: hidden; text-overflow: ellipsis; }
.goldbar #tb-branch { flex-shrink: 0; }
