@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@500;700&family=Nunito:wght@400;600;700&display=swap');

:root {
  --bg-start: #111827;
  --bg-end: #1f2937;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f3f4f6;
  --muted: #cbd5e1;
  --accent-start: #667eea;
  --accent-end: #764ba2;
  --ok: #34d399;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  line-height: 1.5;
}

.backdrop {
  display: none;
}

.app-shell {
  width: min(1040px, calc(100% - 1.2rem));
  margin: 0 auto;
  padding: 1rem 0 1.4rem;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.topbar,
.composer-panel,
.workspace-panel,
.board-card,
.admin-panel,
.site-footer,
.qr-dialog {
  padding: 1rem;
}

.topbar {
  position: relative;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.topbar-left {
  display: grid;
  gap: 0.35rem;
}

.topbar-right,
.top-links,
.auth-buttons,
.button-row,
.card-actions,
.result-actions,
.admin-totals,
.meta-line,
.link-header,
.admin-user-head,
.admin-meta,
.inline-fields,
.helper-row,
.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top-links a,
.short-link,
.result-link,
.text-button {
  color: #dbeafe;
  text-decoration: none;
}

.top-links a {
  font-weight: 700;
  padding: 0.32rem 0.45rem;
  border-radius: 7px;
}

.top-links a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.eyebrow,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  color: #d1d5db;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2,
h3,
.account-name {
  font-family: 'Comfortaa', 'Trebuchet MS', sans-serif;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.12rem, 2.3vw, 1.45rem);
}

.session-pill,
.link-type {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.3rem 0.62rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.12);
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.76rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.ghost-button,
.secondary-button,
.link-button,
.danger-button,
.menu-item,
.avatar-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
}

.danger-button,
.menu-item.danger {
  color: var(--danger);
}

.avatar-button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  padding: 0;
  overflow: hidden;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-popover {
  position: absolute;
  right: 1rem;
  top: calc(100% + 0.5rem);
  width: min(560px, calc(100vw - 2rem));
  padding: 0.75rem;
  z-index: 300;
  background: rgba(30, 41, 59, 0.98);
}

.menu-item {
  width: 100%;
  text-align: left;
  margin-bottom: 0.4rem;
}

.primary-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
}

.composer-panel,
.workspace-panel,
.board-card,
.admin-panel,
.site-footer {
  margin-top: 0.8rem;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font: inherit;
  padding: 0.55rem 0.65rem;
}

input::placeholder {
  color: #a5b4c8;
}

input:focus,
select:focus {
  outline: 2px solid rgba(129, 140, 248, 0.35);
  border-color: rgba(129, 140, 248, 0.75);
}

.composer-form,
.board-list,
.settings-form,
.settings-panel,
.settings-card,
.admin-grid,
.user-menu-panel,
.guest-auth-panel,
.auth-form,
.edit-form,
.password-form {
  display: grid;
  gap: 0.6rem;
}

.settings-card,
.link-card,
.empty-state,
.admin-user-card,
.admin-stat-pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.7rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-field input[type='checkbox'] {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  accent-color: #7c90ff;
}

.info-banner,
.status,
.auth-status,
.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.52rem 0.64rem;
  color: var(--muted);
}

.status.error,
.auth-status.error {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(127, 29, 29, 0.22);
}

.status.success,
.auth-status.success {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.45);
}

.result-link,
.short-link {
  font-weight: 700;
  word-break: break-all;
}

.meta-line,
.admin-meta,
.link-destination,
.qr-caption {
  color: var(--muted);
  font-size: 0.8rem;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(2, minmax(130px, 0.65fr));
  gap: 0.5rem;
}

.board-list.compact .link-card {
  padding: 0.52rem;
}

.board-list.compact .meta-line,
.board-list.compact .link-destination {
  font-size: 0.74rem;
}

.board-list.compact .card-actions button,
.board-list.compact .card-actions a {
  padding: 0.36rem 0.56rem;
  font-size: 0.73rem;
}

.qr-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 1rem;
  z-index: 50;
}

.qr-dialog {
  width: min(100%, 380px);
}

.qr-image {
  width: 100%;
  max-width: 230px;
  aspect-ratio: 1;
  display: block;
  margin: 0 auto 0.6rem;
}

.hidden,
.result.hidden,
.qr-modal.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .primary-grid,
  .workspace-controls,
  .inline-fields {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .profile-popover {
    right: 0.45rem;
  }
}
