@font-face {
  font-family: "NOF1";
  src: local("Inter"), local("SF Pro Text"), local("Segoe UI");
  font-display: swap;
}

@font-face {
  font-family: "NOF1 Alpha";
  src: local("Courier New"), local("Menlo"), local("Monaco");
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --fg: #0f0f0f;
  --line: #d7d7d7;
  --line-strong: #bfbfbf;
  --muted: #686868;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "NOF1", Inter, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-shell.locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(2px);
}

.unlock-overlay.hidden {
  display: none !important;
}

.unlock-card {
  width: min(92vw, 340px);
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 16px;
}

.unlock-card.shake {
  animation: unlock-shake 280ms ease-in-out;
}

.unlock-card h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.unlock-card p {
  margin: 0 0 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.unlock-digits {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.unlock-digit {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-strong);
  text-align: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.unlock-digit:focus {
  outline: none;
  border-color: #111;
}

.unlock-error {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: #b11111;
}

@keyframes unlock-shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
  75% {
    transform: translateX(-5px);
  }
  100% {
    transform: translateX(0);
  }
}

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

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

.brand-main {
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.7px;
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
  font-family: "NOF1 Alpha", "NOF1", Menlo, Monaco, monospace;
  text-transform: uppercase;
}

.brand-main small {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 0;
  text-transform: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #111;
  min-width: 72px;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: "NOF1", Inter, "SF Pro Text", "Segoe UI", Arial, sans-serif;
}

.nav-btn:hover {
  background: #111;
  color: #fff;
}

.workspace {
  flex: 1;
  width: 100%;
  height: calc(100vh - 98px);
  margin: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: 0.764fr 0.236fr;
  gap: 10px;
}

.left-grid {
  display: grid;
  grid-template-columns: 0.262fr 0.262fr 0.262fr 0.214fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.panel {
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 8px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-head.compact {
  margin-bottom: 6px;
}

.panel h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.panel-hint {
  color: var(--muted);
  font-size: 11px;
}

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

.chatbox-panel {
  grid-column: 1 / 4;
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
}

.memory-panel {
  grid-column: 4 / 5;
  grid-row: 2 / 3;
}

.token-panel {
  grid-column: 4 / 5;
  grid-row: 1 / 2;
}

.agent-panel {
  grid-column: 4 / 5;
  grid-row: 3 / 4;
}

.task-panel {
  grid-column: 2 / 3;
  grid-row: 4 / 5;
}

.project-panel {
  grid-column: 3 / 4;
  grid-row: 4 / 5;
}

.mcp-panel {
  grid-column: 1 / 2;
  grid-row: 4 / 5;
}

.alert-panel {
  grid-column: 4 / 5;
  grid-row: 4 / 5;
}

.workplace-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.model-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

select,
textarea,
input {
  font-family: inherit;
  font-size: 12px;
  color: var(--fg);
}

select {
  border: 1px solid var(--line);
  background: #fff;
  height: 30px;
  min-width: 190px;
}

.chatbox-messages {
  flex: 1;
  border: 1px solid var(--line);
  padding: 10px;
  overflow: auto;
  background: #fff;
}

.bubble {
  border: 1px solid var(--line);
  margin-bottom: 8px;
  padding: 7px 8px;
  max-width: 94%;
  white-space: pre-wrap;
  line-height: 1.45;
}

.bubble.user {
  margin-left: auto;
  border-color: #999;
}

.bubble.assistant {
  margin-right: auto;
}

.bubble.system {
  margin: 0 auto 8px;
  border-style: dashed;
  color: var(--muted);
}

.bubble-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.attachment-preview {
  border: 1px solid var(--line);
  border-top: none;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.attachment-preview img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.chatbox-composer {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  align-items: end;
}

.chatbox-composer textarea {
  width: 100%;
  min-height: 56px;
  max-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 8px;
}

.send-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
}

.status-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  min-height: 16px;
}

.memory-rows .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed #ececec;
  padding: 5px 0;
}

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

th,
td {
  text-align: left;
  padding: 5px 4px;
  border-bottom: 1px dashed #ececec;
  font-size: 12px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 500;
}

.project-list {
  margin-top: 6px;
  overflow: auto;
  max-height: calc(100% - 46px);
}

.project-item {
  border: 1px solid var(--line);
  padding: 7px;
  margin-bottom: 6px;
}

.project-item .meta {
  color: var(--muted);
  margin-top: 4px;
  font-size: 11px;
}

.progress {
  margin-top: 6px;
  width: 100%;
  height: 5px;
  background: #efefef;
}

.progress i {
  display: block;
  height: 100%;
  background: #111;
}

.severity-high td {
  color: #a60808;
}

.severity-medium td {
  color: #7a5312;
}

.agent-list {
  border: 1px solid var(--line);
  height: calc(100% - 30px);
  overflow: auto;
  padding: 4px 6px;
}

.agent-item {
  border-bottom: 1px dashed #ececec;
  padding: 4px 0;
}

.agent-item:last-child {
  border-bottom: none;
}

.agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.agent-meta {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
}

.status-symbol {
  color: #111;
  font-weight: 700;
}

.workplace-feed {
  border: 1px solid var(--line);
  height: 100%;
  overflow: auto;
  padding: 8px;
}

.work-item {
  border-bottom: 1px dashed #ececec;
  padding: 6px 0;
  line-height: 1.4;
  white-space: pre-wrap;
}

.work-meta {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
}

.work-attachment {
  margin-top: 4px;
  font-size: 11px;
}

.work-attachment a {
  color: #3e3e3e;
}

.foot {
  height: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    width: 100%;
    margin: 0;
    padding: 8px;
  }

  .left-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .chatbox-panel,
  .memory-panel,
  .token-panel,
  .agent-panel,
  .mcp-panel,
  .task-panel,
  .project-panel,
  .alert-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .workplace-panel {
    min-height: 320px;
  }
}
