:root {
  color-scheme: light;
  --ink: #172321;
  --muted: #687572;
  --line: #dce4e1;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --forest: #103f3a;
  --forest-soft: #1d5c55;
  --mint: #dff2e9;
  --gold: #b98a42;
  --gold-soft: #f5ead7;
  --danger: #a9483e;
  --shadow: 0 14px 40px rgba(28, 55, 50, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 2%, rgba(185, 138, 66, 0.11), transparent 27rem),
    var(--canvas);
  font-family: "IBM Plex Sans Arabic", "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(16, 63, 58, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--forest);
  border-radius: 13px 13px 5px 13px;
  font-size: 23px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(16, 63, 58, 0.2);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.hero,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-actions {
  gap: 12px;
}

.overall-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(185, 138, 66, 0.14);
}

.overall-status.healthy .status-dot {
  background: #2e8065;
  box-shadow: 0 0 0 4px rgba(46, 128, 101, 0.14);
}

.overall-status.down .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(169, 72, 62, 0.14);
}

.avatar-button {
  width: 38px;
  height: 38px;
  color: var(--forest);
  background: var(--mint);
  border: 0;
  border-radius: 50%;
  font-weight: 700;
}

.account-menu { display: flex; align-items: center; gap: 10px; }
.account-menu span, .account-menu strong, .account-menu small { display: block; }
.account-menu strong { font-size: 13px; }
.account-menu small { color: var(--muted); font-size: 11px; }
.logout-button, .text-button { padding: 8px 11px; color: var(--forest); background: #fff; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.logout-button:hover, .text-button:hover { background: var(--mint); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(940px, 100%); display: grid; grid-template-columns: 1fr 430px; gap: 56px; align-items: center; }
.login-copy h1 { margin-top: 52px; }
.login-copy p { max-width: 440px; color: var(--muted); line-height: 1.9; }
.login-card { display: grid; gap: 20px; padding: 34px; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card label, .admin-form label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.login-card input, .admin-form input { width: 100%; padding: 12px 13px; color: var(--ink); background: #fbfdfc; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.login-card input:focus, .admin-form input:focus { border-color: var(--forest-soft); box-shadow: 0 0 0 3px rgba(29,92,85,.1); }
.login-submit { justify-content: center; }
.login-help { color: var(--muted); text-align: center; }
.form-message { min-height: 20px; margin: 0; color: var(--muted); font-size: 12px; }
.form-message.error { color: var(--danger); }
.form-message.success { color: #23684f; }
.admin-panel { margin-top: 16px; }
.admin-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 28px; }
.admin-layout h3 { margin: 0 0 17px; color: var(--forest); font-size: 16px; }
.admin-form { display: grid; gap: 14px; }
.admin-form fieldset { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.admin-form legend { padding: 0 5px; font-size: 13px; font-weight: 800; }
.permission-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.permission-options label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; }
.permission-options input { width: auto; }
.admin-list { display: grid; gap: 10px; }
.admin-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.admin-card.disabled { opacity: .62; }
.admin-card small, .admin-card p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.role-badge { padding: 4px 8px; color: var(--forest); background: var(--mint); border-radius: 7px; font-size: 11px; font-weight: 800; }
.admin-card .text-button { grid-column: 2; grid-row: 3 / span 2; align-self: end; }
.calls-panel { margin-top: 16px; }
.calls-layout { display: grid; grid-template-columns: minmax(280px,.75fr) minmax(0,1.25fr); gap: 28px; }
.calls-layout h3 { margin: 0 0 16px; color: var(--forest); font-size: 16px; }
.call-list { display: grid; gap: 10px; }
.call-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.call-item small, .call-item p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.call-item .text-button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.invite-result { margin-bottom: 20px; padding: 16px; background: var(--mint); border-radius: 12px; }
.invite-result strong, .invite-result a { display: block; }
.invite-result a { margin-top: 8px; color: var(--forest); overflow-wrap: anywhere; }
.call-page { display: grid; place-items: center; padding: 24px; }
.call-shell { width: min(760px, 100%); }
.call-room-card { margin-top: 30px; padding: clamp(24px, 5vw, 48px); background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.call-room-card h1 { margin-top: 18px; font-size: clamp(28px, 5vw, 44px); }
.call-state { display: inline-block; padding: 6px 10px; color: #815f2b; background: var(--gold-soft); border-radius: 999px; font-size: 12px; font-weight: 800; }
.call-state.success { color: #23684f; background: var(--mint); }
.call-state.error { color: var(--danger); background: #fae9e6; }
.call-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0; }
.call-details div { padding: 12px; background: #f5f8f7; border-radius: 10px; }
.call-details dt { color: var(--muted); font-size: 11px; }
.call-details dd { margin: 5px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.realtime-panel { margin: 22px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f8fbfa; }
.realtime-heading, .presence-grid div, .signal-state { display: flex; align-items: center; gap: 9px; }
.realtime-heading { justify-content: space-between; }
.realtime-heading div, .signal-state { display: grid; gap: 3px; }
.realtime-heading small, .signal-state small, .presence-grid small { color: var(--muted); font-size: 11px; }
.presence-dot { width: 10px; height: 10px; background: #b7c1bd; border-radius: 50%; box-shadow: 0 0 0 4px #edf1ef; }
.presence-dot.online { background: #27966b; box-shadow: 0 0 0 4px #dff3ea; }
.presence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.presence-grid div { display: grid; grid-template-columns: auto 1fr; padding: 11px; background: #fff; border-radius: 10px; }
.presence-grid small { grid-column: 2; }
.signal-state { padding-top: 14px; border-top: 1px solid var(--line); }
.signal-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.danger-button { color: var(--danger); }
.media-panel { margin: 18px 0; padding: 18px; color: #fff; background: linear-gradient(135deg, #103f3a, #176359); border-radius: 14px; }
.media-heading { display: flex; align-items: center; justify-content: space-between; }
.media-heading div { display: grid; gap: 3px; }
.media-heading small, .media-stats { color: #c8e0d9; }
.media-level { display: flex; align-items: end; gap: 3px; height: 22px; }
.media-level i { display: block; width: 4px; height: 8px; background: #739d91; border-radius: 4px; }
.media-level i:nth-child(2) { height: 15px; }
.media-level.active i { background: #71e2b7; animation: audio-pulse .8s ease-in-out infinite alternate; }
.media-level.active i:nth-child(2) { animation-delay: .2s; }
.media-level.active i:nth-child(3) { animation-delay: .4s; }
.media-devices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.media-devices:has(.device-field:not([hidden])) { margin-top: 16px; }
.device-field { display: grid; min-width: 0; gap: 6px; color: #e7f4f0; font-size: 12px; }
.device-field select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; color: #173d38; background: #f5faf8; border: 1px solid #c7ded6; border-radius: 9px; font-size: 13px; text-overflow: ellipsis; }
.media-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 16px; }
.media-panel .text-button { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); }
.media-panel .text-button:hover { background: rgba(255,255,255,.16); }
.media-actions .text-button { min-width: 0; min-height: 44px; padding: 9px 8px; font-size: 13px; line-height: 1.5; }
.media-panel .danger-button { color: #ffe4df; background: rgba(169,72,62,.3); border-color: rgba(255,181,170,.55); }
.media-panel .danger-button:hover { background: rgba(169,72,62,.5); }
.media-panel :is(button, select):focus-visible { outline: 2px solid #a9f3d8; outline-offset: 3px; }
.media-actions .text-button:disabled { opacity: .5; cursor: not-allowed; }
.media-stats { display: block; margin-top: 8px; font-size: 11px; overflow-wrap: anywhere; }
.video-state { display: block; margin-top: 12px; color: #d8ece6; }
.quality-state { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 12px; }
.quality-state span { width: 8px; height: 8px; border-radius: 50%; background: #a8b7b3; }
.quality-state[data-state="good"] span { background: #71e2b7; }
.quality-state[data-state="fair"] span { background: #f3c66b; }
.quality-state[data-state="poor"] span { background: #ff8d80; }
.video-stage { position: relative; width: 100%; height: clamp(240px, 40vw, 380px); margin-top: 16px; overflow: hidden; border-radius: 12px; }
.video-stage figure { position: relative; height: 100%; margin: 0; overflow: hidden; background: #082b28; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; }
.video-stage video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.video-stage figcaption { position: absolute; right: 9px; bottom: 9px; z-index: 2; padding: 4px 8px; color: #fff; background: rgba(0,0,0,.68); border-radius: 7px; font-size: 11px; }
.video-stage .local-video { position: absolute; left: 12px; bottom: 12px; z-index: 3; width: clamp(82px, 23%, 130px); height: auto; aspect-ratio: 3 / 4; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.video-stage .local-video video { object-fit: cover; transform: scaleX(-1); }
.video-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; color: #b2ccc3; font-size: 13px; text-align: center; }
.video-placeholder svg { width: 32px; height: 32px; }
.local-video .video-placeholder { gap: 6px; font-size: 10px; }
.local-video .video-placeholder svg { width: 24px; height: 24px; }
.video-stage .has-video .video-placeholder { display: none; }
@media (min-width: 700px) { .media-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@keyframes audio-pulse { to { height: 21px; } }
.next-step { margin-bottom: 18px; padding: 14px; color: var(--forest); background: var(--mint); border-radius: 10px; line-height: 1.7; }

.hero {
  gap: 32px;
  padding: 54px 0 30px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 650px;
  margin-bottom: 13px;
  color: var(--forest);
  font-size: clamp(31px, 5vw, 52px);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

.hero-copy {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.refresh-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  color: #fff;
  background: var(--forest);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 9px 22px rgba(16, 63, 58, 0.2);
}

.refresh-button:hover {
  background: var(--forest-soft);
}

.refresh-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.refresh-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card,
.panel {
  background: rgba(255, 255, 255, 0.91);
  border: 1px solid rgba(16, 63, 58, 0.09);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 146px;
  padding: 21px;
  border-radius: 17px;
}

.primary-card {
  color: #fff;
  background: var(--forest);
}

.metric-label,
.metric-note {
  display: block;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.primary-card .metric-label,
.primary-card .metric-note {
  color: rgba(255, 255, 255, 0.7);
}

.metric-value {
  display: block;
  margin: 10px 0 7px;
  font-size: 34px;
  line-height: 1;
}

.metric-value small {
  margin-right: 5px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.primary-card .metric-value small {
  color: rgba(255, 255, 255, 0.58);
}

.metric-note {
  color: var(--muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.8fr;
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 24px;
  border-radius: 19px;
}

.panel-header {
  gap: 16px;
  margin-bottom: 22px;
}

.version-tag,
.coming-tag {
  padding: 7px 10px;
  color: var(--forest);
  background: var(--mint);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.service-list {
  display: grid;
}

.service-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.service-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.service-name {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
}

.service-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--forest);
  background: #edf3f0;
  border-radius: 10px;
  font-size: 14px;
}

.service-message {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.service-state {
  min-width: 78px;
  padding: 6px 9px;
  color: var(--muted);
  background: #f0f3f2;
  border-radius: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}

.service-state.healthy {
  color: #23684f;
  background: #e3f3eb;
}

.service-state.down {
  color: var(--danger);
  background: #fae9e6;
}

.progress-number {
  color: var(--forest);
  font-size: 26px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  margin-bottom: 22px;
  background: #e8eeeb;
  border-radius: 99px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--forest), #438675);
  border-radius: inherit;
}

.progress-track .progress-96 { width: 96.4%; }

.phase-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.phase-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  color: var(--muted);
  border-radius: 11px;
}

.phase-list li > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #edf1ef;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
}

.phase-list strong,
.phase-list small {
  display: block;
}

.phase-list strong {
  color: var(--ink);
  font-size: 13px;
}

.phase-list small {
  margin-top: 2px;
  font-size: 11px;
}

.phase-list .done > span {
  color: #fff;
  background: #2e8065;
}

.phase-list .current {
  background: var(--gold-soft);
}

.phase-list .current > span {
  color: #fff;
  background: var(--gold);
}

.test-panel {
  margin-top: 16px;
}
.panel-actions { display: flex; gap: 8px; align-items: center; }

.coming-tag {
  color: #815f2b;
  background: var(--gold-soft);
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.test-grid button,
.test-grid article {
  padding: 14px;
  color: var(--muted);
  background: #f6f8f7;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: right;
}

.test-grid article { position: relative; }
.test-grid article b { position: absolute; top: 12px; left: 12px; color: var(--muted); font-size: 11px; }
.test-grid article[data-state="healthy"] { background: #edf8f3; border-color: #b7dfcf; }
.test-grid article[data-state="healthy"] b { color: #25664f; }
.test-grid article[data-state="degraded"] { background: var(--gold-soft); border-color: #e6cf9e; }
.test-grid article[data-state="degraded"] b { color: #815f2b; }
.test-grid article[data-state="down"] { background: #fff0ee; border-color: #f0bbb5; }
.test-grid article[data-state="down"] b { color: #a33a2e; }

.test-grid span,
.test-grid small {
  display: block;
}

.test-grid span {
  margin-bottom: 3px;
  color: var(--ink);
  font-weight: 750;
}

.reports-panel { margin-top: 16px; }
.audit-panel { margin-top: 16px; }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.report-grid article { padding: 16px; background: #f6f8f7; border: 1px solid var(--line); border-radius: 12px; }
.report-grid span, .report-grid small { display: block; color: var(--muted); font-size: 11px; }
.report-grid strong { display: block; margin: 7px 0 4px; color: var(--ink); font-size: 23px; }
.daily-report { margin-top: 18px; }
.daily-report-list { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.daily-report-list article { padding: 11px 8px; background: var(--surface-soft); border-radius: 10px; text-align: center; }
.daily-report-list span, .daily-report-list strong, .daily-report-list small { display: block; }
.daily-report-list strong { margin: 5px 0; font-size: 13px; }
.daily-report-list span, .daily-report-list small { color: var(--muted); font-size: 10px; }
.audit-list { display: grid; gap: 8px; }
.audit-list article { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(110px, .6fr) minmax(180px, 1.5fr) auto; gap: 10px; align-items: center; padding: 12px 14px; background: var(--surface-soft); border-radius: 10px; font-size: 12px; }
.audit-list span, .audit-list small, .audit-list time { color: var(--muted); overflow-wrap: anywhere; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 26px 2px 34px;
  color: var(--muted);
  font-size: 12px;
}

.loading-row {
  padding: 10px 0;
}

.loading-bar {
  display: block;
  width: 70%;
  height: 12px;
  margin-bottom: 10px;
  background: #edf1ef;
  border-radius: 99px;
  animation: pulse 1.2s ease-in-out infinite;
}

.loading-bar.short {
  width: 38%;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

@media (max-width: 860px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .login-shell, .admin-layout, .calls-layout { grid-template-columns: 1fr; }

  .test-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .report-grid { grid-template-columns: repeat(2, 1fr); }
  .daily-report-list { grid-template-columns: repeat(4, 1fr); }
  .audit-list article { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .call-page { padding: 12px; }
  .call-room-card { margin-top: 18px; padding: 18px; border-radius: 18px; }
  .media-panel { padding: 14px; }
  .video-stage { height: clamp(220px, 65vw, 300px); }
  .video-stage .local-video { left: 8px; bottom: 8px; width: clamp(70px, 25%, 100px); }
  .video-stage figcaption { right: 6px; bottom: 6px; padding: 3px 6px; font-size: 10px; }
  .media-devices { grid-template-columns: 1fr; }
  .page-shell {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    min-height: 70px;
  }

  .account-menu > span { display: none; }

  .login-page { display: block; }
  .login-copy h1 { margin-top: 34px; }
  .login-card { margin-top: 24px; padding: 22px; }

  .overall-status {
    padding: 7px 9px;
    font-size: 11px;
  }

  .hero {
    display: block;
    padding-top: 35px;
  }

  .hero-copy {
    font-size: 14px;
  }

  .refresh-button {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
  }

  .panel-actions { width: 100%; flex-direction: column; align-items: stretch; }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .metric-card {
    min-height: 130px;
    padding: 16px;
  }

  .metric-value {
    font-size: 28px;
  }

  .panel {
    padding: 18px;
  }

  .test-grid {
    grid-template-columns: 1fr;
  }

  .report-grid { grid-template-columns: 1fr; }
  .daily-report-list { grid-template-columns: repeat(2, 1fr); }
  .audit-list article { grid-template-columns: 1fr; }

  .call-details { grid-template-columns: 1fr; }
}

/* لوحة الإدارة متعددة الشاشات */
.admin-workspace {
  --sidebar-width: 282px;
  background: #f4f7f6;
}

.workspace-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 0 0 auto;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: #fff;
  background: linear-gradient(180deg, #123f3a 0%, #0d322f 100%);
  border-left: 1px solid rgba(255,255,255,.08);
  box-shadow: -12px 0 35px rgba(20,48,44,.08);
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 22px; }
.sidebar-brand { color: #fff; }
.sidebar-brand .brand-mark { color: var(--forest); background: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.18); }
.sidebar-brand small { color: rgba(255,255,255,.58); }
.sidebar-close { display: none; width: 36px; height: 36px; color: #fff; background: rgba(255,255,255,.08); border: 0; border-radius: 10px; font-size: 25px; cursor: pointer; }

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.nav-label { margin: 18px 11px 8px; color: rgba(255,255,255,.38); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.nav-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 11px;
  color: rgba(255,255,255,.68);
  background: transparent;
  border: 0;
  border-radius: 12px;
  text-align: right;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset -3px 0 #d9b26d; }
.nav-item:active { transform: scale(.985); }
.nav-item strong, .nav-item small { display: block; }
.nav-item strong { font-size: 13px; }
.nav-item small { margin-top: 2px; color: rgba(255,255,255,.43); font-size: 10px; font-weight: 400; }
.nav-item.active small { color: rgba(255,255,255,.66); }
.nav-icon { width: 36px; height: 36px; display: grid; place-items: center; background: rgba(255,255,255,.07); border-radius: 10px; }
.nav-item.active .nav-icon { color: #173f3a; background: #fff; }
.nav-icon svg, .icon-button svg, .menu-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nav-count { min-width: 24px; padding: 4px 6px; color: #244b45; background: #fff; border-radius: 8px; text-align: center; font-size: 10px; }

.sidebar-footer { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-service-state { padding: 0 4px 12px; }
.sidebar .overall-status { width: 100%; color: rgba(255,255,255,.72); background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); }
.sidebar-account { display: grid; grid-template-columns: 38px minmax(0,1fr) 36px; align-items: center; gap: 10px; padding: 10px 5px 2px; }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; color: #16453f; background: #e5f1ed; border-radius: 11px; font-weight: 900; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 12px; }
.account-copy small { margin-top: 3px; color: rgba(255,255,255,.5); font-size: 10px; }
.sidebar .icon-button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: rgba(255,255,255,.7); background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); }
.sidebar .icon-button:hover { color: #fff; background: rgba(255,255,255,.13); }

.workspace-main { min-height: 100vh; margin-right: var(--sidebar-width); }
.workspace-topbar { position: sticky; z-index: 20; top: 0; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px clamp(22px,4vw,50px); background: rgba(244,247,246,.9); border-bottom: 1px solid rgba(16,63,58,.08); backdrop-filter: blur(16px); }
.page-heading { display: flex; align-items: center; gap: 12px; }
.page-heading p { margin: 0 0 2px; color: var(--muted); font-size: 11px; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: 22px; letter-spacing: -.02em; }
.menu-button { display: none; width: 42px; height: 42px; place-items: center; color: var(--forest); background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.refresh-button.compact { padding: 10px 14px; box-shadow: none; }
.workspace-content { width: min(1320px, 100%); min-height: calc(100vh - 138px); margin: 0 auto; padding: 30px clamp(22px,4vw,50px) 10px; }
.app-page { display: none; animation: page-in .22s ease-out; }
.app-page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

.overview-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0,1.4fr) minmax(260px,.6fr); align-items: center; gap: 34px; padding: clamp(26px,4vw,42px); color: #fff; background: linear-gradient(125deg, #123f3a 0%, #1b6258 100%); border-radius: 24px; box-shadow: 0 18px 45px rgba(19,64,58,.16); }
.overview-hero::after { content: ""; position: absolute; width: 340px; height: 340px; left: -120px; top: -190px; border: 70px solid rgba(255,255,255,.045); border-radius: 50%; }
.overview-hero h2 { margin: 12px 0 8px; font-size: clamp(25px,3.4vw,40px); letter-spacing: -.035em; }
.overview-hero p { max-width: 630px; margin: 0; color: rgba(255,255,255,.7); line-height: 1.8; }
.hero-badge { display: inline-flex; padding: 6px 10px; color: #f6d99e; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; font-size: 11px; font-weight: 800; }
.hero-progress { position: relative; z-index: 1; padding: 18px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); border-radius: 17px; }
.hero-progress span, .hero-progress small { display: block; color: rgba(255,255,255,.64); font-size: 11px; }
.hero-progress strong { display: block; margin: 7px 0 12px; font-size: 31px; }
.hero-progress .progress-track { height: 7px; margin: 0 0 10px; background: rgba(255,255,255,.15); }
.hero-progress .progress-track i { display: block; width: 96.4%; height: 100%; background: #e5bd75; border-radius: inherit; }

.dashboard-metrics { margin-top: 18px; }
.dashboard-metrics .metric-card { position: relative; min-height: 132px; padding: 19px; box-shadow: 0 8px 26px rgba(25,57,52,.055); }
.dashboard-metrics .primary-card { background: #fff; color: var(--ink); }
.dashboard-metrics .primary-card .metric-label, .dashboard-metrics .primary-card .metric-note { color: var(--muted); }
.dashboard-metrics .primary-card .metric-value small { color: var(--muted); }
.metric-icon { position: absolute; left: 17px; top: 17px; width: 31px; height: 31px; display: grid; place-items: center; color: #2d705e; background: #e1f1e9; border-radius: 9px; font-size: 12px; font-weight: 900; }
.metric-icon.users { color: #745b2c; background: #f6ecd8; }
.metric-icon.sessions { color: #3c6079; background: #e7f0f5; }
.metric-icon.latency { color: #6c5384; background: #f0eaf5; font-size: 9px; }
.overview-grid { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(300px,.72fr); gap: 18px; margin-top: 18px; }

.workspace-content > .panel { margin-top: 0; padding: clamp(22px,3vw,32px); border-radius: 20px; box-shadow: 0 10px 32px rgba(25,57,52,.06); }
.section-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.section-intro h2 { margin-bottom: 7px; font-size: 26px; }
.section-intro p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.form-card { padding: 20px; background: #f8faf9; border: 1px solid var(--line); border-radius: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list-column { min-width: 0; }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.list-heading h3 { margin: 0 0 3px; }
.list-heading small { color: var(--muted); }
.notice-message { min-height: 0; margin: -6px 0 18px; padding: 12px 14px; background: #f6f8f7; border-radius: 10px; }
.test-grid { grid-template-columns: repeat(3,1fr); }
.report-grid article { min-height: 116px; padding: 18px; }
.daily-report { padding-top: 20px; border-top: 1px solid var(--line); }
.audit-list { max-height: calc(100vh - 260px); overflow: auto; padding-left: 4px; }
.audit-list article { background: #f7f9f8; border: 1px solid transparent; }
.audit-list article:hover { border-color: #d6e3df; background: #fff; }
.call-list { max-height: calc(100vh - 270px); overflow: auto; padding-left: 4px; }
.call-item, .admin-card { background: #fff; transition: border-color .18s ease, box-shadow .18s ease; }
.call-item:hover, .admin-card:hover { border-color: #cbdcd7; box-shadow: 0 6px 18px rgba(20,57,51,.05); }
.workspace-footer { margin-right: 0; padding: 22px clamp(22px,4vw,50px) 28px; }
.sidebar-backdrop { display: none; }

.standalone-form { width: min(760px,100%); margin: 0 auto; padding: clamp(20px,4vw,32px); }
.admin-form select { width: 100%; padding: 12px 13px; color: var(--ink); background: #fbfdfc; border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.admin-form select:focus { border-color: var(--forest-soft); box-shadow: 0 0 0 3px rgba(29,92,85,.1); }
.admin-form label > small { color: var(--muted); font-weight: 400; }
.standalone-form .invite-result { margin: 6px 0 0; }
.data-table-card { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.data-table { width: 100%; }
.data-table-card .dt-container { padding: 16px; color: var(--ink); font-size: 13px; }
.data-table-card .dt-layout-row { align-items: center; gap: 12px; margin: 0 0 14px; }
.data-table-card .dt-layout-row:last-child { margin: 14px 0 0; }
.data-table-card .dt-search input, .data-table-card .dt-length select { min-height: 39px; margin: 0 7px; padding: 8px 11px; color: var(--ink); background: #f8faf9; border: 1px solid var(--line); border-radius: 9px; outline: 0; }
.data-table-card .dt-search input { width: min(260px,65vw); margin-left: 0; }
.data-table-card .dt-search input:focus, .data-table-card .dt-length select:focus { border-color: var(--forest-soft); box-shadow: 0 0 0 3px rgba(29,92,85,.08); }
table.dataTable.data-table { border-collapse: separate; border-spacing: 0; }
table.dataTable.data-table thead th { padding: 13px 12px; color: #52615e; background: #f6f8f7; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 850; white-space: nowrap; }
table.dataTable.data-table tbody td { padding: 14px 12px; border-bottom: 1px solid #e8eeeb; vertical-align: middle; }
table.dataTable.data-table tbody tr:last-child td { border-bottom: 0; }
table.dataTable.data-table tbody tr:hover { background: #fbfdfc; }
.table-primary, .table-subline { display: block; }
.table-primary { color: var(--ink); font-size: 12px; }
.table-subline { max-width: 320px; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.table-code { direction: ltr; display: inline-block; max-width: 260px; overflow: hidden; color: #53635f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.table-status { display: inline-flex; padding: 5px 8px; color: #55635f; background: #edf1ef; border-radius: 8px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.table-status.active, .table-status.ready { color: #24674f; background: #e1f2e9; }
.table-status.disabled, .table-status.ended, .table-status.expired { color: #687572; background: #edf0ef; }
.table-status.created, .table-status.ringing { color: #7f5d29; background: #f7ecd9; }
.table-status.cancelled { color: var(--danger); background: #fae9e6; }
.table-action { padding: 7px 10px; color: var(--forest); background: #fff; border: 1px solid #cddbd7; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 750; }
.table-action:hover { background: var(--mint); }
.table-action.danger { color: var(--danger); border-color: #edcbc7; }
.table-action.danger:hover { background: #fff0ee; }
.protected-label { color: var(--muted); font-size: 10px; }
.dt-container .dt-info { color: var(--muted); font-size: 11px; }
.dt-container .dt-paging .dt-paging-button { min-width: 34px; margin: 0 2px; padding: 7px 9px !important; color: var(--forest) !important; background: #fff !important; border: 1px solid var(--line) !important; border-radius: 8px; }
.dt-container .dt-paging .dt-paging-button.current { color: #fff !important; background: var(--forest) !important; border-color: var(--forest) !important; }
.dt-container .dt-paging .dt-paging-button.disabled { opacity: .45; }
.dt-processing { color: var(--forest); background: #fff !important; border: 1px solid var(--line) !important; border-radius: 10px; box-shadow: var(--shadow); }
.toast { position: fixed; z-index: 100; left: 24px; bottom: 24px; max-width: min(380px,calc(100vw - 32px)); padding: 12px 16px; color: #fff; background: #22644f; border-radius: 11px; box-shadow: 0 12px 30px rgba(20,45,41,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 1050px) {
  .admin-workspace { --sidebar-width: 250px; }
  .dashboard-metrics { grid-template-columns: repeat(2,1fr); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .admin-workspace { --sidebar-width: 282px; }
  .sidebar { transform: translateX(105%); transition: transform .24s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close, .menu-button { display: grid; }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; width: 100%; height: 100%; padding: 0; background: rgba(8,28,26,.46); border: 0; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .workspace-main { margin-right: 0; }
  .workspace-topbar { min-height: 70px; padding: 10px 16px; }
  .workspace-content { padding: 20px 14px 8px; }
  .overview-hero { grid-template-columns: 1fr; gap: 20px; border-radius: 19px; }
  .calls-layout, .admin-layout { grid-template-columns: 1fr; }
  .call-list, .audit-list { max-height: none; overflow: visible; }
  .section-intro { align-items: flex-start; }
  .section-intro .panel-actions { width: 100%; }
  .data-table-card .dt-layout-row { display: grid; grid-template-columns: 1fr; }
  .data-table-card .dt-layout-cell { text-align: right !important; }
  .data-table-card .dt-search input { width: calc(100% - 7px); }
}

@media (max-width: 560px) {
  .page-heading h1 { font-size: 18px; }
  .page-heading p { display: none; }
  .refresh-button.compact { width: 42px; height: 42px; justify-content: center; margin: 0; padding: 0; }
  .refresh-button.compact span { display: none; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-metrics .metric-card { min-height: 122px; padding: 15px; }
  .metric-value { font-size: 29px; }
  .metric-note { font-size: 10px; }
  .overview-hero { padding: 23px 20px; }
  .overview-hero h2 { font-size: 25px; }
  .workspace-content > .panel { padding: 18px 15px; }
  .section-intro { display: grid; gap: 12px; }
  .section-intro h2 { font-size: 22px; }
  .section-intro .panel-actions { display: grid; grid-template-columns: 1fr; }
  .section-intro .panel-actions .refresh-button { margin: 0; }
  .form-row, .test-grid, .report-grid, .daily-report-list { grid-template-columns: 1fr; }
  .permission-options { grid-template-columns: 1fr; }
  .audit-list article { grid-template-columns: 1fr; }
  .call-item, .admin-card { grid-template-columns: 1fr; }
  .call-item .text-button, .admin-card .text-button { grid-column: 1; grid-row: auto; }
  .workspace-footer { display: grid; gap: 5px; padding-inline: 17px; }
}
