:root {
  --bg: #0d0d0d;
  --bg-raised: #161616;
  --bg-surface: #1e1e1e;
  --bg-hover: #252525;
  --border: #2a2a2a;
  --border-subtle: #1f1f1f;
  --text: #e8e0d6;
  --text-secondary: #9a9088;
  --text-muted: #5c5650;
  --accent: #e8713a;
  --accent-hover: #f08044;
  --accent-dim: rgba(232, 113, 58, 0.15);
  --accent-glow: rgba(232, 113, 58, 0.3);
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
  --radius: 8px;
  --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---- Auth Screen ---- */
.auth-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% 0%, var(--accent-dim) 0%, transparent 60%);
}

.auth-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-card input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.auth-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-card button:hover { background: var(--accent-hover); }

.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ---- App Layout ---- */
.app {
  display: flex;
  height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.pc-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-dot.offline {
  background: var(--text-muted);
}

.status-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.status-hostname {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

/* ---- Content ---- */
.content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 700;
}

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

/* ---- Dashboard ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px;
}

.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ---- Terminal ---- */
.terminal-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-output .cmd-line {
  color: var(--accent);
  margin-top: 8px;
}

.terminal-output .cmd-line::before {
  content: '$ ';
  color: var(--text-muted);
}

.terminal-output .stdout { color: var(--text); }
.terminal-output .stderr { color: var(--red); }
.terminal-output .exit-code { color: var(--text-muted); font-style: italic; }

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.terminal-prompt {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.terminal-input-row input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}

.terminal-input-row input:focus {
  border-color: var(--accent);
}

.terminal-send {
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.terminal-send:hover { background: var(--accent-hover); }

.cwd-input {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  width: 260px;
  outline: none;
}

.cwd-input:focus { border-color: var(--accent); }

/* ---- Files ---- */
.files-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.breadcrumb span {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.breadcrumb span:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.breadcrumb .sep { color: var(--text-muted); cursor: default; }
.breadcrumb .sep:hover { background: none; color: var(--text-muted); }

.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.file-item:hover {
  background: var(--bg-hover);
}

.file-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.file-item.dir .file-icon { color: var(--accent); }

.file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--mono);
}

.file-modified {
  color: var(--text-muted);
  font-size: 12px;
  width: 140px;
  text-align: right;
}

.file-loading {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

/* File Viewer */
.file-viewer {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.viewer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-surface);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 18px;
  cursor: pointer;
}

.viewer-close:hover { background: var(--bg-hover); }

#viewer-content {
  flex: 1;
  padding: 16px 24px;
  background: var(--bg);
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.viewer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

.btn-primary {
  padding: 8px 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  padding: 8px 20px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover { background: var(--bg-hover); }

/* ---- Screen ---- */
.screen-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
}

.screen-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.screen-placeholder p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.screen-hint {
  font-size: 12px !important;
  margin-top: 8px !important;
  color: var(--text-muted);
}

.screen-canvas {
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
  image-rendering: auto;
}

.screen-keyboard-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.screen-kb-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
}

.screen-kb-input:focus { border-color: var(--accent); }

/* ---- Claude ---- */
.claude-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.claude-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.claude-welcome {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.claude-welcome h3 {
  color: var(--text);
  margin: 16px 0 8px;
  font-size: 18px;
}

.claude-welcome p {
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

.claude-msg {
  margin-bottom: 20px;
  max-width: 800px;
}

.claude-msg.user {
  display: flex;
  justify-content: flex-end;
}

.claude-msg.user .msg-bubble {
  background: var(--accent);
  color: var(--bg);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 16px;
  max-width: 70%;
  font-size: 14px;
  line-height: 1.5;
}

.claude-msg.assistant .msg-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 18px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.7;
}

.claude-msg.assistant .msg-bubble code {
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 12px;
}

.claude-msg.assistant .msg-bubble pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.claude-msg.assistant .msg-bubble pre code {
  background: none;
  padding: 0;
}

.msg-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.claude-msg.user .msg-label {
  text-align: right;
  color: var(--text-muted);
}

.claude-msg.assistant .msg-label {
  color: var(--accent);
}

.claude-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

.claude-input-row textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 150px;
}

.claude-input-row textarea:focus {
  border-color: var(--accent);
}

.claude-send {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.claude-send:hover { background: var(--accent-hover); }
.claude-send:disabled { opacity: 0.5; cursor: not-allowed; }

.model-select {
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.model-select:focus { border-color: var(--accent); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar-title, .nav-item span, .status-info { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .pc-status { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
