/* ════════════════════════════════════════════════════
   Link | Lincri — Design System
   Paleta: #ffd800 (brand), #111111 (ink), #ffffff
   ════════════════════════════════════════════════════ */
:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --brand: #ffd800;
  --brand-dark: #e4bf00;
  --ink: #111111;
  --danger: #c0392b;
  --wa: #25d366;
  --wa-dark: #1aab52;
  --border: #e5e5e5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-xl: 0 20px 48px rgba(0,0,0,0.16);
  --radius: 14px;
  --topbar-h: 60px;
}

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

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin-top: 0; letter-spacing: -0.02em; }
p { margin-top: 0; }

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  border-radius: 10px;
  padding: 0.52rem 0.95rem;
  background: var(--brand);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.14);
}

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

.btn-ghost:hover {
  background: #f0f0f0;
  transform: none;
  box-shadow: none;
}

.btn-wa {
  background: var(--wa);
  color: #ffffff;
}

.btn-wa:hover { background: var(--wa-dark); }

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

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

.btn-sm {
  padding: 0.36rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Neutral borderless buttons used inside the links table */
.btn-table {
  background: #f0f0f0;
  color: #444;
  font-weight: 600;
}

.btn-table:hover {
  background: #e2e2e2;
  transform: none;
  box-shadow: none;
}

.btn-table.copy  { background: #eef4ff; color: #1a56db; }
.btn-table.copy:hover  { background: #dbeafe; }

.btn-table.save  { background: #f0fdf4; color: #15803d; }
.btn-table.save:hover  { background: #dcfce7; }

.btn-table.del   { background: #fff5f5; color: #c0392b; }
.btn-table.del:hover   { background: #fde8e8; }

.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 0.65rem;
}

/* ── Topbar ──────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.topbar-logo {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border: 1.5px solid var(--ink);
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.topbar-company {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
  white-space: nowrap;
}

/* ── Dashboard main ──────────────────────────────────── */

.dash-main {
  max-width: 1300px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 2.5rem;
}

.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.list-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
}

/* ── Links table ─────────────────────────────────────── */

.links-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.links-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.links-table th {
  background: #fafafa;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.links-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.links-table tbody tr:last-child td { border-bottom: 0; }
.links-table tbody tr:hover { background: #fffef4; }

.td-short a {
  color: #0057b8;
  font-weight: 600;
  font-size: 0.87rem;
  text-decoration: none;
}

.td-short a:hover { text-decoration: underline; }

.td-dest {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-clicks { font-weight: 700; }

.inline-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.36rem 0.55rem;
  font-size: 0.84rem;
  width: 100%;
  min-width: 130px;
  background: #fafafa;
}

.inline-input:focus {
  outline: 2px solid rgba(255, 216, 0, 0.55);
  outline-offset: 1px;
  background: #fff;
}

.actions-cell {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ── Modals ──────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(17,17,17,0.55);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-xl);
  width: min(480px, 100%);
  animation: modal-in 0.22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.05rem; margin: 0; }

.modal-close {
  background: #f0f0f0;
  border: 0;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.15s;
}

.modal-close:hover { background: #e0e0e0; }

.modal-form {
  padding: 1.1rem 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.modal-footer {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
  margin-top: 0.4rem;
}

/* ── Input prefix group (domain prefix inside short-code input) ── */

.input-prefix-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.input-prefix-wrap:focus-within {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(255,216,0,0.22);
}

.input-prefix {
  padding: 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  background: #f5f5f5;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  line-height: 2.4rem;
  user-select: none;
}

.input-with-prefix {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  flex: 1;
  min-width: 0;
}



/* ── Form elements ───────────────────────────────────── */

form { display: grid; gap: 0.55rem; }

label {
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.opt {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.77rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"] {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  font-size: 0.92rem;
  width: 100%;
  background: #fff;
  transition: border-color 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(255,216,0,0.22);
}

/* ── WhatsApp result box ─────────────────────────────── */

.wa-result {
  border: 1px solid #c8f1d6;
  border-radius: 12px;
  padding: 0.9rem;
  background: #f0fdf5;
}

.wa-copy-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.wa-copy-row input { flex: 1; }

/* ── Messages ────────────────────────────────────────── */

.message {
  font-size: 0.85rem;
  font-weight: 600;
  color: #5a4700;
  min-height: 1.2em;
}

.message.error { color: var(--danger); }
.hidden { display: none !important; }

.modal-form-error {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid #fdd;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 600;
}

/* ── Auth pages ──────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(60rem 36rem at 80% -10%, rgba(255,216,0,0.28), transparent 58%),
    var(--bg);
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-xl);
  width: min(420px, 100%);
  padding: 1.5rem;
}

.auth-card h1 { font-size: 1.35rem; margin-bottom: 0.25rem; }
.auth-card > p { color: var(--muted); margin-bottom: 1rem; }

/* ── Landing page ────────────────────────────────────── */

.landing-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(60rem 36rem at 80% -10%, rgba(255,216,0,0.28), transparent 58%),
    var(--bg);
}

.landing-hero {
  max-width: 520px;
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-xl);
}

.landing-hero h1 { font-size: clamp(1.55rem, 3vw, 2.2rem); margin-bottom: 0.7rem; }
.landing-hero p { color: var(--muted); margin-bottom: 1.4rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #f4d210;
  background: #fff7cc;
  color: #463b00;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  margin-bottom: 0.6rem;
}

/* ── Copy fallback modal ─────────────────────────────── */

.modal-sm { max-width: 460px; }

.copy-fallback-hint {
  font-size: 0.87rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.copy-fallback-hint kbd {
  display: inline-block;
  padding: 0.1em 0.45em;
  font-size: 0.8em;
  font-family: monospace;
  background: #f0f0f0;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
}

.copy-fallback-input {
  width: 100%;
  font-size: 0.9rem;
  font-family: monospace;
  color: #0057b8;
  background: #eef4ff;
  border: 1.5px solid #c5d9ff;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  cursor: text;
  user-select: all;
}

/* ── Filters bar ────────────────────────────────────── */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.filter-search {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 0.72rem;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.filter-search input[type="search"] {
  width: 100%;
  padding-left: 2.3rem;
  border-radius: 10px;
  height: 38px;
  font-size: 0.88rem;
}

.filter-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-controls select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 0.85rem;
  height: 38px;
  font-size: 0.86rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.filter-controls select:focus {
  outline: none;
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(255,216,0,0.22);
}

.filter-count {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  min-height: 1em;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 680px) {
  .topbar { padding: 0 1rem; }
  .topbar-name { display: none; }
  .topbar-actions .btn-ghost { display: none; }
  .dash-main { padding: 0 0.75rem 2rem; margin-top: 1rem; }
  .list-header { flex-direction: column; }
  .modal { border-radius: 14px; }
  .actions-cell { flex-wrap: wrap; }
  .inline-input { min-width: 120px; }
}

