:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --panel: #161616;
  --panel-2: #1e1e1e;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f5f1e9;
  --muted: #a8a29e;
  --dim: #78716c;
  --gold: #c9a16a;
  --green: #22c55e;
  --danger: #9d454c;
  --success: #35765c;
  --shadow: 0 20px 60px rgba(0, 0, 0, .6);
  --sidebar-width: 260px;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); min-width: 360px; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 72% -10%, rgba(190, 138, 78, .12), transparent 36%),
    radial-gradient(circle at 4% 8%, rgba(215, 171, 111, .08), transparent 32%),
    linear-gradient(135deg, #0c0b09, #15120f 48%, #0b0a08);
  max-width: 100%;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
.hidden { display: none !important; }

.permissions-section { margin-top: 28px; }
.permissions-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.perm-role-tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.perm-role-tab:hover { color: var(--text); border-color: var(--line-strong); }
.perm-role-tab.active {
  border-color: rgba(201, 161, 106, .45);
  background: rgba(201, 161, 106, .08);
  color: var(--gold);
}
.permissions-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.permissions-panel h3 { margin: 0 0 12px; font-size: 16px; }
.perm-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.perm-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }

.password-col-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.icon-button:hover,
.icon-button.revealed {
  color: var(--gold);
  border-color: rgba(201, 161, 106, .45);
  background: rgba(201, 161, 106, .08);
}

.eye-icon.hidden { display: none; }

code.user-password {
  font-size: 12px;
  color: var(--gold);
  background: rgba(201, 161, 106, .08);
  padding: 2px 6px;
  border-radius: 4px;
}

code.user-password-masked {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
}

.password-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 8, 8, .88);
  backdrop-filter: blur(8px);
}

.password-panel {
  width: min(100%, 420px);
}

.app-shell.password-locked {
  pointer-events: none;
  user-select: none;
  filter: blur(2px);
}
body.rtl { direction: rtl; }
body.rtl .sidebar { border-right: 0; border-left: 1px solid var(--line); }
body.rtl .nav-item { text-align: right; }
body.rtl th, body.rtl td { text-align: right; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: #0a0a0a;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 16px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(18, 17, 15, .96), rgba(12, 12, 10, .98));
  border-right: 1px solid var(--line);
}

