:root {
  --bg: #0b0d12;
  --bg-2: #0f1219;
  --panel: #151925;
  --panel-2: #1c2130;
  --border: #262c3b;
  --border-strong: #323a4d;
  --text: #e9ecf2;
  --muted: #98a1b3;
  --faint: #6b7488;

  --brand: #2563eb;
  --brand-2: #1854eb;
  --brand-3: #1d4ed8;
  --brand-light: #3b82f6;
  --grad: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);

  --danger: #f0594f;
  --ok: #34d399;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #141a2b 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- shared bits ---------- */
.muted { color: var(--muted); }
.hint { color: var(--faint); font-size: 0.82rem; }

.error {
  background: rgba(240, 89, 79, 0.12);
  border: 1px solid rgba(240, 89, 79, 0.5);
  color: #ffb3ad;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -8px rgba(37, 99, 235, 0.9); }
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: #232a3b; border-color: #3a445c; }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(240, 89, 79, 0.4); }
.btn-danger:hover { background: rgba(240, 89, 79, 0.12); }

.btn-soft {
  background: rgba(37, 99, 235, 0.12);
  color: #bcd4ff;
  border-color: rgba(37, 99, 235, 0.4);
}
.btn-soft:hover { background: rgba(37, 99, 235, 0.2); }
.btn-block { width: 100%; }

.btn-sm { padding: 0.42rem 0.7rem; font-size: 0.85rem; }

/* ---------- inputs ---------- */
.field { display: block; }
.field > span { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
input, textarea {
  font: inherit;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 96px; }

/* ============================================================ */
/* AUTH PAGE                                                    */
/* ============================================================ */
body.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.aurora {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(40% 60% at 25% 20%, rgba(59, 130, 246, 0.28), transparent 70%),
    radial-gradient(45% 55% at 80% 10%, rgba(29, 78, 216, 0.25), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(28, 33, 48, 0.85), rgba(21, 25, 37, 0.95));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.1rem; }
.brand-icon { border-radius: 12px; display: block; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.brand-sub { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
.brand-sub span { color: var(--brand-light); }

.lede { color: var(--muted); margin: 0 0 1.3rem; font-size: 0.95rem; }

.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.3rem; }
.actions .btn { width: 100%; }

.or {
  display: flex; align-items: center; gap: 0.8rem;
  color: var(--faint); font-size: 0.8rem; margin: 1.1rem 0 0.9rem;
}
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: var(--border); }

.fineprint {
  margin: 1.4rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.8rem;
  line-height: 1.5;
}

.page-footer {
  position: relative;
  z-index: 1;
  margin-top: 1.4rem;
  color: var(--faint);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

/* ============================================================ */
/* APP / CLIPBOARD PAGE                                         */
/* ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: rgba(15, 18, 25, 0.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.topbar-brand img { border-radius: 8px; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-title strong { font-size: 0.98rem; }
.username { color: var(--brand-light); font-size: 0.8rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.7rem; }

.pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

main { max-width: 780px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }

.composer {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.3rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer:focus-within { border-color: var(--border-strong); }
.composer.dragging { border-color: var(--brand); box-shadow: var(--ring); }
.composer.dragging .drop-overlay { opacity: 1; }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.composer-actions { display: flex; gap: 0.5rem; }

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.14);
  border: 2px dashed var(--brand);
  border-radius: var(--radius);
  color: #cfe0ff;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

/* items */
.items { display: flex; flex-direction: column; gap: 0.85rem; }
.item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem;
  animation: rise 0.18s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.item-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  max-height: 320px;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
}
.item-image { max-width: 100%; border-radius: var(--radius-sm); display: block; border: 1px solid var(--border); }
.item-file {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.98rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
}
.item-file .file-icon {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(37, 99, 235, 0.15); color: var(--brand-light);
}

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.7rem;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.item-meta { color: var(--faint); font-size: 0.78rem; }
.item-actions { display: flex; gap: 0.45rem; }

/* empty state */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  display: none;
}
.empty img { opacity: 0.5; margin-bottom: 0.6rem; filter: grayscale(0.2); }
.empty p { margin: 0.2rem 0; }

/* ---------- generated-credentials banner ---------- */
.creds-banner {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0.06));
  border: 1px solid rgba(37, 99, 235, 0.4);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.3rem;
}
.creds-head { display: flex; align-items: center; justify-content: space-between; }
.creds-head strong { font-size: 1rem; }
.creds-banner .hint { margin: 0.4rem 0 0.8rem; }
.creds-grid {
  display: flex; align-items: flex-end; gap: 1.2rem; flex-wrap: wrap;
}
.cred { display: flex; flex-direction: column; gap: 0.25rem; }
.cred-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cred code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 0.4rem 0.6rem; border-radius: 8px; user-select: all;
}

/* ---------- pair-device dialog ---------- */
.share-dialog {
  width: min(92vw, 380px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}
.share-dialog::backdrop { background: rgba(5, 7, 12, 0.6); backdrop-filter: blur(3px); }
.share-head { display: flex; align-items: center; justify-content: space-between; }
.share-head h2 { margin: 0; font-size: 1.15rem; }
.icon-btn {
  background: transparent; border: none; color: var(--muted);
  font-size: 1rem; cursor: pointer; padding: 0.25rem 0.4rem; border-radius: 8px;
}
.icon-btn:hover { background: var(--panel); color: var(--text); }
.share-dialog .hint { margin: 0.5rem 0 0; }

.qr-wrap {
  display: flex; justify-content: center;
  margin: 1.1rem 0;
}
.qr-wrap canvas {
  width: 220px; height: 220px; image-rendering: pixelated;
  border-radius: 12px; padding: 10px; background: #fff;
  box-shadow: 0 4px 20px -8px rgba(0,0,0,0.5);
}

.share-link { display: flex; gap: 0.5rem; }
.share-link input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}
.share-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; margin: 1rem 0 0; flex-wrap: wrap;
}

@media (max-width: 480px) {
  .topbar-right .btn-sm { padding: 0.42rem 0.6rem; }
  .topbar-right #share-btn span,
  .composer-bar .hint { /* keep label, allow wrap */ }
  .composer-bar .hint { width: 100%; }
}
