/* ============================================================
   Actavio — Designsystem
   Schrift: Inter/System-Fallback — volle Unterstützung für
   Ä, Ö, Ü, ä, ö, ü, ß und alle europäischen Sonderzeichen.
   ============================================================ */

:root {
  /* --- Farbwelt --- */
  --color-bg:           #f4f6fa;
  --color-bg-soft:      #eef1f6;
  --color-surface:      #ffffff;
  --color-surface-2:    #fafbfd;
  --color-border:       #e3e7ee;
  --color-border-strong:#cdd4e0;

  --color-ink:          #0b1f3a;   /* tiefes Navy für Text */
  --color-ink-2:        #2a3a55;
  --color-ink-3:        #56657f;
  --color-ink-4:        #8593a8;
  --color-ink-5:        #aebac9;

  --color-primary:      #185FA5;
  --color-primary-600:  #0C447C;
  --color-primary-50:   #E6F1FB;
  --color-primary-100:  #B5D4F4;

  --color-sidebar-bg:   #042C53;
  --color-sidebar-ink:  #c8d2e3;
  --color-sidebar-mute: #6f7e98;
  --color-sidebar-hover:#0C447C;
  --color-sidebar-active:#185FA5;

  /* --- Statusfarben --- */
  --status-new-bg:     #E6F1FB;  --status-new-fg:     #0C447C;  --status-new-bar:     #378ADD;
  --status-review-bg:  #ebe7ff;  --status-review-fg:  #5b3fd6;  --status-review-bar:  #7c6bf2;
  --status-progress-bg:#fff1e0;  --status-progress-fg:#a35c00;  --status-progress-bar:#f59e0b;
  --status-waiting-bg: #ffe9e5;  --status-waiting-fg: #c2410c;  --status-waiting-bar: #f97316;
  --status-done-bg:    #def7ec;  --status-done-fg:    #036c4d;  --status-done-bar:    #10b981;
  --status-archived-bg:#eef0f3;  --status-archived-fg:#525c6f;  --status-archived-bar:#94a3b8;

  /* --- Maße --- */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-xs: 0 1px 2px rgba(11,31,58,0.04);
  --shadow-sm: 0 1px 3px rgba(11,31,58,0.06), 0 1px 2px rgba(11,31,58,0.04);
  --shadow-md: 0 4px 14px rgba(11,31,58,0.08), 0 2px 6px rgba(11,31,58,0.04);
  --shadow-lg: 0 12px 40px rgba(11,31,58,0.14), 0 4px 12px rgba(11,31,58,0.06);

  --sidebar-w: 240px;
  --sidebar-w-collapsed: 88px;
  --topbar-h:  64px;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
}

/* ============================================================
   Reset / Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-feature-settings: "cv11","ss01","ss03";
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--color-primary-100); }

/* ============================================================
   Installer
   ============================================================ */
