/* Masuri Remote Console - RTL first */
:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1b2330; --muted: #5d6878; --line: #e2e6ec;
  --brand: #1f4e8c; --brand-ink: #fff; --ok: #1e8e4f; --warn: #b76e00; --bad: #c62f2f; --unk: #9aa3af;
  --radius: 10px; --focus: 0 0 0 3px rgba(31, 78, 140, .35);
  font-family: "Segoe UI", "Arial Hebrew", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --surface: #1a2029; --text: #e7ebf0; --muted: #9aa4b2; --line: #2b3440; --brand: #5b8fd6; --brand-ink: #0b1220; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); }
h1 { font-size: 1.45rem; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
code, kbd { font-family: ui-monospace, Consolas, monospace; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* כותרת */
.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { padding: .35rem .6rem; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"], .nav a:hover { background: var(--bg); color: var(--text); }
.qc-open { margin-inline-start: auto; }
.me { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--muted); }
.me form { margin: 0; }
.main { max-width: 1280px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* כרטיסים ורשת */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.card.narrow, .login { max-width: 460px; margin-inline: auto; }
.login { margin-top: 10vh; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.count { background: var(--bg); border-radius: 99px; padding: 0 .55rem; font-size: .85rem; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.empty { color: var(--muted); margin: .25rem 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 .75rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notes { list-style: none; padding: 0; margin: 0 0 .75rem; }
.notes li { border-inline-start: 3px solid var(--line); padding-inline-start: .75rem; margin-bottom: .75rem; }
.notes p { margin: 0; white-space: pre-wrap; }

/* טבלאות */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.table th, .table td { text-align: start; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--bg); }
.table tr:last-child td { border-bottom: 0; }
.table tr.disabled td { opacity: .55; }
.card .table { border: 0; }

/* סטטוס */
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--unk); vertical-align: middle; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--unk); }
.dot.bad { background: var(--bad); }
.badge { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.bad { color: var(--bad); border-color: currentColor; }
meter { width: 6rem; vertical-align: middle; }

/* טפסים */
.form { display: grid; gap: .7rem; margin-top: .6rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: .45rem; color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; display: grid; gap: .45rem; }
legend { color: var(--muted); font-size: .85rem; padding: 0 .3rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters input[type="search"] { flex: 1 1 240px; }
.filters label { display: grid; }
details summary { cursor: pointer; color: var(--brand); margin: .4rem 0; }
.inline { display: inline; margin: 0; }
input.copy { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* כפתורים */
button, .button { font: inherit; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: var(--brand); }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.warn { color: var(--warn); }
.small, .button.small { padding: .2rem .6rem; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; }
button.link.danger { color: var(--bad); }
.star { background: none; border: 0; font-size: 1.1rem; color: var(--unk); padding: 0 .2rem; }
.star.on { color: #e0a800; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
kbd { font-size: .75rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; color: var(--muted); }

/* לשוניות */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--brand); }

/* הודעות */
.flash { padding: .6rem .8rem; border-radius: 8px; background: rgba(30, 142, 79, .1); border: 1px solid rgba(30, 142, 79, .35); margin-bottom: 1rem; }
.flash-bad { background: rgba(198, 47, 47, .08); border-color: rgba(198, 47, 47, .4); }

/* חלונות */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1rem; width: min(560px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.qc { position: fixed; top: 12vh; margin-top: 0; }
.qc input { width: 100%; font-size: 1.05rem; }
.qc ul { list-style: none; padding: 0; margin: .5rem 0; max-height: 50vh; overflow: auto; }
.qc li { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem; border-radius: 8px; cursor: pointer; }
.qc li[aria-selected="true"] { background: var(--bg); }
.qc li .sub { color: var(--muted); font-size: .85rem; margin-inline-start: auto; }

@media (max-width: 720px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .table th, .table td { white-space: nowrap; }
  .qc-open kbd { display: none; }
}
