:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #68798c;
  --line: #dbe3ea;
  --brand: #0f4c81;
  --brand-ink: #0d3f6b;
  --accent: #e8f0f8;
  --danger: #b3261e;
  --warn: #b26a00;
  --ok: #1d7a3d;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.topbar { background: var(--brand); color: #fff; }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 52px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.brand span { font-weight: 300; opacity: .8; }
.brand-logo { height: 30px; width: auto; display: block; }
.topbar nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.topbar nav a { color: #dce8f5; text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.topbar nav a.active, .topbar nav a:hover { background: rgba(255,255,255,.15); color: #fff; }
.nav-more { position: relative; }
.nav-more > summary { list-style: none; cursor: pointer; color: #dce8f5; padding: 6px 10px; border-radius: 6px; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more[open] > summary, .nav-more > summary:hover { background: rgba(255,255,255,.15); color: #fff; }
.topbar .nav-more-menu { position: absolute; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(28,39,51,.18); padding: 6px; min-width: 170px; z-index: 30;
  display: flex; flex-direction: column; gap: 2px; }
.topbar .nav-more-menu a { color: var(--ink); padding: 7px 10px; border-radius: 6px; }
.topbar .nav-more-menu a:hover, .topbar .nav-more-menu a.active { background: var(--accent); color: var(--brand-ink); }
.userbox { display: flex; align-items: center; gap: 8px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--brand-ink); text-transform: uppercase; letter-spacing: .03em; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: 13px; }
.page-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { background: var(--accent); color: var(--brand-ink); font-size: 13px; }
.table tr:last-child td { border-bottom: 0; }
.task-table { table-layout: fixed; }
.task-table .col-task { width: 32%; }
.task-table .col-due { width: 165px; }
.task-table .col-owner { width: 115px; }
.task-table .col-actions { width: 248px; }
.task-table .lamp { margin-right: 8px; }
.task-title { display: inline-block; max-width: calc(100% - 34px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.row-overdue td { background: #fdf0ef; }
.kv { width: 100%; border-collapse: collapse; table-layout: fixed; }
.kv th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 10px 5px 0; width: 38%; vertical-align: top; }
.kv td { padding: 5px 0; }
.kv input, .kv select { width: 100%; box-sizing: border-box; }
select { max-width: 100%; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .field label, .form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.form-grid input, .form-grid select { width: 100%; box-sizing: border-box; }
.form-grid .check input, .form-grid input[type="checkbox"] { width: auto; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid textarea { width: 100%; box-sizing: border-box; }
.field-help { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.errorlist { color: var(--danger); font-size: 12px; margin: 4px 0 0; padding: 0; list-style: none; }
.check-row { display: flex; gap: 16px; flex-wrap: wrap; }
.badge { display: inline-block; background: var(--accent); color: var(--brand-ink); border-radius: 999px; padding: 1px 10px; font-size: 12px; }
.badge-warn { background: #fdeee0; color: var(--warn); }
.badge-danger { background: #fbe9e7; color: var(--danger); }
.badge-conf { background: #2b2b2b; color: #ffd54f; }
.badge-admin { background: #14212e; color: #9ecbff; }
.lamp { display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; color: #fff;
  font-size: 12px; font-weight: 700; flex: 0 0 auto; vertical-align: middle; }
.lamp-red { background: var(--danger); }
.lamp-yellow { background: #d99400; }
.lamp-green { background: var(--ok); }
.lamp-gray { background: #9aa7b4; }
.lamp-legend { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.lamp-item { display: inline-flex; align-items: center; gap: 6px; }
.btn { display: inline-block; background: var(--accent); color: var(--brand-ink); border: 1px solid var(--line);
       border-radius: 8px; padding: 6px 14px; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn-sm { padding: 2px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:hover { filter: brightness(.96); }
.inline { display: inline; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type="search"] { flex: 1; min-width: 200px; }
input, select, textarea { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.board-col { background: #edf1f5; border: 1px solid var(--line); border-radius: 10px;
             min-width: 250px; width: 270px; flex: 0 0 auto; padding: 10px; }
.board-col.drag-over { outline: 2px dashed var(--brand); }
.board-col h3 { font-size: 13px; margin: 0 0 4px; color: var(--brand-ink);
                text-transform: uppercase; letter-spacing: .02em;
                display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.col-sums { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.col-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.deal-card { background: #fff; border: 1px solid var(--line); border-radius: 8px;
             padding: 8px 10px; box-shadow: 0 1px 2px rgba(28,39,51,.06); }
.deal-card a { font-weight: 600; }
.deal-card .card-value { float: right; color: var(--brand-ink); font-weight: 600; }
.stage-move { margin-top: 6px; display: flex; gap: 4px; align-items: center; }
.stage-move select { font-size: 12px; padding: 2px 4px; max-width: 160px; }
body.js .stage-move { display: none; }
/* ---- Kontaktsidan (cp- prefix = contact page), ny tvåkolumnslayout ---- */
.cp-breadcrumb { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.cp-breadcrumb a { color: var(--muted); }
.cp-header { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.cp-header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cp-identity { display: flex; gap: 12px; align-items: flex-start; }
.cp-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--brand-ink);
             display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.cp-identity h1 { font-size: 21px; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.cp-sub { font-size: 13px; color: var(--muted); }
.cp-sub a { color: var(--brand); }
.cp-header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cp-header-fields { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px;
                     background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; }
.cp-header-fields form { display: contents; }
.cp-header-field { min-width: 140px; }
.cp-header-field label, .cp-info-row dt, .cp-edit-form .form-grid label {
  display: block; font-size: 13px; font-weight: 500; color: #4c5a69; margin-bottom: 4px;
}
.cp-stat-value { font-size: 18px; font-weight: 700; color: var(--ink); }

.cp-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .cp-columns { grid-template-columns: 1fr; } }

.cp-info-list { margin: 0; }
.cp-info-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cp-info-row:last-child { border-bottom: 0; }
.cp-info-row dd { margin: 0; font-size: 14px; color: var(--ink); }
.cp-missing { font-size: 13px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }

.cp-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cp-empty-row { color: var(--muted); font-size: 14px; margin: 0; }
.cp-add-link { font-size: 13px; font-weight: 500; }

.cp-role-group { margin-top: 10px; }
.cp-role-group:first-of-type { margin-top: 4px; }
.cp-role-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .03em; margin: 0 0 2px; }

.cp-timeline-notes { margin-top: 14px; }

.cp-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.cp-tab-btn { background: none; border: none; padding: 6px 4px; margin-right: 18px; font-size: 14px;
              color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.cp-tab-btn.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }

.cp-open-tasks { display: flex; flex-direction: column; gap: 2px; margin: 12px 0; font-size: 13px; }
.cp-open-tasks.cp-empty { background: var(--accent); border-radius: 8px; padding: 8px 12px; color: var(--ok); }
.cp-open-task-head, .cp-open-task-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 170px 44px; gap: 10px; align-items: center; }
.cp-open-task-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-open-task-row > span:nth-child(2), .cp-open-task-row > span:nth-child(3) { white-space: nowrap; }
.cp-open-task-head { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 0 10px 2px; }
.cp-open-task-row { background: var(--accent); border-radius: 6px; padding: 6px 10px; }
.cp-open-task-row form { display: flex; justify-content: flex-end; }

.cp-timeline { list-style: none; margin: 0; padding: 0; }
.cp-timeline-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cp-timeline-item:last-child { border-bottom: 0; }
.cp-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--muted); }
.cp-dot-note { background: #3b82f6; }
.cp-dot-won { background: var(--ok); }
.cp-dot-lost { background: var(--danger); }
.cp-dot-task { background: var(--brand); }
.cp-dot-created { background: #9aa7b4; }
.cp-timeline-title { margin: 0; font-size: 14px; font-weight: 500; }
.cp-timeline-meta { margin: 2px 0 0; font-size: 12px; }
.cp-timeline-body { margin: 4px 0 0; font-size: 13px; }

.cp-btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px;
          border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid var(--line);
          background: #fff; color: var(--ink); text-decoration: none; }
.cp-btn:hover { filter: brightness(.97); }
.cp-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.cp-btn-primary:hover { filter: brightness(1.08); }
.cp-link-btn { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px; padding: 0; }

.tab { display: inline-block; padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line);
       color: var(--ink); text-decoration: none; font-size: 14px; }
.tab-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
.messages { margin-bottom: 14px; }
.message { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; background: #e7f5ec; color: var(--ok); border: 1px solid #cdebd8; }
.message.error { background: #fbe9e7; color: var(--danger); border-color: #f3cdc9; }
.undo-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
  background: #e7f5ec; color: var(--ok); border: 1px solid #cdebd8; }
.undo-bar form { display: inline; }
.undo-hint { font-size: 12px; opacity: .75; }
.assign-form input, .assign-form select { min-width: 180px; }
.assign-grid { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.assign-grid label { display: block; font-size: 12px; color: var(--muted); }
.notes { border-left: 3px solid var(--line); padding-left: 10px; }
.notes-form { margin-top: 12px; }
.notes-form label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.notes-form textarea { width: 100%; min-height: 84px; }
.notes-form .actions { margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.quick-task-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
                   margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.quick-task-form input[type="text"] { flex: 1; min-width: 160px; }
.quick-task-form input[type="date"] { padding: 4px 8px; color: var(--muted); }
.assign-row { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.assign-row select { max-width: 180px; padding: 3px 6px; font-size: 13px; }
.note-log li { display: block; }
.note-log .note-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.note-log .note-text { font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.login-card { max-width: 400px; margin: 56px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 30px; text-align: center; }
.login-mark { font-size: 20px; font-weight: 700; color: var(--brand-ink); margin-bottom: 14px; }
.login-mark span { font-weight: 300; color: var(--muted); }
.login-logo { max-height: 62px; width: auto; margin: 0 auto 14px; display: block; }
.login-card h1 { font-size: 19px; margin: 0 0 6px; }
.login-sub { margin: 0 0 20px; }
.login-card form { text-align: left; }
.login-card .field { margin-bottom: 12px; }
.login-card input { width: 100%; }
.login-card .btn-block { margin-top: 6px; }
.login-foot { margin: 18px 0 0; font-size: 12px; }
.login-card label { display: block; margin-bottom: 2px; font-size: 13px; color: var(--muted); }
form p { margin: 0 0 10px; }