.install-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--color-bg);
}
.install-card {
  width: min(860px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.install-brand {
  background: var(--color-sidebar-bg);
  border-radius: var(--radius-sm);
  border-bottom: none;
  margin: 0 0 22px;
  padding: 14px;
}
.install-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.2;
}
.install-form {
  margin-top: 22px;
}
.install-finished {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
}
.install-finished p {
  margin: 0;
  color: var(--color-ink-2);
}

/* ============================================================
   App shell
   ============================================================ */
.app-body { min-height: 100vh; }
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}
html.sidebar-collapsed .app-shell { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.app-main {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  min-width: 0;
}
.app-content { overflow: auto; background: var(--color-bg); }

/* ============================================================
   Sidebar
   ============================================================ */
.app-sidebar {
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-ink);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky; top: 0; height: 100vh;
  z-index: 25;
  border-right: 1px solid #0b1f3a;
  overflow: visible;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid #16294a;
  margin-bottom: 14px;
  min-width: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  min-width: 34px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #042C53;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 -8px 16px rgba(0,0,0,0.15), 0 2px 8px rgba(24,95,165,0.32);
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
}
.brand-text .t1 {
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  white-space: nowrap;
}
.brand-text .t2 {
  color: var(--color-sidebar-mute);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-toggle {
  position: absolute;
  top: 82px;
  right: -13px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(133,183,235,0.45);
  background: var(--color-sidebar-bg);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(4,44,83,0.28);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
  z-index: 30;
}
.sidebar-toggle:hover {
  background: var(--color-sidebar-hover);
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}
.sidebar-toggle:focus-visible {
  outline: 3px solid rgba(133,183,235,0.35);
  outline-offset: 2px;
}

.nav-section-title {
  color: var(--color-sidebar-mute);
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 10px 6px;
}
.nav-list { display: flex; flex-direction: column; gap: 2px; overflow: visible; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-ink);
  font-size: 13.5px; font-weight: 500;
  border: none; background: transparent;
  text-align: left; width: 100%;
  transition: background 120ms ease;
  position: relative;
}
.nav-item:hover { background: var(--color-sidebar-hover); color: #fff; }
.nav-item.is-active { background: rgba(31,111,235,0.18); color: #fff; }
.nav-item.is-active .nav-icon { color: #85B7EB; }
.nav-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; color: var(--color-sidebar-mute); flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #16294a; color: #c8d2e3;
  font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
}
.nav-item.is-active .nav-badge { background: rgba(255,255,255,0.18); color: #fff; }

html.sidebar-collapsed .app-sidebar {
  padding-left: 14px;
  padding-right: 14px;
}
html.sidebar-collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
html.sidebar-collapsed .brand-mark {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
}
html.sidebar-collapsed .app-sidebar .brand-text,
html.sidebar-collapsed .nav-section-title,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .sb-user {
  display: none;
}
html.sidebar-collapsed .sidebar-toggle {
  top: 82px;
  right: -13px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  font-size: 16px;
}
html.sidebar-collapsed .nav-item {
  justify-content: center;
  width: 42px;
  min-height: 42px;
  margin-left: auto;
  margin-right: auto;
  padding: 10px;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: visible;
}
html.sidebar-collapsed .nav-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
html.sidebar-collapsed .nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--color-sidebar-bg);
  font-size: 10px;
  line-height: 1;
  z-index: 2;
}
html.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  gap: 8px;
}
html.sidebar-collapsed .sb-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}
html.sidebar-collapsed .sb-logout {
  margin-left: 0;
  flex: 0 0 28px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px; border-top: 1px solid #16294a;
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}
.sb-user { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; overflow: hidden; }
.sb-user .n { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .r { color: var(--color-sidebar-mute); font-size: 11px; white-space: nowrap; }
.sb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  min-width: 34px;
  flex: 0 0 34px;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg,#378ADD,#185FA5);
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 12px;
}
.sb-logout {
  margin-left: auto;
  width: 28px; height: 28px; border-radius: 8px;
  min-width: 28px;
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  color: var(--color-sidebar-mute);
  background: transparent; border: none;
}
.sb-logout:hover { background: var(--color-sidebar-hover); color: #fff; }

/* ============================================================
   Topbar
   ============================================================ */
.app-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 20;
}
.crumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-ink-3); font-size: 13px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb > * { flex: 0 0 auto; }
.crumb .sep { color: var(--color-ink-5); }
.crumb .here {
  color: var(--color-ink); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar-spacer { flex: 1; }
.topbar-search {
  position: relative; width: 320px;
}
.topbar-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  border-radius: 8px;
  padding: 0 12px 0 34px;
  font-size: 13px;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}
.topbar-search .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--color-ink-4); display: grid; place-items: center;
}
.topbar-date {
  display: flex; align-items: center; gap: 6px;
  color: var(--color-ink-3); font-size: 12.5px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--color-bg-soft);
}
.topbar-bell {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--color-bg-soft);
  border: none; color: var(--color-ink-2);
}
.topbar-bell:hover { background: #e6eaf2; }
.topbar-bell .dot {
  position: absolute; top: 8px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 2px solid #fff;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--color-surface);
  color: var(--color-ink);
  font-weight: 500; font-size: 13px;
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms, transform 80ms;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), inset 0 -1px 0 rgba(0,0,0,0.08);
}
.btn-primary:hover { background: var(--color-primary-600); border-color: var(--color-primary-600); }
.btn-ghost {
  background: transparent;
  color: var(--color-ink-2);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-bg-soft); border-color: var(--color-border-strong); }
.btn-soft {
  background: var(--color-bg-soft);
  color: var(--color-ink-2);
  border-color: transparent;
}
.btn-soft:hover { background: #e6eaf2; }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; border-radius: 10px; }
.btn-danger-ghost { color: #b91c1c; }
.btn-danger-ghost:hover { background: #fff0ef; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  opacity: 0.85;
}

.status-badge.status-new      { background: var(--status-new-bg);      color: var(--status-new-fg); }
.status-badge.status-review   { background: var(--status-review-bg);   color: var(--status-review-fg); }
.status-badge.status-progress { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.status-badge.status-waiting  { background: var(--status-waiting-bg);  color: var(--status-waiting-fg); }
.status-badge.status-done     { background: var(--status-done-bg);     color: var(--status-done-fg); }
.status-badge.status-archived { background: var(--status-archived-bg); color: var(--status-archived-fg); }


.category-badge {
  background: #eef2f9; color: var(--color-ink-2);
  border: 1px solid #e3e7ee;
}
.assignee-badge {
  background: #f1f5ff;
  color: #24406d;
  border: 1px solid #dbe6ff;
}

/* ============================================================
   Page layout
   ============================================================ */
.page {
  padding: 22px 24px 40px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.page-subtitle {
  margin: 0;
  color: var(--color-ink-3); font-size: 13.5px;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-search {
  position: relative; flex: 1; min-width: 200px;
}
.filter-search input {
  width: 100%; height: 34px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 8px;
  font-size: 13px;
}
.filter-search input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.12);
}
.filter-search .icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--color-ink-4);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-surface-2); color: var(--color-ink-2);
  font-size: 12.5px; font-weight: 500;
}
.filter-chip:hover { background: var(--color-bg-soft); }
.filter-chip.is-active {
  background: var(--color-primary-50);
  border-color: var(--color-primary-100);
  color: var(--color-primary-600);
}

