* { box-sizing: border-box; }

:root {
  --bg: #f6f6f8;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1d1d1f;
}

body {
  background: var(--bg);
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 232px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.4);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding: 18px 12px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 18px;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1d1d1f, #48484a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.nav-section { margin-bottom: 16px; }

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-add {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.nav-add:hover { background: rgba(0, 0, 0, 0.14); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
  color: #1d1d1f;
  cursor: pointer;
  user-select: none;
}

.nav-item:hover { background: rgba(0, 0, 0, 0.05); }
.nav-item.active { background: rgba(0, 122, 255, 0.13); color: #0066e0; font-weight: 600; }
.nav-item-static { cursor: default; }
.nav-item-disabled { color: #a1a1a6; cursor: default; }
.nav-item-disabled:hover { background: none; }

.nav-icon { width: 16px; text-align: center; font-size: 12px; opacity: 0.75; }

.project-list, .region-list { display: flex; flex-direction: column; gap: 1px; }

.project-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
}
.project-row:hover { background: rgba(0, 0, 0, 0.05); }
.project-row.active { background: rgba(0, 122, 255, 0.13); color: #0066e0; font-weight: 600; }
.project-row .proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-row .proj-count {
  font-size: 10px;
  color: #86868b;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  padding: 1px 6px;
}
.project-row.active .proj-count { color: #0066e0; background: rgba(0, 102, 224, 0.12); }

.nav-empty { padding: 6px 8px; font-size: 12px; color: #86868b; }

.region-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 24px;
  font-size: 12px;
  color: #48484a;
}
.region-status-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.region-cloud { margin-left: auto; font-size: 11px; color: #86868b; text-transform: uppercase; }

/* Main content */
.content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.content-top {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 9px;
  padding: 6px 10px;
  width: 240px;
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}
.search-icon { font-size: 12px; opacity: 0.6; }

.content-main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  padding: 16px 24px 24px;
  gap: 20px;
}

.list-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Shown instead of the environments list while there are no projects. */
.no-projects {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}
.no-projects h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

/* These set display themselves, which would otherwise override [hidden]. */
.content-top[hidden],
.list-pane[hidden],
.no-projects[hidden] {
  display: none;
}

.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.list-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #86868b;
  margin-bottom: 4px;
}

.list-header h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.subtitle { margin: 0; font-size: 13px; color: #6e6e73; }

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 9px 16px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary-pill {
  background: #1d1d1f;
  color: #fff;
  white-space: nowrap;
}
.btn-primary-pill:hover:not(:disabled) { background: #000; }

.btn-blue-pill {
  background: #0a7cff;
  color: #fff;
}
.btn-blue-pill:hover:not(:disabled) { background: #0066e0; }

.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.btn-secondary:hover:not(:disabled) { background: rgba(0, 0, 0, 0.09); }

.btn-danger {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(255, 59, 48, 0.18); }

.inline-error {
  background: rgba(255, 59, 48, 0.09);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: #c62924;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.inline-note {
  font-size: 11.5px;
  color: #86868b;
  margin-top: 6px;
}

.table-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
}

.env-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.env-table thead th {
  position: sticky;
  top: 0;
  background: rgba(246, 246, 248, 0.95);
  text-align: left;
  font-weight: 600;
  color: #6e6e73;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 1;
}

.col-check { width: 36px; }

.env-table tbody tr {
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.env-table tbody tr:hover { background: rgba(0, 122, 255, 0.05); }
.env-table tbody tr.selected { background: rgba(0, 122, 255, 0.1); }

.env-table td { padding: 10px 14px; vertical-align: middle; }

.name-cell { display: flex; align-items: center; gap: 10px; }

.row-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3a3a3c, #1d1d1f);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.name-lines { min-width: 0; }
.name-primary { font-weight: 600; color: #1d1d1f; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-secondary { font-size: 11.5px; color: #86868b; }

.status-cell { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.status-ready { background: #28c840; }
.status-progress { background: #febc2e; }
.status-failed { background: #ff3b30; }
.status-deleted { background: #a1a1a6; }

.table-empty {
  text-align: center;
  color: #86868b;
  padding: 40px 12px;
  font-size: 13px;
}

/* Detail pane */
.detail-pane {
  width: 340px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 18px;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.detail-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }

.detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3a3a3c, #1d1d1f);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
}

.detail-title { flex: 1; min-width: 0; }
.detail-name { font-size: 16px; font-weight: 700; margin: 0 0 4px; overflow-wrap: anywhere; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}
.status-pill.status-ready { background: rgba(40, 200, 64, 0.14); color: #1a9e37; }
.status-pill.status-progress { background: rgba(254, 188, 46, 0.18); color: #a1720b; }
.status-pill.status-failed { background: rgba(255, 59, 48, 0.14); color: #d5241a; }
.status-pill.status-deleted { background: rgba(161, 161, 166, 0.18); color: #6e6e73; }

.detail-subtitle { font-size: 12px; color: #86868b; }

.detail-overflow {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
  font-size: 14px;
  color: #48484a;
}

.detail-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-actions .btn { flex: 1 1 auto; }

.tab-bar {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 14px;
  font-size: 12.5px;
}
.tab-item {
  padding: 8px 0;
  color: #86868b;
  cursor: default;
  border-bottom: 2px solid transparent;
}
.tab-item.active { color: #1d1d1f; font-weight: 600; border-bottom-color: #1d1d1f; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin-bottom: 18px;
}
.info-grid .full { grid-column: 1 / -1; }
.info-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: #86868b; margin-bottom: 3px; }
.info-value { font-size: 13px; color: #1d1d1f; overflow-wrap: anywhere; }
.info-value.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.stat-row { display: flex; gap: 10px; margin-bottom: 6px; }
.stat-card {
  flex: 1;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  padding: 10px 12px;
}
.stat-label { font-size: 10.5px; color: #86868b; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.stat-value { font-size: 14px; font-weight: 700; color: #1d1d1f; }

.detail-empty {
  color: #86868b;
  font-size: 13px;
  text-align: center;
  padding: 40px 12px;
}

.kubeconfig-usage {
  margin: -6px 0 14px;
}
.kubeconfig-usage pre {
  margin: 6px 0 0;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-sheet {
  background: rgba(250, 250, 252, 0.98);
  backdrop-filter: blur(20px);
  border-radius: 14px;
  width: 380px;
  max-width: 90vw;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.modal-sheet.modal-sheet--settings {
  width: 760px;
}

.modal-sheet h2 { font-size: 16px; margin: 0 0 14px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: #48484a; margin-bottom: 5px; }
.field input, .field select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  outline: none;
}
.field input:focus, .field select:focus { border-color: #0a7cff; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.modal-error {
  background: rgba(255, 59, 48, 0.09);
  border: 1px solid rgba(255, 59, 48, 0.2);
  color: #c62924;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.settings-section-label {
  font-size: 12px;
  color: #86868b;
  margin: -8px 0 16px;
  overflow-wrap: anywhere;
}

.settings-empty-note {
  font-size: 12.5px;
  color: #86868b;
  margin-bottom: 16px;
}

.settings-danger-zone {
  border: 1px solid rgba(255, 59, 48, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 59, 48, 0.04);
}

.settings-danger-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #c62924;
  font-weight: 600;
  margin-bottom: 10px;
}

.settings-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-danger-title { font-size: 13px; font-weight: 500; color: #1d1d1f; }
.settings-danger-desc { font-size: 11.5px; color: #86868b; margin-top: 2px; }

.modal-sheet--settings .settings-danger-row { gap: 24px; }
.modal-sheet--settings .settings-danger-title { font-size: 14px; }
.modal-sheet--settings .settings-danger-desc { font-size: 12.5px; }
.modal-sheet--settings .settings-danger-zone { padding: 16px 20px; }
.modal-sheet--settings .btn-danger { flex: 0 0 auto; white-space: nowrap; }
