* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  color: #111;
  background:
    linear-gradient(135deg, rgba(29, 78, 216, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(220, 38, 38, 0.14), transparent 32%),
    #f5f7fb;
}

.hidden { display: none !important; }
.admin-login-overlay {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 15%, #17325a 0, #07101f 48%, #02050b 100%);
}
.admin-login-card {
  width: min(430px, 100%); padding: 34px; color: #eef7ff;
  border: 1px solid rgba(126, 196, 255, .42); border-radius: 26px;
  background: linear-gradient(145deg, rgba(28, 58, 94, .72), rgba(5, 16, 31, .88));
  box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.18);
  backdrop-filter: blur(24px) saturate(140%);
}
.admin-login-mark { width: 58px; height: 58px; display:grid; place-items:center; border-radius:18px; background:#49a5ff; color:#03111f; font-weight:900; font-size:22px; box-shadow:0 12px 32px rgba(73,165,255,.35); }
.admin-login-kicker { margin:22px 0 6px !important; color:#72baff !important; font-size:12px !important; font-weight:800; letter-spacing:.14em; }
.admin-login-card h1 { margin:0 0 8px; font-size:30px; }
.admin-login-card > p { color:#aebfd2; line-height:1.55; }
.admin-login-card label { display:grid; gap:8px; margin-top:16px; color:#c6d5e5; font-size:13px; font-weight:700; }
.admin-login-card input { width:100%; padding:14px 15px; border:1px solid rgba(150,194,232,.3); border-radius:13px; color:#fff; background:rgba(3,12,24,.65); outline:none; }
.admin-login-card input:focus { border-color:#55adff; box-shadow:0 0 0 4px rgba(73,165,255,.14); }
.admin-login-card button { width:100%; margin-top:20px; padding:14px; border:0; border-radius:14px; background:linear-gradient(135deg,#62b8ff,#3488f5); color:#04101e; font-weight:900; cursor:pointer; }
.admin-login-error { min-height:22px; margin:12px 0 0 !important; color:#ff9eaa !important; font-size:13px; }
.host-title { position:relative; }
.admin-logout-button { position:absolute; top:0; right:0; width:auto; padding:9px 13px; font-size:12px; }

.host-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.host-panel {
  width: min(820px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: white;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16);
}

.host-title h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.host-title p {
  margin: 0;
  color: #536174;
  font-size: 15px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.status-card span {
  color: #475569;
}

.status-card strong {
  font-size: 18px;
}

.status-card-health strong[data-health="healthy"] { color:#15803d; }
.status-card-health strong[data-health="degraded"] { color:#b45309; }
.status-card-health strong[data-health="offline"] { color:#b91c1c; }

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.homepage-button-row,
.entry-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.homepage-keep-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.private-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fff7ed;
  border: 2px solid #fed7aa;
  border-radius: 8px;
}

.private-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.private-title strong {
  color: #7c2d12;
  font-size: 18px;
}

.private-title span {
  color: #9a3412;
  font-size: 13px;
}

.private-control-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}

.private-time-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.private-time-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #7c2d12;
  font-size: 12px;
  font-weight: 700;
}

.private-control-row input,
.private-panel textarea {
  width: 100%;
  border: 2px solid #fdba74;
  border-radius: 8px;
  color: #111827;
  font: inherit;
  outline: none;
}

.private-control-row input {
  height: 29px;
  padding: 0 8px;
}

.private-panel textarea {
  min-height: 78px;
  padding: 12px;
  resize: vertical;
}

.dev-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.backend-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.webhard-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.electron-button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.offline-message-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
}

.offline-message-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offline-message-title strong {
  color: #3730a3;
  font-size: 18px;
}

.offline-message-title span {
  color: #4338ca;
  font-size: 13px;
}

.offline-message-panel textarea {
  min-height: 82px;
  padding: 12px;
  resize: vertical;
}

#offlineMessageSaveButton,
#cloudSyncButton {
  width: 100%;
}

#cloudSyncButton {
  background: #1d4ed8;
}

.google-search-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 8px;
}

.google-search-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.google-search-title strong {
  color: #155e75;
  font-size: 18px;
}

.google-search-title span {
  color: #0e7490;
  font-size: 13px;
  font-weight: 700;
}

.google-search-panel input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 2px solid #67e8f9;
  border-radius: 8px;
  color: #111827;
  font: inherit;
  outline: none;
}

.root-models-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}

.root-models-list {
  display: grid;
  gap: 10px;
}

.root-model-item {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
}

.root-model-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.root-model-item-title strong {
  color: #0f172a;
  font-size: 15px;
}

.root-model-item-title span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

.root-model-item-meta {
  color: #475569;
  font-size: 13px;
  word-break: break-all;
}

.google-limit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #155e75;
  font-size: 13px;
  font-weight: 800;
}

.google-search-note {
  margin: 0;
  color: #0e7490;
  font-size: 13px;
  line-height: 1.45;
}

.ip-block-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
}

.ip-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ip-block-title strong {
  color: #7c2d12;
  font-size: 18px;
}

.ip-block-title span {
  color: #9a3412;
  font-size: 13px;
}

.ip-block-form {
  display: grid;
  grid-template-columns: 1fr 1fr 110px;
  gap: 10px;
}

.ip-block-form input {
  min-width: 0;
}

.ip-block-list {
  display: grid;
  gap: 8px;
}

.ip-block-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.ip-block-item strong {
  display: block;
  color: #111827;
}

.ip-block-item span {
  display: block;
  color: #9a3412;
  font-size: 12px;
}

.domain-panel {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 16px;
  background: #f7fee7;
  border: 1px solid #bef264;
  border-radius: 8px;
}

.domain-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.domain-title strong {
  color: #365314;
  font-size: 18px;
}

.domain-title span,
.domain-note {
  color: #4d7c0f;
  font-size: 13px;
}

.domain-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #3f6212;
  font-size: 13px;
  font-weight: 700;
}

.domain-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #a3e635;
  border-radius: 8px;
  color: #111827;
  font: inherit;
  outline: none;
}

