/* Legalsense KK — exact match to screenshot */
:root {
  --ls-active:      #5b73b8;
  --ls-active-dark: #4a63a8;
  --ls-bg:          #ebebeb;
  --ls-white:       #ffffff;
  --ls-border:      #d8dce8;
  --ls-card-border: #dde1ee;
  --ls-green:       #2e7d32;
  --ls-orange:      #e65100;
  --ls-red:         #c62828;
  --text:           #1f2937;
  --text-light:     #888ea8;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Open Sans', sans-serif;
}

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

html { scrollbar-gutter: stable; }

body {
  font-family: var(--font);
  background: var(--ls-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Top bar ── */
.topbar {
  background: var(--ls-white);
  border-bottom: 1px solid var(--ls-border);
  padding: 0 20px 0 0;
  display: flex;
  align-items: center;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  padding-left: 18px;
}

.topbar-logo img {
  height: 56px;
  width: auto;
}

.topbar-konkurs {
  font-family: Georgia, 'Palatino Linotype', Palatino, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  color: #cc1100;
  letter-spacing: 0.5px;
  margin-left: -6px;
  line-height: 1;
  align-self: center;
  padding-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nd-status {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 3px;
  background: var(--ls-white);
  color: var(--text-light);
  border: 1px solid var(--ls-border);
}
.nd-status.connected {
  background: #e8f5e9;
  color: var(--ls-green);
  border-color: #c8e6c9;
}

/* ── Sub-nav bar ── */
.subnav {
  background: var(--ls-active);
  padding: 0 0;
  display: flex;
  align-items: stretch;
  height: 40px;
  list-style: none;
  position: sticky;
  top: 64px;
  z-index: 99;
}

.subnav li a {
  display: flex;
  align-items: center;
  padding: 0 18px;
  height: 100%;
  text-decoration: none;
  color: white;
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.1s;
}

.subnav li a:hover { background: rgba(0,0,0,0.08); }

.subnav li.active a {
  background: var(--ls-white);
  color: #111;
  font-weight: 700;
}

/* ── Page content ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-light);
  margin-bottom: 18px;
}
.breadcrumb a { color: var(--ls-active); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #b8bdd0; }

/* ── Card ── */
.card {
  background: var(--ls-white);
  border: 1px solid var(--ls-card-border);
  border-radius: 4px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(60,70,120,0.06);
}

.card-header {
  padding: 14px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ls-active);
}

.card-header .count {
  font-size: 13px;
  color: var(--text-light);
}

.card-body { padding: 20px; }

/* ── Matter list ── */
.matter-list { list-style: none; }

.matter-item {
  display: flex;
  align-items: center;
  padding: 13px 20px;
  border-top: 1px solid var(--ls-card-border);
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
  gap: 16px;
}

.matter-item:hover { background: #f7f9fd; }

.matter-info { flex: 1; min-width: 0; }

.matter-name {
  font-weight: 500;
  color: var(--ls-active);
  font-size: 14px;
}
.matter-meta-line {
  font-size: 12.5px;
  color: var(--text-light);
  margin-top: 3px;
}
.matter-meta-line .dot { margin: 0 5px; }

.matter-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.progress-bar-outer {
  width: 100%;
  background: #e2e6f0;
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: var(--ls-active);
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-count {
  font-size: 12px;
  color: var(--text-light);
  min-width: 28px;
  text-align: right;
}

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.status-active         { background: #dbeafe; color: #1e40af; }
.status-forsenad       { background: #fef9c3; color: #854d0e; }
.status-closed         { background: #dcfce7; color: #166534; }
.status-pending        { background: #fff3e0; color: #bf5900; }
.status-submitted      { background: #e8f5e9; color: #2e7d32; }
.status-overdue        { background: #ffebee; color: #c62828; }
.status-not_applicable { background: #f3f4f6; color: #9ca3af; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  font-family: var(--font);
  white-space: nowrap;
}
.btn:hover { opacity: 0.87; }
.btn-primary   { background: var(--ls-active); color: white; border-color: var(--ls-active-dark); }
.btn-secondary { background: var(--ls-white); color: var(--text); border-color: var(--ls-border); }
.btn-secondary:hover { background: #f0f2f8; }
.btn-sm { padding: 4px 11px; font-size: 12px; }

/* ── Workflow table ── */
.workflow-table {
  width: 100%;
  border-collapse: collapse;
}

.workflow-table th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: #fafbfd;
  border-bottom: 1px solid var(--ls-card-border);
  font-weight: 600;
}

.workflow-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ls-card-border);
  vertical-align: middle;
  font-size: 13px;
}

.workflow-table tr:last-child td { border-bottom: none; }
.workflow-table tr:hover td { background: #f7f9fd; }

.item-name { font-weight: 500; font-size: 13px; }
.legal-basis-tag {
  font-size: 11px;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

/* ── Matter detail meta ── */
.matter-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
  margin-bottom: 16px;
}

.meta-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 3px;
  font-weight: 500;
}

.meta-field .value {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

/* ── ND link ── */
.nd-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ls-active);
  text-decoration: none;
}
.nd-link:hover { text-decoration: underline; }

/* ── Alerts ── */
.alert {
  padding: 11px 16px;
  border-radius: 3px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-info    { background: #e8f0fb; color: var(--ls-active); border: 1px solid #c0d0ee; }
.alert-warning { background: #fff8e1; color: #7a4f00; border: 1px solid #ffe082; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,40,80,0.35);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 5px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--ls-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfd;
  border-radius: 5px 5px 0 0;
}

.modal-header h3 { font-size: 14px; font-weight: 600; color: var(--ls-active); }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-light); background: none; border: none; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ls-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfd;
  border-radius: 0 0 5px 5px;
}

/* ── Form fields ── */
.form-group { margin-bottom: 15px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--text-light);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--ls-border);
  border-radius: 3px;
  padding: 7px 10px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--ls-active);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group small { font-size: 11px; color: var(--text-light); margin-top: 3px; display: block; }

/* ── Deadline urgency ── */
.deadline-date { font-size: 12px; color: var(--text); }
.deadline-soon { font-size: 11px; color: var(--ls-orange); }
.deadline-late { font-size: 11px; color: var(--ls-red); }

/* ── Overdue row ── */
tr.is-overdue td { background: #ffd6d6 !important; }
.flexible-row td:not(:first-child) { color: var(--text-light); }

/* ── Pyjama striping ── */
.matter-list .matter-item:nth-child(even) { background: #f4f6fc; }
.matter-list .matter-item:nth-child(even):hover { background: #eef1f8; }

.workflow-table tbody tr:nth-child(even) td { background: #f4f6fc; }
.workflow-table tbody tr:nth-child(even):hover td { background: #eef1f8; }
.workflow-table tbody tr.is-overdue td,
.workflow-table tbody tr.is-overdue:nth-child(even) td { background: #ffd6d6 !important; }

.deadlines-table tbody tr:nth-child(even) td { background: #f4f6fc; }
.deadlines-table tbody tr:nth-child(even):hover td { background: #eef1f8; }
.deadlines-table tbody tr.is-overdue td,
.deadlines-table tbody tr.is-overdue:nth-child(even) td { background: #ffd6d6 !important; }

/* ── Matter filters ── */
.matter-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ls-card-border);
  background: #fafbfd;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--ls-border);
  background: white;
  color: var(--text-light);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.filter-btn:hover { background: #f0f2f8; }

.filter-count {
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
}

.filter-btn.active { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.filter-btn.active .filter-count { background: rgba(30,64,175,0.12); }
.filter-btn.active[data-filter="forsenad"] { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.filter-btn.active[data-filter="forsenad"] .filter-count { background: rgba(133,77,14,0.12); }
.filter-btn.active[data-filter="closed"]   { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.filter-btn.active[data-filter="closed"] .filter-count { background: rgba(22,101,52,0.12); }

/* ── Matters sortable table ── */
.matters-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.matters-table th {
  background: var(--ls-active);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.12);
}
.matters-table th:last-child { border-right: none; }

.matters-table th.sortable { cursor: pointer; user-select: none; }
.matters-table th.sortable:hover { background: #4a63a8; }

.matters-table th .sort-arrow { display: inline-block; margin-left: 5px; font-size: 10px; opacity: 0.55; }
.matters-table th .sort-arrow::after { content: '↕'; }
.matters-table th.sort-asc .sort-arrow { opacity: 1; }
.matters-table th.sort-asc .sort-arrow::after { content: '▲'; }
.matters-table th.sort-desc .sort-arrow { opacity: 1; }
.matters-table th.sort-desc .sort-arrow::after { content: '▼'; }

.matters-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ls-card-border);
  font-size: 13px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.matters-table tr:last-child td { border-bottom: none; }

.matter-row { cursor: pointer; }
.matter-row:hover td { background: #f0f4fc !important; }

.matters-table tbody tr:nth-child(even) td { background: #f4f6fc; }
.matters-table tbody tr:nth-child(even):hover td { background: #eef1f8 !important; }

.col-number a {
  color: var(--ls-active);
  font-weight: 600;
  text-decoration: none;
}
.col-number a:hover { text-decoration: underline; }

.col-name a { color: var(--text); text-decoration: none; }
.col-name a:hover { color: var(--ls-active); }

.col-date { color: var(--text-light); font-size: 12.5px; }
.col-person { font-size: 12.5px; }
.col-status { white-space: normal; vertical-align: middle; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
}
.empty-state h3 { margin-bottom: 8px; font-size: 15px; color: var(--text); }

/* ── Theme picker ── */
.theme-picker-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ls-border);
  background: white url('theme-icon.svg') center / contain no-repeat;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.theme-picker-btn:hover { border-color: #aaa; }

#admin-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.theme-picker-panel {
  position: fixed;
  top: 72px;
  right: 12px;
  background: #fff;
  border: 1px solid var(--ls-border);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.13);
  display: none;
  z-index: 300;
}
.theme-picker-panel.open { display: block; }

.theme-picker-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.theme-swatches { display: flex; gap: 8px; }

.theme-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 0.1s, border-color 0.15s;
}
.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch.active { border-color: #333; }
