:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef2f6;
  --line: #d8dee7;
  --text: #17202a;
  --muted: #667085;
  --accent: #117c6f;
  --accent-strong: #0d5f55;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(17, 124, 111, 0.04), rgba(17, 124, 111, 0) 240px),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.danger {
  border-color: #fecdca;
  color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 124, 111, 0.12);
  outline: none;
}

textarea {
  min-height: 280px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #101828;
  color: #fff;
  padding: 18px 14px;
}

.brand {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0 8px;
  color: #d0d5dd;
  font-size: 12px;
}

.userbox {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 16px;
  color: #d0d5dd;
  overflow-wrap: anywhere;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
  color: #d0d5dd;
  text-align: left;
  transform: none;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid rgba(17, 124, 111, 0.22);
  border-radius: 8px;
  background: linear-gradient(90deg, #ffffff, #eef8f6);
  padding: 14px 16px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.06);
  animation: rise-in 220ms ease both;
}

.strip-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.strip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.strip-meta span {
  border: 1px solid rgba(17, 124, 111, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
  padding: 6px 9px;
  font-size: 12px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.quick-tile {
  display: grid;
  gap: 5px;
  min-height: 56px;
  min-width: 210px;
  justify-items: start;
  align-content: center;
  text-align: left;
  border-color: rgba(17, 124, 111, 0.18);
  background: #fff;
}

.quick-tile span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card {
  padding: 14px;
  animation: rise-in 220ms ease both;
}

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

.card .value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.lift {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.lift:hover {
  border-color: rgba(17, 124, 111, 0.28);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  transform: translateY(-2px);
}

.panel {
  margin-top: 14px;
  overflow: hidden;
  animation: fade-in 180ms ease both;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar select {
  width: auto;
  min-width: 220px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

td {
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  background: var(--panel-soft);
  color: var(--muted);
}

.status.ok {
  background: #dcfae6;
  color: var(--ok);
}

.status.warn {
  background: #fef0c7;
  color: var(--warn);
}

.pulse {
  position: relative;
}

.pulse::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: soft-pulse 1.8s ease-in-out infinite;
}

.error {
  margin: 10px 0;
  color: var(--danger);
}

.success {
  margin: 10px 0;
  color: var(--ok);
}

.muted {
  color: var(--muted);
}

.field-note {
  margin-bottom: 12px;
  border: 1px solid rgba(17, 124, 111, 0.18);
  border-radius: 8px;
  background: #eef8f6;
  color: var(--accent-strong);
  padding: 10px 12px;
  line-height: 1.6;
}

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 86px;
  align-content: center;
  border: 1px dashed rgba(102, 112, 133, 0.32);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  color: var(--muted);
  padding: 16px;
}

.empty-state strong {
  color: var(--text);
}

.empty-state p {
  margin: 0;
  line-height: 1.55;
}

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

.login-box {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.stack {
  display: grid;
  gap: 10px;
}

.meter {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-soft);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #2e90fa);
  animation: meter-grow 500ms ease both;
}

.file-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 14px;
}

.file-list {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
}

.file-row:hover {
  background: var(--panel-soft);
}

.file-explorer {
  display: grid;
  gap: 12px;
}

.file-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.breadcrumb {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 220px;
  color: var(--muted);
}

.breadcrumb button {
  min-height: 28px;
  padding: 0 8px;
}

.explorer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.file-list-panel {
  min-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-table th,
.file-table td {
  padding: 9px 12px;
}

.file-table {
  table-layout: fixed;
}

.file-table .check-cell {
  width: 44px;
  text-align: center;
}

.file-table .check-cell input {
  width: auto;
  box-shadow: none;
}

.file-table tbody tr {
  cursor: default;
  transition: background 120ms ease;
}

.file-table tbody tr:hover,
.file-table tbody tr.active {
  background: #eef8f6;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-height: 22px;
  margin-right: 8px;
  border-radius: 4px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.file-details {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 10px;
}

.detail-grid span {
  color: var(--muted);
}

.terminal-panel {
  display: grid;
  gap: 12px;
}

.terminal-output {
  min-height: 420px;
  max-height: 560px;
  margin: 0;
  overflow: auto;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #0b1220;
  color: #d0d5dd;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.terminal-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.key-once {
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 8px;
  background: #fffbfa;
  padding: 12px;
}

.inline-head {
  border: 0;
  padding: 0 0 10px;
}

.access-form {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.preview-box {
  display: grid;
  min-height: 260px;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.preview-box img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.preview-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.log-box {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1220;
  color: #d0d5dd;
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
}

.watch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.watch-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.watch-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scanline {
  position: absolute;
  right: -30%;
  bottom: 0;
  left: -30%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(17, 124, 111, 0.8), transparent);
  animation: scanline 2.4s linear infinite;
}

.short-textarea {
  min-height: 96px;
}

.ports-input {
  min-width: 150px;
  padding: 7px 9px;
}

.port-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.port-grid span {
  border: 1px solid rgba(17, 124, 111, 0.2);
  border-radius: 999px;
  background: #eef8f6;
  color: var(--accent-strong);
  padding: 7px 10px;
  font-weight: 700;
}

.fade-in {
  animation: fade-in 180ms ease both;
}

.dashboard-refreshing #view *,
.dashboard-refreshing #view *::before,
.dashboard-refreshing #view *::after {
  animation: none !important;
  transition: none !important;
}

.dashboard-open #view,
.dashboard-open #view *,
.dashboard-open #view *::before,
.dashboard-open #view *::after {
  animation: none !important;
  transition: none !important;
}

.site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 14px;
}

.site-create {
  margin-top: 0;
}

.site-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.site-steps span {
  border: 1px solid rgba(17, 124, 111, 0.18);
  border-radius: 8px;
  background: #eef8f6;
  color: var(--accent-strong);
  padding: 10px 12px;
  font-weight: 700;
  text-align: center;
}

.site-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.helper-text {
  color: var(--muted);
  line-height: 1.6;
}

.site-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.site-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.site-card.is-running {
  border-color: rgba(6, 118, 71, 0.24);
}

.site-card.is-unhealthy {
  border-color: rgba(180, 35, 24, 0.22);
}

.site-card-head,
.site-actions,
.site-paths,
.site-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.site-card-head {
  justify-content: space-between;
}

.site-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.site-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.site-facts div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.site-facts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.site-facts strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.site-links a,
.site-links span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  text-decoration: none;
}

.advanced-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.port-grid span.used {
  border-color: #d8dee7;
  background: #f2f4f7;
  color: var(--muted);
}

.file-manager {
  overflow: hidden;
}

.file-nav-row,
.file-actionbar,
.site-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.file-address {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr);
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 4px 8px;
}

