:root {
  color-scheme: light;
  --bg: #f6f9fe;
  --panel: #ffffff;
  --ink: #101b33;
  --muted: #52627f;
  --line: #dce4ef;
  --navy: #081526;
  --blue: #0b73ff;
  --green: #20a45a;
  --amber: #f5a400;
  --purple: #8057db;
  --red: #b3261e;
  --shadow: 0 18px 45px rgb(19 38 68 / 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(circle at 85% 8%, #ffffff 0 12%, transparent 34%), var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 10px 24px rgb(11 115 255 / 0.18);
}

button:disabled { cursor: not-allowed; opacity: .62; box-shadow: none; }
.ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); box-shadow: 0 8px 20px rgb(19 38 68 / 0.06); }
.app-shell { min-height: 100vh; }

.login-panel {
  width: min(430px, calc(100% - 32px));
  margin: 12vh auto 0;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1 { margin: 22px 0 10px; font-size: clamp(2.2rem, 6vw, 3.5rem); line-height: 1; }
.login-panel p { color: var(--muted); }

.dashboard-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 30px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: linear-gradient(180deg, #0b1a2e 0%, var(--navy) 100%);
  color: #eef6ff;
}

.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 1.45rem; font-weight: 850; }
.brand-mark, .bot-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #14a3ff, #0b73ff);
  color: #fff;
  font-size: .92rem;
}