.domain-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.domain-note {
  margin: 0;
  line-height: 1.5;
}

.specific-user-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.host-close-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wide-button {
  width: 100%;
}

.danger-wide-button {
  width: 100%;
  background: #450a0a;
}

button {
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.support-chat-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 30px #0f172a4d;
  font-size: 25px;
}
.support-chat-button b { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: #dc2626; color: #fff; font: 700 12px/22px system-ui; }
.support-chat-modal { width: min(980px, calc(100vw - 32px)); height: min(720px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 24px 80px #0f172a66; }
.support-chat-modal > .modal-header { padding: 16px 18px; border-bottom: 1px solid #e2e8f0; }
.support-chat-modal > .modal-header h2, .support-chat-modal > .modal-header p { margin: 0; }
.support-chat-modal > .modal-header p { margin-top: 3px; color: #64748b; font-size: 13px; }
.support-chat-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 300px 1fr; }
.support-thread-panel>header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.support-thread-panel>header button { padding:6px 9px; border:1px solid #fecaca; border-radius:8px; background:#fff1f2; color:#be123c; font-size:11px; }
.host-support-message-actions { display:flex; gap:5px; margin-top:3px; }
.host-support-message-actions button { padding:3px 6px; border:0; border-radius:5px; background:#ffffff55; color:inherit; font-size:10px; }
.support-account-list { overflow: auto; padding: 10px; border-right: 1px solid #e2e8f0; background: #f8fafc; }
.support-account-item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 12px; margin-bottom: 6px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #172033; text-align: left; }
.support-account-item:hover, .support-account-item.selected { border-color: #bfdbfe; background: #eaf2ff; transform: none; }
.support-account-item strong, .support-account-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-account-item small { grid-column: 1 / -1; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-account-item b { min-width: 20px; height: 20px; border-radius: 999px; background: #dc2626; color: #fff; text-align: center; font-size: 12px; line-height: 20px; }
.support-thread-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.support-thread-panel > header { padding: 14px 18px; border-bottom: 1px solid #e2e8f0; font-weight: 700; }
.support-thread-messages { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 9px; padding: 18px; overflow: auto; background: #f8fafc; }
.support-thread-messages > p { margin: auto; color: #64748b; text-align: center; }
.host-support-message { max-width: 76%; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 11px; background: #e2e8f0; color: #172033; }
.host-support-message.admin { align-self: flex-end; background: #1d4ed8; color: #fff; }
.host-support-message small { opacity: .68; font-size: 11px; }
.support-reply-form { display: grid; grid-template-columns: 1fr 108px; gap: 10px; padding: 12px; border-top: 1px solid #e2e8f0; }
.support-reply-form textarea { resize: none; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
@media (max-width: 720px) { .support-chat-layout { grid-template-columns: 180px 1fr; } }

#closeButton {
  background: #b91c1c;
}

#homepageOpenButton,
#homepageFirstButton {
  background: #047857;
}

#homepageCloseButton {
  background: #9f1239;
}

#homepageKeepButton,
#auxSiteKeepButton {
  background: #4f46e5;
}

#homepageKeepButton[data-enabled="true"],
#auxSiteKeepButton[data-enabled="true"] {
  background: #047857;
}

#mainFirstButton {
  background: #1d4ed8;
}

#privateCloseButton {
  background: #c2410c;
}

#privateOpenButton {
  background: #15803d;
}

#userOpenButton,
#confirmUserOpenButton {
  background: #1d4ed8;
}

#userCloseButton {
  background: #7f1d1d;
}

#devOpenButton {
  background: #047857;
}

#devCloseButton {
  background: #92400e;
}

#backendOpenButton {
  background: #0f766e;
}

#backendCloseButton {
  background: #9f1239;
}

#webhardOpenButton {
  background: #0369a1;
}

#webhardCloseButton {
  background: #7f1d1d;
}

#electronClientsButton {
  background: #1f2937;
}

