:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f5;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button, input {
  font: inherit;
}

button, .download-btn, .asset-row a {
  border: 1px solid #c7d0d8;
  background: #ffffff;
  color: #17202a;
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  text-decoration: none;
}

button:disabled, .download-btn.disabled {
  opacity: .48;
  cursor: not-allowed;
  pointer-events: none;
}

button.primary, .download-btn {
  background: #14765d;
  color: #ffffff;
  border-color: #14765d;
}

.download-btn.secondary {
  background: #17202a;
  border-color: #17202a;
}

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

.sidebar {
  background: #ffffff;
  border-right: 1px solid #d8e0e7;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #17202a;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 18px;
}

h2 {
  font-size: 24px;
  margin-top: 4px;
}

p {
  color: #647383;
  font-size: 13px;
}

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

.nav-btn {
  padding: 8px 6px;
}

.nav-btn.active {
  background: #17202a;
  color: #ffffff;
  border-color: #17202a;
}

.field {
  display: grid;
  gap: 6px;
  color: #526170;
  font-size: 13px;
}

.field input, .tool input[type="text"] {
  width: 100%;
  border: 1px solid #c7d0d8;
  border-radius: 6px;
  padding: 10px 11px;
}

.toolbar, .session-actions, .tool, .auth-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-panel, .pair-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e0e7;
  border-radius: 8px;
  background: #fbfcfd;
}

.auth-state {
  color: #8a4b11;
  font-size: 13px;
  font-weight: 700;
}

.auth-state.ok {
  color: #14765d;
}

.auth-actions button {
  flex: 1;
}

.pair-panel small {
  color: #647383;
  line-height: 1.35;
}

.toolbar button {
  flex: 1;
}

.section-title, .label {
  margin-bottom: 8px;
  color: #526170;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.agent-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.agent {
  border: 1px solid #d8e0e7;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  display: grid;
  gap: 6px;
}

.agent.offline {
  opacity: .72;
}

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

.agent strong {
  font-size: 14px;
}

.agent small {
  color: #647383;
  line-height: 1.35;
}

.agent button {
  width: 100%;
  margin-top: 4px;
}

.badge {
  flex: 0 0 auto;
  border: 1px solid #c7d0d8;
  border-radius: 999px;
  color: #647383;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 7px;
  text-transform: uppercase;
}

.badge.ok {
  border-color: #9ac7b9;
  color: #14765d;
  background: #edf8f4;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
}

.tab-panel {
  min-height: 100vh;
  display: none;
}

.tab-panel.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

#downloadsTab.active, #updatesTab.active {
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar, .pagebar {
  min-height: 64px;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid #d8e0e7;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.topbar strong, .topbar span, .pagebar strong, .pagebar span {
  display: block;
}

.topbar span, .pagebar span {
  color: #647383;
  font-size: 13px;
  margin-top: 3px;
}

.toggle {
  display: flex;
  gap: 7px;
  align-items: center;
  color: #334150;
  user-select: none;
}

.screen-wrap {
  position: relative;
  min-height: 0;
  background: #111820;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#screenCanvas {
  max-width: 100%;
  max-height: 100%;
  background: #0b1016;
  outline: none;
}

.empty-state {
  position: absolute;
  color: #aeb8c2;
  background: rgba(17, 24, 32, .82);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 12px 14px;
}

.tools {
  padding: 10px 18px;
  background: #ffffff;
  border-top: 1px solid #d8e0e7;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.tool span {
  color: #526170;
  font-size: 13px;
  font-weight: 700;
}

.status {
  margin-left: auto;
  color: #647383;
  font-size: 13px;
}

.file-panel {
  background: #f8fafb;
  border-top: 1px solid #d8e0e7;
  max-height: 170px;
  overflow: auto;
  display: none;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 90px;
  gap: 8px;
  align-items: center;
  padding: 8px 18px;
  border-bottom: 1px solid #e2e8ee;
  font-size: 13px;
}

.file-row code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
}

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

.release-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: #ffffff;
  border: 1px solid #d8e0e7;
  border-radius: 8px;
}

.download-list {
  display: grid;
  gap: 8px;
}

.asset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #d8e0e7;
  border-radius: 8px;
}

.asset-row strong, .asset-row span {
  display: block;
}

.asset-row span {
  margin-top: 4px;
  color: #647383;
  font-size: 13px;
}

.manifest-box {
  margin: 0;
  padding: 16px;
  min-height: 320px;
  overflow: auto;
  background: #111820;
  color: #dfe7ef;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #d8e0e7;
  }

  .workspace, .tab-panel {
    min-height: 70vh;
  }

  .release-card, .asset-row, .pagebar, .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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