@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono&display=swap');

:root {
  --bg-body: #130f12;
  --bg-sidebar: #060505;
  --bg-card: #221a1f;
  --bg-hover: #2b2127;
  --bg-input: #171216;
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.18);
  --glass-highlight: rgba(255, 255, 255, 0.05);
  
  --border-light: #3a2c33;
  --border-strong: #5a424d;
  
  --text-main: #f5efef; 
  --text-muted: #a69499; 
  
  --accent: #9e416f; 
  --accent-hover: #b1477f; 
  --accent-alpha: rgba(139, 47, 96, 0.28);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  padding: 24px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, #060505 0%, #080607 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(16, 13, 14, 0.98), rgba(9, 8, 8, 0.98));
  border: 1px solid rgba(137, 52, 94, 0.26);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #170910;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #c9729f 0%, #9e416f 55%, #74264c 100%);
}

.brand h1 {
  margin: 0;
  font-family: "Avenir Next Condensed", "DIN Condensed", sans-serif;
  letter-spacing: 0.03em;
  font-size: 24px;
  color: #f5efef;
}

.eyebrow {
  margin: 0 0 6px;
  color: #c56b95;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.nav-link {
  cursor: pointer;
  transition: 0.18s ease;
  border: 1px solid transparent;
  background: transparent;
  color: #a69499;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 15px;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.is-active {
  color: #f5efef;
  border-color: rgba(197, 107, 149, 0.22);
  background: linear-gradient(90deg, rgba(139, 47, 96, 0.28), rgba(139, 47, 96, 0.08));
}

.main {
  flex: 1;
  overflow-y: auto;
  background:
    radial-gradient(circle at top right, rgba(158, 65, 111, 0.18), transparent 34%),
    radial-gradient(circle at bottom center, rgba(116, 38, 76, 0.16), transparent 28%),
    linear-gradient(180deg, #171215 0%, #120d10 100%);
  position: relative;
}

.global-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  padding: 20px 24px 0;
}

.view-content {
  width: 100%;
  padding: 32px 40px;
}

.hidden { display: none !important; }

/* Headers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 14px;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(180deg, #9e416f 0%, #74264c 100%);
  color: #fff;
  border: 1px solid #c9729f;
  box-shadow: 0 4px 12px rgba(116, 38, 76, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #b1477f 0%, #8b2f60 100%);
  border-color: #df8bb3;
}

.btn-outline {
  background-color: rgba(34, 26, 31, 0.92);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: var(--bg-hover);
  border-color: #c9729f;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-color: var(--border-light);
  background: var(--bg-card);
}

.btn-sm:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

/* Inputs */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
}

.search-box input {
  padding: 8px 12px 8px 32px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
}

.input-field {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

textarea.input-field {
  resize: vertical;
  font-family: var(--font-mono);
}

.input-field:focus {
  border-color: var(--accent);
}

/* Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(35, 27, 32, 0.98), rgba(28, 21, 25, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 14px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* Tables */
.data-table-wrapper {
  background: linear-gradient(180deg, rgba(34, 26, 31, 0.98), rgba(28, 21, 25, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 18px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background-color: #2a2026;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.cell-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cell-sub {
  color: var(--text-muted);
  font-size: 12px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.cmd-text {
  color: #e4e4e7; /* zinc-200 */
  white-space: normal !important;
  word-break: break-all;
  min-width: 240px;
}

/* Status */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-running { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-stopped { background-color: var(--warning); }
.status-failed { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

.badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--border-strong);
  color: var(--text-main);
}
.badge.active { background: var(--accent-alpha); color: var(--accent); }

/* Actions List */
.action-group {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

/* Activity */
.section-block { margin-top: 40px; }
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: linear-gradient(180deg, rgba(35, 27, 32, 0.96), rgba(28, 21, 25, 0.96));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.activity-main { font-weight: 500; font-size: 14px; }
.activity-sub { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.activity-time { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Logs */
.filter-bar {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(36, 28, 33, 0.98), rgba(30, 23, 27, 0.98));
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  align-items: flex-end;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 14px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
.filter-item.flex-1 { flex: 1; }
.filter-item label { font-size: 12px; color: var(--text-muted); }

.log-meta-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.log-tag {
  font-size: 12px;
  padding: 4px 10px;
  background-color: #251d22;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid rgba(201, 114, 159, 0.14);
}
.log-tag strong { color: var(--text-main); font-weight: 500; }

.log-terminal {
  background: linear-gradient(180deg, rgba(28, 21, 25, 0.98), rgba(22, 17, 20, 0.98));
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  height: calc(100vh - 340px);
  min-height: 400px;
  overflow: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 36px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.log-terminal pre {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e4e4e7;
  line-height: 1.6;
  white-space: pre-wrap;
}

.log-modal-container {
  max-width: 980px;
}

.log-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.runtime-log-terminal {
  background: linear-gradient(180deg, rgba(24, 20, 23, 0.98), rgba(17, 14, 17, 0.98));
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  min-height: 420px;
  max-height: 62vh;
  overflow: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 36px rgba(0, 0, 0, 0.22);
}

.runtime-log-terminal pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  color: #f0e9ec;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(6, 5, 6, 0.72);
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-container {
  background: linear-gradient(180deg, rgba(42, 31, 37, 0.99), rgba(32, 24, 29, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 30px 60px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { 
  background: transparent;
  border: none;
  color: var(--text-muted); 
  transition: color 0.2s; 
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text-main); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.form-group { margin-bottom: 32px; }
.form-group:last-child { margin-bottom: 0; }

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.form-row {
  display: grid;
  gap: 16px;
}
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full-width { grid-column: 1 / -1; }
.field.span-2 { grid-column: span 2; }

.field label { font-size: 13px; color: var(--text-muted); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--accent); }
.checkbox-label span { font-size: 13px; color: var(--text-main); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: linear-gradient(180deg, rgba(35, 27, 32, 0.98), rgba(30, 23, 27, 0.98));
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(201, 114, 159, 0.18), transparent 28%),
    radial-gradient(circle at bottom left, rgba(116, 38, 76, 0.2), transparent 30%),
    linear-gradient(180deg, #140f12 0%, #0f0b0d 100%);
}

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

.login-card {
  width: min(480px, 100%);
  padding: 32px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(39, 29, 35, 0.98), rgba(27, 21, 25, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 28px 56px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-copy {
  margin-bottom: 24px;
}

.login-copy h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-copy p {
  color: var(--text-muted);
  line-height: 1.7;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-tips {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  min-height: 44px;
}

.login-error {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ffb4b4;
}
