:root {
  --bg: #0f1419;
  --surface: #16181c;
  --border: #2f3336;
  --text: #e7e9ea;
  --muted: #8b98a5;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --success: #00ba7c;
  --warn: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  margin: 0;
  line-height: 1.5;
}

body.has-topnav { padding-top: 56px; }

.platform-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: rgba(15, 20, 25, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.platform-topnav-brand {
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  margin-right: 8px;
  white-space: nowrap;
}

.platform-topnav-brand:hover { color: var(--accent); }

.platform-topnav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.platform-topnav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.platform-topnav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.platform-topnav-links a.active {
  color: var(--accent);
  background: rgba(29, 155, 240, 0.12);
}

.platform-topnav-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.platform-topnav-actions a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.platform-topnav-actions a:hover {
  color: var(--text);
  border-color: var(--accent);
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 28px 40px; }

.platform-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.platform-topnav-logo { margin-right: 8px; }

.platform-topnav-more { position: relative; }

.platform-topnav-more-btn {
  color: var(--muted);
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.platform-topnav-more-btn:hover,
.platform-topnav-more.open .platform-topnav-more-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.platform-topnav-more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 1000;
}

.platform-topnav-more.open .platform-topnav-more-menu { display: block; }

.platform-topnav-more-menu a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
}

.platform-topnav-more-menu a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.platform-topnav-more-menu a.active { color: var(--accent); }

.platform-topnav-account {
  border: none !important;
  background: rgba(29, 155, 240, 0.1);
  color: var(--accent) !important;
}

.page-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.page-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.page-breadcrumb a:hover { text-decoration: underline; }

.page-breadcrumb .sep { opacity: 0.5; }

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.admin-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(29, 155, 240, 0.25);
  background: rgba(29, 155, 240, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.page-desc {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 15px;
  max-width: 720px;
}

.dashboard-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.dashboard-hero h1 {
  font-size: 30px;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 640px;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dashboard-section {
  margin-bottom: 32px;
}

.dashboard-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 14px;
  padding-left: 2px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.service-card.compact { padding: 18px 20px; }
.service-card.compact h2 { font-size: 16px; }
.service-card.compact .icon { font-size: 22px; }

.launcher-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-top: 28px;
}

.brand-pill {
  display: inline-block;
  background: rgba(29, 155, 240, 0.15);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

h1 { font-size: 32px; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 18px; margin: 0; font-weight: 600; }
h4 { font-size: 13px; margin: 20px 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sub { color: var(--muted); margin-bottom: 28px; }

.hero {
  background: linear-gradient(135deg, #16181c 0%, #1a2332 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 28px;
}
.hero h2 { font-size: 22px; margin-bottom: 8px; }
.hero-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
}
.hero-flow .step {
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.hero-flow .arrow { color: var(--accent); }

.deploy-card {
  grid-column: 1 / -1;
  border-color: var(--accent);
  background: linear-gradient(135deg, #16181c 0%, #15202b 100%);
}
.deploy-output {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 12px;
  display: none;
}
.deploy-output.show { display: block; }
.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-card .icon { font-size: 28px; }
.service-card .desc { color: var(--muted); font-size: 14px; flex: 1; margin: 0; }

.service-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #1a2332;
  color: var(--muted);
}

.tag.active { background: rgba(0, 186, 124, 0.15); color: var(--success); }
.tag.warn { background: rgba(255, 173, 51, 0.15); color: #ffad33; }
.tag.error { background: rgba(244, 33, 46, 0.15); color: var(--danger); }

.readiness-card .kpi-value { font-size: 18px; }
.readiness-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
}
.readiness-checks { display: flex; flex-wrap: wrap; gap: 4px; }
.readiness-warnings {
  color: #ffad33;
  display: none;
}
.readiness-warnings.show { display: block; }

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.panel-header-row h2 { margin: 0; }

.start-wrap { max-width: 960px; }
.start-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 800px) {
  .start-grid { grid-template-columns: 1fr; }
}
.start-features {
  margin: 12px 0 16px;
  padding-left: 20px;
  color: var(--muted);
}
.start-features li { margin-bottom: 6px; }
.start-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.muted.available { color: var(--success); }
.muted.unavailable { color: var(--danger); }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.nav { margin-top: 32px; }
.nav a { color: var(--accent); text-decoration: none; font-size: 14px; }

input, select, textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field { margin-bottom: 16px; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-result {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  color: var(--success);
  display: none;
  word-break: break-all;
}

.modal-result.show { display: block; }
.modal-result.error { color: var(--danger); }

.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s;
}

.tile:hover { border-color: var(--accent); }

.tile .icon { font-size: 32px; margin-bottom: 8px; }
.tile .name { font-weight: 600; font-size: 14px; }
.tile .proto { color: var(--muted); font-size: 12px; margin-top: 4px; }

.log { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; font-family: monospace; }
.log.AUDIT { color: var(--warn); }
.log.ERROR { color: var(--danger); }
.log.INFO { color: var(--muted); }
.ts { color: #555; margin-right: 10px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.log-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.log-filters input { flex: 1; min-width: 200px; }
.log-filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.status-line { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
pre { background: var(--bg); padding: 16px; border-radius: 8px; overflow: auto; font-size: 12px; }

ul { padding-left: 0; list-style: none; }
li { margin: 8px 0; color: var(--muted); font-size: 14px; }

.item-list { margin-bottom: 8px; }
.item {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

.auth-wrapper {
  display: flex;
  height: 100vh;
  width: 100vw;
  align-items: center;
  justify-content: center;
}
.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  padding: 36px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-sizing: border-box;
}
.auth-logo { font-size: 36px; margin-bottom: 12px; }
.auth-title { color: var(--text); margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.auth-desc { color: var(--muted); margin-bottom: 24px; font-size: 14px; line-height: 1.5; }
.auth-input { margin-bottom: 16px; }
.auth-box .btn { width: 100%; margin-bottom: 10px; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  font-family: ui-monospace, monospace;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

.admin-form-panel { position: sticky; top: 24px; align-self: start; }

.input-hint { display: flex; flex-direction: column; gap: 6px; }
.input-hint input { margin-bottom: 0; }
.hint { font-size: 12px; color: var(--accent); font-family: ui-monospace, monospace; }

.user-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.user-hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.host-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
}

.host-badge.cloud { background: rgba(29, 155, 240, 0.12); color: var(--accent); }
.host-badge.services { background: rgba(0, 186, 124, 0.12); color: var(--success); }

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

#provision-output.show { display: block; }
#provision-output:not(.show) { display: block; color: var(--muted); font-style: italic; }