/* Gemtech Data Solutions — Operations Console */
:root {
  --ink: #102033;
  --ink-soft: #2a3d52;
  --muted: #5d7085;
  --line: rgba(16, 32, 51, 0.1);
  --line-strong: rgba(16, 32, 51, 0.16);
  --surface: #ffffff;
  --bg-0: #eef2f5;
  --bg-1: #dce8e4;
  --bg-2: #f1e8dc;
  --teal: #0f6f68;
  --teal-deep: #0b574f;
  --teal-soft: #d8f3ef;
  --teal-glow: rgba(15, 111, 104, 0.16);
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --pending: #475467;
  --pending-soft: #f2f4f7;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(16, 32, 51, 0.04), 0 10px 28px rgba(16, 32, 51, 0.06);
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.5;
  background:
    radial-gradient(1000px 520px at 0% -10%, var(--bg-1), transparent 55%),
    radial-gradient(800px 420px at 100% 0%, var(--bg-2), transparent 50%),
    linear-gradient(180deg, #f7f8fa 0%, var(--bg-0) 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(16, 32, 51, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 32, 51, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, #000, transparent 80%);
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-deep); text-decoration: underline; text-underline-offset: 3px; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.9rem 1.5rem;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: 10px;
  background: linear-gradient(145deg, #19a396, var(--teal) 55%, #0a4f48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; left: 0.45rem; right: 0.45rem; top: 0.55rem;
  height: 0.2rem; border-radius: 99px; background: rgba(255,255,255,0.92);
  box-shadow: 0 0.32rem 0 rgba(255,255,255,0.72), 0 0.64rem 0 rgba(255,255,255,0.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--display); font-size: 1.02rem; font-weight: 650; letter-spacing: -0.02em; }
.brand-text span { font-size: 0.75rem; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.nav { display: flex; gap: 0.25rem; flex: 1; }
.nav a {
  color: var(--muted); font-weight: 700; font-size: 0.92rem;
  padding: 0.45rem 0.85rem; border-radius: 999px; text-decoration: none;
}
.nav a:hover { background: rgba(16,32,51,0.05); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--teal-soft); color: var(--teal-deep); }

.user-menu { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.link-btn { background: none; border: none; color: var(--teal); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.inline-form { display: inline; }

.container { width: min(1120px, 100%); margin: 0 auto; padding: 1.75rem 1.5rem 3rem; flex: 1; }
.container:has(.auth-shell) { max-width: none; padding: 0; display: flex; }

.page-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.4rem; }
.page-kicker {
  margin: 0 0 0.35rem; font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal);
}
.page-header h1 {
  margin: 0 0 0.3rem; font-family: var(--display); font-weight: 650;
  font-size: clamp(1.7rem, 2.5vw, 2.15rem); letter-spacing: -0.03em;
}
.muted { color: var(--muted); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.85rem; margin-bottom: 1.35rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.05rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -1rem; top: -1rem; width: 4.5rem; height: 4.5rem;
  border-radius: 50%; background: var(--teal-glow);
}
.stat-value { display: block; font-family: var(--display); font-size: 2rem; font-weight: 650; letter-spacing: -0.03em; }
.stat-label { color: var(--muted); font-size: 0.85rem; font-weight: 700; }

.group-block { margin-bottom: 1.75rem; }
.group-title {
  margin: 0 0 0.75rem; font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.app-card {
  display: flex; flex-direction: column; gap: 0.75rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow); text-decoration: none; color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.app-card:hover { transform: translateY(-2px); border-color: rgba(15,111,104,0.35); text-decoration: none; color: inherit; }
.app-card.is-inactive { opacity: 0.82; border-style: dashed; }
.host-status {
  border-color: rgba(15, 111, 104, 0.28);
  background:
    linear-gradient(180deg, rgba(216, 243, 239, 0.55), rgba(255, 255, 255, 0.95));
}
.app-card h2 { margin: 0; font-size: 1.08rem; font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; }
.app-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.app-card-meta { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; margin-top: auto; }
.kind-tag {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft); background: rgba(16,32,51,0.05); padding: 0.2rem 0.45rem; border-radius: 6px;
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 0.85rem; font-family: var(--display); font-size: 1.1rem; font-weight: 650; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }

.host-status-header .host-meta { margin-top: 0.25rem; }
.host-meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.meter {
  background: rgba(16, 32, 51, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
}
.meter-top, .meter-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.meter-top strong { font-size: 0.92rem; }
.meter-value, .meter-foot { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.meter-bar {
  height: 0.55rem;
  margin: 0.55rem 0 0.35rem;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.08);
  overflow: hidden;
}
.meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.35s ease;
}
.meter-fill.level-warn { background: var(--warning); }
.meter-fill.level-critical { background: var(--danger); }
.host-load { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font); font-weight: 800; font-size: 0.9rem; cursor: pointer; text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, #12988d, var(--teal)); color: #fff; box-shadow: 0 8px 18px var(--teal-glow); }
.btn.primary:hover { color: #fff; }
.btn.secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.header-actions, .action-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.78rem; font-weight: 800; text-transform: capitalize;
}
.status::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }
.status.active, .status.running { background: var(--success-soft); color: var(--success); }
.status.inactive, .status.failed, .status.dead { background: var(--danger-soft); color: var(--danger); }
.status.degraded, .status.activating, .status.deactivating { background: var(--warning-soft); color: var(--warning); }
.status.disabled, .status.unknown, .status.pending { background: var(--pending-soft); color: var(--pending); }
.status.large { font-size: 0.92rem; padding: 0.4rem 0.85rem; }

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 0.5rem 1rem; }
.detail-list dt { color: var(--muted); font-weight: 700; }
.detail-list dd { margin: 0; }

.log-output {
  background: #0b1622; color: #d7e2ec; padding: 1rem 1.1rem; border-radius: var(--radius-sm);
  overflow-x: auto; font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; white-space: pre-wrap;
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; background: #eff8ff; border: 1px solid #b9e0fe; }
.message.error, .messages .error { background: var(--danger-soft); border-color: #fecdca; color: #7a271a; }
.message.success, .messages .success { background: var(--success-soft); border-color: #abeFC6; color: #085d3a; }

.auth-shell { min-height: 100vh; width: 100%; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card {
  width: min(420px, 100%); background: rgba(255,255,255,0.9); border: 1px solid var(--line);
  border-radius: 18px; padding: 2rem 1.85rem; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0.35rem 0; font-family: var(--display); font-size: 1.8rem; font-weight: 650; }
.form label { display: block; margin: 0.85rem 0 0.35rem; font-weight: 800; font-size: 0.88rem; }
.form input[type="text"], .form input[type="password"] {
  width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; background: #fff;
}
.form input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-glow); }
.auth-card .btn.primary { width: 100%; margin-top: 1.2rem; padding: 0.8rem 1rem; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; }
  .detail-list { grid-template-columns: 1fr; }
}
