:root {
  color-scheme: dark;
  --bg: #0c0d0f;
  --panel: #17191d;
  --panel-2: #22262d;
  --panel-3: #111316;
  --line: #30343b;
  --text: #eef2f7;
  --muted: #9ba9ba;
  --accent: #3ddc97;
  --accent-2: #62a9ff;
  --danger: #ff6b6b;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: #121417;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.1;
}

h2 {
  font-size: 17px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr) minmax(300px, 360px);
  grid-template-areas:
    "command output side"
    "history history history";
  gap: 16px;
  max-width: 1920px;
  margin: 0 auto;
  padding: 16px clamp(18px, 3vw, 36px) 36px;
}

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

.command-panel {
  grid-area: command;
  min-height: calc(100vh - 150px);
}

.output-panel {
  grid-area: output;
  min-height: calc(100vh - 150px);
}

.side-panel {
  grid-area: side;
  min-height: calc(100vh - 150px);
}

.tasks-panel {
  grid-area: history;
}

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

.panel-subtitle {
  margin: 22px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

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

.hint {
  min-height: 0;
  margin: -2px 0 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 12px;
}

.hint.slim {
  min-height: 0;
  margin-top: -2px;
}

.inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1013;
  color: var(--text);
  outline: none;
  padding: 10px 11px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 210px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(98, 169, 255, 0.15);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 13px;
  color: #07120e;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.primary {
  width: 100%;
}

.ghost {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.project-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.project-list,
.task-list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.item a {
  color: var(--accent-2);
  text-decoration: none;
}

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

.usage-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
}

.usage-card.compact {
  min-height: 56px;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.usage-grid div {
  display: grid;
  gap: 2px;
  padding: 9px;
  border-radius: 8px;
  background: #090e14;
  border: 1px solid #202a36;
}

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

.usage-grid strong {
  font-size: 15px;
}

.limit-note {
  color: var(--muted);
  font-size: 12px;
}

.limit-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #303a43;
  border-radius: 8px;
  background: #10151a;
}

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

.limit-status strong {
  color: var(--accent-2);
  font-size: 13px;
  text-align: right;
}

.agent-usage {
  display: grid;
  gap: 6px;
}

.agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.agent-row strong {
  color: var(--text);
}

.status {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

pre {
  height: calc(100vh - 350px);
  min-height: 360px;
  max-height: 760px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080b10;
  color: #dce7f5;
  white-space: pre-wrap;
  word-break: break-word;
}

.result {
  margin-top: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--accent);
  color: #07120e;
  font-weight: 900;
}

.login-panel p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

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

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

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    grid-template-areas:
      "command output"
      "side side"
      "history history";
  }

  .command-panel,
  .output-panel,
  .side-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "command"
      "output"
      "side"
      "history";
  }

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

  pre {
    height: 360px;
  }
}
