:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dde5;
  --text: #1d2430;
  --muted: #637083;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(20, 27, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 11px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #aab3c2;
}

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

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.token-box {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: min(480px, 100%);
}

.token-box input {
  flex: 1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(520px, 1fr);
  grid-template-rows: auto 270px;
  gap: 16px;
  padding: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

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

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

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: middle;
}

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

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9aa4b2;
}

.dot.online {
  background: #15803d;
}

.session-panel {
  min-height: 620px;
}

.screen-wrap {
  position: relative;
  height: 500px;
  margin: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101418;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen-wrap img {
  display: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
}

.empty {
  color: #c3cad5;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}

label {
  display: block;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.inline-control {
  display: flex;
  gap: 8px;
}

.inline-control input {
  flex: 1;
}

.audit-panel {
  grid-column: 1 / -1;
}

#auditLog {
  margin: 0;
  padding: 14px 16px;
  height: 205px;
  overflow: auto;
  font-size: 12px;
  background: #fbfcfd;
  color: #263244;
}

.actions-row {
  display: flex;
  gap: 8px;
}

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

@media (max-width: 980px) {
  .topbar,
  .token-box,
  .layout,
  .control-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .screen-wrap {
    height: 360px;
  }
}