/* ============================================================
   Kanban
   ============================================================ */
.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-column {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  display: flex; flex-direction: column;
  min-height: 240px;
  overflow: visible;
  box-shadow: var(--shadow-xs);
}
.column-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}
.column-header::before {
  content: "";
  position: absolute; left: 14px; right: 14px; top: 0; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--col-bar, var(--status-new-bar));
}
.column-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px;
  color: var(--color-ink);
}
.column-count {
  background: var(--color-bg-soft);
  color: var(--color-ink-3);
  font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.column-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  width: 26px; height: 26px;
  border-radius: 6px; border: none;
  background: transparent; color: var(--color-ink-4);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--color-bg-soft); color: var(--color-ink); }

.column-body {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  flex: 1;
}
.column-body.is-drop-target {
  background: rgba(31,111,235,0.04);
  outline: 2px dashed rgba(31,111,235,0.3);
  outline-offset: -10px;
  border-radius: 8px;
}
.column-empty {
  padding: 18px 10px;
  text-align: center;
  color: var(--color-ink-4); font-size: 12px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
}
.column-footer {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--color-border);
}
.column-add {
  width: 100%; height: 32px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  color: var(--color-ink-3); font-size: 12.5px; font-weight: 500;
}
.column-add:hover { background: var(--color-bg-soft); border-color: var(--color-border-strong); color: var(--color-ink); }
/* ============================================================
   Case card
   ============================================================ */
