:root {
  --blue-900: #17324d;
  --blue-800: #1f4568;
  --blue-700: #2b5f8f;
  --blue-600: #3678ad;
  --blue-500: #4a94c9;
  --blue-100: #eaf4fb;
  --blue-50: #f5fbff;

  --green: #37bf1f;
  --yellow: #ead900;
  --orange: #f45100;
  --red: #b44b4b;

  --gray-50: #f6f8fa;
  --gray-100: #edf2f6;
  --gray-200: #dce6ee;
  --gray-500: #6e7d8b;
  --gray-800: #1e2933;
  --white: #fff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(23,50,77,.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--blue-50), var(--gray-50));
  color: var(--gray-800);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 36px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 6px 24px rgba(23,50,77,.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--gray-200);
  padding: 6px;
}

.topbar h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--blue-900);
}

.topbar p {
  margin: 6px 0 0;
  color: var(--gray-500);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

button, select {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--gray-100);
  color: var(--gray-800);
}

button:hover { filter: brightness(.97); }

.primary {
  background: var(--blue-700);
  color: white;
}

.secondary {
  background: var(--blue-100);
  color: var(--blue-900);
}

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card, .panel {
  background: rgba(255,255,255,.96);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.card {
  padding: 18px;
  min-height: 115px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card span {
  color: var(--gray-500);
  font-size: .92rem;
}

.card strong {
  font-size: 2rem;
  color: var(--blue-900);
}

.card.alert { border-left: 6px solid var(--orange); }
.card.warning { border-left: 6px solid var(--yellow); }
.card.success { border-left: 6px solid var(--green); }
.card.info { border-left: 6px solid var(--blue-600); }
.card.muted { border-left: 6px solid var(--blue-200, #c8dceb); }

.panel {
  padding: 22px;
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  color: var(--blue-900);
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--gray-500);
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px;
  background: var(--blue-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
}

.action-row span {
  display: block;
  color: var(--gray-500);
  margin-top: 3px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.success-btn { background: var(--green); color: white; }
.danger-btn { background: var(--red); color: white; }
.warning-btn { background: var(--orange); color: white; }

.grid-two {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 22px;
}

.send-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.send-card {
  text-align: left;
  border-radius: 16px;
  padding: 18px;
  background: var(--blue-50);
  border: 1px solid var(--gray-200);
}

.send-card strong, .send-card span { display: block; }
.send-card strong { color: var(--blue-900); }
.send-card span { margin-top: 6px; color: var(--gray-500); font-weight: 500; }

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

.summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-200);
}

.summary-list li:last-child { border-bottom: 0; }
.summary-list strong { color: var(--blue-900); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

th, td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--gray-200);
}

th {
  font-size: .82rem;
  text-transform: uppercase;
  color: var(--blue-700);
  letter-spacing: .04em;
}

.customer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.customer-stats div {
  background: var(--blue-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 16px;
}

.customer-stats span, .customer-stats strong { display: block; }
.customer-stats span { color: var(--gray-500); margin-bottom: 8px; }
.customer-stats strong { color: var(--blue-900); }

@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .grid-two { grid-template-columns: 1fr; }
  .customer-stats { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 18px; }
  .brand { align-items: flex-start; }
  .logo { width: 72px; height: 72px; }
  .topbar-actions { width: 100%; flex-direction: column; }
  .topbar-actions button { width: 100%; }
  .dashboard { padding: 14px; }
  .cards { grid-template-columns: 1fr; }
  .action-row { flex-direction: column; align-items: flex-start; }
  .row-actions, .row-actions button { width: 100%; }
  .send-grid { grid-template-columns: 1fr; }
}

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--blue-50), var(--gray-50));
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
}

.login-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 8px;
  color: var(--blue-900);
}

.login-card p {
  color: var(--gray-500);
}

.login-card input {
  width: 100%;
  padding: 13px 14px;
  margin-top: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
}

.login-card button {
  width: 100%;
  margin-top: 16px;
  background: var(--blue-700);
  color: white;
}

