body { min-height: 100vh; display: flex; flex-direction: column; --editor-font: 18px; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  font: 600 19px/1 var(--font-si); background: linear-gradient(140deg, #7c3aed 0%, #5b26c2 60%, #2563eb 140%); }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.brand-name .dot { color: var(--purple); }
.brand-sub { font-weight: 500; color: var(--text-2); }
.mode { display: flex; gap: 4px; margin-left: 12px; }
.mode-btn { height: 34px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; }
.mode-btn:hover { background: var(--surface-2); color: var(--text); }
.mode-btn.active { background: var(--purple-50); color: var(--purple); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.tool { color: var(--text-2); margin-right: 8px; }
.tool input[type=range] { width: 110px; accent-color: var(--purple); }

.layout { flex: 1; display: flex; min-height: 0; }
.main { flex: 1; padding: 16px 20px 20px; min-width: 0; display: flex; flex-direction: column; }
/* Never shrink a view below its content: with the keyboard open the page grows and scrolls
   instead of the panes spilling over the keyboard. */
.view { display: flex; flex-direction: column; flex: 1 0 auto; }
.view[hidden] { display: none; }
.osk-toggle.active { background: var(--purple-50); color: var(--purple); }

/* On-screen keyboard styles: shared/keyboard.css */
/* Batch file conversion results (Convert fonts). */
.batch { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 12px; }
.batch[hidden] { display: none; }
.batch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.batch-head .grow { flex: 1; }
.batch-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.batch-item { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 8px; background: var(--surface-2); }
.batch-item.failed .batch-info { color: var(--red, #c0392b); }
.batch-name { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.batch-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* Harakat check results. */
.harakat-report { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; }
.harakat-report[hidden] { display: none; }
.harakat-report ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.harakat-report li button { all: unset; cursor: pointer; display: flex; gap: 8px; align-items: baseline; width: 100%; }
.harakat-report li button:hover .hk-word { color: var(--purple); }
.harakat-report .hk-word { font-size: 18px; font-family: var(--font-arabic, inherit); }
.harakat-report .hk-error .hk-why { color: var(--amber); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1; min-height: 0; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } .mode { display: none; } }
.pane { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.pane-foot { font-size: 12px; }
.small { font-size: 12px; }
textarea.big { flex: 1; min-height: 180px; font-size: var(--editor-font); resize: none; }
textarea.big.unicode { font-weight: 500; }
.legacy-section { display: flex; flex-direction: column; gap: 8px; flex: 1 0 auto; }
.legacy-section[hidden] { display: none; }
textarea.big.legacy { background: var(--surface-2); font-size: calc(var(--editor-font) * 0.8); }
textarea.big.previewing { font-family: var(--legacy-font, var(--font-mono)); font-size: var(--editor-font); }
.select-sm { width: auto; height: 32px; font-size: 12.5px; border-radius: 8px; }
.file-btn { position: relative; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 16px; cursor: pointer; color: var(--text-2); font-size: 14px; }
.seg button[aria-checked='true'] { background: var(--purple); color: #fff; }

.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 9px;
  border: 1px solid transparent; background: var(--surface-2); cursor: pointer; font-size: 15px; }
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--purple-50); color: var(--purple); border-color: var(--purple-100); }
.chip.english { font-size: 13px; color: var(--text-2); }
.chip-n { font: 600 10px/1 var(--font-ui); color: var(--text-3); }

.swap { border: 1px solid var(--border); }
.side { width: 320px; flex: none; border-left: 1px solid var(--border); background: var(--surface); padding: 14px; overflow-y: auto; max-height: calc(100vh - 56px); position: sticky; top: 56px; }
.side-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.side-tab { flex: 1; height: 32px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; color: var(--text-2); cursor: pointer; }
.side-tab.active { background: var(--purple-50); color: var(--purple); }
#historySearch { height: 34px; margin-bottom: 8px; }
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.h-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; }
.h-item:hover { border-color: var(--purple); }
.h-meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.h-text { white-space: pre-wrap; word-break: break-word; max-height: 3.1em; overflow: hidden; }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 5px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.keys td:first-child { white-space: nowrap; color: var(--text-2); }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font: 600 11px var(--font-mono); background: var(--surface-2); }
h4 { margin: 16px 0 6px; font-size: 13px; }
.empty { padding: 8px 0; }
