:root {
  color-scheme: dark;
  --bg: #11161c;
  --surface: #181f27;
  --surface-alt: #141a21;
  --line: #303b48;
  --text: #e8edf3;
  --muted: #a7b2c0;
  --accent: #a6c8ff;
  --accent-ink: #12223b;
  --red: #f5aca6;
  --green: #9cddb2;
  --radius: 5px;
  font: 16px/1.4 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: .875rem; }
a { color: var(--accent); text-underline-offset: .17em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top { background: var(--surface-alt); border-bottom: 1px solid var(--line); }
.top-inner, main { width: min(1380px, calc(100% - 2rem)); margin: auto; }
.top-inner { min-height: 42px; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.brand { color: var(--text); font-weight: 720; text-decoration: none; font-size: .98rem; }
.brand span { color: var(--muted); }
main { padding: .8rem 0 1.5rem; }
.narrow { width: min(420px, calc(100% - 2rem)); padding-top: clamp(.85rem, 4vw, 2.75rem); }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.2rem, 2.1vw, 1.5rem); font-weight: 680; overflow-wrap: anywhere; }
h2 { font-size: .99rem; font-weight: 680; }
.page-title { margin-bottom: .65rem; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .8rem; }
.narrow .card { padding: .85rem .95rem; }
.card p { margin: .55rem 0 0; }
.back { display: inline-block; margin-bottom: .5rem; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21.5rem;
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "containers tools" "backups tools" "jobs tools";
  gap: .5rem;
  align-items: start;
}
.container-panel { grid-area: containers; }
.backup-panel { grid-area: backups; }
.jobs-panel { grid-area: jobs; }
.dashboard-tools { grid-area: tools; display: grid; gap: .5rem; align-items: start; }
.disk-title, .section-head, .rows li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.section-head { flex-wrap: wrap; }
.rows { list-style: none; margin: .3rem 0 0; padding: 0; }
.rows li { min-width: 0; padding: .32rem 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows li:last-child { padding-bottom: 0; }
.disks li { display: grid; grid-template-columns: minmax(0, 1fr); gap: .22rem; }
.disk-title { min-width: 0; flex-wrap: wrap; gap: .1rem .5rem; }
.disk-title strong { white-space: nowrap; font-size: .82rem; }
progress { display: block; width: 100%; appearance: none; height: .3rem; border: 0; border-radius: 2px; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); border-radius: 2px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.muted { color: var(--muted); font-size: .8rem; }
.compose-row { flex-wrap: wrap; }
.maintenance-list li { padding: 0; }
.maintenance-list a { display: block; width: 100%; padding: .34rem 0; }
.maintenance-list li:last-child a { padding-bottom: 0; }
.container-table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: .45rem; }
.state-col { width: 8.6rem; }
.ports-col { width: 8.6rem; }
.controls-col { width: 16.25rem; }
th, td { padding: .38rem .45rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { color: var(--muted); background: var(--surface-alt); font-size: .79rem; font-weight: 620; }
tbody tr:last-child td { border-bottom: 0; padding-bottom: 0; }
td strong { font-weight: 650; }
.container-state { font-size: .82rem; }
.container-ports code { font-size: .77rem; }
.image-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.is-up { color: var(--green); }
.is-unhealthy { color: var(--red); }
.wrap { overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem; font-size: .81rem; }
.backup-row { flex-wrap: wrap; }
.row-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; min-width: 0; }
.row-size { white-space: nowrap; }
.fields { display: grid; gap: .62rem; margin-top: .75rem; }
.fields label { display: grid; gap: .2rem; font-size: .86rem; font-weight: 600; }
.fields label.check { display: flex; align-items: center; gap: .42rem; }
.fields input:not([type=checkbox]), textarea { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: .39rem .54rem; font: inherit; }
.fields input:not([type=checkbox]) { min-height: 2rem; }
.fields input[name=code] { max-width: 12rem; letter-spacing: .12em; }
.fields input[type=checkbox] { margin: .15rem 0; width: 1rem; height: 1rem; accent-color: var(--accent); flex: 0 0 auto; }
.fields textarea, pre, code { font-family: ui-monospace, monospace; }
.fields textarea { font: .85rem/1.46 ui-monospace, monospace; min-height: clamp(13rem, 48vh, 34rem); max-height: 75vh; resize: vertical; }
.editor-controls { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem .85rem; }
.editor-controls .check { min-height: 2rem; }
button, .control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: .18rem .46rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--accent);
  font: 620 .79rem/1.3 system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  justify-self: start;
  white-space: nowrap;
}
button { min-height: 2rem; padding-inline: .62rem; font-size: .84rem; }
button:hover, .control:hover { filter: brightness(1.16); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.danger { background: var(--red); border-color: var(--red); color: #381611; }
.action-danger { color: var(--red); }
.quiet { color: var(--text); min-height: 27px; padding-inline: .5rem; }
.alert { border-left: 2px solid var(--red); color: var(--red); padding-left: .48rem; }
.status { font-weight: 650; color: var(--green); white-space: nowrap; font-size: .83rem; }
.status.failed, .status.interrupted { color: var(--red); }
.status.running { color: #f2d394; }
pre { margin: .55rem 0 0; padding: .65rem; min-height: 5rem; max-height: 72vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: .83rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.card .recovery { margin-top: .7rem; }
.console-terminal {
  height: clamp(18rem, 75vh, 56rem);
  margin-top: .45rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .35rem;
  overflow: hidden;
}
@media (max-width: 1120px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "containers" "tools" "backups" "jobs"; }
  .dashboard-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .top-inner, main, .narrow { width: calc(100% - 1rem); }
  .narrow { max-width: 420px; }
  .dashboard-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .state-col { width: 7rem; }
  .ports-col { width: 7rem; }
}
@media (max-width: 650px) {
  .top-inner { min-height: 40px; }
  .card { padding: .55rem .65rem; }
  .container-table, .container-table tbody { display: block; }
  .container-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .container-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .16rem .45rem; padding: .4rem 0; border-top: 1px solid var(--line); align-items: center; }
  .container-table td { min-width: 0; padding: 0; border: 0; }
  .container-name, .container-actions { grid-column: 1 / -1; }
  .container-ports { text-align: right; }
  button, .control { min-height: 32px; }
  .fields input:not([type=checkbox]), .fields textarea { font-size: 1rem; }
}
@media (min-width: 500px) and (max-width: 650px) {
  .container-name { grid-column: 1; }
  .container-actions { grid-column: 2; grid-row: 1 / 3; }
  .container-state, .container-ports { grid-column: 1; text-align: left; }
  .container-ports.ports-empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 499px) {
  .dashboard-tools { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .container-table tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
