:root {
  --bg: #0b0f14;
  --bg-elevated: #131922;
  --bg-card: #161d28;
  --border: #232c3a;
  --text: #e7ecf3;
  --text-dim: #8b96a8;
  --accent: #35e0d0;
  --accent-dim: #1c7a72;
  --danger: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.device-badge {
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #04211d; }
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-ghost { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-icon { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); padding: 6px 10px; }
.btn-big { width: 100%; padding: 14px; font-size: 16px; margin-top: 18px; }
.file-label { display: inline-flex; align-items: center; cursor: pointer; }

/* Signed out */
.signed-out {
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.signed-out-card {
  max-width: 380px;
  text-align: center;
}
.signed-out-card h1 { font-size: 26px; margin-bottom: 8px; }
.signed-out-card p { color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.auth-error { color: var(--danger); margin-top: 12px; font-size: 13px; }

/* App */
#app { max-width: 640px; margin: 0 auto; padding: 18px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.composer textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  padding-bottom: 8px;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.file-preview {
  flex: 1;
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-progress {
  margin-top: 10px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 30%;
  background: var(--accent);
  animation: indeterminate 1.1s infinite ease-in-out;
}
@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}
.inbox-header h2 { font-size: 15px; color: var(--text-dim); font-weight: 600; margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }

.inbox { display: flex; flex-direction: column; gap: 8px; }

.msg {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.msg.unread { border-color: var(--accent-dim); }
.msg.unread::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}
.msg-icon { font-size: 20px; flex-shrink: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.msg-filename { font-size: 14.5px; font-weight: 600; word-break: break-word; }
.msg-filesize { font-size: 12.5px; color: var(--text-dim); }
.msg-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.msg-actions { display: flex; gap: 6px; flex-shrink: 0; }
.msg-actions button {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 4px;
}
.msg-actions button:hover { color: var(--text); }
.msg-actions .delete-btn:hover { color: var(--danger); }

.empty-state { text-align: center; color: var(--text-dim); font-size: 14px; margin-top: 40px; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 320px;
  text-align: center;
}
.modal-card h3 { margin-top: 0; }
.device-choices { display: flex; gap: 10px; margin-top: 16px; }
.device-choice { flex: 1; background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); padding: 14px; font-size: 15px; }
.device-choice:hover { border-color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 200;
  max-width: 90vw;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
