/* Techlit Console. Logical properties only, so the layout mirrors for RTL. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1b1f24; --muted: #5d6772;
  --border: #dde1e6; --accent: #1f5eff; --accent-text: #ffffff;
  --ok: #18794e; --warn: #9a6700; --danger: #c62828; --code-bg: #f0f2f5;
  --radius: 10px; --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #171b21; --text: #e6e9ed; --muted: #9aa4ae;
    --border: #2a3038; --accent: #5b8cff; --code-bg: #1e232a;
    --ok: #3fb67e; --warn: #d6a33a; --danger: #ef5350;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-block-size: 100vh; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }

.topbar {
  display: flex; align-items: center; gap: 1rem; padding-block: .6rem; padding-inline: 1.25rem;
  background: var(--surface); border-block-end: 1px solid var(--border); position: sticky; inset-block-start: 0;
}
.brand { font-weight: 700; letter-spacing: .02em; }
.topbar nav { display: flex; gap: .25rem; flex: 1; }
.topbar nav a { padding-block: .35rem; padding-inline: .75rem; border-radius: 8px; text-decoration: none; color: var(--muted); }
.topbar nav a[aria-current="page"] { background: var(--code-bg); color: var(--text); font-weight: 600; }
.user { color: var(--muted); font-size: .9rem; }

main { max-inline-size: 1100px; margin-inline: auto; padding: 1.5rem 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-block-end: 1rem; }
.narrow { max-inline-size: 440px; margin-inline: auto; margin-block-start: 8vh; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

label { display: block; font-weight: 600; margin-block: .75rem .3rem; }
input, select, textarea {
  inline-size: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: .55rem .7rem;
}
textarea, code, pre, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; direction: ltr; text-align: start; }
textarea { min-block-size: 8rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  font: inherit; border-radius: 8px; padding: .55rem 1rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; gap: .5rem; margin-block-start: 1rem; flex-wrap: wrap; }

table { inline-size: 100%; border-collapse: collapse; }
th, td { text-align: start; padding-block: .55rem; padding-inline: .5rem; border-block-end: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; background: var(--code-bg); color: var(--muted); }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.danger { color: var(--danger); }
.dot { display: inline-block; inline-size: .6rem; block-size: .6rem; border-radius: 50%; background: var(--muted); margin-inline-end: .4rem; }
.dot.ok { background: var(--ok); }

pre { background: var(--code-bg); border-radius: 8px; padding: .75rem; overflow: auto; max-block-size: 24rem; white-space: pre-wrap; word-break: break-word; margin: .25rem 0 .75rem; }
.error { color: var(--danger); margin-block: .5rem; }
.notice { background: var(--code-bg); border-inline-start: 4px solid var(--warn); padding: .75rem 1rem; border-radius: 8px; margin-block: .75rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem 1rem; direction: ltr; }
.secret { font-size: 1.15rem; letter-spacing: .08em; word-break: break-all; }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); inline-size: min(560px, 92vw); padding: 1.25rem; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
.lang { min-inline-size: 3rem; }
.qr { display: block; margin-block: .5rem; margin-inline: auto; background: #fff; padding: 8px; border-radius: 8px; image-rendering: pixelated; }
td.row { flex-wrap: nowrap; }
a.button { display: inline-block; text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: .55rem 1rem; background: var(--surface); }
form.row input { flex: 1; min-inline-size: 12rem; }
a.dir { font-weight: 600; text-decoration: none; }
main.wide { max-inline-size: 1400px; }
.terminal { margin-block-start: 1rem; block-size: 65vh; background: #000; border-radius: 8px; padding: 6px; }
/* Remote control (ADR-0022): the screen fills the stage; a dark toolbar
   floats at the top centre and collapses to a small tab. */
.dt-stage { position: relative; display: flex; flex-direction: column; background: #111; height: 78vh; border-radius: 6px; overflow: hidden; }
.dt-stage[hidden] { display: none; }
.desktop-frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.desktop-frame.fit canvas.desktop { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.desktop-frame.actual { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.desktop-frame.actual canvas.desktop { max-width: none; max-height: none; }
canvas.desktop { display: block; cursor: default; }
canvas.desktop:focus { outline: none; }
.dt-stage:fullscreen { height: 100vh; border-radius: 0; }
.dt-toolbar { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: .25rem;
  background: #1e293b; color: #f8fafc; padding: .3rem .5rem; border-radius: 0 0 8px 8px; box-shadow: 0 2px 8px rgb(0 0 0 / 40%); white-space: nowrap; font-size: .9rem; }
.dt-toolbar[hidden] { display: none; }
.dt-toolbar.collapsed > :not(.dt-collapse) { display: none; }
.dt-toolbar.collapsed .dt-collapse { transform: rotate(180deg); }
.dt-toolbar button { background: transparent; color: inherit; border: 0; padding: .3rem .55rem; border-radius: 4px; }
.dt-toolbar button:hover, .dt-toolbar button[aria-expanded="true"] { background: rgb(255 255 255 / 12%); }
.dt-toolbar button.danger { color: #fca5a5; }
.dt-toolbar .error { margin: 0; color: #fca5a5; }
.dt-title { padding: 0 .5rem; }
.dt-status { color: #cbd5e1; padding: 0 .5rem; }
.dt-menu-wrap { position: relative; }
.dt-menu { position: absolute; top: calc(100% + .35rem); inset-inline-start: 0; min-width: 14rem; background: #fff; color: #111827;
  border-radius: 6px; box-shadow: 0 6px 18px rgb(0 0 0 / 30%); padding: .3rem 0; }
.dt-menu[hidden] { display: none; }
.dt-menu button { display: block; width: 100%; text-align: start; color: #111827; border-radius: 0; padding: .45rem .9rem; }
.dt-menu button:hover { background: #eff6ff; }
.dt-menu hr { border: 0; border-top: 1px solid #e5e7eb; margin: .25rem 0; }
.dt-connect { max-width: 28rem; margin: 2rem auto; }
.dt-connect[hidden] { display: none; }
/* Remote control in its own window. */
body.desktop-window { margin: 0; overflow: hidden; background: #111; }
body.desktop-window #app { height: 100vh; display: flex; flex-direction: column; }
body.desktop-window .dt-stage { flex: 1; height: auto; border-radius: 0; }
body.desktop-window .dt-connect { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; width: min(28rem, 90vw); }
