:root {
  --bg: #f5f8fa;
  --panel: #ffffff;
  --panel-raised: #f0f4f6;
  --panel-soft: #f8fafb;
  --line: #e0e7eb;
  --text: #172a33;
  --text-muted: #425660;
  --dim: #647680;
  --accent: #286b6b;
  --accent-hover: #215b5c;
  --accent-soft: #e6f2f0;
  --accent-border: #a9cbc5;
  --accent-text: #286b6b;
  --control-bg: #ffffff;
  --control-hover: #f0f5f5;
  --header-bg: #ffffff;
  --nav-bg: #ffffff;
  --on-accent: #ffffff;
  --danger: #b42332;
  --danger-soft: #fff3f4;
  --chat-bg: #f1f7f5;
  --chat-raised: #e7f2ef;
  --chat-line: #c9ddd7;
  --chat-bubble: #ffffff;
  --chat-own: #e1f2ec;
  --chat-inset: #edf5f2;
  --chat-muted: #526b65;
  --chat-accent: #24685c;
  --chat-control: #e4f1ed;
  --chat-control-hover: #d5e9e3;
  --chat-status: #2d775e;
  --chat-error: #a62936;
  --chat-input: #ffffff;
  --chat-record-bg: #fae9eb;
  --chat-record-text: #9f2636;
  --radius: 16px;
  --shadow: 0 18px 55px #24405414;
  color-scheme: light;
}

* { box-sizing: border-box; }
@keyframes viewEnter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
.view-enter { animation: viewEnter .2s ease-out both; }
html, body { width: 100%; min-width: 320px; height: 100%; min-height: 100%; margin: 0; }
body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 "IBM Plex Sans Arabic", system-ui, sans-serif;
}
button, input, textarea { font: inherit; }
button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--control-bg);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
button:hover { border-color: var(--accent-border); background: var(--control-hover); }
button:active { transform: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: none; }
button.primary:hover { border-color: transparent; background: var(--accent-hover); box-shadow: none; }
button.secondary-button { background: transparent; }
button.danger-button { border-color: color-mix(in srgb, var(--danger) 18%, var(--line)); background: var(--danger-soft); color: var(--danger); }
button.danger-button:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
button.icon-button { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%; font-size: 21px; line-height: 1; }

#appHeader {
  z-index: 5;
  flex: 0 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--text);
  font: 700 12px/1 system-ui, sans-serif;
  letter-spacing: .4px;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.35; }
