/* honah — base design system
   cobalt-inspired: pure black, monospace everything, hairline 1.5px borders,
   12px radius, lowercase, calm. no shadows, no gradients. */

:root {
  --bg: #000000;
  --surface: #0e0e0e;
  --surface-2: #191919;
  --border: #2b2b2b;
  --border-strong: #3f3f3f;
  --text: #e8e8e8;
  --dim: #8a8a8a;
  --accent: #41a4ff;
  --danger: #f2465a;
  --ok: #37c463;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'IBM Plex Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
}

/* ---------- reset ---------- */

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

html { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
}

input, select, textarea { font: inherit; color: inherit; }

img { max-width: 100%; }

[hidden] { display: none !important; }

::selection { background: var(--accent); color: #000; }

/* thin dark scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* icon slots filled from h.icons */
[data-icon] { display: inline-flex; align-items: center; }

/* the png is black-on-white — invert to fit the dark ui */
.logo {  filter: invert(100%); display: inline-block; }
.logo-lg { width: 56px; height: 56px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
a.btn, a.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.btn-primary {
  background: var(--text);
  color: #000;
  border-color: transparent;
}
.btn-primary:hover { background: #fff; border-color: transparent; }

.btn-danger {
  color: var(--danger);
  border-color: rgba(242, 70, 90, .45);
}
.btn-danger:hover {
  background: rgba(242, 70, 90, .12);
  border-color: var(--danger);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
}

/* compact variants (admin tables etc.) */
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-icon-sm {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-icon-sm svg { width: 16px; height: 16px; }

/* button styled as quiet text link */
.linkish {
  color: var(--dim);
  cursor: pointer;
  font-size: 13px;
}
.linkish:hover { color: var(--text); text-decoration: underline; }

/* ---------- inputs ---------- */

.input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  transition: border-color .15s;
}
.input:focus { border-color: var(--border-strong); outline: none; }
.input::placeholder { color: var(--dim); }

select.input { cursor: pointer; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label {
  font-size: 12px;
  color: var(--dim);
  text-transform: lowercase;
}
.field .hint { font-size: 11px; color: var(--dim); }

/* ---------- surfaces ---------- */

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  color: var(--dim);
  white-space: nowrap;
}

/* ---------- switch ---------- */

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex: none;
  cursor: pointer;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch .track {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  pointer-events: none;
  transition: background .15s, border-color .15s;
}
.switch .track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  transform: translateY(-50%);
  transition: left .15s, background .15s;
}
.switch input:checked + .track { background: var(--ok); border-color: var(--ok); }
.switch input:checked + .track::before { left: 18px; background: #000; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- tables ---------- */

.t-wrap { overflow-x: auto; }

table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.t th {
  text-align: left;
  text-transform: lowercase;
  font-weight: 400;
  color: var(--dim);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.t td {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
table.t tbody tr:hover { background: var(--surface); }

.nowrap { white-space: nowrap; }
.t-actions { text-align: right; }
.t-actions .actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ---------- toasts ---------- */

.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  max-width: 100%;
  overflow-wrap: break-word;
  animation: toast-in .18s ease-out;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.out { opacity: 0; transition: opacity .2s; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- layout ---------- */

.center-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}

.auth-card {
  width: min(400px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding-top: 4px;
}

.app-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .5px;
}

.tagline { color: var(--dim); font-size: 13px; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-block { width: 100%; justify-content: center; }

.center-msg { text-align: center; color: var(--dim); font-size: 13px; }

/* ---------- home ---------- */

.join-row { display: flex; gap: 8px; }
.join-row .input { flex: 1; min-width: 0; }

.home-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 13px;
}
.home-foot .spacer { flex: 1; }

/* ---------- profile photo ---------- */

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.avatar-preview {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--dim);
  font-size: 16px;
}
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.avatar-label { font-size: 12px; color: var(--dim); }
.avatar-actions { display: flex; gap: 12px; }

/* ---------- register ---------- */

.admin-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--accent);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.admin-note svg { width: 16px; height: 16px; flex: none; }

/* ---------- admin ---------- */

.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 2px;
}
.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.admin-brand:hover { text-decoration: none; color: #fff; }
.admin-brand .logo { width: 26px; height: 26px; }
.admin-head .spacer { flex: 1; }
.admin-head .page-label { color: var(--dim); font-size: 13px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.head-controls { display: inline-flex; align-items: center; gap: 8px; }
.select-limit { width: auto; }

.invite-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.invite-controls .field-ttl { width: 120px; }
.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.field-inline > span { font-size: 12px; color: var(--dim); }

.invite-result {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.invite-result:hover { border-color: var(--border-strong); }
.invite-result svg { width: 16px; height: 16px; flex: none; color: var(--dim); }
.invite-result .url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--accent);
}

.openreg-status { margin-bottom: 14px; font-size: 13px; }
.openreg-hint { font-size: 12px; }

.status-active { color: var(--ok); }
.status-used { color: var(--dim); }
.status-expired { color: var(--danger); }

/* ---------- admin libraries (soundboard + stickers) ---------- */

.lib-admin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.lib-admin-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.lib-admin-head { font-size: 13px; font-weight: 600; }
.lib-admin-add { display: flex; flex-direction: column; gap: 8px; }
.lib-admin-row { display: flex; align-items: center; gap: 10px; }
.lib-admin-file {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.lib-admin-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  align-content: flex-start;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.lib-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  max-width: 100%;
}
.lib-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}
.lib-row-play, .lib-row-del { cursor: pointer; color: var(--dim); display: inline-flex; }
.lib-row-play:hover { color: var(--text); }
.lib-row-del:hover { color: var(--danger); }
.lib-row svg { width: 14px; height: 14px; }
.sticker-admin-list .lib-row { padding: 4px; gap: 4px; }
.sticker-admin-list .lib-row img { width: 46px; height: 46px; object-fit: contain; }

@media (max-width: 640px) {
  .lib-admin { grid-template-columns: 1fr; }
}

.dim { color: var(--dim); }
.dim-rows td { color: var(--dim); font-size: 12.5px; }

.empty-row td {
  color: var(--dim);
  text-align: center;
  padding: 18px 10px;
}

@media (max-width: 480px) {
  .admin-wrap { padding: 16px 12px; }
  .card { padding: 18px; }
}
