:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-2: #eaf1ed;
  --ink: #111f1a;
  --muted: #60706a;
  --line: #d8e3dc;
  --green: #144b3a;
  --green-2: #237255;
  --blue: #265f93;
  --gold: #b77919;
  --red: #b73535;
  --shadow: 0 20px 50px rgba(17, 31, 26, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, rgba(20, 75, 58, 0.09), transparent 260px), var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

button {
  border: 0;
}

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

.boot-card,
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.login-card h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.login-card p,
.boot-card span,
.muted {
  color: var(--muted);
}

.block {
  display: block;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand strong {
  display: block;
  font-size: 16px;
}

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

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

.nav button,
.tab-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav button:hover,
.tab-button:hover,
.nav button.active,
.tab-button.active {
  border-color: #c5dbce;
  background: #e6f1ea;
  color: var(--green);
}

.side-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.main {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 38px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.topbar p {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
}

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

.mobile-tabs {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

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

.panel-header h2,
.card h3 {
  margin: 0;
  font-size: 16px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 16px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.button:hover {
  border-color: #b7c8be;
  background: #fbfcfa;
}

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

.button.primary:hover {
  background: var(--green-2);
}

.button.danger {
  color: var(--red);
}

.button.icon {
  width: 40px;
  padding: 0;
}

.field,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.wide {
  grid-column: 1 / -1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status.running {
  color: var(--red);
}

.status.running::before {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(183, 53, 53, 0.12);
}

.status.starting::before,
.status.restarting::before,
.status.stopping::before,
.status.scheduled::before,
.status.preparing::before,
.status.processing::before {
  background: var(--gold);
}

.status.ready {
  color: var(--green, #1d7a4f);
}

.status.ready::before {
  background: var(--green, #1d7a4f);
}

.status.error::before {
  background: var(--red);
}

.cards {
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.card-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.playlist {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.check {
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.check span,
.table-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.drop {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 28px;
  border: 1px dashed #b7c8be;
  border-radius: var(--radius);
  background: #fbfcfa;
  text-align: center;
}

.drop svg {
  width: 42px;
  height: 42px;
  color: var(--green);
}

.log {
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px;
  border-radius: var(--radius);
  background: #101916;
  color: #e7f4ee;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.activity {
  display: grid;
  gap: 8px;
}

.activity-line {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.activity-line time {
  color: var(--muted);
}

.empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 26px;
  border: 1px dashed #c7d7cc;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty svg {
  width: 38px;
  height: 38px;
  color: var(--green);
}

.hidden-file {
  display: none;
}

.progress {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: var(--radius);
  background: #e4ede7;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #10241a;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast-message {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #101916;
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 1160px) {
  .overview-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 16px 14px 30px;
  }

  .mobile-tabs {
    display: flex;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .actions {
    justify-content: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .actions,
  .card-top,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .activity-line {
    grid-template-columns: 1fr;
  }
}