.brand {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--text);
  text-decoration: none;
}
.brand img {
  width: min(104px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  filter: sepia(.2) saturate(1.2);
}
.brand span { display: grid; justify-items: center; gap: 4px; }
.brand strong {
  font-family: Manrope, sans-serif;
  font-size: 18px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.brand small {
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.primary-nav { display: grid; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #c8c1b8;
  background: transparent;
  font-size: 13px;
  text-align: left;
  font-weight: 500;
}
.nav-item span:first-child {
  display: grid;
  place-items: center;
  width: 26px;
  color: var(--gold);
}
.nav-item.active {
  color: #f5f1e9;
  background: #2a261f;
  border-color: var(--gold);
}
.sidebar-spacer { flex: 1; }
.account-card {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.profile {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}
.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(215, 171, 111, .42);
  border-radius: 50%;
  color: var(--gold);
  background: #181511;
  font-weight: 700;
}
.profile span { display: grid; gap: 3px; }
.profile strong { font-size: 14px; }
.profile small { color: var(--gold); font-size: 12px; }

main { width: 100%; max-width: 100%; padding: 28px 28px 48px; min-width: 0; overflow-x: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.status-stack { display: flex; gap: 14px; flex-wrap: wrap; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
}
.dot.green { background: var(--green); }

.primary-button, .outline-button, .signout-btn, .lang-toggle, .danger-button, .success-button {
  border-radius: 9px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
}
.primary-button {
  border: 1px solid rgba(215, 171, 111, .58);
  color: #1b140e;
  background: linear-gradient(135deg, #e2bd82, #a97744);
}
.outline-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, .035);
}
.signout-btn, .lang-toggle {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, .03);
}
.danger-button {
  border: 1px solid var(--danger);
  color: white;
  background: #762d32;
}
.success-button {
  border: 1px solid var(--success);
  color: white;
  background: #245c46;
}

.view { display: none; width: 100%; max-width: 1660px; min-width: 0; margin: 0 auto; }
.view.active { display: block; }
.view-heading { margin-bottom: 22px; }
.view-heading p {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.view-heading h1 {
  margin: 0;
  font-family: Manrope, sans-serif;
  font-size: clamp(28px, 3vw, 42px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.metrics div {
  padding: 22px;
  background: rgba(255, 255, 255, .03);
  border-right: 1px solid var(--line);
}
.metrics div:last-child { border-right: 0; }
.metrics strong {
  display: block;
  font-size: 28px;
  color: var(--gold);
}
.metrics span { color: var(--muted); }

.section-heading { margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.network-devices-heading { margin-top: 28px; }
.bandwidth-heading { margin-top: 28px; }
.bandwidth-panel { margin-top: 8px; }
.bandwidth-metrics { margin-bottom: 16px; }
.bandwidth-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 130px;
}
.bandwidth-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.bandwidth-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9a6d32, #e8c88a);
  min-width: 2px;
}
.bandwidth-bar-label {
  font-size: 12px;
  color: var(--muted);
  min-width: 38px;
  text-align: right;
}
.bandwidth-unassigned { color: #f1cf8c; }
.lan-access-panel {
  margin: 0 0 24px;
  padding: 18px 20px;
  border: 1px solid rgba(201, 161, 106, .28);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(201, 161, 106, .08), rgba(255, 255, 255, .02));
  display: grid;
  gap: 12px;
}
.lan-access-panel h2 { margin: 0 0 4px; font-size: 18px; }
.lan-url-list { display: flex; flex-wrap: wrap; gap: 10px; }
.lan-url-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(201, 161, 106, .35);
  background: rgba(0, 0, 0, .25);
  color: #f5f1e9;
  font-size: 13px;
}
.lan-url-chip a { color: #e8c88a; text-decoration: none; }
.lan-url-chip a:hover { text-decoration: underline; }
.policy-cell { min-width: 0; }
.policy-stack { display: grid; gap: 6px; width: 100%; min-width: 0; }
.policy-cell select, .policy-cell input[type="number"] { width: 100%; min-width: 0; margin: 0; }
.policy-custom { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-width: 0; }
.policy-inline { display: flex; align-items: center; gap: 7px; min-height: 24px; font-size: 11px; line-height: 1.25; color: var(--muted); white-space: normal; }
.policy-inline input[type="checkbox"] { flex: 0 0 15px; width: 15px; height: 15px; min-height: 15px; margin: 0; padding: 0; }
.policy-actions { display: grid; gap: 6px; align-content: center; }
.policy-actions button { width: 100%; min-height: 36px; padding: 7px 8px; font-size: 12px; white-space: normal; }
.quota-blocked { color: #f0a07a; font-weight: 600; }
.network-devices-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.network-devices-table { min-width: 1370px; table-layout: fixed; }
.network-devices-table .network-col-host { width: 130px; }
.network-devices-table .network-col-ip { width: 100px; }
.network-devices-table .network-col-mac { width: 145px; }
.network-devices-table .network-col-dhcp { width: 90px; }
.network-devices-table .network-col-role { width: 250px; }
.network-devices-table .network-col-speed { width: 150px; }
.network-devices-table .network-col-quota { width: 150px; }
.network-devices-table .network-col-seen { width: 205px; }
.network-devices-table .network-col-status { width: 80px; }
.network-devices-table .network-col-actions { width: 110px; }
.network-devices-table th,
.network-devices-table td { padding: 10px; }
.network-devices-table .network-host { overflow: hidden; text-overflow: ellipsis; }
.network-devices-table .network-role select { width: 100%; min-width: 0; }
.network-devices-table .network-seen { white-space: normal; line-height: 1.35; }
.network-devices-table .network-status { text-align: center; }
.network-devices-actions { display: inline-flex; align-items: center; gap: 10px; }
.bandwidth-error { display: none; margin: 10px 0; padding: 10px 12px; border: 1px solid rgba(157, 69, 76, .35); border-radius: 8px; color: var(--danger); background: rgba(157, 69, 76, .08); white-space: pre-line; }
.bandwidth-error:not(:empty) { display: block; }
.monitor-status { margin: -2px 0 14px; }
.monitor-status.monitor-problem { color: #b45309; }
.icon-button.refresh-circle { border-radius: 999px; }
.icon-button.refresh-circle.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.assign-designer { min-width: 180px; }
.project-detail { margin-top: 20px; }
.project-workflow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.project-detail-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.project-notes-list, .project-files-list { display: grid; gap: 8px; margin-bottom: 12px; max-height: 220px; overflow: auto; }
.project-note-item, .project-file-item { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px; }
.project-note-item small, .project-file-item small { color: var(--dim); display: block; margin-bottom: 4px; }
.project-file-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; }
.project-file-item small { grid-column: 2; margin: 0; }
.project-file-item .project-file-download { grid-column: 2; justify-self: start; }
.project-file-selector { grid-row: 1 / span 2; display: grid; justify-items: center; gap: 4px; color: var(--dim); font-size: 10px; }
.project-file-selector input { width: 18px; height: 18px; accent-color: var(--gold); }
.project-file-selector input:disabled + span { color: #d99b8e; }
.project-note-form, .project-file-form, .worklog-form { align-items: end; }
.worklog-form .worklog-text { flex: 1 1 100%; }
.vps-panel {
  margin-bottom: 1.5rem;
}

.vps-metrics {
  margin-bottom: 1rem;
}

.vps-settings-form {
  margin-bottom: 1rem;
}

.crm-view { max-width: none; }
.crm-commandbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.crm-module-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.crm-module-brand img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid rgba(201, 161, 106, .4);
  border-radius: 8px;
}
.crm-module-brand p {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.crm-module-brand h1 {
  margin: 0;
  font: 700 24px/1.2 Manrope, sans-serif;
}
.crm-command-actions { display: flex; align-items: center; gap: 8px; }
.crm-live-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 12px;
  border-right: 1px solid var(--line);
}
.crm-live-state .dot { width: 8px; height: 8px; background: var(--dim); }
.crm-live-state .dot.connected { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 197, 94, .1); }
.crm-live-state .dot.failed { background: #df858b; box-shadow: 0 0 0 4px rgba(223, 133, 139, .1); }
.crm-tool-button { width: 38px; height: 38px; text-decoration: none; }
.crm-tool-button.spinning svg { animation: spin .8s linear infinite; }
.crm-metric-rail {
  display: grid;
  grid-template-columns: 150px 130px 190px minmax(0, 1fr);
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}
.crm-metric-rail > div {
  display: grid;
  gap: 3px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}
.crm-metric-rail span { color: var(--dim); font-size: 11px; text-transform: uppercase; }
.crm-metric-rail strong { color: var(--text); font: 700 15px/1.3 Manrope, sans-serif; }
.crm-metric-rail p {
  margin: 0;
  padding: 0 18px;
  color: var(--dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-settings-drawer {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.crm-settings-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, .7fr) auto auto;
  align-items: end;
  gap: 10px;
}
.crm-settings-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.crm-settings-form input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.crm-inline-error {
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #ffd7da;
  background: rgba(122, 51, 56, .24);
}
.crm-inline-error:not(:empty) { padding: 10px 14px; border-bottom: 1px solid rgba(223, 133, 139, .28); }

.inline-check {
  align-items: center;
  flex-direction: row;
  min-height: 44px;
}

.inline-check input {
  width: auto;
}

.crm-frame-shell {
  position: relative;
  height: calc(100vh - 250px);
  min-height: 560px;
  overflow: hidden;
  background: #fff;
}

.crm-frame-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.crm-frame-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--text);
  text-align: center;
  background: #11100e;
}
.crm-frame-overlay.ready { opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.crm-frame-overlay strong { font: 700 16px/1.3 Manrope, sans-serif; }
.crm-frame-overlay span { max-width: 430px; color: var(--muted); font-size: 13px; }
.crm-loader {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  border: 2px solid rgba(201, 161, 106, .18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.crm-frame-overlay.failed .crm-loader { display: none; }

.worklog-form textarea { width: 100%; min-height: 80px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 10px; }
.project-row-selected { background: rgba(201, 161, 106, .08); }
.crm-project-source {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}
.network-devices-heading + .muted { margin: -6px 0 14px; }

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin-bottom: 20px;
}
label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
input, select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(0, 0, 0, .24);
  color: var(--text);
}
select[multiple] { min-height: 80px; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, .02);
}
th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 13px;
}
th {
  background: rgba(255, 255, 255, .04);
  color: #cdd1d6;
  font-size: 12px;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(45, 101, 79, .35);
  color: #e7fff4;
}
.status-badge.locked, .status-badge.revoked, .status-badge.failed {
  background: rgba(122, 51, 56, .35);
  color: #ffd7da;
}
.status-badge.warn {
  background: rgba(201, 161, 106, .2);
  color: #f1cf8c;
}

.monitor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
}
.monitor-actions .outline-button,
.monitor-actions .primary-button { padding: 9px 12px; }
.monitor-agent-state {
  display: grid;
  gap: 3px;
  min-width: 76px;
}
.monitor-agent-state small { color: var(--muted); font-size: 11px; }

.desktop-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 360px;
  background: #050505;
}
.desktop-viewer-bar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #11100f;
}
.desktop-viewer-bar > div { display: grid; gap: 4px; min-width: 0; }
.desktop-viewer-bar strong { font: 700 16px/1.2 Manrope, sans-serif; }
.desktop-viewer-bar span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.desktop-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: #050505;
}
.desktop-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.desktop-empty { display: grid; place-items: center; gap: 10px; color: var(--muted); text-align: center; }
.desktop-empty strong { color: var(--text); }
.desktop-loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, .12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.monitor-dialog {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 5, 5, .88);
  backdrop-filter: blur(8px);
}
.monitor-dialog-panel {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #171614;
  box-shadow: var(--shadow);
}
.monitor-dialog-panel > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.monitor-dialog-panel header p { margin: 0 0 5px; color: var(--gold); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.monitor-dialog-panel h2 { margin: 0; font: 700 22px/1.25 Manrope, sans-serif; }
.monitor-setup-steps { display: grid; gap: 12px; margin: 22px 0; }
.monitor-setup-steps label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.monitor-setup-steps code {
  display: block;
  min-height: 46px;
  padding: 13px;
  border: 1px solid var(--line);
  background: #0d0d0c;
  color: #f1cf8c;
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: all;
}
.monitor-download { display: inline-flex; align-items: center; justify-content: center; width: fit-content; text-decoration: none; }
.monitor-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.monitor-expiry { margin: 16px 0 0; font-size: 12px; }

.network-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 16px;
}
.panel-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
.panel-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}
.router-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.code-panel {
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e0d0b;
  color: #e8d9c3;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.license-key {
  background: #121416;
  border: 1px solid var(--gold);
  padding: 14px;
  color: #f1cf8c;
  overflow-wrap: anywhere;
  margin-bottom: 16px;
}
.upload { display: flex; gap: 8px; align-items: center; }
.upload input { max-width: 220px; }
.muted { color: var(--muted); }