.nav-list { display: grid; gap: 8px; }
.nav-item {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  color: #d8e4f6;
  text-decoration: none;
  font-weight: 720;
}
.nav-item.active { color: #25a4ff; background: linear-gradient(135deg, rgb(22 82 160 / .45), rgb(25 57 107 / .72)); }

.system-card {
  margin-top: auto;
  padding: 18px;
  border-radius: 8px;
  background: rgb(255 255 255 / .06);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .05);
}
.system-card h2 { margin: 0 0 12px; font-size: .95rem; }
.system-card p, .system-card li, .sidebar-footer small { color: #c9d6e9; font-size: .86rem; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 999px; background: currentColor; }
.ok { color: var(--green); }
.system-card ul { list-style: none; padding: 12px 0 0; margin: 12px 0 0; border-top: 1px solid rgb(255 255 255 / .08); }
.system-card li { display: flex; justify-content: space-between; margin-top: 10px; }
.system-card span { color: #4bd47d; }
.sidebar-footer { display: flex; align-items: center; gap: 12px; padding-top: 20px; border-top: 1px solid rgb(255 255 255 / .08); }
.sidebar-footer strong, .sidebar-footer small { display: block; }

.content { min-width: 0; padding: 30px 30px 24px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.topbar h1 { margin: 0 0 8px; font-size: clamp(2.1rem, 4vw, 3rem); line-height: 1; }
.topbar p { margin: 0; color: var(--muted); font-size: 1.04rem; }
.top-actions { display: flex; align-items: end; gap: 12px; }
.profile-select { display: grid; gap: 6px; color: #314266; font-weight: 700; }
.profile-select span { min-height: 42px; display: inline-flex; align-items: center; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; margin: 36px 0 28px; }
.summary-card {
  min-height: 126px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.summary-icon { width: 56px; height: 56px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 16px; color: #fff; font-weight: 850; }
.summary-icon.blue { background: linear-gradient(135deg, #0b73ff, #0a53d6); }
.summary-icon.green { background: linear-gradient(135deg, #34c76d, #15954c); }
.summary-icon.amber { background: linear-gradient(135deg, #ffc03d, #f2a000); }
.summary-icon.purple { background: linear-gradient(135deg, #9b6df1, #7148cf); }
.summary-card h2, .info-panel h2 { margin: 0; font-size: .98rem; }
.summary-card h2, .summary-card p { overflow-wrap: anywhere; }
.summary-card strong { display: block; margin-top: 8px; font-size: 2rem; line-height: 1; }
.summary-card p, .info-panel p { margin: 8px 0 0; color: var(--muted); }

.apps-panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.table-head, .app-card {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) minmax(190px, .9fr) minmax(120px, .45fr) minmax(160px, .6fr) minmax(190px, .72fr);
  gap: 18px;
  align-items: center;
}
.table-head { min-height: 62px; padding: 0 24px; border-bottom: 1px solid var(--line); font-weight: 820; }
.apps { display: grid; }
.app-card { min-width: 0; padding: 16px 24px; border-bottom: 1px solid #edf1f6; }
.app-card:last-child { border-bottom: 0; }
.app-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.app-avatar { width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--blue); background: #eaf2ff; font-weight: 850; }
.app-title { margin: 0 0 5px; font-size: 1rem; }
.domain, .meta, .reason, .type-subtitle { color: var(--muted); overflow-wrap: anywhere; }
.type-title { display: block; font-weight: 800; }
.type-title::before {
  content: "";
  width: 18px;
  height: 12px;
  margin-right: 10px;
  display: inline-block;
  border: 2px solid var(--blue);
  border-top-color: transparent;
  border-radius: 999px;
  vertical-align: -1px;
}
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; border: 1px solid transparent; border-radius: 8px; padding: 0 12px; font-weight: 850; font-size: .88rem; }
.pill::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: currentColor; }
.live { color: #168a45; background: #e9f8ed; border-color: #bde8ca; }
.maintenance { color: #a76800; background: #fff4d8; border-color: #f1d99d; }
.needs-validation { color: #5f6470; background: #eef1f5; border-color: #dfe4ec; }
.health { font-weight: 800; }
.action { min-width: 150px; box-shadow: none; }
.action-row { display: flex; gap: 12px; align-items: center; justify-content: flex-start; }
.more { width: 44px; padding: 0; background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }

.info-panel {
  margin-top: 28px;
  padding: 20px;
  display: flex;
  gap: 18px;
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
}
.shield { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; color: var(--blue); border: 1px solid #c9dcff; border-radius: 10px; background: #fff; font-weight: 850; }
#status-line.busy::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  display: inline-block;
  border: 2px solid #b8cff5;
  border-top-color: var(--blue);
  border-radius: 999px;
  vertical-align: -2px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error { min-height: 1.5em; color: var(--red); }
label { display: block; margin: 22px 0 8px; font-weight: 750; }
input { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; }
form button { width: 100%; margin-top: 16px; }

dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 8px; padding: 0; box-shadow: 0 24px 80px rgb(15 23 42 / .22); }
dialog::backdrop { background: rgb(16 32 61 / .35); }
dialog form { padding: 22px; }
dialog h2 { margin: 0 0 10px; }
dialog p { color: var(--muted); }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 22px 0 0; }

@media (max-width: 900px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 16px; flex-direction: row; align-items: center; }
  .nav-list, .system-card, .sidebar-footer { display: none; }
  .content { padding: 20px 16px 28px; }
}

@media (max-width: 760px) {
  html, body, .app-shell, .dashboard-layout, .content { max-width: 100%; overflow-x: hidden; }
  .topbar, .top-actions { align-items: stretch; flex-direction: column; }
  .profile-select {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }
  .profile-select span {
    min-width: 0;
    justify-content: center;
  }
  .summary { grid-template-columns: 1fr; gap: 12px; margin: 24px 0; }
  .summary-card { min-height: 96px; padding: 16px; }
  .summary-icon { width: 48px; height: 48px; border-radius: 14px; }
  .apps-panel { border: 0; background: transparent; box-shadow: none; }
  .table-head { display: none; }
  .apps { gap: 14px; }
  .app-card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
  .app-card > *, .app-main > div, .summary-card > div { min-width: 0; }
  .action-row, .action { width: 100%; }
  .more { display: none; }
  .info-panel { align-items: flex-start; }
  menu { flex-direction: column-reverse; }
  menu button { width: 100%; }
}