#loginMessage {
  margin-top: 14px;
  font-size: .9rem;
}

.return-box {
  margin: -6px 0 12px;
  padding: 16px;
  background: #fff7f7;
  border: 1px solid #e0b4b4;
  border-radius: 14px;
}

.return-box h4 {
  margin: 0 0 10px;
  color: var(--blue-900);
}

.return-box textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
}

.return-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.timesheet-details {
  margin: -6px 0 12px;
  padding: 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.timesheet-entry {
  padding: 12px;
  margin-bottom: 10px;
  background: var(--blue-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
}

.timesheet-detail-menu {
  margin-top: 18px;
  padding: 16px;
  background: var(--blue-900);
  border-radius: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.timesheet-detail-menu button {
  background: white;
  color: var(--blue-900);
  font-weight: 700;
}

.timesheet-detail-menu .success-btn {
  background: var(--green);
  color: white;
}

.timesheet-detail-menu .danger-btn {
  background: var(--red);
  color: white;
}

.stat-card {
  position: relative;
}

.stat-card {
  position: relative;
}

.stat-card .help-icon {
  position: absolute !important;

  bottom: 14px;
  right: 14px;

  width: 24px;
  height: 24px;

  border: none;
  border-radius: 999px;

  background: #edf6fc;
  color: #17324d;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  margin: 0;

  cursor: help;

  z-index: 5;
}

.help-svg {
  width: 14px;
  height: 14px;
}

.help-svg path {
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  fill: none;
}

.help-svg circle {
  fill: currentColor;
}

.stat-card .help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: 34px;

  width: 260px;
  padding: 10px 12px;

  background: #17324d;
  color: white;

  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(6px);
  transition: 0.15s ease;

  z-index: 50;
  box-shadow: 0 10px 25px rgba(23, 50, 77, 0.18);
}

.stat-card .help-icon:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* Rettelser: filter, historik og detaljer */
.admin-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  background: #f6f8fa;
  border: 1px solid #dce6ee;
  border-radius: 14px;
}

.admin-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
  color: #6e7d8b;
}

.admin-controls select {
  min-width: 180px;
  padding: 9px 10px;
  border: 1px solid #dce6ee;
  border-radius: 10px;
  background: white;
  font-weight: 700;
}

.action-row.status-correction_needed {
  border-left: 5px solid #ead900;
}

.action-row.status-approved {
  border-left: 5px solid #37bf1f;
}

.action-row.status-submitted {
  border-left: 5px solid #f45100;
}

.admin-comment-preview {
  display: block;
  margin-top: 6px;
  padding: 7px 9px;
  background: #fff3cd;
  border-radius: 8px;
  color: #5b4600;
  font-size: .86rem;
}

.timesheet-day-detail {
  margin: 10px 0;
  padding: 10px;
  background: #f6f8fa;
  border-radius: 12px;
}

.timesheet-day-detail h4 {
  margin: 0 0 8px;
}

.timesheet-detail-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.warning-btn {
  background: #ead900;
  color: #1e2933;
}

/* Pippis admin workflow fix */
.admin-filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-filter-row select {
  border: 1px solid var(--gray-200, #dce6ee);
  border-radius: 12px;
  padding: 9px 12px;
  background: white;
  font-weight: 700;
}
.action-row small {
  display: block;
  margin-top: 6px;
  color: #6e7d8b;
}
.timesheet-week-summary {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f5fbff;
  border: 1px solid #dce6ee;
}
.task-line {
  margin-top: 6px;
  padding-left: 10px;
  color: #1e2933;
}
.return-box textarea {
  width: 100%;
  min-height: 90px;
}

/* Pippis beskedsystem */
.message-panel {
  border-left: 5px solid #4a94c9;
}
.message-compose {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.message-compose-row {
  display: grid;
  grid-template-columns: minmax(220px, 340px);
  gap: 12px;
}
.message-compose label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
  color: #1e2933;
}
.message-compose select,
.message-compose textarea {
  border: 1px solid #dce6ee;
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  background: white;
}
.message-compose textarea {
  min-height: 110px;
  resize: vertical;
}
.message-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#messageStatus {
  font-weight: 800;
  color: #2b5f8f;
}