.case-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-xs);
  position: relative;
  cursor: grab;
  transition: transform 120ms, box-shadow 120ms, border-color 120ms;
}
.case-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.case-card.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}
.case-card.is-external-pending {
  border-color: #fecaca;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.08), var(--shadow-xs);
}
.case-card.is-action-required {
  border-color: #fca5a5;
  box-shadow: 0 0 0 1px rgba(220,38,38,0.10), var(--shadow-xs);
}
.case-card.is-due {
  border-color: #facc15;
  box-shadow: 0 0 0 1px rgba(234,179,8,0.14), var(--shadow-xs);
}
.case-card.is-follow-up {
  border-color: #67e8f9;
  box-shadow: 0 0 0 1px rgba(14,165,233,0.13), var(--shadow-xs);
}
.action-required-badge,
.action-required-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  margin: 0;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.13);
}
button.action-required-badge,
button.action-required-label {
  border: 0;
  cursor: pointer;
  font: inherit;
}
button.action-required-badge {
  flex: 0 0 22px;
  text-align: center;
}
.action-required-label {
  background: #fff0ef;
  color: #991b1b;
  border: 1px solid #ffd2cc;
}
.action-required-label .action-required-dot {
  width: 16px;
  height: 16px;
  font-size: 10px;
  box-shadow: none;
}
.due-badge,
.due-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #facc15;
  color: #713f12;
  font-size: 0;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 0 0 3px rgba(250,204,21,0.18);
}
button.due-badge,
button.due-dot {
  border: 0;
  cursor: pointer;
  padding: 0;
}
button.due-label {
  cursor: pointer;
  font: inherit;
}
.due-badge::before,
.due-dot::before {
  content: "";
  width: 9px;
  height: 12px;
  display: block;
  background: currentColor;
  clip-path: polygon(12% 0, 88% 0, 88% 20%, 58% 50%, 88% 80%, 88% 100%, 12% 100%, 12% 80%, 42% 50%, 12% 20%);
}
.due-label {
  background: #fef9c3;
  color: #713f12;
  border: 1px solid #fde68a;
}
.due-label .due-dot {
  width: 16px;
  height: 16px;
  box-shadow: none;
}
.due-label .due-dot::before {
  width: 7px;
  height: 10px;
}
.due-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #713f12;
  font-weight: 650;
}
.due-state .due-dot {
  width: 18px;
  height: 18px;
  box-shadow: none;
}
.due-state .due-dot::before {
  width: 7px;
  height: 10px;
}
.follow-up-badge,
.follow-up-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0891b2;
  color: #fff;
  font-size: 0;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 0 0 3px rgba(8,145,178,0.16);
}
button.follow-up-badge,
button.follow-up-dot {
  border: 0;
  cursor: pointer;
  padding: 0;
}
button.follow-up-label {
  cursor: pointer;
  font: inherit;
}
.follow-up-badge::before,
.follow-up-dot::before {
  content: "↻";
  color: currentColor;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-0.5px);
}
.follow-up-label {
  background: #ecfeff;
  color: #155e75;
  border: 1px solid #a5f3fc;
}
.follow-up-label .follow-up-dot {
  width: 16px;
  height: 16px;
  box-shadow: none;
}
.follow-up-label .follow-up-dot::before {
  font-size: 11px;
}
.follow-up-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #155e75;
  font-weight: 650;
}
.follow-up-state .follow-up-dot {
  width: 18px;
  height: 18px;
  box-shadow: none;
}
.follow-up-state .follow-up-dot::before {
  font-size: 12px;
}
[data-follow-up-display] small {
  display: block;
  width: 100%;
  color: var(--color-ink-4);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.35;
}
.external-badge {
  background: #fff0ef;
  color: #991b1b;
  border: 1px solid #ffd2cc;
}
.external-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.14);
}
.case-card-top {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
}
.case-close-form {
  margin: 0 0 0 auto;
  position: relative;
  z-index: 3;
}
.case-close-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-2);
  color: var(--color-ink-3);
  display: grid;
  place-items: center;
  padding: 0;
}
.case-close-btn:hover {
  border-color: var(--color-primary-100);
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}
.lock-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 14px;
}
.lock-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
}
.lock-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}
.unlock-icon {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 14px;
}
.unlock-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
}
.unlock-icon::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  transform: translateX(2px);
}
.case-card-collapse {
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-2);
  color: var(--color-ink-3);
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  position: relative;
  z-index: 2;
  flex: 0 0 24px;
}
.case-card-collapse:hover {
  border-color: var(--color-border-strong);
  color: var(--color-ink);
}
.case-id {
  color: var(--color-ink-4);
  font-size: 11px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.case-card-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.35;
  color: var(--color-ink);
  margin: 0;
  text-wrap: pretty;
}
.case-card-desc {
  font-size: 12px; line-height: 1.45;
  color: var(--color-ink-3);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.case-card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--color-ink-3);
}
.case-card-foot {
  display: flex; align-items: center; gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
  font-size: 11.5px;
  color: var(--color-ink-3);
}
.case-card-foot .author {
  display: flex; align-items: center; gap: 6px;
  color: var(--color-ink-2); font-weight: 500;
}
.avatar-xs {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg,#378ADD,#185FA5);
  display: grid; place-items: center;
  color: #fff; font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.02em;
}
.foot-icons { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.foot-icon { display: inline-flex; align-items: center; gap: 4px; color: var(--color-ink-4); }
.foot-icon.due-near { color: #c2410c; }
.case-card-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 10px 0 0 10px;
  background: var(--card-bar);
}
.case-card.is-card-collapsed {
  gap: 6px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.case-card.is-card-collapsed .case-card-desc,
.case-card.is-card-collapsed .case-card-meta,
.case-card.is-card-collapsed .case-card-foot {
  display: none;
}
.case-card.is-card-collapsed .case-card-title {
  font-size: 12.5px;
  line-height: 1.25;
}

/* ============================================================
   Login
   ============================================================ */
.login-screen {
  min-height: 100vh;
  background: #f4f6fa;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
}
.login-hero {
  position: relative;
  background:
    radial-gradient(circle at 15% 110%, rgba(55, 138, 221, 0.30) 0%, rgba(4, 44, 83, 0.98) 46%, #0A1628 100%);
  overflow: hidden;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 56px 48px;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 95% 85% at 28% 48%, #000 30%, transparent 85%);
  pointer-events: none;
}
.login-hero::after {
  content: "";
  position: absolute; top: 28px; right: 28px;
  width: 12px; height: 12px;
  background:
    linear-gradient(#fff, #fff) center/1px 12px no-repeat,
    linear-gradient(90deg, #fff, #fff) center/12px 1px no-repeat;
  opacity: 0.24;
  pointer-events: none;
}
.login-brand-block {
  display: flex; align-items: center; gap: 16px;
  position: relative; z-index: 1;
}
.login-brand-block .brand-mark {
  width: 52px; height: 52px;
  min-width: 52px;
  border-radius: 12px;
  font-size: 18px;
  background: #042C53;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.2);
}
.login-brand-block .brand-text .t1 { font-size: 22px; color: #fff; }
.login-brand-block .brand-text .t2 {
  color: rgba(255,255,255,.55);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.login-tagline {
  position: relative; z-index: 1;
  max-width: 620px;
}
.login-tagline h1 {
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.04;
  font-weight: 700;
  margin: 0 0 22px;
  text-wrap: balance;
  letter-spacing: -0.025em;
}
.login-tagline h1.hero-title-lines {
  letter-spacing: 0;
}
.hero-title-lines span {
  display: block;
}
.login-tagline p {
  margin: 0;
  color: rgba(255,255,255,0.62);
  font-size: 16px;
  line-height: 1.55;
  max-width: 500px;
}
.login-meta {
  display: flex; gap: 22px; margin-top: 42px;
  color: rgba(255,255,255,0.75); font-size: 12px;
  flex-wrap: wrap;
}
.login-meta > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-meta-icon {
  position: relative;
  width: 28px;
  height: 28px;
  min-width: 28px;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  font-family: var(--font-sans);
}
.login-meta-lock::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  width: 12px;
  height: 9px;
  border-radius: 2px;
  background: #fff;
}
.login-meta-lock::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}
.login-meta strong { color: #fff; font-weight: 700; display: block; font-size: 24px; line-height: 1; }

.login-card-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 44px 56px 48px;
  background: #f4f6fa;
}
.login-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 34px;
  box-shadow: 0 24px 60px -26px rgba(15,30,60,0.32);
}
.login-card h2 {
  margin: 0 0 6px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.015em;
}
.login-card p.sub {
  margin: 0 0 26px;
  color: var(--color-ink-3); font-size: 14px; line-height: 1.55;
}
.public-actions {
  width: 100%;
  max-width: 520px;
  margin: 22px auto 0;
  display: grid;
  gap: 14px;
}
.public-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15,30,60,0.04), 0 12px 32px -18px rgba(15,30,60,0.18);
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}
.public-action-card:hover {
  border-color: var(--color-primary-100);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.public-action-card strong {
  display: block;
  color: var(--color-ink);
  font-size: 15px;
}
.public-action-card small {
  display: block;
  color: var(--color-ink-3);
  font-size: 12.5px;
  margin-top: 2px;
}
.public-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--color-primary-50);
  color: var(--color-primary);
  font-weight: 800;
  flex-shrink: 0;
}

.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--color-ink-2); }
.form-hint  { font-size: 11.5px; color: var(--color-ink-4); }
.form-input,
.form-textarea,
.form-select {
  height: 38px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13.5px;
  transition: border-color 120ms, box-shadow 120ms;
  width: 100%;
}
.form-input[type="date"] {
  display: block;
  box-sizing: border-box;
  max-height: 38px;
  min-height: 38px;
  line-height: 38px;
  padding-block: 0;
  appearance: none;
  -webkit-appearance: none;
}
.form-input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.2em;
  text-align: left;
}
.form-input[type="date"]::-webkit-datetime-edit {
  padding: 0;
}
.form-textarea { height: auto; padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.5; }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.login-notice {
  margin-top: 16px;
  padding: 14px 16px;
  background: #eef4ff;
  border: 1px solid var(--color-primary-100);
  color: #134089;
  border-radius: 10px;
  font-size: 13px; line-height: 1.5;
  display: flex; gap: 8px;
}
.login-notice svg { flex-shrink: 0; margin-top: 2px; }