.access-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.access-panel {
  width: min(480px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .03);
  box-shadow: var(--shadow);
}
.access-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}
.access-form h2 { margin: 0; }
.message { color: #df858b; min-height: 20px; }
.access-lang { margin-top: 16px; }

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 420px;
  padding: 13px 16px;
  border: 1px solid rgba(215, 171, 111, .34);
  border-radius: 10px;
  background: #171512;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
#toast.show { opacity: 1; transform: translateY(0); }
body.rtl #toast { right: auto; left: 24px; }

@media (max-width: 1100px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    height: auto;
  }
  .primary-nav {
    grid-template-columns: repeat(3, 1fr);
  }
  .network-layout { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .crm-metric-rail { grid-template-columns: repeat(3, 1fr); }
  .crm-metric-rail p { grid-column: 1 / -1; min-height: 40px; display: flex; align-items: center; border-top: 1px solid var(--line); }
  .crm-settings-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1500px) and (min-width: 1101px) {
  #control th:nth-child(5),
  #control td:nth-child(5),
  #control th:nth-child(6),
  #control td:nth-child(6) { display: none; }
  #control .monitor-actions { min-width: 200px; }
  #control th,
  #control td { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 700px) {
  .primary-nav { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .crm-commandbar { align-items: flex-start; }
  .crm-module-brand img { width: 44px; height: 44px; }
  .crm-module-brand h1 { font-size: 19px; }
  .crm-live-state { display: none; }
  .crm-metric-rail { grid-template-columns: 1fr 1fr; }
  .crm-metric-rail > div:nth-child(3) { grid-column: 1 / -1; min-height: 54px; justify-content: center; }
  .crm-settings-form { grid-template-columns: 1fr; }
  .crm-frame-shell { min-height: 520px; height: 70vh; }
  .desktop-viewer-bar { align-items: flex-start; padding: 10px 12px; }
  .desktop-viewer-bar .outline-button { padding: 9px 11px; }
  .monitor-dialog-panel { padding: 18px; }
}