.brand-copy strong { font-size: 16px; }
.brand-copy small { color: var(--dim); font-size: 12px; }
#brandHome[hidden], #accountBtn[hidden] { display: none !important; }
.account-button { display: inline-flex; align-items: center; gap: 10px; max-width: min(310px, 36vw); min-width: 0; padding: 5px 12px 5px 6px; border-color: var(--line); background: var(--panel); text-align: start; }
.account-button:hover { border-color: #59617a; }
.header-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--accent-border); border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: 16px; font-weight: 700; }
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.header-avatar img[hidden] { display: none !important; }
.account-button-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.account-button-copy strong, .account-button-copy small { overflow: hidden; max-width: 220px; text-overflow: ellipsis; white-space: nowrap; }
.account-button-copy strong { font-size: 14px; }
.account-button-copy small { color: var(--dim); font-size: 11px; font-weight: 400; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.header-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.auth-header-actions { display: flex; align-items: center; gap: 6px; }
#authHeaderActions[hidden], #accountBtn[hidden] { display: none !important; }
#languageToggle { min-width: 0; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 7px; border-color: transparent; border-radius: 8px; background: transparent; color: var(--dim); font-size: 12px; font-weight: 500; letter-spacing: 0; white-space: nowrap; box-shadow: none; }
#languageToggle::before { content: "文A"; color: var(--accent); font: 600 10px/1 system-ui, sans-serif; letter-spacing: -.08em; }
#languageToggle:hover { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.header-actions svg, .privacy-chip svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.privacy-chip { display: inline-flex; align-items: center; gap: 7px; margin-inline-end: 8px; color: var(--dim); font-size: 13px; white-space: nowrap; }
#toolsToggle[hidden] { display: none !important; }
#musicToggle[hidden] { display: none !important; }

#workspace { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#workspace[hidden], #guestLanding[hidden] { display: none !important; }
#pdfWorkspace { flex: 1 1 auto; min-height: 0; display: flex; direction: inherit; overflow: hidden; }
#pdfWorkspace[hidden] { display: none !important; }
#guestLanding { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; overflow: auto; padding: clamp(20px, 5vw, 64px); background: radial-gradient(ellipse at 50% 15%, var(--panel) 0, var(--bg) 70%); }
.guest-card { width: min(640px, 100%); display: flex; flex-direction: column; align-items: center; padding: clamp(24px, 5vw, 48px); border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); text-align: center; }
.guest-mark { display: grid; width: 56px; height: 56px; margin: 12px 0 4px; place-items: center; border: 1px solid var(--accent-border); border-radius: 16px; background: var(--accent-soft); color: var(--text); font: 700 14px/1 system-ui,sans-serif; }
.guest-card h1 { margin: 8px 0 10px; font-size: clamp(28px, 4vw, 40px); line-height: 1.25; }
.guest-card > p { max-width: 480px; margin: 0; color: var(--dim); font-size: 15px; }
.guest-actions { display: flex; justify-content: center; gap: 10px; margin: 22px 0 12px; }
.guest-actions button { min-width: 155px; }
.guest-card small { max-width: 480px; color: var(--dim); font-size: 12px; }
#stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: auto;
  padding: clamp(16px, 3vw, 40px);
  background: radial-gradient(ellipse at 50% 15%, var(--panel) 0, var(--bg) 70%);
}
#stage[hidden] { display: none; }
#page { position: relative; margin: auto; background: #fff; line-height: 0; box-shadow: 0 10px 36px #0008; }
#page[hidden] { display: none; }
#pdf, #ink { display: block; }
#pdfTextLayer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.pdf-text-item { position: absolute; display: block; overflow: hidden; color: transparent; white-space: pre; transform-origin: 0 0; pointer-events: none; }
body[data-tool="editText"] .pdf-text-item { pointer-events: auto; cursor: text; }
body[data-tool="editText"] .pdf-text-item:hover { outline: 1px solid #238caa; background: #38bdf822; }
#ink { position: absolute; inset: 0; pointer-events: none; }
body[data-tool="pen"] #ink, body[data-tool="hl"] #ink, body[data-tool="eraser"] #ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
body[data-tool="text"] #ink { pointer-events: auto; cursor: text; }
body[data-tool="shape"] #ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
body[data-tool="image"] #ink { pointer-events: auto; touch-action: none; cursor: default; }
body[data-tool="cover"] #ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.group button[data-tool="editText"], .group button[data-tool="cover"] { font-size: 12px; }
.col textarea { width: 100%; min-height: 76px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); resize: vertical; }
.txt { position: absolute; min-width: 80px; margin: 0; padding: 0; border: 0; border-bottom: 1px dashed var(--accent); outline: none; background: #fff8; font-family: sans-serif; line-height: 1.2; }

#empty {
  width: min(1120px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
  padding: clamp(16px, 3vw, 36px);
}
#empty[hidden] { display: none; }
.landing-copy { max-width: 550px; }
.eyebrow { display: inline-block; color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.landing-copy h1 { max-width: 540px; margin: 12px 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.25; letter-spacing: -.025em; }
.landing-copy .lead { max-width: 520px; margin: 0; color: var(--dim); font-size: 16px; line-height: 1.9; }
.privacy-card { display: flex; align-items: flex-start; gap: 12px; margin-top: 26px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.privacy-icon { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.privacy-card strong { display: block; margin-bottom: 2px; font-size: 14px; }
.privacy-card p { margin: 0; color: var(--dim); font-size: 13px; }
.drop-zone { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 28px; border: 1px dashed var(--line); border-radius: 20px; background: var(--panel); text-align: center; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
#stage.dragover .drop-zone { border-color: var(--accent); background: #262c3d; transform: scale(1.01); }
.file-icon { width: 50px; height: 50px; margin-bottom: 4px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-zone h2 { margin: 0; font-size: 21px; }
.drop-zone p { margin: 0; color: var(--dim); font-size: 14px; }
.drop-zone small { color: var(--dim); font-size: 12px; }
.choose-file-button { min-width: 190px; margin-top: 9px; }
.steps { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.step-number { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.steps li > span:last-child { display: flex; flex-direction: column; line-height: 1.45; }
.steps strong { font-size: 13px; }
.steps small { color: var(--dim); font-size: 12px; }

#panel {
  z-index: 2;
  flex: 0 0 310px;
  width: 310px;
  max-width: 36vw;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 17px;
  overflow: auto;
  padding: 20px 17px;
  border-inline-end: 1px solid var(--line);
  background: var(--panel);
}
#panel[hidden] { display: none !important; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 3px 0 2px; font-size: 18px; }
.panel-heading p { margin: 0; color: var(--dim); font-size: 12px; }
.tool-block { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tool-block:last-child { border-bottom: 0; }
.tool-block h3 { margin: 0; color: var(--dim); font-size: 12px; font-weight: 600; }
.group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.group button { padding: 7px 5px; font-size: 13px; }
.group button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.shape-kinds { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shape-kinds button { min-height: 42px; display: grid; place-items: center; padding: 4px 0; }
.shape-kinds button.on canvas { filter: invert(1); }
.hint { margin: 0; padding: 10px 11px; border-inline-start: 2px solid var(--accent); border-radius: 8px; background: var(--panel-soft); color: var(--dim); font-size: 12px; line-height: 1.65; }
.hint[hidden], #shapeOpts[hidden], #imageOpts[hidden] { display: none !important; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 9px; color: var(--dim); font-size: 13px; }
.row input[type="range"] { width: 110px; accent-color: var(--accent); }
.row input[type="color"] { width: 42px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: transparent; }
.row input[type="checkbox"] { accent-color: var(--accent); }
.page-controls button { min-width: 40px; padding: 5px; }
#zoomVal { min-width: 48px; color: var(--text); text-align: center; font-variant-numeric: tabular-nums; }
#imageOpts, #shapeOpts { display: flex; flex-direction: column; gap: 10px; }
.secondary-button { width: 100%; }
.account-page-head > .secondary-button { width: auto; flex: 0 0 auto; }
.col { display: flex; flex-direction: column; gap: 6px; color: var(--dim); font-size: 13px; }
.col input, #accountCard input, #accountCard textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
#fname { direction: auto; }
.document-actions { margin-top: auto; }
.document-actions button { width: 100%; }
#closeFile { color: var(--danger); }

#nav { position: fixed; z-index: 4; right: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(50%); display: flex; align-items: center; gap: 7px; padding: 5px; border: 1px solid #ffffff19; border-radius: 999px; background: #14161ad9; backdrop-filter: blur(10px); box-shadow: 0 8px 25px #0006; }
#nav[hidden] { display: none !important; }
#nav button { width: 38px; min-height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; }
#nav button:disabled { opacity: .25; cursor: default; }
#pageInfo { min-width: 62px; color: var(--dim); text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }

#frame { position: absolute; z-index: 2; border: 1.5px solid var(--accent); border-radius: 4px; cursor: move; touch-action: none; line-height: 1; }
#frame[hidden] { display: none; }
#frame button { position: absolute; width: 24px; min-height: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; font-size: 15px; line-height: 1; }
.h-rot { top: -38px; left: 50%; margin-left: -12px; background: var(--accent) !important; color: var(--on-accent) !important; cursor: grab; touch-action: none; }
.h-rot::after { position: absolute; top: 100%; left: 50%; width: 1.5px; height: 14px; background: var(--accent); content: ""; transform: translateX(-50%); }
.h-del { top: -38px; left: 50%; margin-left: 20px; background: #e5484d !important; color: #fff !important; cursor: pointer; }
.h-sz { position: absolute; display: none; width: 12px; height: 12px; border: 2px solid var(--accent); border-radius: 3px; background: #fff; touch-action: none; }
#frame.shape .h-sz { display: block; }
.h-sz[data-sx="-1"] { left: -7px; }.h-sz[data-sx="1"] { right: -7px; }
.h-sz[data-sy="-1"] { top: -7px; }.h-sz[data-sy="1"] { bottom: -7px; }
.h-sz[data-sx="-1"][data-sy="-1"], .h-sz[data-sx="1"][data-sy="1"] { cursor: nwse-resize; }
.h-sz[data-sx="1"][data-sy="-1"], .h-sz[data-sx="-1"][data-sy="1"] { cursor: nesw-resize; }
.txt.shp { min-width: 0; overflow: hidden; border: 1px dashed var(--accent); border-radius: 4px; background: transparent; text-align: center; line-height: 1.4; resize: none; box-sizing: border-box; font-family: "IBM Plex Sans Arabic", sans-serif; }

#music {
  position: fixed;
  z-index: 30;
  left: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(410px, calc(100vw - 36px));
  max-height: min(650px, calc(100dvh - 105px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
#music[hidden], #mHome[hidden], #mList[hidden] { display: none !important; }
.music-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px 8px; }
.music-header h2 { margin: 1px 0 0; font-size: 18px; }
#musicClose { flex: 0 0 auto; }
#mHome { padding: 22px; text-align: center; }
.m-line { margin: 0 0 16px; color: var(--dim); font-size: 14px; }
#mList { width: 100%; max-height: 590px; display: flex; flex-direction: column; overflow: hidden; }
#mList header { padding: 10px 17px 6px; }
#mList h2 { margin: 0; font-size: 16px; }
#mSub { margin: 2px 0 0; color: var(--dim); font-size: 12px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 12px; }
.tabs button { min-height: 36px; padding: 5px 3px; font-size: 12px; }
.tabs button.on { border-color: var(--accent); background: var(--accent-soft); }
#mItems { flex: 1; min-height: 90px; overflow: auto; border-top: 1px solid var(--line); }
.s-item { width: 100%; display: flex; gap: 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: start; padding: 8px 15px; }
.s-item .n { width: 34px; color: var(--dim); font-variant-numeric: tabular-nums; }
.s-item.on { color: var(--accent); font-weight: 600; }
#mBar { display: flex; flex-direction: column; gap: 7px; align-items: stretch; padding: 11px 15px; border-top: 1px solid var(--line); }
#mNow { min-height: 22px; text-align: center; font-size: 13px; }
.ctl { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ctl button { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.seek { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.seek input { flex: 1; accent-color: var(--accent); }
#mBar small { color: var(--dim); text-align: center; font-size: 11px; }

#accountGate {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 22px clamp(16px, 4vw, 48px) 40px;
  background: var(--bg);
}
#accountGate[hidden], #setupNotice[hidden], #authForms[hidden], #emailPending[hidden], #recoveryEmailSent[hidden], #passwordUpdatePanel[hidden], #passwordUpdateComplete[hidden], #profilePanel[hidden], #nameField[hidden], #accountPasswordField[hidden], #forgotPasswordLink[hidden], #authModeSwitchRow[hidden], #profileAvatar[hidden] { display: none !important; }
body.account-view-open #workspace { display: none !important; }
body.account-view-open #music { display: none !important; }
.account-page-head { width: min(1120px, 100%); min-height: 42px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.account-layout { width: min(1120px, 100%); margin: auto; padding: clamp(26px, 5vw, 60px) 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 460px); align-items: center; gap: clamp(28px, 7vw, 90px); }
.account-intro { max-width: 520px; }
.account-intro h1 { margin: 8px 0 12px; font-size: clamp(30px, 4vw, 44px); line-height: 1.25; }
.account-intro > p { max-width: 460px; margin: 0; color: var(--dim); font-size: 16px; }
.profile-points { display: grid; gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; color: var(--dim); }
.profile-points li { position: relative; padding-right: 24px; }
.profile-points li::before { position: absolute; right: 0; color: var(--accent); content: "✓"; font-weight: 700; }
#accountCard { width: 100%; padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
#accountCard h2 { margin: 0 0 6px; font-size: 21px; }
#accountStatus { min-height: 1.6em; margin: 0 0 14px; color: var(--dim); font-size: 13px; }
#accountCard p { color: var(--dim); }
#accountCard form, #profilePanel { display: flex; flex-direction: column; gap: 13px; }
#emailPending { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
#emailPending h2, #emailPending p { margin: 0; }
#emailPending .form-intro { max-width: 360px; }
#emailPending button { width: 100%; margin-top: 7px; }
.success-mark { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid #5c9f7c; border-radius: 50%; background: #193328; color: #9bd2b1; font-size: 25px; font-weight: 700; }
#accountCard label { display: flex; flex-direction: column; gap: 6px; color: var(--dim); font-size: 13px; }
#accountCard input, #accountCard textarea { color: var(--text); }
#accountCard textarea { min-height: 105px; resize: vertical; }
#accountCard input::placeholder, #accountCard textarea::placeholder { color: #747b87; }
.form-intro { margin: 0 0 12px; font-size: 13px; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 15px; }
.auth-switch .on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.auth-mode-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; margin-top: 14px; color: var(--dim); font-size: 13px; }
.text-button { min-height: auto; padding: 3px 5px; border: 0; background: transparent; color: var(--accent); font-weight: 700; }
.text-button:hover { background: transparent; color: var(--accent-text); text-decoration: underline; }
#accountForm button { width: 100%; margin-top: 5px; }
.profile-summary { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.avatar-frame { width: 86px; height: 86px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--accent-border); border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: 28px; font-weight: 700; }
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.avatar-actions strong { font-size: 14px; }
.avatar-actions .secondary-button { width: auto; min-height: 35px; padding: 5px 10px; font-size: 12px; }
.avatar-actions small { max-width: 270px; color: var(--dim); font-size: 11px; line-height: 1.5; }
.profile-cover-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 12px 0; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.profile-cover-preview { height: 112px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #164b42; }
.profile-cover-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-cover-preview img[hidden] { display: none !important; }
.profile-cover-controls { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.profile-cover-controls > strong { flex: 1 1 100%; font-size: 13px; }
.profile-cover-controls small, .profile-privacy-note { color: var(--dim); font-size: 11px; line-height: 1.55; }
.profile-cover-controls small { flex: 1 1 100%; }
.profile-cover-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-cover-buttons button { width: auto; min-height: 34px; padding: 5px 9px; font-size: 11px; }
.profile-color-control { display: inline-flex !important; align-items: center; gap: 7px; font-size: 11px !important; }
#accountCard label.profile-color-control input[type="color"] { width: 38px; min-width: 38px; height: 34px; min-height: 34px; padding: 2px; }
.profile-phone-public { display: flex !important; align-items: center; flex-direction: row; gap: 8px; margin: 2px 0 0; }
#accountCard label.profile-phone-public input[type="checkbox"] { width: 17px; min-width: 17px; height: 17px; min-height: 17px; margin: 0; padding: 0; border-radius: 4px; background: transparent; box-shadow: none; accent-color: #286b6b; }
.profile-privacy-note { display: block; margin-top: -7px; }
.profile-social-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 10px; margin: 8px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.profile-social-fields legend { padding: 0 5px; color: var(--text); font-size: 13px; font-weight: 700; }
.profile-social-fields p { grid-column: 1 / -1; margin: -5px 0 1px; color: var(--dim) !important; font-size: 11px; line-height: 1.5; }
.profile-social-fields label { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 11px !important; }
.profile-social-fields input { min-height: 38px !important; padding: 8px 9px !important; font-size: 11px !important; }
.profile-email { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.profile-email span { color: var(--dim); font-size: 11px; }
.profile-email strong { overflow-wrap: anywhere; font-size: 13px; }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.profile-actions button { width: 100%; }
#signOut { align-self: flex-start; min-height: 36px; margin-top: 2px; padding-inline: 8px; border-color: transparent; background: transparent; }
#setupNotice p { margin: 8px 0 17px; }
#setupNotice button { width: 100%; }

/* هوية دخول فاتحة: مساحة هادئة ومركّزة بعيدًا عن كثافة المحرر */
#accountGate { background: radial-gradient(ellipse at 18% 12%, #e2f1ef 0, transparent 35%), linear-gradient(135deg, #f7f9fc 0%, #edf2f7 100%); color: #17222c; }
#accountGate .account-page-head { border-color: #dfe6ec; }
#accountGate .account-page-head .eyebrow, #accountGate .account-intro .eyebrow { color: #397a78; }
#accountGate .account-page-head > button { border-color: #d6e0e7; background: #ffffffb8; color: #304451; }
.account-layout { width: min(1040px, 100%); grid-template-columns: minmax(0, 1fr) minmax(340px, 440px); gap: clamp(36px, 8vw, 104px); }
.account-intro { max-width: 510px; }
.auth-intro-mark { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 28px; color: #354b58; font: 700 11px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: .16em; }
.auth-intro-mark .brand-mark { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; background: #e2f1ef; }
.auth-intro-mark .brand-mark i { background: #2f7475; }
#accountGate .account-intro h1 { max-width: 12ch; color: #182832; font-size: clamp(34px, 4.4vw, 49px); letter-spacing: -.035em; }
#accountGate .account-intro > p { color: #5c6b76; font-size: 16px; line-height: 1.85; }
.auth-benefits { display: grid; gap: 12px; margin: 25px 0 0; padding: 0; list-style: none; color: #465964; font-size: 14px; }
.auth-benefits li { position: relative; padding-inline-start: 28px; }
.auth-benefits li::before { position: absolute; inset-inline-start: 0; top: .1em; display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; background: #dcefeb; color: #28716d; content: "✓"; font: 700 12px/1 system-ui, sans-serif; }
.auth-security-note { display: flex; align-items: center; gap: 8px; margin-top: 34px; color: #71808b; font-size: 12px; }
.auth-security-note > span:first-child { color: #4c8a83; font-size: 17px; }
#accountCard { padding: clamp(24px, 3.2vw, 34px); border-color: #e2e8ed; border-radius: 20px; background: #fff; box-shadow: 0 22px 60px #24405412, 0 2px 8px #24405408; color: #17222c; color-scheme: light; }
#accountCard h2 { color: #182832; font-size: 22px; letter-spacing: -.02em; }
#accountCard #accountStatus { color: #677780; }
#accountCard #accountStatus.is-error { color: #b42332; }
#accountCard p { color: #5e6d77; }
#accountCard .form-intro { color: #687780; line-height: 1.7; }
#accountCard label { color: #42535e; font-size: 13px; font-weight: 600; }
#accountCard input:not([type="file"]), #accountCard textarea { min-height: 46px; padding: 10px 12px; border: 1px solid #dce4e9; border-radius: 10px; background: #fbfcfd; color: #17222c; box-shadow: inset 0 1px 2px #17222c05; }
#accountCard input:not([type="file"]):focus, #accountCard textarea:focus { border-color: #66a19d; background: #fff; outline: 3px solid #3f8e851c; }
#accountCard input::placeholder, #accountCard textarea::placeholder { color: #97a2aa; }
#accountCard button { border-color: #d9e2e8; border-radius: 10px; background: #fff; color: #344b59; }
#accountCard button:hover { border-color: #aabfc6; background: #f6f9fa; }
#accountCard button.primary { border-color: #286b6b; background: #286b6b; color: #fff; box-shadow: 0 5px 12px #286b6b26; }
#accountCard button.primary:hover { border-color: #215b5c; background: #215b5c; }
#accountCard button.danger-button { border-color: #f0dadd; background: #fff; color: #a52a37; }
#accountCard button.danger-button:hover { border-color: #e6bdc2; background: #fff7f7; color: #8f1e2a; }
#accountCard .text-button { min-height: auto; border: 0; background: transparent; color: #246b70; box-shadow: none; }
#accountCard .text-button:hover { background: transparent; color: #174f55; }
#accountCard .success-mark { border-color: #a7d6c3; background: #e9f6ef; color: #27734f; }
#accountCard .auth-mode-switch { color: #71808a; }
#accountCard .profile-email { border-color: #e2e8ed; background: #f7f9fb; }
#accountCard .profile-email span { color: #77858f; }
#accountCard .profile-email strong { color: #263a45; }
.forgot-password-link { display: block; margin-block-start: 9px; margin-inline-start: auto; margin-inline-end: 0; padding: 2px 0 !important; font-size: 13px; font-weight: 600; }
#recoveryEmailSent, #passwordUpdatePanel, #passwordUpdateComplete { display: flex; flex-direction: column; gap: 10px; }
#recoveryEmailSent, #passwordUpdateComplete { align-items: center; text-align: center; }
#recoveryEmailSent h2, #recoveryEmailSent p, #passwordUpdateComplete h2, #passwordUpdateComplete p { margin: 0; }
#recoveryEmailSent button, #passwordUpdateComplete button { width: 100%; margin-top: 6px; }
#passwordUpdatePanel form { display: flex; flex-direction: column; gap: 13px; margin-top: 5px; }
#passwordUpdatePanel form button { width: 100%; margin-top: 4px; }

@media (max-width: 900px) {
  #appHeader { min-height: 66px; padding-inline: 16px; }
  .privacy-chip { display: none; }
  #panel { flex-basis: 280px; width: 280px; }
  #empty { grid-template-columns: minmax(0, 1fr) minmax(270px, .9fr); gap: 25px; padding: 18px; }
  .steps { gap: 8px; }
  .steps li { padding: 10px; }
  .step-number { width: 30px; height: 30px; }
}
@media (max-width: 680px) {
  #appHeader { flex-wrap: wrap; gap: 9px; padding: 10px 13px; }
  .brand { gap: 8px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { display: none; }
  .account-button { max-width: min(250px, 64vw); }
  .account-button-copy small { display: none; }
  .header-actions { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 5px; }
  .auth-header-actions { flex-wrap: wrap; }
  .header-actions button { min-height: 37px; gap: 5px; padding: 6px 9px; font-size: 12px; }
  .header-actions svg { width: 16px; height: 16px; }
  #guestLanding { padding: 16px; }
  .guest-card { padding: 25px 18px; }
  .guest-card h1 { font-size: clamp(26px, 8vw, 34px); }
  .guest-actions { width: 100%; flex-direction: column; }
  .guest-actions button { width: 100%; }
  #workspace { flex-direction: column; }
  #pdfWorkspace { flex-direction: column; }
  #panel { order: 0; flex: 0 0 auto; width: 100%; max-width: none; max-height: 36dvh; gap: 12px; padding: 13px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  #stage { order: 1; flex: 1 1 0; padding: 12px; }
  #empty { width: min(520px, 100%); grid-template-columns: 1fr; gap: 17px; padding: 14px 5px; }
  .landing-copy { padding: 3px 5px; }
  .landing-copy h1 { margin: 6px 0 9px; font-size: clamp(27px, 8vw, 36px); }
  .landing-copy .lead { font-size: 14px; }
  .privacy-card { margin-top: 14px; padding: 12px; }
  .drop-zone { min-height: 230px; padding: 20px 14px; }
  .steps { grid-template-columns: 1fr; gap: 7px; }
  .steps li { padding: 8px 10px; }
  #music { left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); max-height: min(76dvh, 600px); }
  .account-page-head { align-items: center; }
  .account-page-head > button { width: auto; min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .account-layout { grid-template-columns: 1fr; gap: 18px; padding: 22px 0; }
  .account-intro h1, #accountGate .account-intro h1 { max-width: none; margin: 4px 0 7px; font-size: clamp(29px, 7.5vw, 36px); }
  .account-intro > p, #accountGate .account-intro > p { font-size: 14px; }
  .auth-intro-mark { margin-bottom: 17px; }
  .auth-benefits { grid-template-columns: 1fr; gap: 7px; margin-top: 15px; font-size: 12px; }
  .auth-security-note { margin-top: 15px; }
  .profile-points { grid-template-columns: 1fr; gap: 5px; margin-top: 11px; font-size: 12px; }
  #accountCard { padding: 18px; }
}
@media (max-width: 390px) {
  .header-actions button span { display: inline; }
  .header-actions button { width: auto; padding: 5px 7px; font-size: 11px; }
  .profile-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }


/* مساحة العمل والأقسام */
.brand-mark { grid-template-columns: repeat(2, 1fr); gap: 3px; padding: 10px; }
.brand-mark i { display: block; width: 100%; height: 100%; border-radius: 3px; background: var(--accent); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .62; }
.suite-workspace { flex-direction: column; }
.suite-nav { z-index: 3; flex: 0 0 auto; display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 9px clamp(14px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--header-bg); scrollbar-width: thin; }
.suite-nav-item { flex: 0 0 auto; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 13px; border-color: transparent; background: transparent; color: var(--dim); font-size: 13px; white-space: nowrap; }
.suite-nav-item:hover { background: var(--panel-raised); color: var(--text); }
.suite-nav-item.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.suite-nav-divider { width: 1px; height: 24px; flex: 0 0 1px; margin-inline: 3px; background: var(--line); }
.suite-nav-item.nav-upcoming { cursor: not-allowed; }
.suite-nav-item small { color: var(--dim); font-size: 10px; }
.suite-view { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; }
.suite-view[hidden], #sheetsHomeView[hidden], #sheetEditorView[hidden], #pdfWorkspace[hidden] { display: none !important; }
.home-view, .section-view { padding: clamp(22px, 4vw, 50px) clamp(16px, 5vw, 72px); background: radial-gradient(ellipse at 75% 0, var(--panel) 0, var(--bg) 62%); }
.home-heading { max-width: 760px; margin: 0 0 20px; }
.home-heading h1, .section-heading h1 { margin: 5px 0 4px; font-size: clamp(27px, 3.6vw, 38px); line-height: 1.3; }
.home-heading p, .section-heading p { margin: 0; color: var(--dim); font-size: 15px; }
.home-quick-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 20px 0 26px; }
.home-quick-actions button { min-width: 145px; }
.workspace-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 1060px; }
.workspace-card { position: relative; min-height: 102px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); color: var(--text); text-align: start; text-decoration: none; }
button.workspace-card:hover { border-color: var(--accent-border); background: var(--panel-raised); transform: translateY(-1px); }
.workspace-card-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font: 700 17px/1 system-ui, sans-serif; }
.workspace-card-copy { min-width: 0; display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; }
.workspace-card-copy strong { font-size: 16px; }
.workspace-card-copy small { color: var(--dim); font-size: 12px; }
.workspace-card-arrow { flex: 0 0 auto; color: var(--accent); font-size: 18px; }
.workspace-card-upcoming { opacity: .7; cursor: default; }
.workspace-card-status { flex: 0 0 auto; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--dim); font-size: 11px; white-space: nowrap; }
.recent-section { max-width: 1060px; margin-top: clamp(28px, 5vw, 48px); }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title-row h2, .project-list-section h2 { margin: 2px 0 0; font-size: 20px; }
.recent-list, .project-list { display: grid; gap: 8px; }
.recent-item, .project-row { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.recent-item-open, .project-open { min-width: 0; min-height: 42px; flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-start; gap: 10px; overflow: hidden; border: 0; background: transparent; text-align: start; }
.recent-item-open:hover, .project-open:hover { background: transparent; }
.recent-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.recent-item-type { flex: 0 0 auto; color: var(--dim); font-size: 11px; }
.project-delete { min-height: 34px; padding: 4px 9px; color: var(--danger); font-size: 12px; }
.empty-hint { margin: 10px 0 0; color: var(--dim); font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 0 0 24px; }
.section-heading > div { min-width: 0; }
.section-heading > button { flex: 0 0 auto; }
.document-tool-cards { max-width: 800px; margin: 4px 0 28px; }
.document-tool-card { width: 100%; min-height: 82px; display: flex; align-items: center; gap: 13px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-align: start; }
.document-tool-card > span:nth-child(2) { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.document-tool-card small { color: var(--dim); }
.document-tool-card:hover { border-color: var(--accent-border); }
.project-list-section { max-width: 800px; }

/* محرّر المستند */
.editor-view { display: flex; flex-direction: column; overflow: hidden; background: var(--panel-soft); }
.editor-view[hidden] { display: none !important; }
.editor-header { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px clamp(10px, 2.5vw, 26px); border-bottom: 1px solid var(--line); background: var(--panel); }
.editor-header > input[type="text"] { min-width: 100px; flex: 1 1 180px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); font-weight: 600; }
.editor-header > input[type="text"]:focus { border-color: var(--line); background: var(--bg); }
.editor-header button, .file-action { min-height: 36px; padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.save-status { flex: 0 1 auto; min-width: 90px; color: #a7c6ae; font-size: 11px; text-align: center; }
.word-toolbar { z-index: 1; flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px clamp(10px, 2.5vw, 26px); border-bottom: 1px solid var(--line); background: var(--panel); }
.word-toolbar button { min-width: 36px; min-height: 34px; padding: 4px 8px; }
.word-toolbar select { min-height: 34px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; font-size: 12px; }
.doc-color-control { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; color: var(--dim); font-size: 11px; white-space: nowrap; }
.doc-color-control input[type="color"] { width: 30px; min-width: 30px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--control-bg); cursor: pointer; }
.toolbar-divider { width: 1px; height: 24px; margin-inline: 3px; background: var(--line); }
.doc-page-scroller { flex: 1 1 auto; min-height: 0; overflow: auto; padding: clamp(14px, 3vw, 32px); background: var(--panel-soft); }
.doc-paper { width: min(850px, 100%); min-height: 100%; margin: 0 auto; padding: clamp(24px, 6vw, 78px); border: 1px solid #dedede; border-radius: 3px; background: #fff; box-shadow: 0 8px 30px #0004; color: #202124; font: 16px/1.85 "IBM Plex Sans Arabic", Arial, sans-serif; outline: none; overflow-wrap: anywhere; }
.doc-paper:empty::before { color: #9aa0a6; content: attr(data-placeholder); }
.doc-paper h2 { margin: .8em 0 .4em; font-size: 1.6em; line-height: 1.35; }
.doc-paper h3 { margin: .75em 0 .35em; font-size: 1.25em; line-height: 1.4; }
.doc-paper table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc-paper th, .doc-paper td { min-width: 70px; padding: 7px 9px; border: 1px solid #777; }
.doc-paper th { background: #f0f1f4; }
.doc-paper blockquote { margin-inline: 0; padding-inline-start: 14px; border-inline-start: 3px solid var(--accent); color: #555; }

/* قوالب السيرة الذاتية: تبدأ قواعد المظهر المصدّر وتنتهي عند العلامة الختامية. */
/* CV_RESUME_STYLES_START */
.documents-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.resume-gallery { max-width: 1120px; margin: 8px 0 30px; }
.resume-gallery-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin: 8px 0 14px; }
.resume-gallery-heading h2 { margin: 3px 0; font-size: 22px; }
.resume-gallery-heading p { margin: 0; color: var(--dim); font-size: 13px; }
.resume-template-count { flex: 0 0 auto; padding: 5px 10px; border: 1px solid var(--accent-border); border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; }
.resume-templates-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.resume-template-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-align: start; }
.resume-template-card:hover { border-color: var(--accent-border); box-shadow: 0 10px 28px #1a34310f; }
.resume-template-preview { height: 150px; display: flex; justify-content: center; overflow: hidden; padding: 12px 12px 0; background: var(--panel-raised); }
.resume-mini-page { position: relative; width: 148px; height: 205px; flex: 0 0 148px; overflow: hidden; padding: 13px 11px; border: 1px solid #e1e5e9; background: #fff; box-shadow: 0 5px 18px #1e293b1a; direction: ltr; }
.resume-mini-banner { height: 42px; display: flex; align-items: center; gap: 7px; padding: 6px; background: var(--cv-accent, #315778); }
.resume-mini-avatar { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: #ffffff9c; }
.resume-mini-lines { flex: 1; display: grid; gap: 4px; }
.resume-mini-lines i, .resume-mini-section i { height: 3px; display: block; border-radius: 5px; background: #d7dde4; }
.resume-mini-lines i:first-child { width: 72%; height: 5px; background: #fff; }
.resume-mini-lines i:last-child { width: 50%; background: #ffffffb5; }
.resume-mini-body { display: grid; grid-template-columns: 42px 1fr; gap: 8px; margin-top: 10px; }
.resume-mini-side { min-height: 125px; padding: 5px; background: color-mix(in srgb, var(--cv-accent, #315778) 12%, white); }
.resume-mini-main { display: grid; align-content: start; gap: 7px; }
.resume-mini-section { display: grid; gap: 4px; }
.resume-mini-section b { width: 54%; height: 4px; display: block; margin-bottom: 2px; border-radius: 4px; background: var(--cv-accent, #315778); }
.resume-mini-section i { width: 96%; height: 2.5px; background: #d9dfe5; }
.resume-mini-section i:last-child { width: 72%; }
.resume-template-copy { display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; padding: 12px 13px 13px; }
.resume-template-copy strong { font-size: 14px; }
.resume-template-copy small { min-height: 34px; color: var(--dim); font-size: 11px; line-height: 1.55; }
.resume-template-use { align-self: flex-start; margin-top: 6px; color: var(--accent-text); font-size: 12px; font-weight: 600; }
.resume-local-note { margin: 12px 0 0; color: var(--dim); font-size: 11px; }
.cv-builder-dialog { width: min(1120px, calc(100vw - 28px)); max-width: 1120px; max-height: min(92dvh, 900px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 24px 90px #0005; }
.cv-builder-dialog::backdrop { background: #11182780; backdrop-filter: blur(3px); }
.cv-builder-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 20px 13px; border-bottom: 1px solid var(--line); }
.cv-builder-header-actions { display: flex; align-items: center; gap: 7px; }
.cv-fullscreen-button { min-height: 34px; padding: 5px 10px; font-size: 12px; white-space: nowrap; }
.cv-builder-header h2 { margin: 2px 0; font-size: 20px; }
.cv-builder-header p { margin: 0; color: var(--dim); font-size: 12px; }
.cv-builder-header .cv-edit-hint { margin-top: 5px; color: var(--accent-text); }
.cv-builder-content { max-height: calc(min(92dvh, 900px) - 78px); display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(270px, .7fr); overflow: auto; }
.cv-builder-form { min-width: 0; padding: 16px 20px 20px; }
.cv-photo-picker { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.cv-photo-preview-wrap { width: 62px; height: 62px; flex: 0 0 62px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.cv-photo-preview-wrap img { width: 100%; height: 100%; object-fit: cover; }
.cv-photo-preview-wrap img[hidden] { display: none !important; }
.cv-photo-picker p { margin: 1px 0 5px; color: var(--dim); font-size: 11px; }
.cv-photo-button { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--accent-text); font-size: 11px; cursor: pointer; }
.cv-photo-picker small { display: block; min-height: 16px; color: var(--dim); font-size: 10px; }
.cv-cert-picker { margin: 0 0 15px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.cv-cert-picker-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cv-cert-picker-heading p { margin: 3px 0 0; color: var(--dim); font-size: 11px; line-height: 1.55; }
.cv-cert-picker-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.cv-cert-picker-item { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.cv-cert-picker-item img { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 5px; object-fit: cover; }
.cv-cert-picker-item span { min-width: 0; flex: 1; overflow: hidden; color: var(--text); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.cv-cert-picker-item button { min-height: 28px; padding: 3px 7px; color: var(--danger); font-size: 10px; }
.cv-cert-picker > small { display: block; min-height: 16px; margin-top: 4px; color: var(--dim); font-size: 10px; }
.cv-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 12px; }
.cv-field { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: var(--text-muted); font-size: 12px; }
.cv-field-wide { grid-column: 1 / -1; }
.cv-field input, .cv-field textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.cv-field input { min-height: 38px; }
.cv-field textarea { min-height: 72px; resize: vertical; line-height: 1.55; }
.cv-field small { color: var(--dim); font-size: 10px; line-height: 1.5; }
.cv-builder-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); }
.cv-live-preview-panel { min-width: 0; overflow: hidden; padding: 14px; border-inline-start: 1px solid var(--line); background: var(--panel-soft); }
.cv-live-preview-panel h3 { margin: 0 0 9px; font-size: 13px; }
.cv-live-preview-frame { height: min(620px, 65dvh); overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #e9edf1; }
#cvLivePreview { width: 100%; min-height: 100%; }
#cvLivePreview .cv-layout { width: 100%; min-height: 0; padding: 16px !important; box-shadow: 0 2px 10px #0001; font-size: 9px; }
#cvLivePreview .cv-banner { padding: 12px; }
#cvLivePreview .cv-photo-box { width: 56px; height: 56px; flex-basis: 56px; }
#cvLivePreview .cv-name { font-size: 20px; }
#cvLivePreview .cv-headline, #cvLivePreview .cv-contact-item, #cvLivePreview .cv-summary, #cvLivePreview .cv-entry-org, #cvLivePreview .cv-entry-detail { font-size: 8px; }
#cvLivePreview .cv-section-title { font-size: 10px; }
#cvLivePreview .cv-chip { padding: 2px 5px; font-size: 7px; }
#cvLivePreview .cv-certificate-image { max-height: 110px; }
#cvLivePreview .cv-certificate-title { font-size: 7px; }
#cvLivePreview .cv-columns { gap: 12px; grid-template-columns: minmax(0, .72fr) minmax(0, 1.5fr); }
#cvLivePreview .cv-sidebar { padding: 8px; }
#cvLivePreview .cv-section { margin-bottom: 12px; }
.cv-document { padding: 20px !important; background: var(--panel-soft) !important; }
/* CV layout */
.cv-layout { --cv-accent: #315778; --cv-tint: #edf3f7; width: 100%; max-width: 850px; min-height: 980px; margin: 0 auto; padding: 0; overflow: hidden; background: #fff; color: #243448; font: 14px/1.5 "IBM Plex Sans Arabic", Arial, sans-serif; box-shadow: 0 2px 14px #1d29391a; }
.cv-layout * { box-sizing: border-box; }
.cv-banner { min-height: 178px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 34px 38px; background: var(--cv-accent); color: #fff; }
.cv-banner-copy { min-width: 0; flex: 1 1 auto; }
.cv-kicker { display: inline-block; margin-bottom: 7px; color: #ffffffc7; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.cv-name { margin: 0; color: inherit; font-size: clamp(26px, 4vw, 38px); font-weight: 700; line-height: 1.18; overflow-wrap: anywhere; }
.cv-headline { margin: 6px 0 12px; color: #ffffffe0; font-size: 15px; font-weight: 500; }
.cv-contact { display: flex; flex-wrap: wrap; gap: 5px 14px; color: #ffffffe8; font-size: 10px; }
.cv-contact-item { overflow-wrap: anywhere; }
.cv-photo-box { width: 112px; height: 112px; flex: 0 0 112px; display: grid; place-items: center; overflow: hidden; border: 3px solid #ffffffb8; border-radius: 50%; background: #ffffff29; }
.cv-photo { width: 100%; height: 100%; display: block; object-fit: cover; }
.cv-photo-placeholder { color: #fff; font-size: 33px; font-weight: 700; }
.cv-columns { display: grid; grid-template-columns: minmax(0, .76fr) minmax(0, 1.55fr); gap: 30px; padding: 28px 38px 38px; }
.cv-sidebar { min-width: 0; padding: 17px 17px 5px; background: var(--cv-tint); }
.cv-main { min-width: 0; }
.cv-section { margin: 0 0 23px; break-inside: avoid; }
.cv-section:last-child { margin-bottom: 0; }
.cv-layout .cv-section-title { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--cv-accent); color: var(--cv-accent); font-size: 15px; font-weight: 700; line-height: 1.35; }
.cv-summary, .cv-language-list { margin: 0; color: #405064; font-size: 12px; line-height: 1.85; white-space: pre-line; }
.cv-entry { margin: 0 0 14px; break-inside: avoid; }
.cv-entry:last-child { margin-bottom: 0; }
.cv-entry-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cv-layout .cv-entry-title { margin: 0; color: #223247; font-size: 13px; font-weight: 700; }
.cv-entry-period { flex: 0 0 auto; color: var(--cv-accent); font-size: 10px; font-weight: 600; }
.cv-entry-org { margin: 2px 0 0; color: var(--cv-accent); font-size: 11px; font-weight: 600; }
.cv-entry-detail { margin: 4px 0 0; color: #526173; font-size: 11px; line-height: 1.65; }
.cv-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-chip { display: inline-block; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--cv-accent) 20%, #fff); border-radius: 999px; background: #fff; color: #34485b; font-size: 10px; line-height: 1.35; }
.cv-certificate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cv-certificate-card { min-width: 0; margin: 0; padding: 7px; border: 1px solid color-mix(in srgb, var(--cv-accent) 24%, #fff); border-radius: 8px; background: #fff; break-inside: avoid; }
.cv-certificate-image { width: 100%; max-height: 310px; display: block; object-fit: contain; background: #fff; }
.cv-certificate-title { margin: 5px 0 0; color: #405064; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.cv-certificates-empty { margin: 0; color: #748091; font-size: 11px; font-style: italic; }
.cv-template-classic { --cv-accent: #315778; --cv-tint: #edf3f7; }
.cv-template-modern { --cv-accent: #137b78; --cv-tint: #e9f5f3; }
.cv-template-sidebar { --cv-accent: #26384d; --cv-tint: #e8edf3; }
.cv-template-sidebar .cv-banner { min-height: 155px; }
.cv-template-minimal { --cv-accent: #525e69; --cv-tint: #f3f4f5; }
.cv-template-minimal .cv-banner { padding-block: 24px; background: #fff; color: #27313a; border-bottom: 2px solid var(--cv-accent); }
.cv-template-minimal .cv-kicker, .cv-template-minimal .cv-headline, .cv-template-minimal .cv-contact { color: #58636c; }
.cv-template-minimal .cv-photo-box { border-color: #d7dde2; background: var(--cv-tint); }
.cv-template-minimal .cv-photo-placeholder { color: var(--cv-accent); }
.cv-template-executive { --cv-accent: #493469; --cv-tint: #f1edf6; }
.cv-template-executive .cv-banner { min-height: 195px; }
.cv-template-executive .cv-photo-box { border-radius: 18px; }
.cv-template-creative { --cv-accent: #b54f3e; --cv-tint: #fbefeb; }
.cv-template-creative .cv-banner { border-radius: 0 0 48px 0; }
.cv-template-creative .cv-photo-box { border-radius: 26px 50% 50% 50%; }
.cv-template-academic { --cv-accent: #174b66; --cv-tint: #eef3f5; }
.cv-template-academic .cv-banner { background: #fff; color: #20394a; border-bottom: 1px solid #d4dfe4; }
.cv-template-academic .cv-kicker, .cv-template-academic .cv-headline, .cv-template-academic .cv-contact { color: #476273; }
.cv-template-academic .cv-photo-box { border-color: var(--cv-accent); }
.cv-template-academic .cv-photo-placeholder { color: var(--cv-accent); }
.cv-template-compact { --cv-accent: #397157; --cv-tint: #ebf3ee; }
.cv-template-compact .cv-banner { min-height: 145px; padding-block: 22px; }
.cv-template-compact .cv-columns { gap: 20px; padding-block: 20px; }
.cv-template-elegant { --cv-accent: #93674f; --cv-tint: #f6f0ec; }
.cv-template-elegant .cv-banner { background: #fbf8f5; color: #42352d; border-bottom: 3px solid var(--cv-accent); }
.cv-template-elegant .cv-kicker, .cv-template-elegant .cv-headline, .cv-template-elegant .cv-contact { color: #766454; }
.cv-template-elegant .cv-photo-box { border-color: #c4a48e; }
.cv-template-elegant .cv-photo-placeholder { color: var(--cv-accent); }
.cv-template-tech { --cv-accent: #126581; --cv-tint: #e9f3f6; }
.cv-template-tech .cv-name { letter-spacing: -.035em; }
.cv-template-professional { --cv-accent: #394d64; --cv-tint: #edf0f4; }
.cv-template-professional .cv-banner { min-height: 160px; }
.cv-template-professional .cv-photo-box { width: 94px; height: 94px; flex-basis: 94px; }
.cv-template-bold { --cv-accent: #ae3e37; --cv-tint: #f8eeed; }
.cv-template-bold .cv-banner { border-inline-start: 12px solid #772e2b; }
.cv-template-bold .cv-section-title { border-bottom-width: 3px; }
.cv-layout[dir="rtl"] .cv-contact { direction: rtl; }
.cv-layout[dir="ltr"] .cv-contact { direction: ltr; }
.cv-live-preview-panel .cv-layout { min-height: 0; }
@media (max-width: 980px) { .resume-templates-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .resume-templates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .resume-gallery-heading { align-items: flex-start; }
  .cv-builder-content { grid-template-columns: 1fr; }
  .cv-live-preview-panel { border-inline-start: 0; border-top: 1px solid var(--line); }
  .cv-live-preview-frame { height: 440px; }
  .cv-live-preview-panel #cvLivePreview { max-width: 420px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .documents-heading-actions { width: 100%; }
  .documents-heading-actions button { flex: 1 1 auto; }
  .resume-template-preview { height: 128px; }
  .resume-template-copy { padding: 9px; }
  .resume-template-copy small { min-height: 44px; }
  .cv-builder-header { padding: 13px; }
  .cv-builder-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .cv-fullscreen-button { max-width: 125px; white-space: normal; }
  .cv-builder-form { padding: 12px; }
  .cv-form-grid { grid-template-columns: 1fr; }
  .cv-field-wide { grid-column: auto; }
  .cv-banner { min-height: 130px; gap: 10px; padding: 18px 16px; }
  .cv-photo-box { width: 72px; height: 72px; flex-basis: 72px; }
  .cv-columns { grid-template-columns: 1fr; gap: 15px; padding: 17px 16px; }
  .cv-sidebar { order: 2; }
  .cv-main { order: 1; }
  .cv-template-minimal .cv-columns, .cv-template-academic .cv-columns { grid-template-columns: 1fr; }
  .cv-cert-picker-list, .cv-certificate-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) { .cv-certificate-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .cv-certificate-grid { grid-template-columns: 1fr; gap: 7px; } .cv-certificate-card { padding: 4px; } .cv-certificate-image { max-height: 220px; } }
#cvBuilderDialog:fullscreen, #cvBuilderDialog.is-pseudo-fullscreen { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
#cvBuilderDialog.is-pseudo-fullscreen { position: fixed; inset: 0; }
#cvBuilderDialog:fullscreen .cv-builder-content, #cvBuilderDialog.is-pseudo-fullscreen .cv-builder-content { height: calc(100dvh - 82px); max-height: calc(100dvh - 82px); }
@media print {
  .cv-layout { width: 100%; max-width: none; min-height: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cv-layout .cv-banner, .cv-layout .cv-sidebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cv-layout .cv-section, .cv-layout .cv-entry { break-inside: avoid; }
  .cv-document { padding: 0 !important; background: #fff !important; }
  #docEditor.cv-document .cv-layout { width: 100%; max-width: none; min-height: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #docEditor.cv-document .cv-banner, #docEditor.cv-document .cv-sidebar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #docEditor.cv-document .cv-section, #docEditor.cv-document .cv-entry, #docEditor.cv-document .cv-certificate-card { break-inside: avoid; }
  #docEditor.cv-document .cv-photo { print-color-adjust: exact; }
}
/* CV_RESUME_STYLES_END */

/* محرّر الجداول */
#spreadsheetsView { display: flex; flex-direction: column; overflow: hidden; }
#spreadsheetsView[hidden] { display: none !important; }
#sheetsHomeView { flex: 1 1 auto; overflow: auto; padding: clamp(22px, 4vw, 50px) clamp(16px, 5vw, 72px); background: radial-gradient(ellipse at 75% 0, var(--panel) 0, var(--bg) 62%); }
#sheetsHomeView .project-list, #sheetsHomeView .empty-hint { max-width: 800px; }
.sheet-editor-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sheet-editor-header { flex-wrap: wrap; }
.file-action { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: var(--control-bg); color: var(--text); cursor: pointer; }
.file-action:hover { background: var(--control-hover); }
.formula-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.cell-address-label { width: 76px; flex: 0 0 76px; }
.cell-address-label input, #formulaInput { width: 100%; min-width: 0; height: 35px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text); }
.cell-address-label input { text-align: center; font: 600 13px/1.3 ui-monospace, monospace; }
.formula-mark { color: var(--dim); font: italic 600 15px/1 Georgia, serif; }
#formulaInput { flex: 1 1 auto; direction: ltr; text-align: left; }
#applyFormula { min-width: 38px; min-height: 35px; padding: 4px; }
.sheet-hint { flex: 0 0 auto; margin: 0; padding: 6px 14px; color: var(--dim); font-size: 11px; }
.sheet-grid-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 12px 18px; }
.sheet-grid { min-width: 830px; border-collapse: separate; border-spacing: 0; table-layout: fixed; direction: ltr; color: var(--text); font: 13px/1.3 system-ui, sans-serif; }
.sheet-grid th, .sheet-grid td { width: 105px; height: 34px; padding: 0; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet-grid thead th { position: sticky; z-index: 2; top: 0; height: 32px; background: var(--panel-raised); color: var(--dim); text-align: center; font-weight: 600; }
.sheet-grid thead th:first-child, .sheet-grid tbody th { position: sticky; z-index: 1; left: 0; width: 44px; background: var(--panel-raised); color: var(--dim); text-align: center; font-weight: 500; }
.sheet-grid thead th:first-child { z-index: 3; }
.sheet-grid td { background: var(--header-bg); }
.sheet-grid td input { display: block; width: 100%; height: 100%; padding: 5px 8px; border: 0; border-radius: 0; outline: none; background: transparent; color: var(--text); font: inherit; text-align: left; }
.sheet-grid td:focus-within { position: relative; z-index: 1; outline: 2px solid var(--accent); outline-offset: -2px; }
.sheet-grid td input:focus-visible { outline: 0; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; }

@media (max-width: 720px) {
  .suite-nav { gap: 2px; padding-inline: 10px; }
  .suite-nav-item { padding-inline: 10px; font-size: 12px; }
  .home-view, .section-view, #sheetsHomeView { padding: 20px 14px; }
  .workspace-card-grid { grid-template-columns: 1fr; gap: 8px; }
  .workspace-card { min-height: 82px; padding: 13px; }
  .workspace-card-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .section-heading > button { width: 100%; }
  .editor-header { gap: 6px; padding: 8px; }
  .editor-header > input[type="text"] { flex-basis: calc(100% - 130px); }
  .editor-header button, .file-action { min-height: 34px; padding: 4px 8px; font-size: 11px; }
  .save-status { order: 5; flex: 1 0 100%; text-align: start; }
  .doc-page-scroller { padding: 10px; }
  .doc-paper { min-height: 68vh; padding: 22px 18px; font-size: 15px; }
  .sheet-editor-header { align-items: stretch; }
  .sheet-editor-header > input[type="text"] { flex: 1 1 55%; }
  .sheet-editor-header .save-status { order: 5; }
  .sheet-grid-scroll { padding-inline: 5px; }
}
@media (max-width: 420px) {
  .workspace-card-status { padding: 2px 6px; font-size: 10px; }
  .home-quick-actions button { flex: 1 1 100%; }
  .formula-bar { gap: 5px; padding-inline: 7px; }
  .cell-address-label { width: 58px; flex-basis: 58px; }
}
@media print {
  body { display: block; overflow: visible; background: #fff; color: #111; }
  #appHeader, #suiteNav, .editor-header, .word-toolbar { display: none !important; }
  #workspace, #docEditorView, .doc-page-scroller { display: block !important; width: 100%; height: auto; min-height: 0; overflow: visible; padding: 0; background: #fff; }
  #docEditorView[hidden] { display: none !important; }
  #docEditor { width: 100%; min-height: 0; margin: 0; padding: 0; border: 0; box-shadow: none; color: #111; }
}


/* استوديو التصميم: محرر صور محلي بأدوات تحويل وتحسين ورسم وتصدير. */
#designEditor[hidden], #designEmpty[hidden] { display: none !important; }
.design-view { min-height: 0; }
.design-heading { align-items: center; }
.design-heading-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.design-empty { min-height: min(54vh, 500px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 34px 22px; border: 1px dashed var(--accent-border); border-radius: 22px; background: radial-gradient(ellipse at 50% 0, var(--accent-soft), var(--panel-soft) 68%); text-align: center; }
.design-empty-mark { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 20px; background: var(--panel); color: var(--accent); font-size: 32px; box-shadow: 0 12px 30px #122f2412; }
.design-empty h2 { margin: 6px 0 0; font-size: 23px; }
.design-empty p { max-width: 520px; margin: 0; color: var(--text-muted); line-height: 1.7; }
.design-empty small { max-width: 480px; margin-top: 4px; color: var(--dim); font-size: 12px; }
.design-editor { display: flex; min-height: min(76vh, 940px); flex-direction: column; gap: 8px; }
.design-toolbar, .design-toolstrip { min-width: 0; display: flex; align-items: center; gap: 7px; overflow-x: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); scrollbar-width: thin; }
.design-toolbar { justify-content: space-between; }
.design-history-actions, .design-zoom-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.design-history-actions button, .design-zoom-actions button { min-width: 34px; min-height: 34px; padding: 4px 8px; border-radius: 9px; font-size: 13px; }
.design-history-actions button:disabled { opacity: .45; cursor: not-allowed; }
.design-history-actions button:not(:disabled):hover, .design-zoom-actions button:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.design-toolbar-divider { width: 1px; height: 24px; margin-inline: 2px; background: var(--line); }
.design-preset-label { min-width: 150px; display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 11px; }
.design-preset-label select { min-width: 120px; height: 34px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.design-zoom-actions { color: var(--dim); font: 11px ui-monospace,monospace; }
.design-zoom-actions #designZoomFit { min-width: 66px; font-family: inherit; font-size: 11px; }
.design-toolstrip { justify-content: flex-start; padding-block: 6px; }
.design-toolstrip button { min-height: 35px; flex: 0 0 auto; padding: 5px 13px; border-color: transparent; border-radius: 9px; background: transparent; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.design-toolstrip button:hover { background: var(--panel-soft); color: var(--text); }
.design-toolstrip button.is-active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.design-workarea { min-width: 0; min-height: 430px; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 350px); align-items: stretch; gap: 10px; }
.design-preview-panel, .design-controls { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.design-preview-panel { display: flex; flex-direction: column; overflow: hidden; }
.design-preview-heading, .design-preview-meta { min-width: 0; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; }
.design-preview-heading { border-bottom: 1px solid var(--line); }
.design-preview-heading > div { min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; }
.design-preview-heading strong { max-width: min(45vw, 380px); overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.design-preview-heading span, .design-preview-meta { color: var(--dim); font-size: 10px; }
.design-preview-heading button { min-height: 31px; flex: 0 0 auto; padding: 4px 9px; font-size: 11px; }
.design-preview-stage { min-height: 330px; max-height: min(74vh, 860px); flex: 1 1 auto; display: grid; place-items: center; overflow: auto; padding: clamp(10px, 2vw, 22px); background-color: var(--panel-soft); background-image: linear-gradient(45deg,var(--panel-raised) 25%,transparent 25%),linear-gradient(-45deg,var(--panel-raised) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--panel-raised) 75%),linear-gradient(-45deg,transparent 75%,var(--panel-raised) 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
#designPreview { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 8px 28px #0007; touch-action: none; user-select: none; }
#designPreview[data-tool="crop"] { cursor: crosshair; }
#designPreview[data-tool="brush"], #designPreview[data-tool="eraser"], #designPreview[data-tool="rect"], #designPreview[data-tool="ellipse"], #designPreview[data-tool="line"], #designPreview[data-tool="arrow"] { cursor: crosshair; }
#designPreview[data-tool="text"] { cursor: text; }
.design-preview-meta { justify-content: flex-start; flex-wrap: wrap; margin: 0; border-top: 1px solid var(--line); }
.design-preview-meta strong { color: var(--text); direction: ltr; font: 600 11px/1.3 ui-monospace,monospace; }
.design-preview-meta #designToolHint { flex: 1 1 180px; text-align: end; }
.design-controls { display: flex; flex-direction: column; gap: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.design-control-group { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.design-control-group:last-child { border-bottom: 0; }
.design-control-group h2 { margin: 0 0 6px; font-size: 14px; }
.design-control-group > p { margin: 0 0 10px; color: var(--dim); font-size: 11px; line-height: 1.6; }
.design-number-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.design-number-grid label, .design-format-label { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 10px; }
.design-number-grid input, .design-format-label select, .design-text-label input, .design-inline-option input[type="number"], .design-inline-option select { width: 100%; min-width: 0; height: 34px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: 12px/1.3 ui-monospace,monospace; }
.design-number-grid input { direction: ltr; text-align: start; }
.design-output-fields { margin-top: 8px; }
.design-check { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: var(--text-muted); font-size: 11px; }
.design-check input { accent-color: var(--accent); }
.design-subtle-button { min-height: 31px; margin-top: 8px; padding: 4px 8px; border-color: var(--line); background: var(--panel-soft); color: var(--text-muted); font-size: 10px; }
.design-filter-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 9px; }
.design-filter-presets button { min-width: 0; min-height: 30px; padding: 3px 4px; border-color: var(--line); background: var(--panel-soft); color: var(--text-muted); font-size: 9px; }
.design-filter-presets button:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.design-range-list { display: grid; gap: 7px; }
.design-range-list label, .design-quality-label, .design-draw-options label { min-width: 0; display: grid; grid-template-columns: minmax(72px, .8fr) minmax(60px, 1.5fr) 34px; align-items: center; gap: 7px; color: var(--text-muted); font-size: 10px; }
.design-range-list input, .design-quality-label input, .design-draw-options input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.design-range-list output, .design-quality-label output, .design-draw-options output { color: var(--dim); direction: ltr; font: 10px ui-monospace,monospace; text-align: end; }
.design-text-label { display: grid; gap: 5px; color: var(--dim); font-size: 10px; line-height: 1.5; }
.design-text-label input { font-family: inherit; font-size: 12px; line-height: 1.3; }
.design-inline-option { display: grid; grid-template-columns: auto minmax(55px, .6fr) minmax(96px, 1fr); align-items: center; gap: 7px; margin-top: 8px; color: var(--text-muted); font-size: 10px; }
.design-inline-option select { font-family: inherit; }
.design-draw-options { display: grid; grid-template-columns: minmax(70px, .7fr) minmax(0, 1.5fr); gap: 10px; margin-top: 9px; }
.design-draw-options label { grid-template-columns: auto minmax(0, 1fr); }
.design-draw-options input[type="color"] { width: 37px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.design-draw-options label:nth-child(2) { grid-template-columns: minmax(60px, auto) minmax(0, 1fr) 20px; }
.design-format-label select { font-family: inherit; }
.design-quality-label { grid-template-columns: minmax(70px, .8fr) minmax(60px, 1.5fr) 38px; margin-top: 9px; }
.design-actions { display: flex; gap: 7px; margin-top: 12px; }
.design-actions button { flex: 1 1 0; min-height: 36px; padding-inline: 7px; font-size: 11px; }
.design-status { min-height: 1.45em; margin: 8px 0 0 !important; color: var(--success, #39856a) !important; font-size: 11px !important; }
.design-status.error { color: var(--danger) !important; }
@media (max-width: 1000px) {
  .design-workarea { grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); }
  .design-toolbar { flex-wrap: wrap; justify-content: flex-start; }
}
@media (max-width: 820px) {
  .design-editor { min-height: auto; }
  .design-workarea { grid-template-columns: 1fr; }
  .design-preview-stage { min-height: 290px; max-height: 60vh; flex: 0 0 auto; }
  .design-controls { max-height: none; overflow: visible; }
}
@media (max-width: 560px) {
  .design-heading { align-items: stretch; }
  .design-heading-actions, .design-heading-actions button { width: 100%; }
  .design-toolbar { gap: 6px; padding: 7px; }
  .design-history-actions { gap: 3px; }
  .design-history-actions button, .design-zoom-actions button { min-width: 32px; min-height: 32px; padding-inline: 6px; }
  .design-preset-label { min-width: 0; flex: 1 1 100%; }
  .design-preset-label select { flex: 1; }
  .design-zoom-actions { margin-inline-start: auto; }
  .design-preview-stage { min-height: 250px; padding: 8px; }
  .design-preview-meta #designToolHint { flex-basis: 100%; text-align: start; }
  .design-control-group { padding: 12px; }
}
@media (max-width: 420px) {
  .design-actions { flex-direction: column; }
  .design-filter-presets button { font-size: 8px; }
}


/* إرشادات الجداول وأدواتها الإضافية */
.sheet-guide-strip { z-index: 1; flex: 0 0 auto; padding: 10px clamp(14px, 3vw, 28px); border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-quick-start { margin: 0 0 5px; color: #cbd0da; font-size: 12px; line-height: 1.55; }
.sheet-guide-details { color: var(--text); font-size: 12px; }
.sheet-guide-details summary { width: fit-content; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.sheet-guide-content { max-height: min(38vh, 390px); overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 10px 2px 2px; }
.sheet-guide-content section { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.sheet-guide-content h2 { margin: 0 0 4px; font-size: 12px; }
.sheet-guide-content p { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.7; }
.sheet-guide-content code { direction: ltr; display: inline-block; padding: 1px 4px; border-radius: 4px; background: var(--control-bg); color: var(--accent-text); font: 11px/1.5 ui-monospace, monospace; }
.sheet-home-heading { align-items: flex-start; }
.sheet-home-actions { flex: 0 1 570px; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.sheet-home-actions button { min-height: 38px; padding-inline: 11px; font-size: 12px; white-space: nowrap; }
.sheet-editor-header { align-items: center; }
.sheet-editor-header > button { flex: 0 0 auto; }
#clearSheetCell { white-space: nowrap; }
.sheet-hint { line-height: 1.6; }
@media (max-width: 720px) {
  .sheet-guide-strip { padding: 8px 10px; }
  .sheet-guide-content { grid-template-columns: 1fr; max-height: 32vh; gap: 6px; }
  .sheet-home-heading { align-items: flex-start; flex-direction: column; }
  .sheet-home-actions { width: 100%; flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-home-actions button { min-width: 0; white-space: normal; }
  .sheet-editor-header { align-items: stretch; }
  .sheet-editor-header > button { flex: 1 1 auto; }
  #sheetBackList { flex: 0 0 auto; }
}
@media (max-width: 420px) {
  .sheet-guide-content section { padding: 8px 9px; }
  .sheet-home-actions button { padding-inline: 7px; font-size: 11px; }
}


/* المرحلة الأولى: تنظيم بصري رسمي لمساحة العمل دون تغيير أدواتها أو وظائفها */
#workspace.suite-workspace { flex-direction: row; }
#suiteNav {
  width: 238px;
  flex: 0 0 238px;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 14px;
  border-bottom: 0;
  border-inline-end: 1px solid var(--line);
  background: var(--nav-bg);
}
.suite-nav-heading {
  padding: 0 13px 10px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.suite-nav-item {
  width: 100%;
  min-height: 46px;
  flex: 0 0 auto;
  justify-content: flex-start;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: start;
}
.suite-nav-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.suite-nav-divider {
  width: auto;
  height: 1px;
  flex: 0 0 1px;
  margin: 7px 8px;
  background: var(--line);
}
.suite-nav-item.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--on-accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.suite-nav-item.nav-upcoming { cursor: not-allowed; }
.suite-nav-item small { margin-inline-start: auto; }
.suite-view { min-width: 0; }
.home-view, .section-view {
  background: radial-gradient(ellipse at 78% 0, var(--panel) 0, var(--bg) 58%);
}
.home-heading { max-width: 1120px; margin-bottom: 23px; }
.home-heading h1 { margin-top: 8px; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -.025em; }
.home-heading p, .section-heading p { max-width: 720px; line-height: 1.8; }
.home-quick-actions { max-width: 1120px; align-items: center; gap: 10px; margin: 22px 0 30px; }
.home-quick-actions button { min-height: 44px; padding-inline: 17px; }
.workspace-card-grid { max-width: 1120px; gap: 14px; }
.workspace-card {
  min-height: 112px;
  gap: 16px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--panel), var(--panel));
}
.workspace-card-icon { width: 48px; height: 48px; flex-basis: 48px; border-radius: 14px; }
.workspace-card-copy { gap: 5px; }
.workspace-card-copy strong { font-size: 16px; }
.workspace-card-copy small { font-size: 12px; line-height: 1.6; }
.workspace-card-arrow { margin-inline-start: 4px; }
.recent-section { max-width: 1120px; }
.section-heading {
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 26px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}
.section-heading h1 { margin-top: 7px; font-size: clamp(28px, 3vw, 36px); }
.section-heading > button { min-height: 43px; padding-inline: 17px; }
.document-tool-cards { max-width: 920px; margin-block: 8px 30px; }
.document-tool-card { min-height: 94px; padding: 17px 19px; border-radius: 15px; }
.document-tool-card strong { font-size: 15px; }
.document-tool-card small { line-height: 1.65; }
.project-list-section { max-width: 920px; }
.project-list-section h2 { margin-bottom: 12px; }
.recent-item, .project-row { min-height: 62px; padding: 10px 14px; border-radius: 13px; }
.editor-header { flex-wrap: wrap; row-gap: 8px; padding-block: 12px; }
.editor-header > input[type="text"] { min-height: 40px; }
.editor-header > button { min-height: 39px; }
.sheet-home-actions { gap: 8px; }
.sheet-home-actions button { min-height: 40px; font-size: 12px; }
.sheet-home-actions #newSheet { order: -1; }
.sheet-editor-header { row-gap: 8px; }
#sheetBackList { min-width: 104px; }
.guest-mark {
  width: 58px;
  height: 58px;
  margin: 17px 0 7px;
  padding: 13px;
  gap: 5px;
  border-radius: 16px;
  box-shadow: 0 12px 30px #0003;
}
.guest-mark i { border-radius: 4px; }

@media (max-width: 920px) {
  #suiteNav { width: 208px; flex-basis: 208px; }
  .suite-nav-item { gap: 10px; padding-inline: 10px; }
  .home-view, .section-view { padding-inline: clamp(18px, 3vw, 34px); }
}
@media (max-width: 680px) {
  #workspace.suite-workspace { flex-direction: column; }
  #suiteNav {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }
  .suite-nav-heading { display: none; }
  .suite-nav-item { width: auto; min-height: 42px; gap: 7px; padding: 7px 10px; font-size: 12px; }
  .suite-nav-icon { width: 17px; height: 17px; flex-basis: 17px; }
  .suite-nav-divider { width: 1px; height: 23px; flex: 0 0 1px; margin-inline: 2px; }
  .suite-nav-item small { display: none; }
  .home-view, .section-view { padding: 22px 15px 30px; }
  .home-heading { margin-bottom: 17px; }
  .home-heading h1 { font-size: clamp(27px, 7vw, 34px); }
  .home-heading p, .section-heading p { font-size: 14px; }
  .home-quick-actions { margin: 18px 0 23px; }
  .home-quick-actions button { flex: 1 1 145px; }
  .workspace-card-grid { grid-template-columns: 1fr; gap: 9px; }
  .workspace-card { min-height: 86px; padding: 14px; }
  .workspace-card-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .recent-section { margin-top: 28px; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 13px; margin-bottom: 19px; padding-bottom: 15px; }
  .section-heading > button { align-self: flex-start; }
  .document-tool-cards { margin-bottom: 23px; }
  .editor-header { padding: 9px 11px; }
  .editor-header > input[type="text"] { flex-basis: 155px; }
  .sheet-editor-header > button { min-height: 38px; }
}
@media (prefers-reduced-motion: no-preference) {
  .suite-nav-item, .workspace-card, .document-tool-card { transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
  .suite-nav-item:hover:not(.active) { border-color: var(--line); background: var(--control-hover); }
  .workspace-card:hover { box-shadow: 0 12px 32px #0003; }
}


/* محادثة الأقسام العامة */
#chatToggle[hidden], #sectionChat[hidden], #chatBackdrop[hidden] { display: none !important; }
.chat-toggle { border-color: #48516f; background: #252a38; }
.chat-toggle:hover { border-color: #7388e4; background: #2c3348; }
.chat-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#workspace { position: relative; }
.chat-backdrop { position: fixed; z-index: 18; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: #07090dc9; cursor: default; }
.chat-backdrop:hover { background: #07090dc9; }
.chat-drawer {
  position: fixed;
  z-index: 19;
  inset-block: calc(74px + env(safe-area-inset-top) + 12px) 12px;
  inset-inline-end: 18px;
  width: min(430px, calc(100vw - 28px));
  min-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--nav-bg);
  box-shadow: 0 24px 80px #0009;
  animation: chatDrawerIn .18s ease-out both;
}
@keyframes chatDrawerIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
.chat-drawer-header { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 17px 13px; border-bottom: 1px solid var(--line); background: var(--panel); }
.chat-drawer-header h2 { margin: 2px 0 1px; font-size: 19px; line-height: 1.35; }
.chat-drawer-header p { margin: 0; color: var(--dim); font-size: 11px; }
.chat-room-tabs { flex: 0 0 auto; display: flex; gap: 5px; overflow-x: auto; padding: 9px 11px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.chat-room-tabs button { min-height: 35px; flex: 0 0 auto; padding: 5px 10px; border-color: transparent; background: transparent; color: var(--dim); font-size: 12px; white-space: nowrap; }
.chat-room-tabs button[aria-selected="true"] { border-color: #53649e; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.chat-privacy-note { flex: 0 0 auto; margin: 9px 12px 4px; padding: 7px 9px; border-inline-start: 2px solid #697dc4; border-radius: 5px; background: #242936; color: #bdc4d3; font-size: 10px; line-height: 1.55; }
.chat-status { flex: 0 0 auto; min-height: 19px; margin: 1px 14px 5px; color: #a8cbb0; font-size: 10px; }
.chat-status[data-kind="error"] { color: #f0a0a3; }
.chat-messages { flex: 1 1 auto; min-height: 100px; display: flex; flex-direction: column; gap: 9px; overflow: auto; overscroll-behavior: contain; padding: 10px 12px 16px; scrollbar-width: thin; }
.chat-load-older { align-self: center; min-height: 30px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent-text); font-size: 11px; }
.chat-load-older:disabled { opacity: .65; cursor: progress; }
.chat-empty-state { align-self: center; margin: auto; padding: 20px; color: var(--dim); font-size: 13px; text-align: center; }
.chat-message { max-width: 91%; display: flex; align-self: flex-start; }
.chat-message.is-own { align-self: flex-end; }
.chat-message-bubble { min-width: 110px; max-width: 100%; padding: 8px 10px 6px; border: 1px solid #383d47; border-radius: 13px 13px 13px 4px; background: #252930; overflow-wrap: anywhere; }
.chat-message.is-own .chat-message-bubble { border-color: #4b587f; border-radius: 13px 13px 4px 13px; background: #293148; }
.chat-message.is-pending .chat-message-bubble { opacity: .72; }
.chat-message-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 3px; }
.chat-message-meta strong { min-width: 0; overflow: hidden; color: var(--accent-text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-message-meta time { flex: 0 0 auto; color: var(--dim); font-size: 9px; }
.chat-message-text { margin: 0; color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message-attachment { max-width: 100%; margin-top: 5px; }
.chat-message-attachment a { display: block; max-width: 100%; }
.chat-message-attachment img { display: block; width: auto; max-width: min(100%, 260px); max-height: 240px; object-fit: contain; border-radius: 9px; background: #15171b; }
.chat-message-attachment audio { display: block; width: min(260px, 100%); height: 38px; }
.chat-message-attachment span { color: var(--dim); font-size: 10px; }
.chat-reply-quote { width: 100%; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; margin: 2px 0 5px; padding: 4px 7px; border-inline-start: 2px solid var(--accent); border-radius: 3px; background: #171a20; text-align: start; }
.chat-reply-quote strong { color: var(--accent-text); font-size: 10px; }
.chat-reply-quote span { max-width: 100%; overflow: hidden; color: var(--dim); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chat-message-actions { display: flex; justify-content: flex-end; margin-top: 2px; }
.chat-reply-button { min-height: 25px; padding: 1px 6px; border: 0; background: transparent; color: #b5c0f4; font-size: 10px; }
.chat-reply-button:hover { background: #ffffff0b; }
.chat-reply-preview, .chat-attachment-preview { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 11px 7px; padding: 7px 9px; border: 1px solid #3c4354; border-radius: 10px; background: #222631; }
.chat-reply-preview[hidden], .chat-attachment-preview[hidden], #chatImageAttachment[hidden], #chatAudioAttachment[hidden] { display: none !important; }
.chat-reply-preview > div { min-width: 0; display: flex; flex-direction: column; }
.chat-reply-preview strong { color: var(--accent-text); font-size: 10px; }
.chat-reply-preview span { overflow: hidden; color: var(--dim); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply-preview .icon-button, .chat-attachment-preview .icon-button { width: 30px; min-width: 30px; height: 30px; min-height: 30px; font-size: 18px; }
.chat-attachment-image, .chat-attachment-audio { min-width: 0; display: flex; align-items: center; gap: 9px; color: var(--dim); font-size: 11px; }
.chat-attachment-image img { width: 45px; height: 45px; border-radius: 7px; object-fit: cover; background: #15171b; }
.chat-attachment-audio audio { width: min(260px, 62vw); height: 34px; }
.chat-composer { flex: 0 0 auto; padding: 9px 11px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.chat-composer textarea { width: 100%; min-height: 41px; max-height: 130px; resize: vertical; padding: 9px 10px; border: 1px solid #414650; border-radius: 11px; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.5; }
.chat-composer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.chat-attach-button, .chat-send-button { min-height: 34px; padding: 4px 9px; font-size: 11px; }
.chat-recording-stop { border-color: #a84c55; background: #532a31; }
.chat-recording-timer { margin-inline-start: auto; color: #f0a0a3; font: 600 11px/1.3 ui-monospace, monospace; }
.chat-send-button { margin-inline-start: auto; min-width: 74px; }
@media (max-width: 680px) {
  .chat-toggle { min-width: 40px; padding: 7px 9px; }
  .chat-toggle span { display: none; }
  .chat-drawer { inset: 0; width: 100%; max-width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .chat-messages { padding-inline: 12px; }
  .chat-message { max-width: 94%; }
  .chat-composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-drawer { animation: none; }
}


/* نافذة الشات صغيرة وعائمة؛ لا تستحوذ على الشاشة على الهاتف أو سطح المكتب. */
.chat-backdrop { display: none !important; pointer-events: none !important; }
.chat-drawer {
  inset-block-start: auto;
  inset-block-end: 16px;
  inset-inline-end: 18px;
  height: min(620px, calc(100dvh - 108px));
  max-height: calc(100dvh - 108px);
}
@media (max-width: 680px) {
  .chat-drawer {
    inset-block-start: auto;
    inset-block-end: max(8px, env(safe-area-inset-bottom));
    inset-inline-end: 8px;
    inset-inline-start: auto;
    width: calc(100vw - 16px);
    max-width: 430px;
    height: min(540px, calc(100dvh - 84px));
    max-height: calc(100dvh - 84px);
    min-height: 300px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 19px;
  }
}


/* مظهر مستقل لمحادثة الأقسام */
.chat-toggle { border-color: #367f72; background: #123b36; color: #d9fff5; }
.chat-toggle:hover { border-color: #63d9bf; background: #195046; }
.chat-drawer { border-color: #2b6d62; background: #0d2927; color: #eafff8; }
.chat-drawer-header { border-color: #24564f; background: #103531; }
.chat-drawer-header .eyebrow { color: #73dcc5; }
.chat-drawer-header p { color: #a7c9c1; }
.chat-room-tabs { border-color: #24564f; scrollbar-color: #397c70 #102e2b; }
.chat-room-tabs button[aria-selected="true"] { border-color: #48bca4; background: #1a4d44; color: #e9fff8; }
.chat-status { color: #82dec9; }
.chat-status[data-kind="error"] { color: #ffadb3; }
.chat-empty-state { color: #a7c9c1; }
.chat-message-bubble { border-color: #28534c; background: #123632; }
.chat-message.is-own .chat-message-bubble { border-color: #368c78; background: #17483f; }
.chat-message-meta strong { color: #b5f0df; }
.chat-message-meta time, .chat-attachment-image, .chat-attachment-audio { color: #a7c9c1; }
.chat-reply-quote { border-inline-start-color: #5ad7b9; background: #0c2825; }
.chat-reply-quote strong, .chat-reply-button { color: #9be9d4; }
.chat-reply-button:hover { background: #b6fff019; }
.chat-reply-preview, .chat-attachment-preview { border-color: #2c6258; background: #123b36; }
.chat-reply-preview strong { color: #b5f0df; }
.chat-reply-preview span { color: #a7c9c1; }
.chat-composer { border-color: #24564f; background: #103531; }
.chat-composer textarea { border-color: #2a6258; background: #092522; color: #eafff8; }
.chat-composer textarea:focus-visible, .chat-drawer button:focus-visible { outline-color: #6ce7c7; }
.chat-composer-actions { flex-wrap: nowrap; }
.chat-icon-button {
  width: 39px;
  min-width: 39px;
  height: 39px;
  min-height: 39px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-color: #347b6f;
  border-radius: 12px;
  background: #14443d;
  color: #a4f1dc;
}
.chat-icon-button:hover { border-color: #65d9bf; background: #1a5a4e; color: #effff9; }
.chat-icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-icon-button[hidden] { display: none !important; }
.chat-recording-stop { border-color: #d95d6c; background: #5c2933; color: #ffe1e3; }
.chat-recording-stop:hover { border-color: #ff8994; background: #74323d; }
.chat-recording-timer { margin-inline-start: 0; color: #ffb2b8; }
.chat-send-button { margin-inline-start: auto; border-color: #49b79e !important; background: #57d2b1 !important; color: #0d2927 !important; }
.chat-send-button:hover { border-color: #83edd2 !important; background: #7ce4c9 !important; }
@media (prefers-reduced-motion: no-preference) {
  .chat-recording-stop:not([hidden]) { animation: chatRecordPulse 1.3s ease-in-out infinite alternate; }
}
@keyframes chatRecordPulse { to { box-shadow: 0 0 0 4px #dc69732b; } }


/* فقاعات سوداء داخل لوحة المحادثة التركوازية */
.chat-message-bubble { border-color: #26312e; background: #070a09; }
.chat-message.is-own .chat-message-bubble { border-color: #256052; background: #070a09; }
.chat-message-meta { align-items: center; }
.chat-author { min-width: 0; display: inline-flex; align-items: center; gap: 7px; }
.chat-author strong { min-width: 0; overflow: hidden; color: #e6f2ee; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-verified-badge { width: 17px; height: 17px; flex: 0 0 17px; display: inline-flex; align-items: center; justify-content: center; color: #0866ff; vertical-align: middle; }
.chat-verified-badge svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chat-verified-badge .verified-mark { fill: currentColor; }
.chat-verified-badge .verified-check { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-author-avatar { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; overflow: hidden; border: 1px solid #368b78; border-radius: 50%; background: #123c35; color: #9be9d4; }
.chat-author-avatar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-message.is-own .chat-author-avatar { border-color: #58bda4; background: #16473e; color: #c2ffed; }
.chat-reply-quote { background: #101514; }

/* صور مرسلي الرسائل تظهر داخل الأيقونة الدائرية مع رمز احتياطي للصورة المفقودة */
.chat-author-avatar { position: relative; }
.chat-author-avatar-image { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.chat-author-avatar-fallback { display: grid; place-items: center; }


/* PDF page manager — scoped styles */
.pdf-pages-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: none;
  max-height: min(88vh, 900px);
  padding: 22px;
  border: 1px solid #ffffff20;
  border-radius: 18px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 28px 90px #000a;
}
.pdf-pages-dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.pdf-pages-dialog::backdrop { background: #080a0dcc; backdrop-filter: blur(5px); }
.pdf-pages-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pdf-pages-dialog-header h2 { margin: 4px 0; font-size: 20px; }
.pdf-pages-dialog-header p { margin: 0; color: var(--dim); font-size: 13px; }
.pdf-pages-toolbar, .pdf-pages-selection-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.pdf-pages-toolbar button, .pdf-pages-selection-bar button { min-height: 37px; padding: 7px 12px; }
.pdf-pages-count, #pdfPagesSelected { margin-inline-start: auto; color: var(--dim); font-size: 12px; }
#pdfPagesExtract:disabled, #pdfPagesSelectAll:disabled, #pdfPagesClearSelection:disabled { opacity: .45; cursor: not-allowed; }
.pdf-pages-status { min-height: 18px; margin: -5px 0 0; color: var(--dim); font-size: 12px; }
.pdf-pages-status.error { color: #ff888e; }
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 170px;
  max-height: 54vh;
  overflow: auto;
  padding: 2px 2px 8px;
  overscroll-behavior: contain;
}
.pdf-page-card { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); transition: border-color .15s ease, background .15s ease; }
.pdf-page-card.is-selected { border-color: #7894ff; background: #282e3b; }
.pdf-page-card-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--text); font-size: 12px; }
.pdf-page-card-heading input { accent-color: var(--accent); }
.pdf-page-preview { display: grid; place-items: center; min-height: 140px; max-height: 190px; overflow: hidden; border-radius: 7px; background: #121417; }
.pdf-page-preview canvas { display: block; width: auto; max-width: 100%; max-height: 180px; height: auto; opacity: 0; transition: opacity .18s ease; }
.pdf-page-preview canvas.is-ready { opacity: 1; }
.pdf-page-card-actions { display: grid; grid-template-columns: repeat(4, minmax(30px, 1fr)); gap: 5px; margin-top: 8px; }
.pdf-page-action { min-width: 30px; min-height: 32px; padding: 2px; border-radius: 7px; font-size: 17px; line-height: 1; }
.pdf-page-action-delete { color: #ff9298; }
.pdf-page-action:disabled { opacity: .35; cursor: not-allowed; }
.pdf-pages-dialog-footer { display: flex; justify-content: flex-start; padding-top: 9px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }
@media (max-width: 600px) {
  .pdf-pages-dialog { width: calc(100vw - 14px); max-height: 93vh; padding: 14px; border-radius: 14px; }
  .pdf-pages-dialog-header h2 { font-size: 17px; }
  .pdf-pages-dialog-header p { max-width: 34ch; font-size: 12px; }
  .pdf-pages-toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .pdf-pages-toolbar button { width: 100%; padding-inline: 8px; font-size: 12px; }
  .pdf-pages-count { grid-column: 1 / -1; margin: 0; }
  .pdf-pages-selection-bar { gap: 6px; }
  .pdf-pages-selection-bar button { min-height: 34px; padding: 6px 8px; font-size: 11px; }
  #pdfPagesSelected { width: 100%; margin: 0; }
  .pdf-pages-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 58vh; gap: 8px; }
  .pdf-page-card { padding: 7px; }
  .pdf-page-preview { min-height: 115px; }
}

/* قائمة المشاريع المحفوظة محليًا */
.projects-view .section-heading { align-items: flex-start; }
.project-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 8px; }
.project-library-summary { display: flex; align-items: baseline; gap: 8px; max-width: 1000px; margin: 0 0 12px; color: var(--dim); font-size: 13px; }
.project-library-summary strong { color: var(--text); font-size: 19px; }
.project-library-list { max-width: 1000px; }
.project-library-row { gap: 12px; }
.project-library-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); font: 700 14px/1 system-ui, sans-serif; }
.project-library-open { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
.project-library-open .recent-item-name { max-width: 100%; }
.project-library-meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--dim); font-size: 11px; }
.project-library-meta .recent-item-type { color: var(--accent); }
.project-library-row .project-delete { flex: 0 0 auto; }
.projects-view .project-actions button { min-height: 40px; }
@media (max-width: 680px) {
  .projects-view .section-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .project-actions { width: 100%; }
  .project-actions button { flex: 1 1 130px; }
  .project-library-row { gap: 8px; padding: 10px; }
  .project-library-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .project-library-row .project-delete { padding-inline: 7px; }
}


/* لوحة ألوان موحدة: الفاتح افتراضي، والداكن/التلقائي من إعدادات المستخدم */
html[data-theme="dark"] {
  --bg: #14191b;
  --panel: #1d2426;
  --panel-raised: #252e30;
  --panel-soft: #20282a;
  --line: #354346;
  --text: #ecf4f2;
  --text-muted: #c2d0cf;
  --dim: #a2b2b0;
  --accent: #57d2b1;
  --accent-hover: #7ce4c9;
  --accent-soft: #153a35;
  --accent-border: #367f72;
  --accent-text: #b5f0df;
  --control-bg: #1b2325;
  --control-hover: #252e30;
  --header-bg: #1c2425;
  --nav-bg: #1b2224;
  --on-accent: #092522;
  --danger: #ff9298;
  --danger-soft: #352124;
  --chat-bg: #10211e;
  --chat-raised: #15302b;
  --chat-line: #2b554c;
  --chat-bubble: #172b28;
  --chat-own: #1a4038;
  --chat-inset: #102723;
  --chat-muted: #b4cac3;
  --chat-accent: #a5e7d1;
  --chat-control: #173b34;
  --chat-control-hover: #205347;
  --chat-status: #a5e7d1;
  --chat-error: #ffadb5;
  --chat-input: #0d211d;
  --chat-record-bg: #582a33;
  --chat-record-text: #ffdce1;
  --shadow: 0 18px 55px #0006;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #14191b;
    --panel: #1d2426;
    --panel-raised: #252e30;
    --panel-soft: #20282a;
    --line: #354346;
    --text: #ecf4f2;
    --text-muted: #c2d0cf;
    --dim: #a2b2b0;
    --accent: #57d2b1;
    --accent-hover: #7ce4c9;
    --accent-soft: #153a35;
    --accent-border: #367f72;
    --accent-text: #b5f0df;
    --control-bg: #1b2325;
    --control-hover: #252e30;
    --header-bg: #1c2425;
    --nav-bg: #1b2224;
    --on-accent: #092522;
    --danger: #ff9298;
    --danger-soft: #352124;
    --chat-bg: #10211e;
    --chat-raised: #15302b;
    --chat-line: #2b554c;
    --chat-bubble: #172b28;
    --chat-own: #1a4038;
    --chat-inset: #102723;
    --chat-muted: #b4cac3;
    --chat-accent: #a5e7d1;
    --chat-control: #173b34;
    --chat-control-hover: #205347;
    --chat-status: #a5e7d1;
    --chat-error: #ffadb5;
    --chat-input: #0d211d;
    --chat-record-bg: #582a33;
    --chat-record-text: #ffdce1;
    --shadow: 0 18px 55px #0006;
    color-scheme: dark;
  }
}

/* مكونات عامة تشترك في لوحة السمة */
body, #workspace, #appHeader, #suiteNav, .guest-card, .workspace-card,
.document-tool-card, .recent-item, .project-row, .project-library-row,
.design-controls, .design-preview-panel, .design-control-group,
.sheet-guide-content section, .sheet-guide-content details,
.pdf-pages-dialog, .pdf-page-card, .settings-group {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.suite-nav-item.active { color: var(--accent); }
button, input, textarea, select { color-scheme: inherit; }
.sheet-quick-start { color: var(--text-muted); }

/* صفحة الإعدادات */
.settings-view { overflow-y: auto; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(270px, .8fr); align-items: start; gap: 18px; width: min(980px, 100%); }
.settings-group { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); box-shadow: 0 8px 24px #2440540a; }
.settings-group-heading { display: flex; align-items: flex-start; gap: 13px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.settings-group-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 21px; font-weight: 700; }
.settings-group-heading h2 { margin: 0; color: var(--text); font-size: 17px; }
.settings-group-heading p { margin: 3px 0 0; color: var(--dim); font-size: 12px; line-height: 1.65; }
.settings-theme-options { display: grid; gap: 8px; padding-top: 15px; }
.theme-option { width: 100%; min-height: 70px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 24px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); color: var(--text); text-align: start; }
.theme-option:hover { border-color: var(--accent-border); background: var(--control-hover); }
.theme-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent); }
.theme-option-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; font-size: 20px; }
.theme-icon-light { background: #fff; color: #b67a24; border: 1px solid #e7e9eb; }
.theme-icon-dark { background: #242d30; color: #d4e3e2; border: 1px solid #435154; }
.theme-icon-system { background: linear-gradient(135deg,#fff 50%,#242d30 50%); color: #397a78; border: 1px solid var(--line); }
.theme-option strong, .theme-option small { display: block; }
.theme-option strong { color: var(--text); font-size: 13px; }
.theme-option small { margin-top: 3px; color: var(--dim); font-size: 11px; }
.theme-check { width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: transparent; font-size: 12px; }
.theme-option[aria-checked="true"] .theme-check { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.settings-footnote { margin: 12px 2px 0; color: var(--dim); font-size: 11px; }
.settings-language-group { padding-bottom: 18px; }
.settings-language-options { display: grid; gap: 8px; padding-top: 15px; }
.settings-language-choice { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); color: var(--text); text-align: start; }
.settings-language-choice > span:last-child { display: grid; min-width: 30px; height: 28px; place-items: center; border-radius: 7px; background: var(--panel-raised); color: var(--dim); font-size: 11px; font-weight: 700; }
.settings-language-choice.is-selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.settings-language-choice.is-selected > span:last-child { background: var(--accent); color: var(--on-accent); }
html[data-theme="dark"] #accountGate, html[data-theme="dark"] #accountCard,
html[data-theme="dark"] #accountCard input:not([type="file"]), html[data-theme="dark"] #accountCard textarea { background: var(--panel); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] #accountGate .account-page-head, html[data-theme="dark"] #accountGate .account-page-head > button,
html[data-theme="dark"] #accountCard button:not(.primary):not(.text-button) { background: var(--panel-raised); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] #accountGate .account-intro h1, html[data-theme="dark"] #accountCard h2,
html[data-theme="dark"] #accountCard label, html[data-theme="dark"] #accountCard .profile-email strong { color: var(--text); }
html[data-theme="dark"] #accountGate .account-intro > p, html[data-theme="dark"] #accountCard p,
html[data-theme="dark"] #accountCard #accountStatus { color: var(--dim); }
html[data-theme="dark"] #accountGate .account-intro .eyebrow, html[data-theme="dark"] .auth-benefits,
html[data-theme="dark"] .auth-security-note { color: var(--text-muted); }
html[data-theme="dark"] #accountCard button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
html[data-theme="dark"] #accountCard button.danger-button { color: var(--danger); }
html[data-theme="dark"] #accountCard button.text-button { background: transparent; color: var(--accent); }
html[data-theme="dark"] #accountCard .profile-email { background: var(--panel-raised); border-color: var(--line); }
html[data-theme="dark"] #accountGate { background: radial-gradient(ellipse at 18% 12%, #1a3533 0, transparent 36%), linear-gradient(135deg, #14191b, #1b2224); }
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] #accountGate, html[data-theme="system"] #accountCard,
  html[data-theme="system"] #accountCard input:not([type="file"]), html[data-theme="system"] #accountCard textarea { background: var(--panel); color: var(--text); border-color: var(--line); }
  html[data-theme="system"] #accountGate .account-page-head, html[data-theme="system"] #accountGate .account-page-head > button,
  html[data-theme="system"] #accountCard button:not(.primary):not(.text-button) { background: var(--panel-raised); color: var(--text); border-color: var(--line); }
  html[data-theme="system"] #accountGate .account-intro h1, html[data-theme="system"] #accountCard h2,
  html[data-theme="system"] #accountCard label, html[data-theme="system"] #accountCard .profile-email strong { color: var(--text); }
  html[data-theme="system"] #accountGate .account-intro > p, html[data-theme="system"] #accountCard p,
  html[data-theme="system"] #accountCard #accountStatus { color: var(--dim); }
  html[data-theme="system"] #accountGate .account-intro .eyebrow, html[data-theme="system"] .auth-benefits,
  html[data-theme="system"] .auth-security-note { color: var(--text-muted); }
  html[data-theme="system"] #accountCard button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  html[data-theme="system"] #accountCard button.danger-button { color: var(--danger); }
  html[data-theme="system"] #accountCard button.text-button { background: transparent; color: var(--accent); }
  html[data-theme="system"] #accountCard .profile-email { background: var(--panel-raised); border-color: var(--line); }
  html[data-theme="system"] #accountGate { background: radial-gradient(ellipse at 18% 12%, #1a3533 0, transparent 36%), linear-gradient(135deg, #14191b, #1b2224); }
}
@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-group { padding: 17px; }
}

/* محادثة متكيفة مع السمة: تباين واضح في الفاتح والداكن دون فقاعات سوداء ثابتة. */
.chat-toggle { border-color: var(--chat-line); background: var(--chat-control); color: var(--chat-accent); }
.chat-toggle:hover { border-color: var(--chat-accent); background: var(--chat-control-hover); color: var(--chat-accent); }
.chat-drawer { border-color: var(--chat-line); background: var(--chat-bg); color: var(--text); }
.chat-drawer-header, .chat-composer { border-color: var(--chat-line); background: var(--chat-raised); }
.chat-drawer-header .eyebrow, .chat-message-meta strong, .chat-author strong,
.chat-reply-quote strong, .chat-reply-preview strong { color: var(--chat-accent); }
.chat-drawer-header p, .chat-message-meta time, .chat-empty-state,
.chat-reply-quote span, .chat-reply-preview span, .chat-attachment-image,
.chat-attachment-audio, .chat-message-attachment span { color: var(--chat-muted); }
.chat-room-tabs { border-color: var(--chat-line); scrollbar-color: var(--chat-accent) var(--chat-bg); }
.chat-room-tabs button[aria-selected="true"] { border-color: var(--chat-line); background: var(--chat-control); color: var(--chat-accent); }
.chat-privacy-note { border-inline-start-color: var(--chat-accent); background: var(--chat-inset); color: var(--chat-muted); }
.chat-status { color: var(--chat-status); }
.chat-status[data-kind="error"] { color: var(--chat-error); }
.chat-message-bubble { border-color: var(--chat-line); background: var(--chat-bubble); color: var(--text); }
.chat-message.is-own .chat-message-bubble { border-color: var(--chat-line); background: var(--chat-own); }
.chat-message-text { color: var(--text); }
.chat-author strong { color: var(--chat-accent); }
.chat-author-avatar { border-color: var(--chat-line); background: var(--chat-control); color: var(--chat-accent); }
.chat-message.is-own .chat-author-avatar { border-color: var(--chat-line); background: var(--chat-own); color: var(--chat-accent); }
.chat-reply-quote { border-inline-start-color: var(--chat-accent); background: var(--chat-inset); color: var(--text); }
.chat-reply-quote:hover { border-color: var(--chat-line); border-inline-start-color: var(--chat-accent); background: var(--chat-control-hover); }
.chat-reply-button { color: var(--chat-accent); }
.chat-reply-button:hover { background: var(--chat-control-hover); color: var(--chat-accent); }
.chat-reply-preview, .chat-attachment-preview { border-color: var(--chat-line); background: var(--chat-raised); }
.chat-icon-button { border-color: var(--chat-line); background: var(--chat-control); color: var(--chat-accent); }
.chat-icon-button:hover { border-color: var(--chat-accent); background: var(--chat-control-hover); color: var(--chat-accent); }
.chat-composer textarea { border-color: var(--chat-line); background: var(--chat-input); color: var(--text); }
.chat-composer textarea:focus-visible, .chat-drawer button:focus-visible { outline-color: var(--chat-accent); }
.chat-recording-stop { border-color: var(--chat-error); background: var(--chat-record-bg); color: var(--chat-record-text); }
.chat-recording-stop:hover { border-color: var(--chat-error); background: var(--chat-record-bg); color: var(--chat-record-text); }
.chat-recording-timer { color: var(--chat-error); }
.chat-send-button { border-color: #49b79e !important; background: #57d2b1 !important; color: #092522 !important; }
.chat-send-button:hover { border-color: #83edd2 !important; background: #7ce4c9 !important; color: #092522 !important; }
.chat-message-attachment img, .chat-attachment-image img { background: var(--chat-raised); }
.chat-message-attachment audio, .chat-attachment-audio audio { color-scheme: inherit; }


/* حوارات PDF: مساحة واضحة، مريحة للوحة اللمس، وتتكيف مع السمات. */
.pdf-edit-dialog {
  width: min(560px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: clamp(16px, 3vw, 24px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 18px 55px #10192335;
}
.pdf-edit-dialog[open] { display: block; }
.pdf-edit-dialog::backdrop { background: #101923aa; backdrop-filter: blur(3px); }
.pdf-edit-dialog-content { display: flex; flex-direction: column; gap: 14px; }
.pdf-edit-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pdf-edit-dialog-header h2 { margin: 3px 0; font-size: 20px; }
.pdf-edit-dialog-header p { margin: 0; color: var(--dim); font-size: 13px; }
.pdf-edit-dialog-header .icon-button { flex: 0 0 36px; }
.signature-mode-switch { display: flex; width: fit-content; max-width: 100%; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.signature-mode-switch button { min-height: 34px; padding: 5px 12px; border-color: transparent; background: transparent; color: var(--dim); font-size: 12px; }
.signature-mode-switch button[aria-selected="true"] { border-color: var(--line); background: var(--panel); color: var(--accent); }
#signatureDrawPanel { display: grid; gap: 8px; }
#signatureCanvas { display: block; width: 100%; height: auto; aspect-ratio: 18 / 5; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel-soft); cursor: crosshair; touch-action: none; }
#signatureClear { justify-self: start; min-height: 32px; padding: 4px 9px; font-size: 12px; }
#signatureTypePanel[hidden], #signatureDrawPanel[hidden] { display: none !important; }
#signatureText { width: 100%; }
.pdf-local-note { margin: 0; color: var(--dim); font-size: 11px; line-height: 1.6; }
.pdf-edit-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.pdf-edit-dialog-actions button { min-height: 36px; }
.pdf-form-dialog { width: min(700px, calc(100vw - 24px)); }
.pdf-form-status { min-height: 1.4em; margin: 0; color: var(--accent); font-size: 12px; }
.pdf-form-status[data-state="error"] { color: var(--danger); }
.pdf-form-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel-soft); color: var(--dim); text-align: center; }
.pdf-form-empty[hidden] { display: none !important; }
.pdf-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-height: min(48vh, 480px); overflow: auto; padding: 2px; }
.pdf-form-field { display: grid; align-content: start; gap: 5px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.pdf-form-label { overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.pdf-form-required { color: var(--danger); font-size: 10px; }
.pdf-form-type { color: var(--dim); font-size: 10px; }
.pdf-form-field input:not([type="checkbox"]), .pdf-form-field textarea, .pdf-form-field select { width: 100%; min-width: 0; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.pdf-form-field textarea { resize: vertical; }
.pdf-form-checkbox-row, .pdf-form-radio-options label { display: flex; align-items: center; gap: 8px; }
.pdf-form-radio-options { display: grid; gap: 7px; max-height: 130px; margin: 0; padding: 0; overflow: auto; border: 0; }
.pdf-form-radio-options label span { overflow-wrap: anywhere; font-size: 12px; }
.pdf-form-unsupported { margin: 2px 0; color: var(--dim); font-size: 11px; }
@media (max-width: 560px) {
  .pdf-edit-dialog { padding: 14px; border-radius: 15px; }
  .pdf-edit-dialog-header h2 { font-size: 18px; }
  .pdf-form-fields { grid-template-columns: 1fr; max-height: 42vh; }
  .pdf-edit-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .pdf-edit-dialog-actions button { width: 100%; }
  #signatureInsert, #pdfFormApply { grid-column: 1 / -1; }
  #signatureCanvas { border-radius: 9px; }
}

/* أدوات تنسيق الجداول والمستندات */
.sheet-format-toolbar { flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-format-toolbar button, .sheet-format-toolbar select, .sheet-format-toolbar input[type="search"] { min-height: 32px; padding: 4px 8px; font-size: 11px; white-space: nowrap; }
.sheet-format-toolbar select, .sheet-format-toolbar input[type="search"] { border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); }
.sheet-format-toolbar input[type="search"] { width: clamp(120px, 18vw, 220px); }
.sheet-color-control { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-size: 10px; white-space: nowrap; }
.sheet-color-control input[type="color"] { width: 28px; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--control-bg); cursor: pointer; }
#sheetBold[aria-pressed="true"] { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sheet-grid tbody tr[hidden] { display: none; }
.doc-table-size { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-size: 10px; white-space: nowrap; }
.doc-table-size input { width: 44px; min-width: 40px; min-height: 30px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--control-bg); color: var(--text); font: inherit; text-align: center; }
@media (max-width: 720px) {
  .sheet-format-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
  .sheet-format-toolbar > * { flex: 0 0 auto; }
  .sheet-format-toolbar input[type="search"] { width: 150px; }
  .doc-table-size { gap: 2px; }
  .doc-table-size input { width: 38px; }
}


/* تفضيلات واجهة المستخدم والمحررات */
.settings-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-layout > .settings-group:last-child { grid-column: 1 / -1; }
.settings-control-row, .settings-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--text); }
.settings-control-row > span, .settings-toggle-row > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.settings-control-row strong, .settings-toggle-row strong { font-size: 13px; font-weight: 600; }
.settings-control-row small, .settings-toggle-row small { color: var(--dim); font-size: 11px; line-height: 1.5; }
.settings-control-row select { width: min(190px, 42%); min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--control-bg); color: var(--text); font: inherit; font-size: 12px; }
.settings-toggle-row input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--accent); }
.settings-reset-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 12px; }
#settingsStatus { color: var(--accent); font-size: 12px; }
#docEditor { width: min(var(--doc-width, 850px), 100%); font-size: var(--doc-font-size, 16px); }
.sheet-grid { font-size: var(--sheet-font-size, 13px); }
html[data-ui-scale="small"] { font-size: 15px; }
html[data-ui-scale="standard"] { font-size: 16px; }
html[data-ui-scale="large"] { font-size: 18px; }
html[data-contrast="high"] { --line: #687681; --dim: #38454f; }
html[data-theme="dark"][data-contrast="high"] { --line: #8b9ca8; --dim: #d0dbe1; }
html[data-contrast="high"] :focus-visible { outline: 3px solid var(--accent) !important; outline-offset: 2px !important; }
html[data-contrast="high"] button, html[data-contrast="high"] input, html[data-contrast="high"] select, html[data-contrast="high"] textarea { border-color: var(--line); }
body[data-density="compact"] .settings-group { padding: 15px; }
body[data-density="compact"] .settings-control-row, body[data-density="compact"] .settings-toggle-row { min-height: 48px; padding-block: 6px; }
body[data-density="compact"] .workspace-card { min-height: 82px; padding: 12px; }
body[data-density="compact"] .recent-item, body[data-density="compact"] .project-row { padding-block: 7px; }
body[data-sheet-gridlines="false"] .sheet-grid th, body[data-sheet-gridlines="false"] .sheet-grid td { border-color: transparent; }
body[data-reduced-motion="true"] *, body[data-reduced-motion="true"] *::before, body[data-reduced-motion="true"] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
@media (max-width: 760px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-layout > .settings-group:last-child { grid-column: auto; }
  .settings-control-row select { width: min(165px, 42%); }
}


/* صفحة إعدادات مسطّحة — صفوف وفواصل بدل البطاقات */
.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: min(820px, 100%);
  margin-inline: auto;
  border-top: 1px solid var(--line);
}
.settings-layout > .settings-group,
.settings-layout > .settings-language-group,
.settings-layout > .settings-group:last-child {
  width: 100%;
  grid-column: auto;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.settings-group-heading {
  align-items: center;
  padding: 0 0 12px;
  border: 0;
}
.settings-group-icon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 10px;
  font-size: 17px;
}
.settings-theme-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 570px;
  padding-top: 4px;
}
.theme-option {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
}
.theme-option:hover { border-color: var(--line); background: var(--panel-soft); }
.theme-option[aria-checked="true"] { border-color: var(--accent-border); background: var(--accent-soft); box-shadow: none; }
.theme-option-icon { width: 24px; height: 24px; border: 0; background: transparent; font-size: 16px; }
.theme-option small, .theme-check { display: none; }
.settings-language-options {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}
.settings-language-choice {
  min-width: 132px;
  min-height: 37px;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
}
.settings-language-choice.is-selected {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px #00000012;
}
.settings-control-row:last-child, .settings-toggle-row:last-child { border-bottom: 0; }
body[data-density="compact"] .settings-layout > .settings-group,
body[data-density="compact"] .settings-layout > .settings-language-group { padding-block: 14px; }
@media (max-width: 560px) {
  .settings-layout > .settings-group,
  .settings-layout > .settings-language-group { padding-block: 16px; }
  .settings-theme-options { grid-template-columns: 1fr; max-width: none; }
  .theme-option { width: 100%; }
  .settings-control-row, .settings-toggle-row { gap: 10px; }
  .settings-control-row select { width: min(150px, 40%); }
  .settings-language-choice { min-width: 0; flex: 1 1 0; }
}


/* تنقل أقسام الإعدادات على نمط صفحات التفضيلات */
.settings-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: clamp(22px, 4vw, 44px);
  width: min(1120px, 100%);
  margin-inline: auto;
}
.settings-nav {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-inline-end: 14px;
  border-inline-end: 1px solid var(--line);
}
.settings-tab {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  text-align: start;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.settings-tab:hover { background: var(--panel-soft); color: var(--text); }
.settings-tab[aria-selected="true"] {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.settings-tab-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: inherit;
  font-size: 14px;
  font-weight: 650;
}
.settings-panels { min-width: 0; }
.settings-panel[hidden] { display: none !important; }
.settings-panel .settings-layout {
  width: 100%;
  max-width: none;
  margin: 0;
  border-top: 0;
}
.settings-panel .settings-group,
.settings-panel .settings-language-group,
.settings-panel .settings-group:last-child {
  padding: 16px 0;
}
.settings-panel .settings-group-heading { padding-block: 0 12px; }
@media (max-width: 760px) {
  .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 0 0 7px;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: thin;
  }
  .settings-tab { width: auto; flex: 0 0 auto; min-height: 40px; white-space: nowrap; }
}
@media (max-width: 420px) {
  .settings-tab { gap: 6px; padding-inline: 9px; font-size: 12px; }
  .settings-tab-icon { width: 20px; flex-basis: 20px; }
}

/* على الشاشات الضيقة: أزرار الأقسام في صفّين واضحين */
@media (max-width: 760px) {
  .settings-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex-direction: initial;
    overflow: visible;
    padding: 0 0 8px;
  }
  .settings-tab {
    width: 100%;
    flex: initial;
    min-height: 42px;
    white-space: normal;
  }
}


/* أنظمة العمل: مساحة ممتدة، بنية واضحة، وأدوات قابلة للاستخدام على الشاشات الصغيرة */
.systems-view { padding: clamp(14px, 2vw, 30px) clamp(14px, 2.2vw, 38px); }
.systems-view .section-heading { align-items: center; margin-bottom: 14px; padding-bottom: 14px; }
.systems-view .section-heading p { max-width: 820px; }
.system-heading-actions, .system-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.system-heading-actions button, .system-detail-header button, .system-panel-heading button { min-height: 40px; }
.system-local-note { width: fit-content; max-width: 100%; margin: 0 0 18px; padding: 9px 12px; border: 1px solid var(--accent-border); border-radius: 10px; background: var(--accent-soft); color: var(--text-muted); font-size: 12px; line-height: 1.65; }
.system-library-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 12px 0; }
.system-library-heading h2 { margin: 0; font-size: 20px; }
.system-library-heading span { color: var(--dim); font-size: 12px; }
.systems-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 13px; }
.system-library-card { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 5px 18px #183b4a08; }
.system-library-open { width: 100%; min-height: 112px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px; padding: 16px; border: 0; border-radius: inherit; background: transparent; text-align: start; }
.system-library-open:hover { border: 0; background: var(--panel-soft); }
.system-card-icon { grid-row: span 2; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 22px; font-weight: 700; }
.system-library-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.system-library-copy strong { overflow-wrap: anywhere; font-size: 15px; }
.system-library-copy small { display: -webkit-box; overflow: hidden; color: var(--dim); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.system-card-meta { grid-column: 2; color: var(--dim); font-size: 11px; }
.system-detail-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 88px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.system-detail-copy { min-width: 0; }
.system-detail-copy h2 { margin: 0; overflow-wrap: anywhere; font-size: clamp(20px, 2.3vw, 28px); line-height: 1.3; }
.system-detail-copy p { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--dim); font-size: 12px; }
.system-tabs { position: sticky; z-index: 2; top: 0; display: flex; gap: 5px; overflow-x: auto; margin-top: 12px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); scrollbar-width: thin; }
.system-tabs button { flex: 0 0 auto; min-width: 112px; min-height: 40px; border-color: transparent; background: transparent; color: var(--dim); font-size: 13px; }
.system-tabs button.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); font-weight: 700; }
.system-status { min-height: 1.55em; margin: 5px 2px 0; color: var(--accent-text); font-size: 12px; }
.system-panel { min-width: 0; min-height: min(58vh, 640px); padding-block: 12px 32px; }
.system-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 11px; margin-bottom: 16px; }
.system-metric-card, .system-finance-card { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 100px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.system-metric-card span, .system-finance-card span { color: var(--dim); font-size: 12px; }
.system-metric-card strong, .system-finance-card strong { overflow-wrap: anywhere; font-size: clamp(17px, 2vw, 23px); font-variant-numeric: tabular-nums; }
.system-panel-card { min-width: 0; margin-bottom: 14px; padding: clamp(14px, 2vw, 21px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.system-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.system-panel-heading h3 { margin: 0; font-size: 17px; }
.system-panel-heading p { margin: 3px 0 0; color: var(--dim); font-size: 12px; }
.system-module-overview-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 9px; }
.system-module-overview { min-width: 0; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); text-align: start; }
.system-module-overview strong { overflow: hidden; text-overflow: ellipsis; }
.system-module-overview span { flex: 0 0 auto; color: var(--dim); font-size: 11px; }
.system-record-layout { display: grid; grid-template-columns: minmax(195px, 245px) minmax(0, 1fr); align-items: start; gap: 14px; min-height: min(60vh, 700px); }
.system-module-sidebar { position: sticky; top: 66px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.system-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 1px 2px 9px; border-bottom: 1px solid var(--line); }
.system-sidebar-head h3 { margin: 0; font-size: 14px; }
.system-sidebar-head .icon-button { width: 34px; min-width: 34px; height: 34px; min-height: 34px; font-size: 20px; }
.system-module-list { display: grid; gap: 5px; max-height: min(52vh, 520px); overflow: auto; padding-top: 8px; }
.system-module-choice { width: 100%; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 40px; padding: 7px 9px; border-color: transparent; background: transparent; text-align: start; }
.system-module-choice.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.system-module-choice small { flex: 0 0 auto; color: var(--dim); font-variant-numeric: tabular-nums; }
.system-record-content { min-width: 0; padding: clamp(12px, 1.8vw, 20px); border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.system-actions { justify-content: flex-end; }
.system-table-wrap { width: 100%; max-height: min(62vh, 680px); overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.system-data-table { width: 100%; min-width: 620px; border-collapse: separate; border-spacing: 0; background: var(--panel); font-size: 12px; }
.system-data-table th, .system-data-table td { max-width: 360px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; overflow-wrap: anywhere; }
.system-data-table th { position: sticky; z-index: 1; top: 0; background: var(--panel-raised); color: var(--text-muted); font-weight: 700; }
.system-data-table tr:last-child td { border-bottom: 0; }
.system-data-table td { color: var(--text); }
.system-row-actions { min-width: 120px; white-space: nowrap; }
.system-row-actions button { min-height: 30px; padding: 3px 6px; font-size: 11px; }
.danger-text { color: var(--danger) !important; }
.system-limit-note { margin: 9px 0 0; color: var(--dim); font-size: 11px; }
.system-finance-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.system-finance-card.income { border-inline-start: 3px solid #328564; }
.system-finance-card.expense { border-inline-start: 3px solid var(--danger); }
.system-finance-card.net { border-inline-start: 3px solid var(--accent); }
.system-income-text { color: #328564 !important; font-weight: 700; }
.system-expense-text { color: var(--danger) !important; font-weight: 700; }
.system-money-cell { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.system-empty-block { display: grid; justify-items: start; gap: 7px; padding: 20px; border: 1px dashed var(--accent-border); border-radius: 12px; background: var(--panel-soft); }
.system-empty-block strong { font-size: 14px; }
.system-empty-block p { margin: 0 0 4px; color: var(--dim); font-size: 12px; }
.system-settings-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 8px 14px; color: var(--text-muted); font-size: 13px; }
.system-settings-summary p { grid-column: 1 / -1; margin: 0; color: var(--dim); }
.system-schema-card { margin-top: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.system-schema-heading, .system-field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.system-schema-heading { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.system-schema-heading > strong { overflow-wrap: anywhere; }
.system-field-list { display: grid; gap: 3px; padding-block: 7px; }
.system-field-row { min-height: 42px; padding: 5px 4px; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.system-field-row > span { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.system-field-row > small { color: var(--dim); font-size: 11px; }
.system-add-field { width: auto; min-height: 34px; }
.system-danger-zone { border-color: color-mix(in srgb, var(--danger) 28%, var(--line)); }
.system-danger-zone h3 { margin: 0; font-size: 15px; }
.system-danger-zone p { color: var(--dim); font-size: 12px; }
.system-dialog { width: min(640px, calc(100vw - 28px)); max-width: none; max-height: min(90dvh, 780px); overflow: auto; padding: 0; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); color: var(--text); box-shadow: 0 22px 80px #0003; }
.system-dialog::backdrop { background: #07151c80; backdrop-filter: blur(3px); }
.system-dialog-form { display: flex; flex-direction: column; gap: 16px; padding: clamp(16px, 3vw, 24px); }
.system-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.system-dialog-header h2 { margin: 4px 0; font-size: 21px; }
.system-dialog-header p { margin: 0; color: var(--dim); font-size: 12px; }
.system-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.system-form-field { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: var(--text-muted); font-size: 12px; }
.system-form-field:has(textarea), .system-form-field:has(input[type="checkbox"]) { grid-column: 1 / -1; }
.system-form-field input:not([type="checkbox"]), .system-form-field select, .system-form-field textarea { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--control-bg); color: var(--text); font: inherit; }
.system-form-field textarea { min-height: 82px; resize: vertical; }
.system-form-field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.system-form-field:has(input[type="checkbox"]) { flex-direction: row; align-items: center; justify-content: flex-start; }
.system-form-error { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 12px; }
.system-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 11px; border-top: 1px solid var(--line); }
.system-dialog-actions button { min-width: 100px; }
.systems-view [hidden] { display: none !important; }
@media (max-width: 760px) {
  .systems-view { padding: 14px 12px 28px; }
  .systems-view .section-heading { align-items: stretch; flex-direction: column; gap: 13px; }
  .system-heading-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .system-heading-actions button { min-width: 0; padding-inline: 8px; font-size: 12px; }
  .system-detail-header { grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 8px; }
  .system-detail-header > #systemBack { width: fit-content; }
  .system-detail-header > .system-actions { justify-content: flex-start; }
  .system-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; margin-inline: 0; }
  .system-tabs button { min-width: 0; padding-inline: 8px; font-size: 12px; }
  .system-record-layout { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .system-module-sidebar { position: static; padding: 8px; }
  .system-sidebar-head { padding-inline: 4px; }
  .system-module-list { display: flex; max-height: none; overflow-x: auto; overflow-y: hidden; gap: 6px; padding-bottom: 2px; }
  .system-module-choice { width: max-content; max-width: 75vw; flex: 0 0 auto; }
  .system-record-content { padding: 11px; }
  .system-panel-heading { align-items: flex-start; flex-direction: column; }
  .system-panel-heading > .system-actions { width: 100%; justify-content: flex-start; }
  .system-panel-heading > .system-actions button { flex: 1 1 auto; }
  .system-finance-summary { grid-template-columns: 1fr; }
  .system-finance-card { min-height: 75px; }
  .system-field-row { flex-wrap: wrap; }
  .system-field-row > span { flex-basis: 100%; }
  .system-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .system-heading-actions { grid-template-columns: 1fr; }
  .system-detail-header > .system-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .system-detail-header > .system-actions button { min-width: 0; padding-inline: 7px; font-size: 11px; }
  .system-panel-card { padding: 12px; }
  .system-schema-heading { align-items: flex-start; flex-direction: column; }
  .system-schema-heading .system-actions { justify-content: flex-start; }
  .system-field-row .system-actions { width: 100%; justify-content: flex-start; }
}


/* دليل الأنظمة، ملء الشاشة، وآخر التحديثات */
.updates-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 11px;
  border-color: var(--accent-border);
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent-text);
  white-space: nowrap;
}
#updatesButton[hidden] { display: none !important; }
.updates-button svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.updates-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; }
.updates-badge[hidden] { display: none !important; }
.updates-dialog { width: min(760px, calc(100vw - 28px)); padding: clamp(16px, 3vw, 24px); }
.updates-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.updates-dialog-header h2 { margin: 3px 0 4px; font-size: 22px; }
.updates-dialog-header p { margin: 0; color: var(--dim); font-size: 13px; }
.updates-list { display: grid; gap: 9px; max-height: min(58vh, 620px); overflow: auto; padding: 1px 2px 3px; }
.update-card { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.update-date { display: block; margin-bottom: 3px; color: var(--accent); font-size: 11px; font-weight: 600; }
.update-card h3 { margin: 0 0 4px; font-size: 15px; }
.update-card p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.system-guide-dialog { width: min(820px, calc(100vw - 28px)); max-height: min(92dvh, 900px); }
.system-guide-content { display: flex; flex-direction: column; gap: 14px; padding: clamp(16px, 3vw, 24px); }
.system-guide-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0; padding: 0; list-style: none; }
.system-guide-steps li { min-width: 0; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.system-guide-steps li > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.system-guide-steps h3 { margin: 1px 0 3px; font-size: 14px; }
.system-guide-steps p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.system-guide-privacy { padding: 12px 14px; border: 1px solid var(--accent-border); border-radius: 12px; background: var(--accent-soft); }
.system-guide-privacy strong { font-size: 13px; }
.system-guide-privacy p { margin: 3px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
#systemsView:fullscreen, #systemsView.is-pseudo-fullscreen { width: 100vw; height: 100dvh; min-height: 100dvh; overflow: auto; padding: clamp(14px, 2vw, 30px); background: var(--bg); color: var(--text); }
#systemsView.is-pseudo-fullscreen { position: fixed; z-index: 10000; inset: 0; }
#systemsView:fullscreen::backdrop { background: var(--bg); }

@media (max-width: 720px) {
  #appHeader { gap: 6px; padding-inline: 10px; }
  .brand { gap: 7px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small, .account-button-copy small, .privacy-chip { display: none; }
  .account-button { max-width: 132px; gap: 5px; padding: 4px 6px; }
  .header-avatar { width: 34px; height: 34px; flex-basis: 34px; }
  .header-actions { gap: 4px; min-width: 0; }
  #chatToggle { width: 38px; min-width: 38px; height: 38px; padding: 6px; }
  #chatToggle span, #updatesButton .updates-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  #updatesButton { width: 38px; min-width: 38px; height: 38px; flex: 0 0 38px; justify-content: center; padding: 5px; }
  #updatesButton .updates-badge { position: absolute; top: -4px; inset-inline-end: -4px; width: 13px; min-height: 13px; padding: 0; overflow: hidden; border: 2px solid var(--header-bg); font-size: 0; }
  .system-guide-steps { grid-template-columns: 1fr; }
}

.account-header-group { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; }
@media (max-width: 720px) {
  .account-header-group { flex: 0 0 auto; }
}


/* معرض أنظمة العمل الجاهزة والوظائف التلقائية */
.system-catalog-heading { align-items: flex-start; margin-top: 4px; }
.system-catalog-heading > div { min-width: 0; }
.system-catalog-heading p { max-width: 760px; margin: 5px 0 0; color: var(--dim); font-size: 12px; line-height: 1.7; }
.system-templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 285px), 1fr)); gap: 13px; margin-bottom: 24px; }
.system-template-card { min-width: 0; display: flex; flex-direction: column; gap: 11px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); box-shadow: 0 4px 16px #183b4a08; transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
.system-template-card:hover { transform: translateY(-2px); border-color: var(--accent-border); box-shadow: 0 9px 24px #183b4a12; }
.system-template-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.system-template-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 700; }
.system-template-category { max-width: 70%; padding: 5px 9px; border-radius: 999px; background: var(--panel-soft); color: var(--text-muted); font-size: 11px; }
.system-template-card h3 { margin: 0; font-size: 16px; }
.system-template-description { min-height: 3.5em; margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.system-template-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.system-template-badge { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--dim); font-size: 10px; }
.system-template-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 3px; }
.system-template-actions button { min-height: 38px; flex: 1 1 125px; padding-inline: 9px; font-size: 12px; }
.system-automation-card h3 { margin: 0; font-size: 15px; }
.system-automation-card > p { margin: 4px 0 10px; color: var(--dim); font-size: 12px; }
.system-automation-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.system-automation-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); font-size: 12px; }
.system-automation-list li > span:nth-child(2) { flex: 1 1 auto; font-weight: 600; }
.system-automation-list small { color: var(--dim); font-size: 10px; }
.system-rule-indicator { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.system-field-detail { flex-basis: 100%; color: var(--accent-text) !important; }
.system-catalog-heading #systemTemplateCount { flex: 0 0 auto; }
@media (max-width: 760px) {
  .system-catalog-heading { flex-direction: column; gap: 6px; }
  .system-template-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .system-template-actions button { min-width: 0; padding-inline: 6px; font-size: 11px; }
}
@media (max-width: 420px) {
  .system-templates-grid { grid-template-columns: 1fr; }
  .system-template-actions { grid-template-columns: 1fr; }
}


/* ملء شاشة القسم النشط فقط؛ تبقى واجهة الموقع والتنقل خارج نطاق العرض الكامل. */
.section-fullscreen-toggle { flex: 0 0 auto; min-height: 34px; margin-inline-start: auto; padding: 5px 11px; border-color: var(--accent-border); background: var(--panel); color: var(--accent-text); font-size: 12px; white-space: nowrap; }
.section-fullscreen-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.section-fullscreen-toolbar { display: flex; justify-content: flex-end; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.suite-view:fullscreen,
#sheetEditorView:fullscreen,
#pdfWorkspace:fullscreen,
.suite-view.is-pseudo-fullscreen,
#sheetEditorView.is-pseudo-fullscreen,
#pdfWorkspace.is-pseudo-fullscreen {
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--bg);
  color: var(--text);
}
.suite-view.is-pseudo-fullscreen,
#sheetEditorView.is-pseudo-fullscreen,
#pdfWorkspace.is-pseudo-fullscreen { position: fixed; z-index: 10000; inset: 0; }
.suite-view:fullscreen,
.suite-view.is-pseudo-fullscreen { overflow: auto; }
#docEditorView:fullscreen,
#docEditorView.is-pseudo-fullscreen,
#spreadsheetsView:fullscreen,
#spreadsheetsView.is-pseudo-fullscreen,
#sheetEditorView:fullscreen,
#sheetEditorView.is-pseudo-fullscreen { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
#pdfWorkspace:fullscreen,
#pdfWorkspace.is-pseudo-fullscreen { display: flex; overflow: hidden; padding: 0; }

/* مساحة جدول ممتدة بأشرطة الأدوات والشريط الحسابي داخل القسم نفسه. */
#sheetEditorView:fullscreen .sheet-editor-header,
#sheetEditorView.is-pseudo-fullscreen .sheet-editor-header { gap: 7px; padding: 9px clamp(10px, 2vw, 24px); background: var(--panel); }
#sheetEditorView:fullscreen .sheet-format-toolbar,
#sheetEditorView.is-pseudo-fullscreen .sheet-format-toolbar { gap: 8px; padding: 9px clamp(10px, 2vw, 24px); background: var(--panel); }
#sheetEditorView:fullscreen .formula-bar,
#sheetEditorView.is-pseudo-fullscreen .formula-bar { padding: 9px clamp(10px, 2vw, 24px); }
#sheetEditorView:fullscreen .sheet-grid-scroll,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid-scroll { width: 100%; flex: 1 1 0; min-height: 0; padding: 0 clamp(8px, 1.5vw, 22px) 16px; background: var(--panel-soft); }
#sheetEditorView:fullscreen .sheet-grid,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid { width: 100%; min-width: 830px; font-size: 14px; }
#sheetEditorView:fullscreen .sheet-grid th,
#sheetEditorView:fullscreen .sheet-grid td,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid th,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid td { height: 40px; }
#sheetEditorView:fullscreen .sheet-grid thead th,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid thead th { height: 38px; }
#sheetEditorView:fullscreen .sheet-grid tbody tr:nth-child(even) td,
#sheetEditorView.is-pseudo-fullscreen .sheet-grid tbody tr:nth-child(even) td { background: var(--panel-soft); }
#sheetEditorView:fullscreen .sheet-hint,
#sheetEditorView.is-pseudo-fullscreen .sheet-hint { padding-inline: clamp(10px, 2vw, 24px); }
@media (max-width: 720px) {
  #sheetEditorView:fullscreen .sheet-editor-header,
  #sheetEditorView.is-pseudo-fullscreen .sheet-editor-header { max-height: 30dvh; overflow: auto; }
  #sheetEditorView:fullscreen .sheet-format-toolbar,
  #sheetEditorView.is-pseudo-fullscreen .sheet-format-toolbar { max-height: 22dvh; overflow: auto; }
  #sheetEditorView:fullscreen .sheet-grid-scroll,
  #sheetEditorView.is-pseudo-fullscreen .sheet-grid-scroll { padding-inline: 4px; }
}

/* Google أولًا في شاشة الحساب، مع خيار البريد الحالي مفصولًا بوضوح. */
.auth-google-button { width: 100%; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 11px; margin: 7px 0 0; border-color: #d7e0e7; background: #fff; color: #273640; font-weight: 600; }
.auth-google-button:hover { border-color: #b7c7d1; background: #f7f9fa; }
.auth-google-button svg { width: 20px; height: 20px; flex: 0 0 20px; }
.auth-google-button[hidden] { display: none !important; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 15px 0 12px; color: #82909a; font-size: 11px; text-align: center; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1 1 auto; background: #e6ebef; content: ""; }
.auth-divider[hidden] { display: none !important; }
html[data-theme="dark"] .auth-google-button,
html[data-theme="system"] .auth-google-button { border-color: #d7e0e7; background: #fff; color: #273640; }


/* مشغل رسائل صوتية خاص بالمحادثة بدل عناصر التحكم الخام للمتصفح. */
.chat-message-attachment-audio { width: min(340px, 76vw); }
.chat-audio-player { width: min(330px, 76vw); min-width: 215px; display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 11px; border: 1px solid var(--chat-line); border-radius: 13px; background: var(--chat-inset); color: var(--text); }
.chat-audio-player-compact { width: min(330px, 70vw); min-width: 200px; padding: 7px 9px; }
.chat-audio-player audio[hidden] { display: none !important; }
.chat-audio-play { width: 38px; min-width: 38px; height: 38px; min-height: 38px; display: grid; place-items: center; padding: 8px; border: 1px solid #4bb99f; border-radius: 50%; background: #57d2b1; color: #092522; box-shadow: 0 4px 14px #0002; }
.chat-audio-play:hover { border-color: #83edd2; background: #7ce4c9; color: #092522; transform: translateY(-1px); }
.chat-audio-play svg { width: 19px; height: 19px; fill: currentColor; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-audio-player.is-playing .chat-audio-play { box-shadow: 0 0 0 4px #57d2b12a; }
.chat-audio-body { min-width: 0; display: grid; gap: 4px; }
.chat-audio-topline { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-audio-topline strong { overflow: hidden; color: var(--chat-accent); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.chat-audio-topline time { color: var(--chat-muted); font: 10px ui-monospace,monospace; }
.chat-audio-progress { width: 100%; height: 12px; margin: 0; appearance: none; -webkit-appearance: none; border: 0; outline: 0; background: transparent; cursor: pointer; direction: ltr; }
.chat-audio-progress::-webkit-slider-runnable-track { height: 4px; border-radius: 9px; background: linear-gradient(to right, var(--chat-accent) 0%, var(--chat-accent) var(--audio-progress, 0%), var(--chat-line) var(--audio-progress, 0%), var(--chat-line) 100%); }
.chat-audio-progress::-moz-range-track { height: 4px; border-radius: 9px; background: var(--chat-line); }
.chat-audio-progress::-moz-range-progress { height: 4px; border-radius: 9px; background: var(--chat-accent); }
.chat-audio-progress::-webkit-slider-thumb { width: 11px; height: 11px; margin-top: -3.5px; appearance: none; -webkit-appearance: none; border: 2px solid var(--chat-bg); border-radius: 50%; background: var(--chat-accent); box-shadow: 0 0 0 1px var(--chat-accent); }
.chat-audio-progress::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid var(--chat-bg); border-radius: 50%; background: var(--chat-accent); box-shadow: 0 0 0 1px var(--chat-accent); }
.chat-audio-progress:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 3px; border-radius: 4px; }
.chat-audio-times { display: flex; justify-content: space-between; direction: ltr; color: var(--chat-muted); font: 9px ui-monospace,monospace; }
.chat-attachment-audio { width: 100%; }
.chat-attachment-audio .chat-audio-player { width: min(330px, 68vw); }
@media (max-width: 420px) {
  .chat-message-attachment-audio, .chat-audio-player { width: min(300px, 68vw); min-width: 190px; }
  .chat-audio-player { grid-template-columns: 36px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .chat-audio-play { width: 35px; min-width: 35px; height: 35px; min-height: 35px; }
}


/* Profiles, public project previews, and the owner-only administration dialog */
#deleteAvatar[hidden], #adminDashboardButton[hidden] { display: none !important; }
.public-profile-summary[hidden], #publicProfileProjectsEmpty[hidden], #adminProjectsEmpty[hidden], #publicProfileVerified[hidden], #publicProfileAdminVerified[hidden] { display: none !important; }
.avatar-actions .danger-button { width: auto; min-height: 34px; padding: 5px 10px; font-size: 12px; }
.chat-author-name { min-width: 0; max-width: min(180px, 42vw); overflow: hidden; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--chat-accent, #e6f2ee); font: inherit; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.chat-author-name:hover:not(:disabled) { background: transparent; color: var(--chat-accent, #b8f3e2); text-decoration: underline; }
.chat-author-name:disabled { opacity: 1; cursor: default; }
.public-profile-dialog { width: min(700px, calc(100vw - 24px)); padding: 18px; }
.public-project-dialog { width: min(1120px, calc(100vw - 24px)); max-height: min(94dvh, 920px); padding: 18px; }
.admin-dashboard-dialog { width: min(880px, calc(100vw - 24px)); padding: 18px; }
.public-profile-header, .public-project-dialog > .system-dialog-header, .admin-dashboard-dialog > .system-dialog-header { margin-bottom: 12px; }
.public-profile-status, .admin-status { min-height: 1.4em; margin: 4px 0 12px; color: var(--dim); font-size: 12px; }
.public-profile-status.is-error, .admin-status.is-error { color: var(--danger); }
.public-profile-summary { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; overflow: hidden; margin: 8px 0 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.public-profile-cover { height: 142px; overflow: hidden; background: #164b42; }
.public-profile-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.public-profile-cover img[hidden] { display: none !important; }
.public-profile-identity { min-width: 0; display: flex; align-items: center; gap: 16px; padding: 16px 16px 10px; }
.public-profile-avatar { width: 76px; height: 76px; flex: 0 0 76px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--accent-border); border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 25px; font-weight: 700; }
.public-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.public-profile-copy { min-width: 0; }
.public-profile-copy h3 { display: inline; margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.public-profile-copy p { margin: 7px 0 0; color: var(--dim); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.public-profile-copy .chat-verified-badge { width: 20px; height: 20px; margin-inline-start: 5px; vertical-align: -3px; }
.public-profile-contact { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 4px 16px 16px; }
.public-profile-contact[hidden], .public-profile-social-links[hidden], .public-profile-phone[hidden] { display: none !important; }
.public-profile-phone, .public-profile-social-links a { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent-text); font-size: 11px; text-decoration: none; }
.public-profile-phone:hover, .public-profile-social-links a:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.public-profile-social-links { display: flex; flex-wrap: wrap; gap: 7px; }
.public-profile-projects > h3, .admin-section h3 { margin: 0 0 10px; font-size: 15px; }
.public-project-list, .admin-project-list { display: grid; gap: 8px; }
.public-project-card, .admin-project-row { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.public-project-open { min-width: 0; flex: 1 1 auto; display: flex; align-items: flex-start; flex-direction: column; gap: 4px; padding: 3px; border: 0; background: transparent; text-align: start; }
.public-project-open:hover { border-color: transparent; background: transparent; }
.public-project-open strong { max-width: 100%; overflow-wrap: anywhere; }
.public-project-open span, .admin-project-copy span { color: var(--dim); font-size: 11px; }
.project-visibility { flex: 0 0 auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; color: var(--dim); font-size: 10px; white-space: nowrap; }
.project-visibility.is-public { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); color: var(--accent-text); }
.project-visibility-toggle { min-height: 34px; flex: 0 0 auto; padding: 5px 9px; border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); font-size: 11px; }
.project-library-row .project-delete { min-height: 34px; padding: 5px 9px; font-size: 11px; }
.public-project-content { min-height: 170px; max-height: calc(94dvh - 120px); overflow: auto; margin-top: 12px; padding: clamp(10px, 2vw, 22px); border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.public-document-page { max-width: 820px; min-height: 460px; margin: 0 auto; padding: clamp(18px, 4vw, 52px); border: 1px solid #dce1e6; border-radius: 4px; color: #202b34; box-shadow: 0 8px 30px #0002; line-height: 1.65; overflow-wrap: anywhere; }
.public-document-page img { max-width: 100%; height: auto; }
.public-document-page .cv-layout { max-width: 800px; margin: 0 auto; font-family: Arial, sans-serif; }
.public-document-page .cv-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px; background: #eef3f6; }
.public-document-page .cv-banner-copy { min-width: 0; }
.public-document-page .cv-name { margin: 4px 0; font-size: clamp(22px, 4vw, 36px); }
.public-document-page .cv-headline { margin: 0 0 10px; color: #536474; }
.public-document-page .cv-contact { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; }
.public-document-page .cv-photo-box { width: 100px; height: 100px; flex: 0 0 100px; overflow: hidden; border-radius: 50%; background: #dfe7eb; }
.public-document-page .cv-photo { width: 100%; height: 100%; object-fit: cover; }
.public-document-page .cv-columns { display: grid; grid-template-columns: minmax(150px, .72fr) minmax(0, 1.6fr); gap: 20px; padding: 22px; }
.public-document-page .cv-section { margin-bottom: 15px; }
.public-document-page .cv-section-title { margin: 0 0 7px; padding-bottom: 4px; border-bottom: 1px solid #cbd5dc; font-size: 15px; }
.public-document-page .cv-entry { margin: 0 0 12px; }
.public-document-page .cv-entry-head { display: flex; justify-content: space-between; gap: 8px; }
.public-document-page .cv-entry-title { margin: 0; font-size: 13px; }
.public-document-page .cv-entry-org, .public-document-page .cv-entry-period, .public-document-page .cv-entry-detail { margin: 3px 0; color: #526271; font-size: 12px; }
.public-document-page .cv-chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.public-document-page .cv-chip { padding: 3px 7px; border-radius: 99px; background: #edf1f4; font-size: 11px; }
.public-document-page .cv-certificate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 9px; }
.public-document-page .cv-certificate-card { margin: 0; padding: 7px; border: 1px solid #d8e0e5; border-radius: 8px; }
.public-document-page .cv-certificate-image { width: 100%; max-height: 150px; object-fit: contain; }
.public-document-page .cv-certificate-title { margin: 4px 0 0; font-size: 11px; }
.public-sheet-scroll { overflow: auto; max-height: inherit; }
.public-sheet-table { width: 100%; border-collapse: collapse; color: var(--text); font-size: 12px; }
.public-sheet-table th, .public-sheet-table td { min-width: 90px; max-width: 300px; padding: 6px 8px; border: 1px solid var(--line); text-align: start; vertical-align: top; }
.public-sheet-table thead th, .public-sheet-table tbody th { position: sticky; z-index: 1; background: var(--panel); color: var(--dim); font-size: 10px; }
.public-sheet-table thead th { top: 0; }
.public-sheet-table tbody th { inset-inline-start: 0; min-width: 38px; }
.public-sheet-table td span { display: block; max-height: 100px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 12px 0 18px; }
.admin-stats article { display: flex; align-items: flex-start; flex-direction: column; gap: 3px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.admin-stats strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.admin-stats span { color: var(--dim); font-size: 11px; }
.admin-section { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.admin-section > p { color: var(--dim); font-size: 12px; line-height: 1.65; }
.admin-section label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; color: var(--dim); font-size: 12px; }
.admin-section select { min-width: 180px; min-height: 36px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; }
.admin-section > .danger-button { min-height: 38px; }
.admin-project-row { justify-content: space-between; }
.admin-project-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.admin-project-copy strong { overflow-wrap: anywhere; }
.admin-project-row .danger-button { min-height: 34px; flex: 0 0 auto; padding: 5px 8px; font-size: 11px; }
.profile-cover-editor { gap: 4px; overflow: visible; margin: 12px 0 15px; padding: 10px; }
.profile-cover-preview { position: relative; height: 146px; margin-bottom: 39px; overflow: visible; border: 0; border-radius: 10px; background-position: center; background-size: cover; }
.profile-cover-preview > img { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.profile-avatar-overlay { position: absolute; z-index: 1; inset-inline-start: 16px; bottom: -40px; width: 90px; height: 90px; display: grid; place-items: center; border: 4px solid var(--panel); border-radius: 50%; background: var(--panel); box-shadow: 0 3px 12px #0003; }
.profile-avatar-overlay .avatar-frame { width: 82px; height: 82px; border-width: 2px; }
.profile-summary { min-height: 88px; align-items: flex-end; padding-inline-start: 108px; }
.profile-social-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
.chat-message-actions { flex-wrap: wrap; gap: 6px; }
.chat-message-actions button { min-height: 28px; padding: 3px 8px; border: 1px solid var(--chat-line); border-radius: 8px; background: transparent; color: var(--chat-muted); font: inherit; font-size: 10px; cursor: pointer; }
.chat-message-actions button:hover:not(:disabled) { border-color: var(--chat-accent); background: color-mix(in srgb,var(--chat-accent) 10%,transparent); color: var(--chat-accent); }
.chat-message-actions button:disabled { opacity: .55; cursor: default; }
.chat-message-actions .chat-report-button:hover:not(:disabled) { border-color: #e29a9a; background: #e1555514; color: #c64747; }
.chat-verified-badge.is-admin-verified { color: #57218a; filter: drop-shadow(0 1px 2px #57218a30); }
.public-profile-cover { height: 154px; }
.public-profile-identity { position: relative; z-index: 1; align-items: flex-end; gap: 14px; margin-top: -44px; padding-top: 0; }
.public-profile-avatar { width: 86px; height: 86px; flex-basis: 86px; border: 4px solid var(--panel); box-shadow: 0 3px 12px #0003; }
.admin-account-list, .admin-report-list { display: grid; gap: 8px; }
.admin-account-row, .admin-report-row { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.admin-account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-account-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.admin-account-copy strong, .admin-account-copy span { overflow-wrap: anywhere; }
.admin-account-copy span, .admin-account-copy small, .admin-report-row small { color: var(--dim); font-size: 11px; }
.admin-account-actions, .admin-report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.admin-account-actions button, .admin-report-actions button { width: auto; min-height: 32px; padding: 5px 8px; font-size: 10px; }
.admin-account-badge { border: 1px solid #6b3a99; border-radius: 8px; background: #f1e8fa; color: #51227e; }
.admin-account-badge.is-active { background: #57218a; color: #fff; }
.admin-report-row { display: grid; gap: 6px; }
.admin-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.admin-report-head strong { font-size: 12px; }
.admin-report-status { padding: 3px 7px; border-radius: 99px; background: var(--panel); color: var(--dim); font-size: 10px; white-space: nowrap; }
.admin-report-status.is-pending { background: #fff4d9; color: #805b00; }
.admin-report-status.is-reviewed { background: #e4f3eb; color: #246444; }
.admin-report-status.is-dismissed { background: #f0edf2; color: #675a70; }
.admin-report-reason { margin: 0; font-size: 12px; font-weight: 650; }
.admin-report-row blockquote { margin: 0; padding: 8px 10px; border-inline-start: 3px solid var(--accent); border-radius: 5px; background: var(--panel); color: var(--text-muted); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-report-actions { justify-content: flex-end; padding-top: 4px; }
@media (max-width: 680px) {
  .project-library-row { flex-wrap: wrap; }
  .project-library-open { flex-basis: calc(100% - 54px); }
  .project-visibility, .project-visibility-toggle { margin-inline-start: 44px; }
  .project-library-row .project-delete { margin-inline-start: auto; }
  .public-profile-dialog, .public-project-dialog, .admin-dashboard-dialog { padding: 13px; }
  .public-profile-summary { align-items: stretch; }
  .public-profile-cover { height: 116px; }
  .public-profile-identity { align-items: flex-end; gap: 9px; margin-top: -38px; padding: 0 12px 9px; }
  .public-profile-contact { padding: 3px 12px 13px; }
  .public-profile-avatar { width: 60px; height: 60px; flex-basis: 60px; }
  .profile-cover-preview { height: 120px; }
  .profile-avatar-overlay { inset-inline-start: 11px; bottom: -37px; width: 80px; height: 80px; }
  .profile-avatar-overlay .avatar-frame { width: 72px; height: 72px; }
  .profile-summary { padding-inline-start: 94px; }
  .public-document-page .cv-banner { align-items: flex-start; padding: 14px; }
  .public-document-page .cv-photo-box { width: 70px; height: 70px; flex-basis: 70px; }
  .public-document-page .cv-columns { grid-template-columns: 1fr; gap: 8px; padding: 14px; }
  .admin-stats { gap: 6px; }
  .admin-stats article { padding: 9px; }
  .admin-stats strong { font-size: 18px; }
  .admin-project-row { align-items: flex-start; }
  .admin-account-row { align-items: flex-start; flex-direction: column; }
  .admin-account-actions { width: 100%; }
}
@media (max-width: 420px) {
  .project-library-open { flex-basis: calc(100% - 45px); }
  .project-visibility, .project-visibility-toggle { margin-inline-start: 0; }
  .public-project-card { align-items: flex-start; flex-direction: column; }
  .admin-stats { grid-template-columns: 1fr; }
  .admin-section select { width: 100%; }
}
.admin-freeze-dialog, .account-frozen-dialog { width: min(460px,calc(100vw - 28px)); }
.admin-freeze-dialog { max-height: min(88vh,700px); }
.admin-freeze-duration { display: grid; gap: 7px; margin: 16px 0 8px; color: var(--text); font-size: 13px; }
.admin-freeze-duration select { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--control-bg); color: var(--text); font: inherit; }
.admin-freeze-note { color: var(--dim); font-size: 12px; line-height: 1.7; }
.account-frozen-dialog {
  position: relative;
  width: min(500px, calc(100vw - 28px));
  max-height: min(88dvh, 680px);
  overflow: auto;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--line));
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--danger) 8%, transparent), transparent 54%),
    linear-gradient(165deg, var(--panel), var(--panel-soft));
  color: var(--text);
  text-align: center;
  box-shadow: 0 28px 84px #07151c38, 0 3px 12px #07151c16;
  overscroll-behavior: contain;
}
.account-frozen-dialog[open] { animation: frozenDialogEnter .24s cubic-bezier(.2,.8,.2,1) both; }
.account-frozen-dialog::backdrop { background: #07151c99; backdrop-filter: blur(7px); }
.account-frozen-dialog::before {
  content: "!";
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  border-radius: 20px;
  background: linear-gradient(145deg, var(--danger-soft), color-mix(in srgb, var(--danger) 12%, var(--panel)));
  color: var(--danger);
  font: 750 29px/1 system-ui, sans-serif;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--danger) 7%, transparent), 0 10px 24px color-mix(in srgb, var(--danger) 12%, transparent);
}
.account-frozen-dialog > .eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 4px;
  padding: 4px 11px;
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--line));
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}
.account-frozen-dialog h2 { margin: 10px 0 8px; font-size: clamp(22px, 4vw, 29px); line-height: 1.35; letter-spacing: -.02em; }
.account-frozen-dialog > p { margin: 0; line-height: 1.85; }
.account-frozen-dialog #accountFrozenBody { max-width: 43ch; margin-inline: auto; color: var(--dim); font-size: 14px; }
.account-frozen-duration {
  max-width: 42ch;
  margin: 20px auto 13px !important;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 18%, var(--line));
  border-inline-start: 4px solid var(--danger);
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger-soft) 62%, var(--panel));
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.account-frozen-dialog #accountFrozenSupport { max-width: 43ch; margin: 15px auto 0; color: var(--dim); font-size: 12px; }
.account-frozen-dialog #accountFrozenSignOutStatus { min-height: 1.4em; margin: 8px 0 0; font-size: 12px; }
.account-frozen-dialog > button { display: block; width: min(100%, 340px); min-height: 48px; margin: 22px auto 0; border-radius: 12px; font-weight: 650; }
@keyframes frozenDialogEnter { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 420px) {
  .account-frozen-dialog { width: min(420px, calc(100vw - 22px)); padding: 22px 17px 19px; border-radius: 20px; }
  .account-frozen-dialog::before { width: 54px; height: 54px; margin-bottom: 14px; border-radius: 17px; font-size: 25px; }
  .account-frozen-dialog #accountFrozenBody { font-size: 13px; }
  .account-frozen-dialog > button { margin-top: 18px; }
}


/* Username search and one-to-one private messages */
.people-search { position: relative; z-index: 12; flex: 0 1 310px; min-width: 0; }
.people-search[hidden] { display: none !important; }
.people-search-toggle { display: none !important; }
.people-search-panel { position: relative; width: 100%; }
.people-search-form { display: flex; align-items: center; gap: 6px; width: 100%; }
.people-search-form input { flex: 1 1 auto; min-width: 0; width: 100%; height: 38px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--control-bg); color: var(--text); text-align: left; }
.people-search-form button { min-height: 38px; padding-inline: 12px; }
.people-search-note { margin: 4px 4px 0; color: var(--dim); font-size: 10px; line-height: 1.35; }
.people-search-status { margin: 7px 4px; color: var(--dim); font-size: 12px; }
.people-search-status.is-error { color: var(--danger); }
.people-search-results { position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 6px); display: grid; gap: 5px; max-height: min(55dvh, 420px); overflow: auto; padding: 7px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 14px 40px #183b4a20; }
.people-search-results[hidden] { display: none !important; }
.people-search-item { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 9px; background: var(--panel-soft); }
.people-search-avatar { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--accent-border); border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.people-search-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.people-search-identity { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; line-height: 1.35; }
.people-search-identity strong, .people-search-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-search-identity strong { font-size: 12px; }
.people-search-identity span { color: var(--dim); font-size: 11px; direction: ltr; text-align: start; }
.people-search-message { min-height: 32px !important; flex: 0 0 auto; padding: 4px 9px !important; font-size: 11px; }
.username-field { display: flex; align-items: center; gap: 5px; min-height: 40px; padding-inline: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--control-bg); color: var(--dim); direction: ltr; }
.username-field:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.username-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); text-align: left; }
.username-field input:focus-visible { outline: 0; }
#profileUsername { text-align: left; }
.direct-message-dialog { width: min(560px, calc(100vw - 24px)); height: min(720px, 82dvh); max-height: min(82dvh, 760px); overflow: hidden; padding: 17px; }
.direct-message-dialog[open] { display: flex; flex-direction: column; gap: 10px; }
.direct-message-header { flex: 0 0 auto; align-items: center; }
.direct-message-header h2 { margin: 2px 0 0; }
.direct-message-header p { margin: 0; color: var(--dim); font-size: 11px; text-align: start; }
.direct-message-status { flex: 0 0 auto; min-height: 1.3em; margin: 0; color: var(--dim); font-size: 11px; }
.direct-message-status.is-error { color: var(--danger); }
.direct-message-load-older { flex: 0 0 auto; align-self: center; min-height: 30px; padding: 3px 10px; font-size: 11px; }
.direct-message-messages { flex: 1 1 auto; min-height: 140px; display: flex; flex-direction: column; gap: 8px; overflow: auto; padding: 12px; border: 1px solid var(--chat-line); border-radius: 13px; background: var(--chat-bg); overscroll-behavior: contain; }
.direct-message-empty { margin: auto; color: var(--dim); font-size: 13px; text-align: center; }
.direct-message-row { display: flex; justify-content: flex-start; }
.direct-message-row.is-own { justify-content: flex-end; }
.direct-message-bubble { max-width: min(85%, 420px); padding: 8px 11px 5px; border: 1px solid var(--chat-line); border-radius: 14px 14px 14px 4px; background: var(--chat-bubble); overflow-wrap: anywhere; }
.direct-message-row.is-own .direct-message-bubble { border-color: var(--accent-border); border-radius: 14px 14px 4px 14px; background: var(--chat-own); }
.direct-message-bubble p { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.direct-message-bubble time { display: block; margin-top: 3px; color: var(--dim); font-size: 9px; text-align: end; }
.direct-message-composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.direct-message-composer textarea { flex: 1 1 auto; min-width: 0; max-height: 130px; resize: vertical; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--control-bg); color: var(--text); }
.direct-message-composer button { min-height: 40px; }
@media (max-width: 720px) {
  #appHeader { flex-wrap: wrap; min-height: 0; }
  .header-actions { order: 3; flex: 1 0 100%; justify-content: space-between; overflow: visible; }
  .people-search { flex: 0 0 38px; width: 38px; }
  .people-search-toggle { width: 38px; min-width: 38px; height: 38px; display: inline-flex !important; align-items: center; justify-content: center; padding: 7px; }
  .people-search-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .people-search-panel { position: absolute; z-index: 40; top: calc(100% + 8px); inset-inline-end: 0; display: none; width: min(360px, calc(100vw - 20px)); padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 14px 40px #183b4a20; }
  .people-search.is-open .people-search-panel { display: block; }
  .people-search-note { margin-top: 7px; }
  .people-search-results { position: static; max-height: min(45dvh, 360px); margin-top: 6px; box-shadow: none; }
  .direct-message-dialog { height: min(680px, 86dvh); max-height: 86dvh; padding: 12px; }
}
@media (max-width: 380px) {
  .people-search-message { padding-inline: 6px !important; }
  .direct-message-composer { gap: 5px; }
  .direct-message-composer button { padding-inline: 8px; }
}


/* ترتيب محرر الملف، وفصل هوية المستخدم عن تداخل غلاف الملف العام. */
.profile-core-fields { display: grid; gap: 11px; margin: 2px 0 14px; }
.profile-core-fields > h3 { margin: 0 0 2px; font-size: 14px; }
.profile-settings-group { margin: 9px 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.profile-settings-group > summary { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; list-style: none; }
.profile-settings-group > summary::-webkit-details-marker { display: none; }
.profile-settings-chevron { width: 8px; height: 8px; flex: 0 0 8px; border-inline-end: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .18s ease; }
.profile-settings-group[open] > summary { border-bottom: 1px solid var(--line); }
.profile-settings-group[open] > summary .profile-settings-chevron { transform: rotate(225deg); }
.profile-settings-content { display: grid; gap: 12px; padding: 13px 0; }
.profile-settings-content .profile-cover-controls { gap: 9px; margin: 0; padding: 0; border: 0; }
.profile-settings-content .profile-summary { min-height: 0; align-items: flex-start; padding: 0; }
.profile-settings-content .avatar-actions { width: 100%; }
.profile-settings-content .profile-social-fields { grid-template-columns: minmax(0,1fr); margin: 4px 0 0; }
.profile-cover-editor { margin: 12px 0 8px; padding: 0; }
.profile-cover-preview { margin-bottom: 38px; border-radius: 13px; }
.profile-avatar-overlay { inset-inline-start: 14px; bottom: -35px; }
.profile-phone-public { display: flex; align-items: center; gap: 8px; }
.profile-phone-public input { width: auto; min-height: auto; accent-color: var(--accent); }

/* شريط بحث مضغوط، ونتائج/حالات تظهر كقائمة منبثقة بدل تمديد الرأس. */
.people-search { flex: 0 1 330px; min-width: 190px; }
.people-search-form { gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--control-bg); transition: border-color .16s ease, box-shadow .16s ease; }
.people-search-form:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent); }
.people-search-form input { height: 36px; padding-inline: 13px; border: 0; outline: 0; background: transparent; text-align: start; }
.people-search-form input:focus-visible { outline: 0; }
.people-search-form .people-search-submit { width: 36px; min-width: 36px; height: 36px; min-height: 36px; display: grid; place-items: center; padding: 7px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-contrast, #fff); cursor: pointer; }
.people-search-submit:hover { filter: brightness(1.06); transform: translateY(-1px); }
.people-search-submit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.people-search-note { display: none; }
.people-search-status:not([hidden]) { position: absolute; z-index: 41; inset-inline: 0; top: calc(100% + 7px); margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: 0 12px 32px #183b4a1a; }
.people-search-status.is-error { color: var(--danger); }
.people-search-results { top: calc(100% + 7px); }
.public-profile-identity { align-items: flex-start; gap: 14px; margin-top: 0; padding: 0 16px 15px; }
.public-profile-avatar { position: relative; z-index: 2; margin-top: -42px; }
.public-profile-copy { min-width: 0; padding-top: 9px; }
@media (max-width: 720px) {
  .profile-settings-content .profile-cover-controls { gap: 9px; }
  .people-search-note { display: block; margin: 7px 4px 1px; }
  .people-search-panel { width: min(360px,calc(100vw - 20px)); }
}
@media (max-width: 680px) {
  .public-profile-identity { align-items: flex-start; gap: 9px; margin-top: 0; padding: 0 12px 13px; }
  .public-profile-avatar { margin-top: -31px; }
  .public-profile-copy { padding-top: 7px; }
}
@media (max-width: 420px) {
  .profile-settings-group { padding-inline: 10px; }
  .profile-settings-content { gap: 10px; }
}


/* أدوات تحرير صغيرة فوق معاينة الغلاف والصورة بدل أزرار اختيار كبيرة. */
.profile-media-edit {
  position: absolute;
  z-index: 4;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent, #fff);
  box-shadow: 0 2px 9px #0003;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.profile-media-edit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-media-edit:hover:not(:disabled) { transform: scale(1.08); filter: brightness(1.06); }
.profile-media-edit:focus-visible { outline: 3px solid var(--accent-border); outline-offset: 2px; }
.profile-media-edit:disabled { opacity: .55; cursor: wait; }
.profile-cover-preview .profile-cover-edit { inset-inline-end: 10px; bottom: 10px; }
.profile-avatar-overlay .profile-avatar-edit { z-index: 3; inset-inline-end: -5px; bottom: -3px; width: 31px; min-width: 31px; height: 31px; min-height: 31px; }
.profile-avatar-overlay .profile-avatar-edit svg { width: 14px; height: 14px; }

html[data-theme="dark"] #accountCard button.profile-media-edit:not(.primary):not(.text-button),
html[data-theme="system"] #accountCard button.profile-media-edit:not(.primary):not(.text-button) {
  border-color: var(--panel);
  background: var(--accent);
  color: var(--on-accent, #fff);
}
#accountCard button.profile-media-edit {
  border-color: var(--panel);
  background: var(--accent);
  color: var(--on-accent, #fff);
}

/* صندوق وارد مباشر للمحادثات الخاصة مع مؤشر للمحادثات غير المقروءة. */
.direct-inbox-button {
  position: relative;
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #173536));
  color: var(--on-accent, #fff);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 20%, transparent);
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.direct-inbox-button[hidden] { display: none !important; }
.direct-inbox-button > svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.direct-inbox-button:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 26%, transparent); }
.direct-inbox-button:focus-visible { outline: 3px solid var(--accent-border); outline-offset: 2px; }
.direct-inbox-label { white-space: nowrap; font-size: 12px; }
.direct-inbox-badge {
  position: absolute;
  z-index: 2;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: #d83e70;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.direct-inbox-badge[hidden] { display: none !important; }
.direct-inbox-button.has-unread { box-shadow: 0 0 0 3px color-mix(in srgb, #d83e70 12%, transparent), 0 6px 18px color-mix(in srgb, var(--accent) 24%, transparent); }
.direct-message-inbox-dialog { width: min(560px, calc(100vw - 24px)); height: min(680px, 82dvh); max-height: min(82dvh, 740px); overflow: hidden; padding: 17px; }
.direct-message-inbox-dialog[open] { display: flex; flex-direction: column; gap: 10px; }
.direct-message-inbox-header { flex: 0 0 auto; align-items: center; }
.direct-message-inbox-header h2 { margin: 2px 0 0; }
.direct-message-inbox-actions { display: flex; align-items: center; gap: 5px; }
.direct-message-inbox-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.direct-message-inbox-status { flex: 0 0 auto; margin: 0; color: var(--dim); font-size: 12px; }
.direct-message-inbox-status.is-error { color: var(--danger); }
.direct-message-inbox-list { flex: 1 1 auto; min-height: 0; display: grid; align-content: start; gap: 7px; overflow: auto; padding: 2px; overscroll-behavior: contain; }
.direct-message-inbox-list[hidden] { display: none !important; }
.dm-inbox-item {
  width: 100%;
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.dm-inbox-item:hover { transform: translateY(-1px); border-color: var(--accent-border); background: var(--panel-raised); }
.dm-inbox-item:focus-visible { outline: 3px solid var(--accent-border); outline-offset: 1px; }
.dm-inbox-item.has-unread { border-color: var(--accent-border); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.dm-inbox-copy { min-width: 0; display: grid; gap: 2px; }
.dm-inbox-heading { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dm-inbox-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.dm-inbox-heading time { flex: 0 0 auto; color: var(--dim); font-size: 10px; }
.dm-inbox-username { overflow: hidden; color: var(--dim); font-size: 10px; text-align: start; text-overflow: ellipsis; white-space: nowrap; }
.dm-inbox-preview { overflow: hidden; margin: 1px 0 0; color: var(--dim); font-size: 11px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.dm-inbox-item.has-unread .dm-inbox-preview { color: var(--text); font-weight: 600; }
.dm-inbox-unread { min-width: 21px; height: 21px; display: grid; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent, #fff); font-size: 10px; font-weight: 800; }
.dm-inbox-unread[hidden] { display: none !important; }
.direct-message-inbox-empty { margin: auto; padding: 18px; color: var(--dim); font-size: 13px; line-height: 1.6; text-align: center; }
.direct-message-inbox-empty[hidden] { display: none !important; }
@media (max-width: 720px) {
  .direct-inbox-button { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 6px; border-radius: 12px; }
  .direct-inbox-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .direct-message-inbox-dialog { height: min(680px, 86dvh); max-height: 86dvh; padding: 12px; }
}

/* رسائل صوتية ومرفقات داخل محادثة المستخدم الخاصة. */
.dm-conversation-actions { display: flex; align-items: center; gap: 4px; }
.dm-conversation-actions .dm-call-button { width: 36px; min-width: 36px; height: 36px; min-height: 36px; display: grid; place-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--accent); }
.dm-conversation-actions svg, .dm-media-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.direct-message-composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 7px; }
.dm-media-button { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); color: var(--accent); cursor: pointer; }
.dm-media-button:disabled { opacity: .52; cursor: wait; }
.dm-media-button.is-recording { background: #ffe9ee; border-color: #e98ca2; color: #bf3155; animation: dm-record-pulse 1.2s ease-in-out infinite; }
@keyframes dm-record-pulse { 50% { box-shadow: 0 0 0 5px #de557326; } }
.dm-message-attachment { display: grid; gap: 6px; margin-top: 7px; }
.dm-message-attachment audio { width: min(280px, 100%); height: 38px; }
.dm-message-attachment img { display: block; max-width: min(280px, 100%); max-height: 240px; border: 1px solid var(--chat-line); border-radius: 10px; object-fit: contain; }
.dm-message-attachment a { overflow-wrap: anywhere; color: var(--accent); font-size: 12px; text-decoration: underline; }
.dm-message-attachment { color: var(--dim); font-size: 11px; }
.dm-conversation-actions .dm-call-button:disabled { opacity: .48; cursor: not-allowed; }
.direct-call-dialog { width: min(540px, calc(100vw - 24px)); max-height: min(90dvh, 820px); overflow: auto; padding: 18px; }
.direct-call-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.direct-call-message { min-height: 1.3em; margin: 0; color: var(--dim); font-size: 12px; text-align: center; }
.direct-call-audio-stage { min-height: 216px; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px 16px; border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-radius: 20px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 58%), var(--panel-soft); color: var(--dim); font-size: 13px; font-weight: 650; }
.direct-call-audio-stage[hidden] { display: none !important; }
.direct-call-audio-mark { width: 88px; height: 88px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 28px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 12%, transparent); }
.direct-call-audio-mark svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.direct-call-screen-stage { position: relative; min-height: 140px; display: grid; place-items: center; overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: #10191b; }
.direct-call-screen-stage[hidden] { display: none !important; }
.direct-call-screen-stage video { width: 100%; max-height: min(52dvh, 460px); object-fit: contain; border-radius: 10px; background: #10191b; }
#directCallRemoteVideo.is-visible { display: block; }
#directCallRemoteVideo[hidden], #directCallLocalVideo[hidden] { display: none !important; }
#directCallLocalVideo { position: absolute; inset-inline-end: 12px; bottom: 12px; width: clamp(100px, 25%, 180px); max-height: 140px; border: 1px solid #ffffff85; background: #263234; box-shadow: 0 5px 20px #0005; }
.direct-call-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding-top: 2px; }
.direct-call-controls .direct-call-control { width: 48px; min-width: 48px; height: 48px; min-height: 48px; display: grid; place-items: center; padding: 0; border-radius: 50%; transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.direct-call-control[hidden] { display: none !important; }
.direct-call-control svg { width: 21px; height: 21px; }
.direct-call-control:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--accent-border); background: var(--panel-raised); }
.direct-call-control:focus-visible { outline: 3px solid var(--accent-border); outline-offset: 3px; }
.direct-call-control .call-icon-mic-off { display: none; }
.direct-call-control.is-muted .call-icon-mic { display: none; }
.direct-call-control.is-muted .call-icon-mic-off { display: block; }
.direct-call-control.is-muted { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }
.direct-call-control.is-sharing { color: var(--on-accent, #fff); background: var(--accent); border-color: var(--accent); }
.direct-call-control.call-accept-control { color: var(--on-accent, #fff); background: var(--accent); border-color: var(--accent); }
.direct-call-control.call-end-control { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 24%, var(--line)); }
.direct-call-control.call-end-control:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 18%, var(--panel)); border-color: var(--danger); }
@media (max-width: 720px) {
  .dm-conversation-actions { gap: 2px; }
  .dm-conversation-actions .dm-call-button { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 8px; }
  .direct-message-composer { gap: 4px; }
  .dm-media-button { min-width: 34px; min-height: 36px; padding: 6px; }
  .direct-message-composer .dm-media-button { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 8px; }
  .direct-call-dialog { max-height: 88dvh; padding: 12px; }
  .direct-call-audio-stage { min-height: 186px; padding: 20px 14px; }
  .direct-call-audio-mark { width: 76px; height: 76px; border-radius: 24px; }
  .direct-call-controls { gap: 8px; }
  .direct-call-controls .direct-call-control { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .direct-call-screen-stage video { max-height: 42dvh; }
}