.login-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 24px;
  color: var(--color-ink-4); font-size: 13px;
}
.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--color-ink-2); }
.checkbox-row input { accent-color: var(--color-primary); }
.assignee-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
}
.assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: 12.5px;
  cursor: pointer;
}
.assignee-option input {
  accent-color: var(--color-primary);
}
.assignee-option:has(input:checked) {
  border-color: var(--color-primary-100);
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 4px 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
  cursor: pointer;
}
.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-control {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-border-strong);
  position: relative;
  flex: 0 0 42px;
  transition: background 140ms ease;
}
.switch-control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease;
}
.switch-row input:checked + .switch-control { background: var(--color-primary); }
.switch-row input:checked + .switch-control::after { transform: translateX(18px); }
.switch-row strong {
  display: block;
  color: var(--color-ink);
  font-size: 13px;
}
.switch-row small {
  display: block;
  color: var(--color-ink-3);
  font-size: 11.5px;
  line-height: 1.4;
}

/* ============================================================
   Detail view (Akte)
   ============================================================ */
.case-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
.case-detail-header {
  grid-column: 1 / -1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.case-detail-header .top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.case-detail-header h1 {
  margin: 0; font-size: 20px; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.3;
}
.case-detail-header .meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 24px;
  color: var(--color-ink-3); font-size: 12.5px;
  margin-top: 14px;
}
.case-detail-header .meta > div { min-width: 0; }
.case-detail-header .meta div > span:first-child {
  color: var(--color-ink-4); display: block; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px;
  font-weight: 600;
}
.case-detail-header .meta div > span:last-child {
  color: var(--color-ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.detail-actions { display: flex; gap: 8px; margin-left: auto; }
.detail-actions form { margin: 0; }

.case-body-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.case-body-card h3 {
  margin: 0 0 10px;
  font-size: 13px; font-weight: 600;
  color: var(--color-ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.case-description {
  font-size: 14px; line-height: 1.6; color: var(--color-ink);
  margin: 0;
  text-wrap: pretty;
}

/* Timeline */
.journal-timeline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.journal-timeline-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.journal-timeline h3 {
  margin: 0;
  font-size: 13px; font-weight: 600;
  color: var(--color-ink-2);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 8px;
}
.journal-sort-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.journal-sort-form .form-label {
  margin: 0;
  font-size: 10.5px;
}
.journal-timeline h3 .count {
  background: var(--color-bg-soft);
  color: var(--color-ink-3);
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  text-transform: none; letter-spacing: 0;
}
.timeline-list {
  position: relative;
  display: flex; flex-direction: column; gap: 14px;
  padding-left: 26px;
}
.timeline-list::before {
  content: ""; position: absolute;
  left: 9px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-border) 0%, var(--color-border) 95%, transparent);
}
.journal-entry { position: relative; }
.journal-entry::before {
  content: "";
  position: absolute;
  left: -22px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--entry-color, var(--color-primary));
  box-shadow: 0 0 0 3px var(--color-surface);
}
.journal-entry-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--color-surface-2);
}
.entry-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  flex-wrap: wrap;
}
.entry-type {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--entry-bg, var(--color-primary-50));
  color: var(--entry-color, var(--color-primary));
  letter-spacing: 0.01em;
}
.entry-meta { color: var(--color-ink-4); font-size: 11.5px; margin-left: auto; }
.entry-author { color: var(--color-ink-2); font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.entry-text {
  margin: 6px 0 0;
  font-size: 13px; line-height: 1.55;
  color: var(--color-ink);
  text-wrap: pretty;
}
.entry-edited { margin-top: 8px; color: var(--color-ink-4); font-size: 11.5px; }
.journal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.journal-actions form { margin: 0; }
.journal-edit summary { cursor: pointer; color: var(--color-primary); font-weight: 600; font-size: 12.5px; }
.journal-edit form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.journal-attach-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.journal-file-details { margin-top: 10px; }
.journal-file-details summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 12.5px;
}
.compact-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.compact-file:hover { background: var(--color-bg-soft); }
.compact-file::before { content: "↥"; color: var(--color-primary); font-weight: 700; }
.compact-file.large { padding: 12px; width: 100%; justify-content: center; }
.compact-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.attachment-list { display: grid; gap: 8px; margin: 10px 0; }
.attachment-list.compact { margin-top: 12px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.attachment-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.attachment-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.attachment-name { color: var(--color-primary); font-weight: 600; overflow-wrap: anywhere; }
.attachment-info span { color: var(--color-ink-4); font-size: 11.5px; }

/* Journal form */
.journal-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 16px;
  box-shadow: var(--shadow-xs);
}
.journal-form-head {
  display: grid;
  gap: 8px;
  align-items: start;
  justify-items: start;
  margin-bottom: 10px;
}
.journal-form-head > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.journal-form .type-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.type-chip {
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink-2);
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
}
.type-chip:hover { background: var(--color-bg-soft); }
.type-chip.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}
.journal-form-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
}
.journal-form-hint { color: var(--color-ink-4); font-size: 11.5px; }

