/* Hammock CRM — deliberately small. */
:root {
  --bg: #f6f5f1;
  --card: #fff;
  --ink: #1d1f1c;
  --muted: #6c6f68;
  --line: #e3e1da;
  --accent: #2f6b4f;
  --accent-ink: #fff;
  --danger: #b3261e;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.page-title { margin-bottom: 1rem; }
.muted, .sub { color: var(--muted); font-size: .88rem; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.5rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: .5rem; align-items: center; font-weight: 700; color: var(--ink); text-decoration: none; }
.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.back { margin: 0 0 1rem; }
.back a { text-decoration: none; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .columns { grid-template-columns: 1fr; } }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }

/* Flash */
.flash { background: #e6f2ea; border: 1px solid #c4dfcd; padding: .6rem .9rem; border-radius: var(--radius); }
.flash--alert { background: #fbeae9; border-color: #f0c9c6; }

/* Buttons */
.btn {
  display: inline-block; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer;
}
.btn:hover { border-color: #c9c6bc; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn--danger { color: var(--danger); margin-top: 1rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--danger); }

/* Stats bar */
.stats { display: flex; flex-wrap: wrap; gap: .5rem; }
.stat {
  display: flex; flex-direction: column; min-width: 92px; padding: .6rem .8rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.stat strong { font-size: 1.35rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rates { color: var(--muted); margin: .75rem 0 1rem; }
.rates strong { color: var(--ink); }

/* Toolbar */
.toolbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: .75rem; }
.search input { width: 340px; max-width: 100%; }
.sorts { color: var(--muted); display: flex; gap: .75rem; }
.sorts a { color: var(--muted); text-decoration: none; }
.sorts a.is-active { color: var(--ink); font-weight: 600; text-decoration: underline; }

/* Inputs */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=date], select, textarea {
  font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }

/* Quick add */
.quick-add {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  padding: .75rem; margin-bottom: .75rem; background: var(--card);
  border: 1px dashed #cfccc2; border-radius: var(--radius);
}
.quick-add input[type=text] { flex: 1 1 160px; }
.errors.inline { flex-basis: 100%; margin: 0; }

/* List */
.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.list td { padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* Rows never wrap: long sub-lines (reason, last reply) are cut with an ellipsis instead. */
.list th, .list td { white-space: nowrap; }
.list td .sub, .list td.sub { overflow: hidden; text-overflow: ellipsis; max-width: 34ch; }
.list tr:last-child td { border-bottom: 0; }
.list .name { font-weight: 600; color: var(--ink); text-decoration: none; }
.list .name:hover { text-decoration: underline; }
.list .empty { text-align: center; color: var(--muted); padding: 2rem; }
form.inline { margin: 0; }
select.bare, input.bare { border-color: transparent; background: transparent; padding: .3rem .4rem; }
select.bare:hover, input.bare:hover { border-color: var(--line); }
.chance-select { color: #c08a1e; letter-spacing: .05em; }
.overdue, .overdue input { color: var(--danger); font-weight: 600; }

/* Status colours (badges, pills, stat accents) */
.badge, .pill { border-radius: 999px; padding: .2rem .65rem; font-size: .82rem; font-weight: 600; border: 0; }
.pill { cursor: pointer; }
.badge--ny, .pill--ny                     { background: #ecebe6; color: #4a4c46; }
.badge--design_laget, .pill--design_laget { background: #e7eefb; color: #2a4f8f; }
.badge--sendt, .pill--sendt               { background: #fff1d6; color: #8a5a00; }
.badge--svart, .pill--svart               { background: #f1e6fb; color: #6a3596; }
.badge--i_dialog, .pill--i_dialog         { background: #dcf1f4; color: #1d6470; }
.badge--solgt, .pill--solgt               { background: #dcf2e3; color: #1f6b3a; }
.badge--nei_takk, .pill--nei_takk         { background: #fbe4e2; color: #9b2c22; }
.badge--ingen_svar, .pill--ingen_svar     { background: #efefef; color: #7a7a7a; }

/* Sales chance */
.chance { display: inline-block; min-width: 3.5em; text-align: center; border-radius: 6px; padding: .15rem .45rem; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.chance--low  { background: #efefef; color: #6a6a6a; }
.chance--mid  { background: #fff1d6; color: #8a5a00; }
.chance--high { background: #dcf2e3; color: #1f6b3a; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.dots i.on { background: #e0a526; }
.chance-box { background: var(--bg); border-radius: 8px; padding: .75rem .9rem; margin-bottom: 1rem; }
.chance-box__value { display: flex; gap: .5rem; align-items: center; }
.chance-box__value .chance { font-size: 1.1rem; }
.chance-box__calc { margin: .5rem 0 0; font-size: .88rem; line-height: 1.6; }
.yes, .no { font-size: .82rem; border-radius: 999px; padding: .1rem .55rem; margin-right: .25rem; }
.yes { background: #dcf2e3; color: #1f6b3a; }
.yes::before { content: "✓ "; }
.no { background: #efefef; color: #7a7a7a; }
.no::before { content: "– "; }

/* Forecast */
.forecast { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.kpi__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi__value { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: .85rem; color: var(--muted); }
.progress { display: block; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: .35rem; }
.progress i { display: block; height: 100%; background: var(--accent); }

/* Stats page */
.navlink { color: var(--ink); text-decoration: none; }
.navlink.is-active { font-weight: 700; text-decoration: underline; }
.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.funnel li { display: flex; flex-direction: column; background: var(--bg); border-radius: 8px; padding: .7rem .9rem; }
.funnel strong { font-size: 1.4rem; }
.funnel span { color: var(--muted); font-size: .85rem; }
.decision__verdict { font-weight: 600; }
.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; margin-top: 1rem; }
.mini { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mini th, .mini td { text-align: right; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
.mini th:first-child { text-align: left; }
.mini thead th { font-size: .75rem; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mini tbody tr:last-child > * { border-bottom: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.grid label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--ink); }

/* Details */
.facts { display: grid; grid-template-columns: 150px 1fr; gap: .55rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.notes p { margin: 0 0 .5rem; }

/* Forms */
.form fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
.form legend { font-weight: 700; margin-bottom: .5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.grid label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
.grid label.wide { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; }
.errors { background: #fbeae9; border: 1px solid #f0c9c6; color: var(--danger); padding: .5rem .8rem; border-radius: 8px; margin-bottom: 1rem; }
.errors p { margin: .15rem 0; }

/* Replies */
.reply-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.reply-form .row { display: flex; gap: .5rem; }
.reply-form .btn { align-self: flex-start; }
.replies { list-style: none; margin: 0; padding: 0; }
.replies li { border-left: 3px solid var(--line); padding: .2rem 0 .2rem .8rem; margin-bottom: .9rem; }
.replies li p { margin: .25rem 0 0; }
.replies .meta { display: flex; gap: .4rem; align-items: baseline; font-size: .88rem; }
.replies .meta form { margin-left: auto; }
.replies:has(li) + .only-child-hint { display: none; }

/* Login */
.topnav { display: flex; gap: 1rem; align-items: center; }
.topnav form { margin: 0; }
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login { width: 320px; display: flex; flex-direction: column; gap: .6rem; }
.login h1 { display: flex; gap: .5rem; align-items: center; font-size: 1.25rem; margin-bottom: .5rem; }
.login label { font-size: .85rem; color: var(--muted); }

/* Finn kandidater */
.tag { display: inline-block; padding: 0 .4rem; border-radius: 999px; background: var(--line); color: var(--muted); font-size: .72rem; font-weight: 600; vertical-align: middle; }
.tag--running { background: var(--accent); color: var(--accent-ink); }
.tag--failed { background: #fbeae9; color: var(--danger); }
.tag--done { background: #e6f2ea; color: #2f6b45; }
.tag--queued { background: #fff4d6; color: #7a5a00; }
.design-log { font-size: .78rem; line-height: 1.4; background: #f6f5f0; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; max-height: 14rem; overflow: auto; white-space: pre-wrap; margin: .75rem 0; }
.design-preview { display: block; width: 100%; border: 1px solid var(--line); border-radius: 8px; margin: .75rem 0; }
.design-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
.design-actions form { display: inline; }
.card.design-card, .card.email-card { margin-top: 1rem; }
.email-form { display: flex; flex-direction: column; gap: .3rem; }
.email-form label { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.email-form input { width: 100%; }
.email-form textarea { font: inherit; font-size: .92rem; }
.email-form .btn { align-self: flex-start; margin-top: .6rem; }
.email-preview { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 8px; background: #ededea; resize: vertical; }
.emails { list-style: none; margin: 0; padding: 0; }
.emails li { border-left: 3px solid var(--line); padding: .2rem 0 .2rem .8rem; margin-bottom: .9rem; }
.emails .meta { display: flex; gap: .5rem; align-items: baseline; font-size: .88rem; }
.emails details { margin-top: .25rem; }
.emails summary { cursor: pointer; }
.emails pre { white-space: pre-wrap; font: inherit; font-size: .9rem; background: #f6f5f0; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; margin: .4rem 0 0; }
.error-line { color: var(--danger); font-size: .88rem; margin: .25rem 0 0; }
.tag--sent { background: #e6f2ea; color: #2f6b45; }
.install { margin: .75rem 0; font-size: .88rem; }
.install summary { cursor: pointer; color: var(--muted); }
.command { display: flex; gap: .5rem; align-items: stretch; margin: .5rem 0; }
.command pre { flex: 1; min-width: 0; margin: 0; background: #f6f5f0; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; overflow: auto; font-size: .85rem; }
.btn--copy { flex: none; align-self: center; white-space: nowrap; }
.btn--copy.is-copied { background: #e6f2ea; border-color: #c4dfcd; color: #2f6b45; }
.progress { height: .6rem; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.progress__bar { height: 100%; background: var(--accent); transition: width .3s; }
.searches { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.search-row { display: flex; gap: .6rem; align-items: baseline; }
.skipped { margin: 0 0 .5rem; padding-left: 1.1rem; }
.chips { margin: 0 0 .75rem; }
.chip { display: inline-flex; gap: .4rem; align-items: center; padding: .15rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: .85rem; }
.form input[list] { width: 100%; }
.card + .card, .card + h2, section.card + section.card { margin-top: 1rem; }
