/* GrowingSmart Hub — mörk indigo-lila bas, vit brödtext, korall/blå accenter.
   Regler: ALL brödtext #fff · accenter #ff8598 / #9db8ff · minst 14px ·
   Big Shoulders endast i stora rubriker (≥20px). */

:root {
  --bg-deepest: #1c1230;
  --bg-deep: #221a48;
  --indigo: #322a5e;
  --blue-light: #3a55a5;
  --coral: #d15261;        /* endast ytor/ramar/knappar */
  --coral-light: #ff8598;  /* korall som text */
  --blue-pop: #9db8ff;     /* blå som text */
  --white: #ffffff;
  --card: rgba(255, 255, 255, 0.055);
  --card-hover: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 14px 40px rgba(10, 5, 25, 0.45);
  --radius: 18px 22px 18px 24px; /* organiskt asymmetrisk */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  color: var(--white);
  background: linear-gradient(158deg, var(--bg-deepest) 0%, var(--bg-deep) 45%, var(--indigo) 100%) fixed;
  min-height: 100vh;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }

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

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(158deg, var(--bg-deepest), var(--indigo));
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 36px 32px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 34px; font-weight: 800; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.login-card label { font-size: 14px; font-weight: 600; color: var(--coral-light); }
.login-card input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25); color: var(--white);
}
.login-error { color: var(--coral-light); font-size: 14px; }

/* ---------- Toppbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 26px;
  background: rgba(28, 18, 48, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 26px; font-weight: 800; letter-spacing: 1px;
  color: var(--white); white-space: nowrap;
}
.brand em { font-style: normal; color: var(--coral-light); }

.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tab {
  border: none; background: none; color: var(--white);
  font-size: 15px; font-weight: 500;
  padding: 9px 18px; border-radius: 999px;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.tab:hover { background: var(--card-hover); transform: translateY(-1px); }
.tab.active { background: var(--coral); font-weight: 600; }

.mock-banner {
  background: var(--blue-light); color: var(--white);
  font-size: 14px; text-align: center; padding: 9px 16px;
}

/* ---------- Layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 28px 22px 90px; }

.view-title {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 32px; font-weight: 800; letter-spacing: 0.5px;
  margin: 6px 0 20px;
}
.section-title {
  font-size: 17px; font-weight: 700; color: var(--coral-light);
  margin: 26px 0 12px;
}

/* ---------- Kort och listor ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: 0 6px 24px rgba(10, 5, 25, 0.25);
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { text-align: left; }
.stat .num {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 38px; font-weight: 800; line-height: 1; color: var(--white);
}
.stat .lbl { font-size: 14px; color: var(--blue-pop); font-weight: 500; margin-top: 4px; }

.row-list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 13px 16px;
  transition: background 0.15s, transform 0.15s;
}
.row.clickable:hover { background: var(--card-hover); transform: translateY(-1px); cursor: pointer; }
.row .grow { flex: 1; min-width: 0; }
.row .main-line { font-weight: 600; font-size: 15px; }
.row .sub-line { font-size: 14px; color: var(--white); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { font-size: 15px; color: var(--white); padding: 14px 4px; }

/* ---------- Pills & chips ---------- */
.pill {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 3px 12px; border-radius: 999px; white-space: nowrap;
}
.pill-lead { background: rgba(157, 184, 255, 0.16); color: var(--blue-pop); }
.pill-prospect { background: rgba(255, 133, 152, 0.15); color: var(--coral-light); }
.pill-active { background: rgba(58, 85, 165, 0.45); color: var(--white); }
.pill-inactive { background: rgba(255, 255, 255, 0.1); color: var(--white); }
.pill-partner { background: rgba(157, 184, 255, 0.28); color: var(--white); }

.pill-p1 { background: var(--coral); color: var(--white); }
.pill-p2 { background: rgba(255, 133, 152, 0.2); color: var(--coral-light); }
.pill-p3 { background: rgba(255, 255, 255, 0.1); color: var(--white); }

.date-chip { font-size: 14px; font-weight: 600; color: var(--blue-pop); white-space: nowrap; }
.date-chip.overdue { color: var(--coral-light); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.chip {
  border: 1px solid var(--line); background: none; color: var(--white);
  font-size: 14px; font-weight: 500; padding: 7px 15px; border-radius: 999px;
  transition: background 0.15s;
}
.chip:hover { background: var(--card-hover); }
.chip.active { background: var(--coral); border-color: var(--coral); font-weight: 600; }

/* ---------- Knappar ---------- */
.btn {
  border: none; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  padding: 9px 18px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(209, 82, 97, 0.28); }
.btn-primary { background: var(--coral); color: var(--white); }
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--white); }
.btn-ghost:hover { box-shadow: none; background: var(--card-hover); }
.btn-sm { padding: 7px 14px; font-size: 14px; }

