:root {
  --bg: #f5f3ef;
  --card: #ffffff;
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --accent: #40916c;
  --danger: #b5341c;
  --warning-bg: #fff3cd;
  --warning-border: #e0a800;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --border: #ddd9d3;
  --radius: 14px;
  --shadow: 0 2px 8px rgba(0,0,0,.07);

  /* Cockpit-kort-färger */
  --prio-bg: #fffde7;
  --prio-border: #f9a825;
  --review-bg: #fff8f0;
  --review-border: #f4a35a;
  --cal-bg: #f0f7f4;
  --cal-border: #b7dece;
  --tasks-bg: #ffffff;
  --care-bg: #f0f7f4;
  --care-border: #b7dece;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-icon { font-size: 3em; margin-bottom: 12px; }
.login-card h1 { font-size: 1.5em; color: var(--primary-dark); margin-bottom: 6px; }
.login-sub { color: var(--muted); font-size: 0.95em; margin-bottom: 24px; }

.login-card input[type=password] {
  width: 100%;
  padding: 16px;
  font-size: 1.4em;
  letter-spacing: 0.3em;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  background: #fafaf8;
}
.login-card input:focus { outline: none; border-color: var(--accent); background: #fff; }
.login-card button {
  width: 100%;
  padding: 16px;
  font-size: 1.1em;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.login-card button:hover { background: var(--primary-dark); }

/* ── Global Header ── */
.global-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Cockpit-layout ── */
.cockpit {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ── Header ── */
.cockpit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0 20px;
  border-bottom: none;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.greeting-block { display: flex; flex-direction: column; gap: 2px; }
.greeting { font-size: 1.6em; font-weight: 700; color: var(--primary-dark); line-height: 1.2; }
.date-str { font-size: 0.9em; color: var(--muted); }

.brand { font-size: 1.05em; font-weight: 700; color: var(--primary-dark); }
.logout-link { font-size: 0.82em; color: var(--muted); text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* ── Cockpit grid – responsiv ── */
.cockpit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 800px) {
  .cockpit-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ── Kort ── */
.cockpit-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card-label {
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Prioritet */
.card-prio {
  background: var(--prio-bg);
  border-color: var(--prio-border);
  position: relative;
}
.prio-text { font-size: 1.05em; color: #3e2c00; line-height: 1.6; }

.prio-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.prio-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95em;
  color: #3e2c00;
  line-height: 1.5;
}

.prio-item:last-child { border-bottom: none; }

/* Trello-ruta */
.card-trello {
  background: #f5f3ef;
  border-color: #9d7c6e;
  position: relative;
}

.trello-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.trello-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95em;
  color: #5a4a40;
  line-height: 1.5;
}

.trello-item:last-child { border-bottom: none; }

.refresh-form { position: absolute; top: 14px; right: 14px; }
.btn-refresh {
  background: none;
  border: 1px solid var(--prio-border);
  border-radius: 6px;
  color: #7a5800;
  font-size: 1em;
  padding: 3px 8px;
  cursor: pointer;
}
.btn-refresh:hover { background: #fff3cd; }

/* Behöver din blick */
.card-review {
  background: var(--review-bg);
  border-color: var(--review-border);
}

.review-list { list-style: none; }
.review-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #fddcba;
  font-size: 0.9em;
}
.review-item:last-child { border-bottom: none; }

.review-trello-buttons {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn-trello-yes, .btn-trello-no {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.9em;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-trello-yes {
  color: #2d6a4f;
  border-color: #40916c;
}

.btn-trello-yes:hover {
  background: #e8f5e9;
}

.btn-trello-no {
  color: #b5341c;
  border-color: #e8a4a4;
}

.btn-trello-no:hover {
  background: #fde7e7;
}

.review-more-link {
  display: block;
  margin-top: 8px;
  color: #2d6a4f;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9em;
}
.review-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--review-border);
  flex-shrink: 0;
}
.review-text { flex: 1; }
.review-done-form { margin: 0; }
.btn-review-done {
  background: #fee8d0;
  border: 1px solid var(--review-border);
  border-radius: 6px;
  color: #7a3c00;
  font-size: 0.85em;
  padding: 3px 8px;
  cursor: pointer;
}
.btn-review-done:hover { background: #fddcba; }

/* Kalender */
.card-cal {
  background: var(--cal-bg);
  border-color: var(--cal-border);
}

.cal-day { margin-bottom: 14px; }
.cal-day:last-child { margin-bottom: 0; }
.cal-day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.cal-day-label {
  font-weight: 700;
  font-size: 0.95em;
  color: var(--primary-dark);
}
.cal-day-date { font-size: 0.8em; color: var(--muted); }

.cal-events { list-style: none; }
.cal-event {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #cde8da;
  font-size: 0.9em;
}
.cal-event:last-child { border-bottom: none; }
.cal-event-untagged { opacity: 0.65; font-style: italic; }
.cal-time {
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 3.5em;
  font-size: 0.85em;
}
.cal-title { flex: 1; }
.cal-tags {
  font-size: 0.75em;
  background: #d8f0e7;
  color: var(--primary-dark);
  border-radius: 4px;
  padding: 1px 5px;
}
.cal-empty { font-size: 0.85em; color: var(--muted); }

/* Uppgifter */
.card-tasks { background: var(--tasks-bg); }

.task-list { list-style: none; }
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-late-item { border-left: 3px solid var(--danger); padding-left: 10px; }

.task-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.task-title { font-size: 1em; }
.task-badge {
  display: inline-block;
  font-size: 0.7em;
  background: #e8eaf6;
  color: #3949ab;
  border-radius: 4px;
  padding: 1px 6px;
  align-self: flex-start;
}
.task-due      { font-size: 0.8em; color: var(--muted); }
.task-due-late { color: var(--danger); font-weight: 600; }

.btn-done {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-done:hover { background: #c8e6c9; }

/* Omsorg */
.card-care {
  background: var(--care-bg);
  border-color: var(--care-border);
}

.upcoming-list { list-style: none; }
.upcoming-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #cde8da;
  font-size: 0.88em;
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-date   { font-weight: 700; color: var(--primary-dark); min-width: 4em; }
.upcoming-person { color: var(--muted); font-size: 0.82em; min-width: 4.5em; }
.upcoming-detail { flex: 1; }
.care-link {
  font-size: 0.82em;
  color: var(--accent);
  text-decoration: none;
  margin-top: 8px;
  display: inline-block;
}
.care-link:hover { text-decoration: underline; }

/* ── Footer: Lägg till + nyss ── */
.cockpit-footer { margin-top: 20px; }

.add-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.add-row {
  display: flex;
  gap: 10px;
}

.add-row input[type=text] {
  flex: 1;
  padding: 14px 16px;
  font-size: 1em;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fafaf8;
}
.add-row input:focus { outline: none; border-color: var(--accent); background: #fff; }

.btn-add {
  padding: 14px 20px;
  font-size: 1em;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-add:hover { background: var(--primary); }

.nyss-row {
  margin-top: 8px;
  font-size: 0.82em;
  color: var(--muted);
  text-align: right;
  padding-right: 4px;
}

/* ── Gemensamt ── */
.top-nav { display: flex; gap: 14px; align-items: center; }
.top-nav a { font-size: 0.88em; color: var(--muted); text-decoration: none; }
.top-nav a.active { color: var(--primary-dark); font-weight: 600; }
.top-nav a:hover { color: var(--primary); }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 0.92em;
}
.alert-error   { background: #fdecea; color: var(--danger); border-left: 4px solid var(--danger); }
.alert-success { background: #e8f5e9; color: #1b5e20;       border-left: 4px solid #43a047; }
.alert-info    { background: #e3f2fd; color: #0d47a1;        border-left: 4px solid #1976d2; }

.empty-msg { color: var(--muted); font-size: 0.9em; padding: 12px 0; }
.muted { color: var(--muted); }
.add-hint { font-size: 0.85em; color: var(--muted); margin-bottom: 10px; }

h2 {
  font-size: 1.05em;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

/* ── Care-sidan (kalkylblad) ── */
.page { max-width: 1100px; margin: 0 auto; padding: 16px; }
.page-care {}

header {
  display: none;
}

.care-upcoming {
  background: var(--cal-bg);
  border: 1px solid var(--cal-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.care-upcoming h2 { margin-bottom: 8px; }

.care-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.person-filter { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-btn {
  font-size: 0.85em;
  padding: 5px 12px;
  border-radius: 20px;
  background: #eee;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
}
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.filter-btn:hover:not(.active) { background: #ddd; }

.btn-new-post { padding: 8px 16px; font-size: 0.9em; border-radius: 8px; }

.add-care-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

/* ── Kalkylblad ── */
.care-sheet-wrap { overflow-x: auto; }

.care-sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.care-sheet thead th {
  background: #f0f4f2;
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.th-action { width: 36px; }

.care-row {
  border-bottom: 1px solid var(--border);
  cursor: default;
  transition: background 0.1s;
}
.care-row:last-child { border-bottom: none; }
.care-row.has-note { cursor: pointer; }
.care-row.has-note:hover { background: #f7faf8; }

.care-row td {
  padding: 10px 12px;
  vertical-align: top;
}

.td-person { font-weight: 600; white-space: nowrap; }
.td-date   { white-space: nowrap; color: var(--muted); }
.td-typ    {}
.td-vard   { font-weight: 500; }
.td-syfte  { color: var(--muted); }
.td-nasta  { white-space: nowrap; }
.td-action { text-align: right; padding: 6px 8px; }

.care-typ    { font-size: 0.78em; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.typ-besok   { background: #e8f5e9; color: #2e7d32; }
.typ-samtal  { background: #e3f2fd; color: #0d47a1; }

.note-row td { background: #f9fbfa; }
.note-cell { padding: 8px 16px 10px; font-size: 0.85em; color: var(--muted); font-style: italic; }
.note-label { font-weight: 700; font-style: normal; color: var(--text); }

.btn-delete {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1em;
  padding: 4px 6px;
  border-radius: 4px;
}
.btn-delete:hover { background: #fdecea; color: var(--danger); }

/* ── Tag buttons (kalenderhändelser) ── */
.review-tag-buttons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-tag {
  background: #fff8f0;
  border: 1px solid #f4a35a;
  border-radius: 6px;
  color: #7a3c00;
  font-size: 0.8em;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  min-width: 28px;
  transition: all 0.2s;
}

.btn-tag:hover {
  background: #f4a35a;
  color: white;
}

.btn-tag:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Mobil ── */
@media (max-width: 600px) {
  body { font-size: 17px; }

  .global-header {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }

  .global-header .top-nav {
    width: 100%;
    justify-content: space-around;
  }

  .cockpit-header { flex-direction: column; gap: 10px; }
  .greeting { font-size: 1.35em; }

  .cockpit-grid { grid-template-columns: 1fr; }

  .add-row { flex-direction: column; }
  .btn-add { width: 100%; }

  .care-sheet { font-size: 0.8em; }
  .care-sheet thead th,
  .care-row td { padding: 8px 8px; }

  .td-syfte  { display: none; }
  .td-nasta  { display: none; }
}
