:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-muted: #f6f8fa;
  --border: #d6dde3;
  --border-strong: #b8c4cc;
  --text: #1d252c;
  --muted: #64717d;
  --accent: #1f6f68;
  --accent-strong: #15514d;
  --danger: #b42318;
  --shadow: 0 16px 36px rgba(20, 32, 43, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #26333b;
  color: #ffffff;
  font-weight: 800;
}

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

.brand-row h1,
.topbar h1 {
  font-size: 22px;
  line-height: 1.2;
}

.brand-row p,
.topbar p,
.app-list p,
.empty-state p,
#appId {
  color: var(--muted);
}

.error-text {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.console-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 22px;
}

.secondary-button,
.small-button,
.text-button {
  background: #e7ecef;
  color: var(--text);
}

.secondary-button:hover,
.small-button:hover,
.text-button:hover {
  background: #d8e0e5;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px;
  overflow: auto;
}

.sidebar-header,
.panel-heading,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sidebar-header h2,
.detail-header h2 {
  font-size: 20px;
}

.app-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.app-item {
  width: 100%;
  min-height: 70px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.app-item:hover,
.app-item.active {
  border-color: var(--accent);
  background: #eef8f6;
}

.app-item strong {
  display: block;
}

.app-item span {
  color: var(--muted);
  font-size: 12px;
}

.detail {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.empty-state {
  display: grid;
  gap: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 32px;
}

.detail-header {
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field-inline {
  min-width: 220px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

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

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.panel {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.panel h3 {
  font-size: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.compact-toggle {
  padding-top: 22px;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.feature-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.feature-pill.enabled {
  border-color: #8fc5bb;
  background: #e8f6f3;
  color: var(--accent-strong);
}

.feature-editor {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #26333b;
  color: #ffffff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 310px;
  }

  .status-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .detail-header {
    display: grid;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    display: grid;
  }

  .detail,
  .sidebar {
    padding: 14px;
  }

  .feature-editor {
    grid-template-columns: 1fr;
  }

  .compact-toggle {
    padding-top: 0;
  }
}
