:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f8;
  color: #202124;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: #256f62;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  align-self: start;
  background: #ffffff;
  border-right: 1px solid #e4e7eb;
  color: #202124;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand-mark {
  background: #28b981;
  border-radius: 7px;
  box-shadow: 0 0 0 5px rgba(40, 185, 129, 0.12);
  display: block;
  height: 28px;
  width: 28px;
}

h1 {
  font-size: 20px;
  font-weight: 760;
}

#server-line {
  color: #70757a;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 3px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tabs button {
  background: transparent;
  border: 1px solid transparent;
  color: #5f6368;
  justify-content: flex-start;
  min-height: 42px;
  text-align: left;
}

.tabs button.active {
  background: #e8f4f1;
  border-color: #c7e3dc;
  color: #165f52;
}

.workspace {
  min-width: 0;
}

.workspace-header {
  align-items: center;
  background: rgba(250, 251, 252, 0.9);
  border-bottom: 1px solid #e0e4e8;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 36px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.workspace-header h2 {
  font-size: 22px;
  font-weight: 760;
  line-height: 1.15;
}

.eyebrow {
  color: #70757a;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.lang-toggle,
.token-form {
  display: flex;
  gap: 8px;
}

.token-form {
  min-width: min(100%, 360px);
}

input,
select,
button {
  border: 1px solid #c8d2dc;
  border-radius: 6px;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
}

input {
  background: #ffffff;
  color: #16202a;
  min-width: 180px;
}

button {
  align-items: center;
  background: #1f7a5a;
  border-color: #1f7a5a;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 680;
  justify-content: center;
}

button.secondary {
  background: #ffffff;
  color: #26313d;
}

.lang-toggle button {
  min-width: 72px;
}

.lang-toggle button.active {
  background: #e5f3ed;
  border-color: #a6d8c2;
  color: #12563f;
}

main {
  padding: 22px clamp(18px, 4vw, 40px) 44px;
}

.page-tabs {
  align-items: end;
  border-bottom: 1px solid #e0e4e8;
  display: flex;
  gap: 4px;
  margin: -4px 0 18px;
  min-height: 42px;
  overflow-x: auto;
}

.page-tab {
  background: #f1f3f4;
  border: 1px solid #dfe3e7;
  border-bottom-color: #e0e4e8;
  border-radius: 8px 8px 0 0;
  color: #5f6368;
  gap: 8px;
  max-width: 260px;
  min-height: 38px;
  padding: 8px 10px;
}

.page-tab.active {
  background: #ffffff;
  border-bottom-color: #ffffff;
  color: #202124;
  margin-bottom: -1px;
}

.page-tab span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-tab-close {
  align-items: center;
  border-radius: 50%;
  color: #70757a;
  display: inline-flex;
  font-size: 16px;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.page-tab-close:hover {
  background: #e5e8eb;
  color: #202124;
}

.page-content {
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.overview-grid {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.briefing-column {
  min-width: 0;
}

.section-title,
.service-panel .card-heading {
  min-height: 43px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 20px;
  line-height: 1.2;
}

.card,
.metric {
  background: #ffffff;
  border: 1px solid #e2e6ea;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(12, 22, 32, 0.04);
}

.card {
  padding: 16px;
}

.card-heading {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card h2,
.service-panel h2 {
  font-size: 17px;
  line-height: 1.25;
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
}

.report-card button {
  margin-top: auto;
  width: fit-content;
}

.report-lead {
  color: #3c4043;
  font-size: 15px;
  line-height: 1.7;
}

.metric-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric {
  border-top: 3px solid #8fa0ad;
  padding: 14px;
}

.metric.healthy {
  border-top-color: #26a875;
}

.metric.warning {
  border-top-color: #c58a22;
}

.metric span {
  color: #667687;
  display: block;
  font-size: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
  margin-top: 5px;
}

.service-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #202124;
  padding: 0;
}

.service-panel .eyebrow,
.service-panel .muted {
  color: #70757a;
}

.service-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid #edf0f2;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-top: 10px;
  min-height: 48px;
  padding: 0 12px;
}

.service-row:first-of-type {
  margin-top: 0;
}

.service-row span:first-child {
  color: #5f6368;
}

.service-row strong {
  color: #202124;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  align-items: center;
  border: 1px solid #cdd6df;
  border-radius: 999px;
  color: #4f5e6c;
  display: inline-flex;
  font-size: 12px;
  font-weight: 720;
  gap: 6px;
  padding: 4px 8px;
  white-space: nowrap;
}

.status-pill span {
  background: #8fa0ad;
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.status-pill.healthy {
  background: rgba(38, 168, 117, 0.12);
  border-color: rgba(38, 168, 117, 0.35);
  color: #17724f;
}

.status-pill.healthy span {
  background: #26a875;
}

.status-pill.warning {
  background: rgba(197, 138, 34, 0.12);
  border-color: rgba(197, 138, 34, 0.35);
  color: #8a5d13;
}

.status-pill.warning span {
  background: #c58a22;
}

.report-detail {
  margin: 0 auto;
  max-width: 940px;
  position: relative;
}

.report-detail h1 {
  color: #202124;
  font-size: 28px;
  line-height: 1.28;
  margin-bottom: 8px;
}

.report-view-modes {
  background: #f1f3f4;
  border: 1px solid #dfe3e7;
  border-radius: 8px;
  display: inline-flex;
  gap: 4px;
  margin: 14px 0 4px;
  padding: 4px;
}

.report-view-modes button {
  background: transparent;
  border-color: transparent;
  color: #5f6368;
  min-height: 30px;
}

.report-view-modes button.active {
  background: #ffffff;
  border-color: #d8e0e5;
  color: #165f52;
}

.report-section {
  border-top: 1px solid #edf0f2;
  margin-top: 24px;
  padding-top: 22px;
}

.report-section h2 {
  color: #202124;
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 6px;
}

.report-item {
  background: #ffffff;
  border: 1px solid #edf0f2;
  border-radius: 8px;
  margin-top: 12px;
  padding: 16px 18px;
}

.report-item h3 {
  color: #202124;
  font-size: 17px;
  line-height: 1.42;
  margin: 5px 0 8px;
}

.report-meta-line {
  color: #80868b;
  font-size: 12px;
  line-height: 1.4;
}

.report-body {
  color: #3c4043;
  font-size: 15px;
  line-height: 1.75;
  margin-top: 8px;
}

.report-link {
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-list span {
  background: #f1f8f6;
  border: 1px solid #d6ebe5;
  border-radius: 999px;
  color: #236b5e;
  font-size: 12px;
  padding: 3px 8px;
}

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

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

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

.data-row {
  background: #fafbfc;
  border: 1px solid #e8ecef;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 9px 10px;
}

.data-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.muted {
  color: #70757a;
  font-size: 13px;
  line-height: 1.45;
}

.notice {
  background: #fff8e6;
  border: 1px solid #f0d58d;
  border-radius: 8px;
  color: #5d470d;
  margin-bottom: 14px;
  padding: 14px 16px;
}

pre {
  background: #fafbfc;
  border: 1px solid #edf0f2;
  border-radius: 6px;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tabs button {
    justify-content: center;
    text-align: center;
  }

  .workspace-header,
  .top-actions,
  .token-form {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-grid,
  .grid.two,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .lang-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  input {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-card,
  .service-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .history-card {
    flex-direction: column;
  }

  .history-card button {
    width: 100%;
  }

  .data-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    border-bottom: 1px solid #e4e7eb;
    border-right: 0;
    gap: 14px;
    padding: 14px 14px 10px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    height: 24px;
    width: 24px;
  }

  h1 {
    font-size: 18px;
  }

  #server-line {
    font-size: 11px;
  }

  .tabs {
    display: flex;
    gap: 8px;
    margin: 0 -14px;
    overflow-x: auto;
    padding: 0 14px 2px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar,
  .page-tabs::-webkit-scrollbar {
    display: none;
  }

  .tabs button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 12px;
    white-space: nowrap;
  }

  .workspace-header {
    padding: 12px 14px;
    position: static;
  }

  .workspace-header h2 {
    font-size: 18px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .lang-toggle {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  #refresh-button {
    min-width: 88px;
  }

  .token-form {
    grid-column: 1 / -1;
  }

  main {
    padding: 12px 14px 28px;
  }

  .page-tabs {
    background: #f6f7f8;
    margin: -12px -14px 14px;
    min-height: 40px;
    padding: 8px 14px 0;
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .page-tab {
    flex: 0 0 auto;
    max-width: 220px;
    min-height: 34px;
    padding: 7px 10px;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .metric {
    padding: 12px;
  }

  .metric strong {
    font-size: 19px;
  }

  .overview-grid,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .section-title,
  .service-panel .card-heading {
    min-height: auto;
  }

  .card,
  .report-item {
    padding: 14px;
  }

  .report-card {
    min-height: auto;
  }

  .history-card {
    align-items: stretch;
    flex-direction: column;
  }

  .history-card button,
  .report-card button {
    width: 100%;
  }

  .service-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 46px;
  }

  .service-row .status-pill {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .report-detail {
    max-width: none;
  }

  .report-detail h1 {
    font-size: 22px;
  }

  .report-view-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .report-view-modes button {
    width: 100%;
  }

  .report-section {
    margin-top: 18px;
    padding-top: 18px;
  }

  .report-section h2 {
    font-size: 17px;
  }

  .report-item h3 {
    font-size: 16px;
  }

  .report-body {
    font-size: 14px;
    line-height: 1.7;
  }

  .data-list,
  pre {
    overflow-x: auto;
  }

  .data-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .top-actions {
    grid-template-columns: 1fr;
  }

  #refresh-button {
    width: 100%;
  }

  .token-form {
    flex-direction: column;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .page-tab {
    max-width: 190px;
  }

  .card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .service-row {
    grid-template-columns: 1fr;
  }
}
