:root {
  --bg: #0e0f12;
  --panel: #17181c;
  --panel-alt: #1e2025;
  --border: #2a2c33;
  --text: #e7e8ea;
  --text-muted: #9a9ca3;
  --accent: #6c8cff;
  --accent-hover: #7f9cff;
  --danger: #ff6b6b;
  --success: #4ade80;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); }

/* ---------- Login page ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.login-card p.sub {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 13px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
}

.btn-primary {
  width: 100%;
  margin-top: 22px;
  background: var(--accent);
  color: #0e0f12;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.error-msg {
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
  min-height: 16px;
}

/* ---------- Chat page ---------- */

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.topbar h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.main-area {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: 0;
}

@media (max-width: 720px) {
  .main-area { grid-template-columns: 1fr; }
  .files-panel { display: none; }
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 70%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  align-self: flex-start;
  word-wrap: break-word;
}

.msg.own {
  align-self: flex-end;
  background: #23305c;
  border-color: #33448c;
}

.msg .meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.msg .body {
  font-size: 14px;
  white-space: pre-wrap;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.composer input[type="text"] {
  flex: 1;
}

.btn-send {
  background: var(--accent);
  color: #0e0f12;
  font-weight: 600;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
}
.btn-send:hover { background: var(--accent-hover); }

.files-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.files-panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 14px 16px 8px;
  margin: 0;
}

.upload-row {
  padding: 0 16px 12px;
}

.file-input-label {
  display: block;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.file-input-label:hover { border-color: var(--accent); color: var(--text); }
.file-input-label input { display: none; }

.file-list {
  list-style: none;
  margin: 0;
  padding: 0 10px 16px;
  overflow-y: auto;
  flex: 1;
}

.file-list li {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.file-list li:hover { background: var(--panel-alt); }

.file-list a {
  display: block;
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-list a:hover { color: var(--accent); }

.file-list .meta {
  font-size: 11px;
  color: var(--text-muted);
}

.empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 6px;
}