/* Sidebar info card */
.detail-side { display: flex; flex-direction: column; gap: 14px; }
.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.info-card h4 {
  margin: 0 0 12px;
  font-size: 12px; font-weight: 600;
  color: var(--color-ink-3);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.info-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 12.5px;
}
.info-row:last-child { border-bottom: none; }
.info-row .k { color: var(--color-ink-3); }
.info-row .v { color: var(--color-ink); font-weight: 500; }
.info-row-stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
}
.info-row-stacked .v {
  width: 100%;
  color: var(--color-ink-2);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.assignee-summary {
  text-align: right;
}
.info-action-form {
  margin: 8px 0 10px;
}
.info-action-form .btn {
  width: 100%;
  justify-content: center;
}
.measure-action-group {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px;
}
.measure-action-group .btn {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
}
.measure-action-group .btn[hidden] {
  display: none;
}
.detail-full-action,
.follow-up-detail-action {
  width: 100%;
  justify-content: center;
  margin: 8px 0 10px;
}
.tracking-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,22,40,0.38);
  backdrop-filter: blur(4px);
}
.tracking-modal-backdrop[hidden] { display: none; }
.tracking-modal {
  width: min(520px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tracking-modal-body {
  display: grid;
  gap: 12px;
}
.tracking-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
  color: var(--color-ink-2);
}
.tracking-choice strong {
  display: block;
  color: var(--color-ink);
  font-size: 13px;
}
.tracking-choice small {
  display: block;
  margin-top: 2px;
  color: var(--color-ink-4);
  font-size: 11.5px;
  line-height: 1.35;
}

.related-list { display: flex; flex-direction: column; gap: 8px; }
.related-item {
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-2);
  font-size: 12.5px;
}
.related-item .t { font-weight: 600; color: var(--color-ink); margin-bottom: 3px; }
.related-item .m { color: var(--color-ink-4); font-size: 11.5px; }
.history-details {
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}
.history-details summary {
  cursor: pointer;
  color: var(--color-primary-600);
  font-size: 12px;
  font-weight: 600;
  list-style: none;
}
.history-details summary::-webkit-details-marker { display: none; }
.history-details summary::after {
  content: "⌄";
  display: inline-block;
  margin-left: 6px;
  transition: transform 140ms ease;
}
.history-details[open] summary::after { transform: rotate(180deg); }
.history-hidden-list { margin-top: 8px; }
.tracking-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tracking-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  display: inline-block;
}
.tracking-state.is-active .tracking-state-dot {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}
.tracking-state.is-inactive .tracking-state-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(11,31,58,0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 160ms ease;
}
.modal-target { display: none; }
.modal-target:target { display: grid; }
.modal {
  width: 100%; max-width: 600px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 200ms cubic-bezier(0.16,1,0.3,1);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
}
.modal-foot .left { margin-right: auto; color: var(--color-ink-4); font-size: 11.5px; }
.due-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,22,40,0.38);
  backdrop-filter: blur(4px);
}
.due-modal-backdrop[hidden] { display: none; }
.due-modal {
  width: min(460px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.due-modal-body {
  display: grid;
  gap: 10px;
}
.due-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
  cursor: pointer;
}
.due-choice input {
  margin-top: 2px;
  accent-color: var(--color-primary);
}
.due-choice strong {
  display: block;
  font-size: 13px;
  color: var(--color-ink);
}
.due-choice small {
  display: block;
  margin-top: 2px;
  color: var(--color-ink-3);
  font-size: 11.5px;
  line-height: 1.4;
}
.due-modal-date {
  margin: 4px 0 0;
}
.measure-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,22,40,0.38);
  backdrop-filter: blur(4px);
}
.measure-modal-backdrop[hidden] { display: none; }
.measure-modal {
  width: min(520px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.measure-modal-body {
  display: grid;
  gap: 12px;
}
.measure-modal-intro {
  margin: 0;
  color: var(--color-ink-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.measure-preview {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
}
.measure-preview p {
  margin: 6px 0 0;
  color: var(--color-ink);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.follow-up-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,22,40,0.38);
  backdrop-filter: blur(4px);
}
.follow-up-modal-backdrop[hidden] { display: none; }
.follow-up-modal {
  width: min(520px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.follow-up-modal-body {
  display: grid;
  gap: 12px;
}
.follow-up-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-2);
  color: var(--color-ink-2);
}
.follow-up-choice[hidden] { display: none; }
.follow-up-choice strong {
  display: block;
  color: var(--color-ink);
  font-size: 13px;
}
.follow-up-choice small {
  display: block;
  margin-top: 2px;
  color: var(--color-ink-4);
  font-size: 11.5px;
  line-height: 1.35;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============================================================
   Table (archive)
   ============================================================ */
.data-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-ink-3);
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 14px;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-ink);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 100ms; cursor: pointer; }
.data-table tbody tr:hover { background: var(--color-bg-soft); }
.table-action-cell {
  width: 1%;
  white-space: nowrap;
}
.table-action-cell .btn {
  pointer-events: auto;
}
.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cell-title { font-weight: 600; }
.cell-muted { color: var(--color-ink-3); font-size: 12.5px; }
.cell-author { display: flex; align-items: center; gap: 8px; }

/* Pagination */
.pagination {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  font-size: 12px; color: var(--color-ink-3);
}
.page-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--color-ink-2);
  font-size: 12px; font-weight: 500;
}
.page-btn:hover { background: var(--color-bg-soft); }
.page-btn.is-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============================================================
   Stat tiles
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-xs);
}
.stat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--color-primary-50);
  color: var(--color-primary);
}
.stat-tile .v { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.stat-tile .k { color: var(--color-ink-3); font-size: 12px; margin-top: 4px; }
.stat-tile .trend { margin-left: auto; font-size: 11px; color: var(--color-ink-4); }
.stat-tile.tone-warn .stat-icon { background: var(--status-waiting-bg); color: var(--status-waiting-fg); }
.stat-tile.tone-progress .stat-icon { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.stat-tile.tone-done .stat-icon { background: var(--status-done-bg); color: var(--status-done-fg); }
.stat-tile.tone-due .stat-icon { background: #fef9c3; color: #713f12; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-ink-4);
}
.empty-state .ico {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--color-bg-soft);
  display: grid; place-items: center;
  color: var(--color-ink-4);
}
.empty-state h4 { margin: 0 0 4px; color: var(--color-ink-2); font-size: 14px; font-weight: 600; }
.empty-state p { margin: 0; font-size: 12.5px; }

/* ============================================================
   Tabs (mobile status switcher)
   ============================================================ */
.status-tabs {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.status-tab {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: none; background: transparent;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--color-ink-3);
  white-space: nowrap;
}
.status-tab.is-active {
  background: var(--color-bg-soft);
  color: var(--color-ink);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .case-detail { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: 430px; }
  .login-card-side { padding: 34px; }
}
@media (max-width: 860px) {
  :root {
    --sidebar-w: 220px;
    --sidebar-w-collapsed: 72px;
  }
  .topbar-search { width: 220px; }
}
@media (max-width: 700px) {
  .login-screen { min-height: 100vh; }
  .login-shell { min-height: auto; }
  .login-hero { padding: 28px 22px; min-height: 430px; }
  .login-card-side { padding: 24px 18px 32px; }
  .login-meta { gap: 12px; margin-top: 30px; }
  .login-meta strong { font-size: 18px; }
  .login-card { padding: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kanban-board { display: block; }
  .kanban-column { margin-bottom: 12px; max-height: none; }
  .status-tabs { display: flex; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .topbar-date { display: none; }
  .page { padding: 16px; }
  .external-notice { display: block; }
  .external-notice-actions { justify-content: flex-start; margin-top: 12px; }
  .external-notice-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PHP integration additions
   ============================================================ */
.full-btn { width: 100%; justify-content: center; }
.alert-box {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 12.5px;
  line-height: 1.45;
}
.alert-error {
  background: #fff0ef;
  border: 1px solid #ffd2cc;
  color: #991b1b;
}
.alert-success {
  background: var(--status-done-bg);
  border: 1px solid #a7f3d0;
  color: var(--status-done-fg);
}
.alert-info {
  background: var(--color-primary-50);
  border: 1px solid var(--color-primary-100);
  color: #134089;
}
.tracking-details {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
}
.tracking-details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface-2);
  font-size: 12px;
}
.tracking-details span { color: var(--color-ink-3); }
.tracking-details strong {
  color: var(--color-ink);
  font-weight: 600;
  text-align: right;
}
.external-notice {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #ffd2cc;
  border-radius: 12px;
  background: #fff7f6;
}
.external-notice h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.external-notice p {
  margin: 0 0 12px;
  color: var(--color-ink-3);
  font-size: 12.5px;
}
.external-notice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}
.external-notice-grid span {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: 12px;
}
.external-notice-grid strong {
  display: block;
  color: var(--color-ink-4);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.external-notice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.external-notice-actions form { margin: 0; }
.compact-select { height: 34px; width: auto; min-width: 160px; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.back-row { margin-bottom: 12px; }
.small-strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-2);
}
.narrow-page { max-width: 980px; }
.form-panel h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.inline-foot {
  margin: 8px -20px -18px;
  border-radius: 0 0 12px 12px;
}
.nav-item[href] { text-decoration: none; }
.case-card .case-card-top,
.case-card .case-card-desc,
.case-card .case-card-meta,
.case-card .case-card-foot { position: relative; z-index: 1; }

.color-swatch {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.topbar-search button { display: none; }
.data-table form { margin: 0; }
.settings-grid {
  display: grid;
  gap: 16px;
}
.settings-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.settings-card-head {
  margin-bottom: 16px;
}
.settings-card-head h2 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.settings-card-head p {
  margin: 0;
  color: var(--color-ink-3);
  font-size: 13px;
}
.settings-inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.settings-table {
  margin-top: 0;
}
.settings-status-list {
  display: grid;
  gap: 10px;
}
.settings-status-row {
  display: grid;
  grid-template-columns: 12px 86px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}
.settings-status-row > span:nth-child(2) {
  color: var(--color-ink-3);
  font-size: 12.5px;
  font-weight: 600;
}
.settings-card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
@media (max-width: 700px) {
  .settings-inline-form,
  .settings-status-row {
    grid-template-columns: 1fr;
  }
  .settings-status-row .status-dot {
    display: none;
  }
}
.print-body {
  background: #fff;
  color: #111827;
  font-size: 13px;
}
.print-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px;
}
.print-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 20px;
}
.print-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid #111827;
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.print-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
  font-weight: 700;
}
.print-header h1 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}
.print-case-id {
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}
.print-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 14px;
  margin-bottom: 22px;
}
.print-grid div {
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  border-radius: 4px;
}
.print-grid span {
  display: block;
  color: #6b7280;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 3px;
}
.print-section {
  break-inside: avoid;
  margin-bottom: 22px;
}
.print-section h2 {
  font-size: 15px;
  border-bottom: 1px solid #d1d5db;
  padding-bottom: 5px;
  margin: 0 0 10px;
}
.print-entry {
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 10px 12px;
  margin-bottom: 10px;
  break-inside: avoid;
}
.print-entry header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.print-entry header span,
.print-muted,
.print-meta-line {
  color: #6b7280;
  font-size: 12px;
}
.print-entry p { margin: 6px 0 0; line-height: 1.5; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; }
  .no-print { display: none !important; }
  .print-page { max-width: none; padding: 0; }
  .print-grid { grid-template-columns: repeat(3, 1fr); }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 700px) {
  .compact-select { width: 100%; }
  .data-table-wrap { overflow-x: auto; }
  .login-tagline h1 { font-size: 25px; }
  .print-grid { grid-template-columns: 1fr; }
  .print-header { flex-direction: column; }
}