.checkbox {
  width: 22px; height: 22px; min-width: 22px;
  border: 2px solid var(--coral-light); border-radius: 7px;
  background: none; display: inline-flex; align-items: center; justify-content: center;
  color: transparent; font-size: 14px; font-weight: 700;
  transition: background 0.15s;
}
.checkbox:hover { background: rgba(255, 133, 152, 0.15); }
.checkbox.done { background: var(--coral); border-color: var(--coral); color: var(--white); }

/* ---------- Formulär ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; color: var(--blue-pop); }
.field input, .field select, .field textarea {
  padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--white);
}
.field textarea { min-height: 74px; resize: vertical; }
.field select option { background: var(--bg-deep); color: var(--white); }
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 255, 255, 0.75); }
input[type="date"] { color-scheme: dark; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

.check-line { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-bottom: 14px; }
.check-line input { width: 18px; height: 18px; accent-color: var(--coral); }

/* ---------- Tavla ---------- */
.board-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.board-bar select {
  padding: 9px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25); color: var(--white);
}
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.col {
  background: rgba(0, 0, 0, 0.18); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px; min-height: 130px;
}
.col.drag-over { border-color: var(--coral-light); background: rgba(255, 133, 152, 0.08); }
.col-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--coral-light); padding: 2px 6px 10px;
}
.col-head .count { color: var(--blue-pop); }
.col-trello .col-head { color: var(--blue-pop); }
.task-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 9px;
  cursor: grab;
}
.task-card:active { cursor: grabbing; }
.task-card .t-title { font-size: 15px; font-weight: 500; }
.task-card .t-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.task-card .t-kund { font-size: 14px; color: var(--blue-pop); }
.task-card.dragging { opacity: 0.45; }

/* ---------- Logg ---------- */
.feed-day {
  font-size: 14px; font-weight: 700; color: var(--blue-pop);
  text-transform: uppercase; letter-spacing: 0.5px; margin: 22px 0 10px;
}
.feed-item { display: flex; gap: 14px; align-items: flex-start; }
.feed-item .typ-dot {
  min-width: 10px; height: 10px; border-radius: 50%; margin-top: 7px;
}
.typ-Mejl { background: var(--blue-pop); }
.typ-Samtal { background: var(--blue-light); }
.typ-Möte { background: var(--coral); }
.typ-Uppföljning { background: var(--coral-light); }
.typ-Anteckning { background: #b39ddb; }
.typ-Övrigt { background: rgba(255, 255, 255, 0.5); }

.feed-item .f-body { flex: 1; }
.feed-item .f-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.f-typ { font-size: 14px; font-weight: 600; color: var(--coral-light); }
.f-kund { font-size: 14px; font-weight: 600; color: var(--blue-pop); }
.f-title { font-size: 15px; font-weight: 500; }
.f-note { font-size: 14px; color: var(--white); margin-top: 3px; white-space: pre-wrap; }
.f-flag { font-size: 14px; color: var(--coral-light); font-weight: 600; }

/* ---------- Drawer (kundkort) ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 5, 25, 0.6); backdrop-filter: blur(3px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(560px, 100vw);
  background: linear-gradient(170deg, var(--bg-deep), var(--bg-deepest));
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow-y: auto; padding: 26px 26px 40px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-head h2 {
  font-family: 'Big Shoulders Display', sans-serif;
  font-size: 30px; font-weight: 800; letter-spacing: 0.5px;
}
.drawer-close {
  background: none; border: 1px solid var(--line); color: var(--white);
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px;
}
.contact-grid { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 4px; font-size: 15px; }
.contact-grid .cg-label { color: var(--coral-light); font-weight: 600; margin-right: 6px; }
.drawer .btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 4px; }
.timeline { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; z-index: 70; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: 88vh; overflow-y: auto;
  background: linear-gradient(170deg, var(--bg-deep), var(--bg-deepest));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px;
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.modal .btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* ---------- Toast & loading ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 90; background: var(--coral); color: var(--white);
  font-size: 15px; font-weight: 600;
  padding: 12px 24px; border-radius: 999px; box-shadow: var(--shadow);
}
.toast.error { background: var(--blue-light); }

.loading { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; background: linear-gradient(158deg, var(--bg-deepest), var(--indigo)); }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--coral-light);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobil ---------- */
@media (max-width: 720px) {
  .topbar { flex-direction: column; gap: 10px; padding: 12px 16px; align-items: flex-start; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 9px 8px; }
  main { padding: 18px 14px 70px; }
  .row { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .stat .num { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
