/* Catppuccin Mocha */
:root {
  --base:    #1e1e2e;
  --mantle:  #181825;
  --crust:   #11111b;
  --surface0:#313244;
  --surface1:#45475a;
  --surface2:#585b70;
  --overlay0:#6c7086;
  --overlay1:#7f849c;
  --text:    #cdd6f4;
  --subtext: #a6adc8;
  --blue:    #89b4fa;
  --lavender:#b4befe;
  --green:   #a6e3a1;
  --yellow:  #f9e2af;
  --red:     #f38ba8;
  --peach:   #fab387;
  --teal:    #94e2d5;
  --mauve:   #cba6f7;
  --sky:     #89dceb;
  --radius:  8px;
}

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

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

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

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--mantle);
  border-right: 1px solid var(--surface0);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 0.5rem 1.2rem 1.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  border-bottom: 1px solid var(--surface0);
  margin-bottom: 0.5rem;
}

.sidebar-logo span { color: var(--subtext); font-size: 0.75rem; display: block; font-weight: 400; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  color: var(--subtext);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 0.9rem;
}

.nav-item:hover, .nav-item.active {
  background: var(--surface0);
  color: var(--text);
}

.nav-item.active { border-left: 3px solid var(--blue); padding-left: calc(1.2rem - 3px); }
.nav-section { padding: 0.8rem 1.2rem 0.3rem; font-size: 0.7rem; text-transform: uppercase; color: var(--overlay0); letter-spacing: 0.08em; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--mantle);
  border-bottom: 1px solid var(--surface0);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-title { font-size: 1.1rem; font-weight: 600; }
.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

.content { padding: 1.5rem; overflow-y: auto; flex: 1; }

/* Widgets */
.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.widget {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.widget-icon { font-size: 1.5rem; }
.widget-num { font-size: 1.6rem; font-weight: 700; }
.widget-label { font-size: 0.78rem; color: var(--subtext); }
.widget.warn .widget-num { color: var(--yellow); }
.widget.danger .widget-num { color: var(--red); }
.widget.ok .widget-num { color: var(--green); }
.widget.info .widget-num { color: var(--blue); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: filter 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--blue); color: var(--base); }
.btn-success { background: var(--green); color: var(--base); }
.btn-danger  { background: var(--red);  color: var(--base); }
.btn-warn    { background: var(--yellow); color: var(--base); }
.btn-ghost   { background: var(--surface0); color: var(--text); }
.btn-sm      { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* Tabel */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid var(--surface0); }
th { font-size: 0.78rem; text-transform: uppercase; color: var(--subtext); letter-spacing: 0.05em; white-space: nowrap; }
tr:hover td { background: var(--surface0); }
td { font-size: 0.9rem; }

/* Status chips */
.chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip-draft     { background: var(--surface1); color: var(--subtext); }
.chip-pending   { background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.chip-confirmed { background: color-mix(in srgb, var(--blue) 20%, transparent); color: var(--blue); }
.chip-signed    { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.chip-invoiced  { background: color-mix(in srgb, var(--mauve) 20%, transparent); color: var(--mauve); }
.chip-cancelled { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.chip-conflict  { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }
.chip-woo       { background: color-mix(in srgb, var(--peach) 20%, transparent); color: var(--peach); }

/* Filtre */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.filter-btn {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--surface1);
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
}
.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--blue); border-color: var(--blue); color: var(--base); }

/* Kort (booking-detail) */
.card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.card-title { font-size: 0.85rem; text-transform: uppercase; color: var(--subtext); margin-bottom: 0.8rem; letter-spacing: 0.05em; }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.82rem; color: var(--subtext); margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* Messages */
.msg-thread { display: flex; flex-direction: column; gap: 0.8rem; }
.msg-bubble {
  max-width: 80%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.5;
}
.msg-inbound  { background: var(--surface0); align-self: flex-start; }
.msg-outbound { background: color-mix(in srgb, var(--blue) 20%, transparent); align-self: flex-end; }
.msg-meta { font-size: 0.72rem; color: var(--overlay0); margin-top: 0.25rem; }

/* Pris-summary */
.price-summary { border-top: 1px solid var(--surface0); margin-top: 0.5rem; padding-top: 0.5rem; }
.price-row { display: flex; justify-content: space-between; padding: 0.2rem 0; font-size: 0.9rem; }
.price-row.total { font-weight: 700; font-size: 1rem; color: var(--green); border-top: 1px solid var(--surface1); margin-top: 0.3rem; padding-top: 0.5rem; }
.price-row.vat { color: var(--subtext); font-size: 0.85rem; }

/* Mobil */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-layout { flex-direction: column; }
  .content { padding: 1rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .widgets { grid-template-columns: 1fr 1fr; }
  table { font-size: 0.8rem; }
  th, td { padding: 0.5rem 0.6rem; }
  .topbar { padding: 0.7rem 1rem; }
}

/* Hamburger mobile nav */
.mobile-nav {
  display: none;
  background: var(--mantle);
  border-bottom: 1px solid var(--surface0);
  padding: 0 1rem;
}
@media (max-width: 768px) {
  .mobile-nav { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem; }
  .mobile-menu { display: none; flex-direction: column; background: var(--mantle); }
  .mobile-menu.open { display: flex; }
  .mobile-menu .nav-item { padding: 0.7rem 1rem; font-size: 1rem; }
}

/* Offentlig side (kontrakt / invitation) */
.public-page {
  max-width: 680px;
  margin: 2rem auto;
  padding: 1.5rem;
}
.public-logo { font-size: 1.4rem; font-weight: 700; color: var(--blue); margin-bottom: 1.5rem; }
.public-logo span { color: var(--subtext); font-size: 0.9rem; font-weight: 400; }

/* Mobil opgave-kort */
.task-card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.task-date { font-size: 0.8rem; color: var(--subtext); }
.task-name { font-weight: 600; font-size: 1rem; }
.task-addr { font-size: 0.85rem; color: var(--overlay1); }
.task-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* Alert */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.88rem;
}
.alert-error { background: color-mix(in srgb, var(--red) 20%, transparent); border: 1px solid var(--red); color: var(--red); }
.alert-success { background: color-mix(in srgb, var(--green) 20%, transparent); border: 1px solid var(--green); color: var(--green); }
.alert-info { background: color-mix(in srgb, var(--blue) 15%, transparent); border: 1px solid var(--blue); color: var(--blue); }

/* Spinner */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--surface1); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Badge */
.badge { background: var(--red); color: white; border-radius: 999px; font-size: 0.7rem; padding: 0.1rem 0.45rem; font-weight: 700; }

/* Gantt calendar */
.gantt-bar { transition: opacity 0.15s; }
.gantt-bar:hover { opacity: 0.85; }
.gantt-bar-draft        { background: var(--surface2); color: var(--subtext); }
.gantt-bar-pending_review { background: var(--yellow); color: #1e1e2e; }
.gantt-bar-confirmed    { background: var(--blue);   color: #1e1e2e; }
.gantt-bar-signed       { background: var(--green);  color: #1e1e2e; }
.gantt-bar-invoiced     { background: var(--teal);   color: #1e1e2e; }
.gantt-bar-conflict     { background: var(--red);    color: #1e1e2e; }
.gantt-bar-cancelled    { background: var(--overlay0); color: var(--mantle); }
