/* aclff - dark theme, no gradients, SVGs only */

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

:root {
  --bg: #080808;
  --surface: #101010;
  --surface2: #181818;
  --surface3: #202020;
  --border: #1e1e1e;
  --border2: #2a2a2a;
  --text: #d8d8d8;
  --text-muted: #555;
  --text-dim: #3a3a3a;
  --accent: #e0e0e0;
  --accent2: #aaaaaa;
  --danger: #c03030;
  --danger-hover: #d03838;
  --success: #2a9d2a;
  --warn: #a07020;
  --font: 'SF Mono', 'Fira Mono', 'Consolas', 'Menlo', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout shells --- */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 420px;
  padding: 32px;
}

.card-wide { max-width: 600px; }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 20px;
  margin-top: -16px;
  line-height: 1.6;
}

/* --- Forms --- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  border-radius: 0;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--text-muted);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-dim);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.field-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  border-radius: 0;
  white-space: nowrap;
}

.btn:hover { background: var(--surface2); border-color: var(--text-muted); }
.btn:active { background: var(--bg); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #080808;
  font-weight: 600;
}

.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: #080808; }

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { background: var(--surface2); border-color: var(--border); color: var(--text); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { font-size: 11px; padding: 5px 10px; }

/* --- Alerts --- */
.alert {
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-error { border-color: var(--danger); color: #e07070; background: #1a0808; }
.alert-success { border-color: var(--success); color: #60b060; background: #081508; }
.alert-info { border-color: var(--border2); color: var(--text-muted); background: var(--surface2); }
.alert-warn { border-color: var(--warn); color: #c09040; background: #100c00; }

/* --- App layout --- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.sidebar-section {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 14px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  border-left: 2px solid transparent;
  transition: all 0.1s;
  user-select: none;
}

.sidebar-item:hover { color: var(--text); background: var(--surface2); }
.sidebar-item.active { color: var(--accent); border-left-color: var(--accent); background: var(--surface2); }

.sidebar-item svg { width: 14px; height: 14px; flex-shrink: 0; }

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

.user-tag {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.user-tag:hover { color: var(--text); }

.user-number {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
}

/* Main content */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Panel header */
.panel-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Panel body */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* --- Messages --- */
#messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg {
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  border-radius: 0;
  transition: background 0.1s;
}

.msg:hover { background: var(--surface); }

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent2);
}

.msg-number {
  font-size: 10px;
  color: var(--text-dim);
}

.msg-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 4px;
}

.msg-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.msg-body.encrypted {
  color: var(--text-dim);
  font-style: italic;
  font-size: 11px;
}

.msg-encrypted-label {
  font-size: 10px;
  color: var(--warn);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Message input */
#msg-input-wrap {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#msg-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  resize: none;
  max-height: 120px;
  border-radius: 0;
}

#msg-input:focus { border-color: var(--text-muted); }

.key-bar {
  padding: 6px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.key-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.key-status.active { color: var(--success); }
.key-status.inactive { color: var(--warn); }

/* --- Lists --- */
.item-list { display: flex; flex-direction: column; gap: 1px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.list-item:hover { background: var(--surface2); }

.list-item-icon {
  width: 32px;
  height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.list-item-icon svg { width: 16px; height: 16px; }

.list-item-body { flex: 1; min-width: 0; }

.list-item-name {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.list-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  width: 100%;
  max-width: 420px;
  padding: 28px;
  position: relative;
}

.modal-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 20px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

/* --- Tabs --- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.tab {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.1s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- TOTP QR placeholder --- */
.totp-box {
  background: var(--bg);
  border: 1px solid var(--border2);
  padding: 16px;
  margin-bottom: 16px;
}

.totp-secret {
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--accent);
  word-break: break-all;
  margin-bottom: 8px;
  font-weight: 600;
}

.totp-note {
  font-size: 10px;
  color: var(--text-muted);
}

/* --- Ban overlay --- */
#ban-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

#ban-overlay .ban-icon { color: var(--danger); }
#ban-overlay h1 { font-size: 20px; color: var(--danger); letter-spacing: 0.05em; }
#ban-overlay p { color: var(--text-muted); font-size: 12px; text-align: center; max-width: 300px; }

/* --- Nothing here page --- */
.nothing {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.03em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* --- Utility --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.danger { color: var(--danger); }
.success { color: var(--success); }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* --- Badge --- */
.badge {
  font-size: 9px;
  padding: 1px 5px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.badge-owner { border-color: var(--accent); color: var(--accent); }
.badge-banned { border-color: var(--danger); color: var(--danger); }
.badge-pending { border-color: var(--warn); color: var(--warn); }

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* --- Security settings --- */
.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.security-row:last-child { border-bottom: none; }

.security-row-label { font-size: 12px; color: var(--text); }
.security-row-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* --- Key entry --- */
.key-prompt {
  background: var(--surface);
  border: 1px solid var(--warn);
  padding: 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.key-prompt p { margin-bottom: 10px; }

/* Channel info panel */
#channel-info {
  width: 220px;
  min-width: 220px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  padding: 16px 14px;
}

.info-section { margin-bottom: 20px; }
.info-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

/* Owner dash table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--surface2); }

/* Invite link box */
.invite-box {
  background: var(--bg);
  border: 1px solid var(--border2);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--accent2);
  word-break: break-all;
  margin-bottom: 8px;
}

/* Loading state */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 12px;
  gap: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border2);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Profile cards */
.profile-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 8px;
}

.profile-card-name { font-size: 13px; color: var(--accent); margin-bottom: 4px; }
.profile-card-display { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.profile-card-viewers { font-size: 11px; color: var(--text-dim); }
