:root {
  --glass-bg: rgba(26, 28, 36, 0.46);
  --glass-bg-soft: rgba(40, 43, 56, 0.35);
  --glass-stroke: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --bg-0: #07080d;
  --bg-1: #10131d;
  --bg-2: #1a1f2b;
  --text-main: #f3f5ff;
  --text-muted: #b2b8cc;
  --accent: #7aa2ff;
  --success-soft: rgba(127, 255, 176, 0.18);
  --danger-soft: rgba(255, 132, 132, 0.2);
  --radius: 18px;
}

html,
body {
  min-height: 100%;
}

body {
  color: var(--text-main);
  background:
    radial-gradient(900px 520px at 0% -20%, rgba(122, 162, 255, 0.35) 0%, rgba(122, 162, 255, 0) 60%),
    radial-gradient(900px 520px at 100% -10%, rgba(162, 134, 255, 0.25) 0%, rgba(162, 134, 255, 0) 60%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 40%, rgba(255, 255, 255, 0.02));
}

a {
  color: #aec7ff;
}

a:hover {
  color: #d6e1ff;
}

.navbar-modern {
  margin: 0.8rem 1rem 0;
  border: 1px solid var(--glass-stroke);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(28, 31, 44, 0.74), rgba(17, 20, 32, 0.72));
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35), inset 0 1px 0 var(--glass-highlight);
}

.navbar .navbar-brand {
  letter-spacing: 0.01em;
}

.navbar .btn,
.navbar .form-select {
  border-radius: 12px;
}

.navbar .btn-light,
.navbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.24);
  color: #eef2ff;
  background: rgba(255, 255, 255, 0.06);
}

.navbar .btn-light:hover,
.navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.app-shell {
  margin-top: 1.25rem;
}

.card,
.card-modern,
.metric-card {
  border-radius: var(--radius);
  border: 1px solid var(--glass-stroke);
  background: linear-gradient(160deg, var(--glass-bg), var(--glass-bg-soft));
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.28), inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.card-header,
.metric-card .card-header,
.card-modern .card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
}

.section-title,
h1,
h2,
h3,
h4,
h5,
h6,
label,
.nav-link {
  color: var(--text-main);
}

.muted,
.text-muted,
p,
small,
.table,
.form-text {
  color: var(--text-muted) !important;
}

.alert {
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
}

.table-modern {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-main);
  --bs-table-border-color: rgba(255, 255, 255, 0.12);
  --bs-table-hover-color: rgb(174, 199, 255);
}

.table-modern th {
  color: #d9def0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(255, 255, 255, 0.03);
}

.table-modern.table-striped > tbody > tr:nth-of-type(odd) > *,
.table-modern.table-striped > tbody > tr:nth-of-type(odd) > * a,
.table-modern.table-striped > tbody > tr:nth-of-type(odd) > * small {
  color: rgb(174, 199, 255) !important;
}

.badge-soft {
  border-radius: 999px;
  padding: 0.38rem 0.68rem;
  font-weight: 600;
}

.badge-soft-success {
  background: var(--success-soft);
  color: #c7ffd8;
  border: 1px solid rgba(127, 255, 176, 0.25);
}

.badge-soft-danger {
  background: var(--danger-soft);
  color: #ffd0d0;
  border: 1px solid rgba(255, 132, 132, 0.28);
}

.btn {
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  --bs-btn-bg: #7ea0ff;
  --bs-btn-border-color: rgba(169, 190, 255, 0.45);
  --bs-btn-hover-bg: #90adff;
  --bs-btn-hover-border-color: rgba(186, 203, 255, 0.65);
  --bs-btn-color: #0c1226;
  font-weight: 600;
  background-image: linear-gradient(135deg, #6a8dff, #85a7ff);
  box-shadow: 0 10px 20px rgba(95, 126, 255, 0.35);
}

.form-control,
.form-select,
.form-card input,
.form-card select,
.form-card textarea {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.form-control:focus,
.form-select:focus,
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
  border-color: rgba(133, 167, 255, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(133, 167, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
}

.form-card p {
  margin-bottom: 1rem;
}

pre.logs-pane,
.terminal-pane {
  background: rgba(7, 11, 20, 0.78);
  color: #dae6ff;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.docker-logs-compact {
  height: 260px;
  overflow: auto;
  white-space: pre;
  word-break: normal;
}

.docker-logs-fullscreen {
  height: calc(100vh - 110px);
  overflow: auto;
  white-space: pre;
  word-break: normal;
}

.git-status-pane {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.git-stage-scroll {
  max-height: 280px;
  overflow: auto;
}

.git-dir-browser {
  max-height: 160px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(7, 11, 20, 0.35);
}

.git-dir-btn {
  margin: 0.15rem;
}

.remote-branches-scroll {
  max-height: 400px;
  overflow-y: auto;
}

.docker-actions .btn,
.btn-docker-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  color: #eaf0ff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.docker-actions .btn:hover,
.btn-docker-icon:hover {
  transform: translateY(-1px);
  color: #fff;
  background: linear-gradient(145deg, rgba(122, 162, 255, 0.36), rgba(122, 162, 255, 0.16));
  border-color: rgba(170, 196, 255, 0.7);
}

.docker-actions .btn i,
.btn-docker-icon i {
  font-size: 1rem;
  line-height: 1;
}

#dockerLogsModal .modal-content {
  background: rgba(9, 12, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(22px);
}

.truncate-cell {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.truncate-name {
  max-width: 220px;
}

.truncate-image {
  max-width: 320px;
}

.terminal-pane {
  height: 520px;
  overflow: hidden;
}

.metric-card .card-header {
  padding: 0.75rem 1rem;
}

.metric-card .card-body {
  padding: 0.5rem 0.75rem 0.25rem;
}

.fullscreen-card {
  width: 100%;
  min-height: calc(100vh - 170px);
}

.fullscreen-card > .card-body {
  min-height: calc(100vh - 250px);
}

.nav-pills .nav-link {
  border-radius: 10px;
  border: 1px solid transparent;
  color: #cfd5eb;
}

.nav-pills .nav-link.active {
  background: rgba(122, 162, 255, 0.2);
  border-color: rgba(122, 162, 255, 0.4);
  color: #e8eeff;
}

.audit-user {
  font-weight: 600;
  color: #dce5ff;
}

.audit-meta-cell {
  min-width: 320px;
}

.audit-meta-details {
  width: min(72vw, 900px);
}

.audit-meta-summary {
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.audit-meta-expanded {
  margin-top: 0.5rem;
  max-width: min(72vw, 900px);
  max-height: 42vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(7, 11, 20, 0.65);
  color: #dae6ff;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 0.75rem;
}

.files-editor-textarea {
  height: 76vh !important;
  min-height: 76vh !important;
  max-height: 92vh;
  resize: vertical;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.45;
}

.files-name-input {
  width: 170px;
}

.files-upload-btn {
  min-width: 130px;
  justify-content: center;
}

@media (max-width: 768px) {
  .navbar-modern {
    margin: 0.6rem 0.6rem 0;
  }

  .app-shell {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .fullscreen-card {
    min-height: calc(100vh - 130px);
  }

  .fullscreen-card > .card-body {
    min-height: calc(100vh - 210px);
  }

  .audit-meta-cell {
    min-width: 220px;
  }

  .audit-meta-details,
  .audit-meta-expanded {
    max-width: 86vw;
    width: 86vw;
  }

  .files-editor-textarea {
    height: 62vh !important;
    min-height: 62vh !important;
    max-height: 85vh;
  }

  .files-name-input {
    width: 140px;
  }

  .files-upload-btn {
    min-width: 112px;
  }
}