#domainConnectButton {
  background: #047857;
}

#domainDisconnectButton {
  background: #9f1239;
}

#domainVerifyButton {
  background: #1d4ed8;
}

#hostCloseButton {
  background: #581c87;
}

#hostShutdownButton {
  background: #450a0a;
}

.progress-wrap {
  height: 12px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  transition: width 0.28s ease;
}

.log-box {
  min-height: 160px;
  max-height: 240px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.modal-overlay.hidden {
  display: none;
}

.user-modal {
  width: min(50vw, 560px);
  height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  margin: 0;
}

#modalCloseButton {
  width: 44px;
  height: 38px;
}

.user-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.user-item {
  flex: 0 0 auto;
  width: 100%;
  text-align: left;
  background: #f1f5f9;
  color: #111827;
}

.user-item.selected {
  outline: 3px solid #60a5fa;
  outline-offset: 2px;
  background: #dbeafe;
}

.electron-clients-panel {
  width: min(760px, 100%);
}

.electron-client-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
}

.electron-client-card,
.electron-empty {
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.electron-client-card.online {
  border-color: #86efac;
  background: #f0fdf4;
}

.electron-client-card.offline {
  opacity: 0.74;
}

.electron-client-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.electron-client-top strong {
  font-size: 18px;
}

.electron-client-top span {
  color: #15803d;
  font-size: 13px;
  font-weight: 800;
}

.electron-client-card.offline .electron-client-top span {
  color: #92400e;
}

.electron-client-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0;
}

.electron-client-card div {
  min-width: 0;
}

.electron-client-card dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.electron-client-card dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: #111827;
}

.electron-empty {
  color: #475569;
  text-align: center;
}

@media (max-width: 720px) {
  .host-shell {
    align-items: flex-start;
    padding: 14px;
  }

  .host-panel {
    padding: 18px;
  }

  .host-title h1 {
    font-size: 26px;
  }

  .button-row,
  .private-control-row,
  .webhard-button-row,
  .domain-actions {
    grid-template-columns: 1fr;
  }

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

  .status-card,
  .domain-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

.voip-emergency-overlay { position:fixed; inset:0; z-index:120; display:grid; place-items:center; padding:24px; background:rgba(18,2,4,.66); backdrop-filter:blur(16px); }
.voip-emergency-overlay.hidden { display:none; }
.voip-emergency-call { width:min(92vw,430px); padding:38px 30px 30px; border:3px solid #ef4444; border-radius:30px; background:linear-gradient(150deg,#fff7f7,#ffe4e6); box-shadow:0 30px 100px rgba(127,29,29,.55); text-align:center; color:#450a0a; }
.voip-emergency-pulse { width:86px; height:86px; display:grid; place-items:center; margin:0 auto 18px; border-radius:30px; background:#dc2626; color:white; font-size:40px; box-shadow:0 0 0 0 rgba(239,68,68,.5); animation:voip-emergency-ring 1.25s infinite; }
.voip-emergency-call small { color:#b91c1c; font-weight:900; letter-spacing:.13em; }
.voip-emergency-call h2 { margin:8px 0 14px; font-size:28px; }
.voip-emergency-call strong { display:block; font-size:31px; }
.voip-emergency-call p { color:#7f1d1d; }
.voip-emergency-call > div { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:24px; }
.voip-emergency-call button { min-height:50px; border:0; border-radius:16px; color:#fff; font-weight:900; }
.voip-emergency-call .decline { background:#991b1b; }
.voip-emergency-call .answer { background:#16a34a; }
@keyframes voip-emergency-ring { 70% { box-shadow:0 0 0 22px rgba(239,68,68,0); transform:rotate(0); } 76% { transform:rotate(-6deg); } 82% { transform:rotate(6deg); } 88% { transform:rotate(0); } }