.file-address span {
  color: var(--accent-strong);
  font-weight: 700;
}

.file-address input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.file-search,
.site-search {
  margin-left: auto;
  min-width: min(320px, 100%);
}

.file-table-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.file-main-table th,
.file-main-table td,
.site-table th,
.site-table td {
  vertical-align: middle;
}

.file-name-button,
.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: #2563eb;
  padding: 0;
  text-align: left;
}

.file-name-button:hover,
.link-button:hover {
  transform: none;
  text-decoration: underline;
}

.file-icon.folder {
  background: #fff5cc;
  color: #9a6700;
}

.file-actions-inline,
.site-row-actions,
.site-access-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.file-actions-inline button,
.site-row-actions button {
  min-height: 28px;
  padding: 0 8px;
}

.file-preview-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-detail-grid {
  grid-template-columns: 80px minmax(0, 1fr);
}

.site-runtime-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.runtime-pill {
  border-radius: 6px;
  background: #eef2f6;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 800;
}

.runtime-pill.is-on {
  background: #ecfdf3;
  color: var(--ok);
}

.site-toolbar-panel {
  overflow: hidden;
}

.site-wizard {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.site-wizard .helper-text,
.site-wizard .error {
  grid-column: 1 / -1;
}

.site-table {
  min-width: 980px;
}

.site-table td:first-child {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.site-access-list a,
.site-access-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  text-decoration: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes meter-grow {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.25);
  }
}

@keyframes scanline {
  from {
    transform: translateX(-35%);
  }
  to {
    transform: translateX(35%);
  }
}

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

  .sidebar {
    position: static;
  }

  .grid,
  .quick-grid,
  .dashboard-actions,
  .form-grid,
  .file-grid,
  .explorer-grid,
  .dashboard-grid,
  .watch-grid,
  .ops-strip {
    grid-template-columns: 1fr;
  }

  .terminal-input,
  .access-form,
  .site-layout,
  .site-create-form,
  .site-wizard,
  .site-steps,
  .site-facts {
    grid-template-columns: 1fr;
  }

  .strip-meta {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

.drop-hint {
  border: 1px dashed rgba(104, 116, 139, 0.28);
  border-radius: 8px;
  color: var(--muted);
  margin: 0 0 10px;
  padding: 10px 12px;
  text-align: center;
}

.drag-over {
  outline: 2px solid rgba(17, 124, 111, 0.35);
  outline-offset: -4px;
}

.upload-progress {
  background: #eef3f7;
  border: 1px solid #d7e0e8;
  border-radius: 999px;
  height: 28px;
  margin: 10px 0;
  overflow: hidden;
  position: relative;
}

.upload-progress span {
  background: linear-gradient(90deg, var(--accent), #5791f1);
  display: block;
  height: 100%;
  transition: width 160ms ease;
}

.upload-progress strong {
  color: #17212f;
  font-size: 12px;
  inset: 0;
  line-height: 28px;
  position: absolute;
  text-align: center;
}

.context-menu {
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 6px;
  position: fixed;
  z-index: 50;
}

.context-menu button {
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.limit-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  min-width: 430px;
}

.limit-grid label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  gap: 3px;
}

.limit-grid input {
  min-width: 0;
  padding: 6px 7px;
}

@media (max-width: 900px) {
  .limit-grid {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }
}