/* Pippis indbakke v2 - øverst, foldet sammen, todelt */
.message-panel {
  border-left: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #eef7ff;
  border: 1px solid #cfe3f5;
  box-shadow: var(--shadow, 0 10px 30px rgba(23,50,77,.08));
  margin: 0 0 18px;
}
.message-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}
.message-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.message-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d9edff;
  color: #1f5f91;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.message-panel h2,
.message-panel h3 {
  margin: 0;
  color: #17324d;
}
.message-panel-header p {
  margin: 2px 0 0;
  color: #5b6b7b;
  font-weight: 600;
}
.message-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #2b5f8f;
  font-weight: 800;
  white-space: nowrap;
}
.message-toggle {
  transition: transform .18s ease;
}
.message-panel.open .message-toggle {
  transform: rotate(180deg);
}
.message-panel-body {
  display: block;
  border-top: 1px solid #cfe3f5;
  padding: 16px;
  background: #f7fbff;
}
.message-panel.collapsed .message-panel-body {
  display: none;
}
.message-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.message-compose-card,
.message-history-card {
  background: #fff;
  border: 1px solid #dce6ee;
  border-radius: 16px;
  padding: 16px;
}
.message-compose-card h3,
.message-history-card h3 {
  margin-bottom: 12px;
}
.message-compose-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
  color: #1e2933;
  margin-bottom: 12px;
}
.message-compose-card select,
.message-compose-card textarea {
  border: 1px solid #dce6ee;
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  background: white;
}
.message-compose-card textarea {
  min-height: 150px;
  resize: vertical;
}
.admin-message-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}
.admin-message-item {
  border-radius: 14px;
  border: 1px solid #dce6ee;
  padding: 12px;
  background: #fff;
}
.admin-message-item.from-employee {
  border-left: 5px solid #f45100;
}
.admin-message-item.from-admin {
  border-left: 5px solid #4a94c9;
}
.admin-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #17324d;
  font-size: .9rem;
}
.admin-message-meta span,
.admin-message-route {
  color: #6e7d8b;
  font-weight: 700;
  font-size: .82rem;
}
.admin-message-route {
  margin-top: 3px;
}
.admin-message-text {
  white-space: pre-wrap;
  margin-top: 8px;
  line-height: 1.45;
  color: #1e2933;
}
.admin-unread-badge {
  background: #f45100;
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: .75rem;
  font-weight: 900;
}
.message-empty {
  color: #6e7d8b;
  font-weight: 700;
  padding: 12px;
}
@media (max-width: 900px) {
  .message-two-col { grid-template-columns: 1fr; }
  .message-panel-header { align-items: flex-start; }
  .message-header-right { align-self: center; }
}


/* Besked-popup og læst/ulæst status */
.admin-message-item {
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.admin-message-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(23,50,77,.10);
}
.admin-message-item.unread {
  background: #fff7ed;
  border-color: #f45100;
}
.message-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.45);
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.message-modal-overlay.open { display: flex; }
.message-modal {
  width: min(620px, 100%);
  max-height: 82vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
  padding: 24px;
  position: relative;
}
.message-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef2f6;
  color: #17324d;
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
}
.message-modal-title {
  color: #17324d;
  font-size: 1.18rem;
  font-weight: 900;
  padding-right: 42px;
}
.message-modal-subtitle {
  color: #6e7d8b;
  font-size: .88rem;
  font-weight: 700;
  margin-top: 4px;
}
.message-modal-body {
  margin-top: 16px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: #1e2933;
  font-size: 1rem;
}
@media (max-width: 700px) {
  .message-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .message-modal {
    width: 100%;
    max-height: 86vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 18px 28px;
  }
}
