* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #e4e4e7;
  background: #0b0b0d;
  display: flex;
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted  { color: #a1a1aa; }

/* ------------------------------------------------------------------ login */

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0b0b0d;
}
.login-card {
  background: #18181b;
  padding: 32px;
  border-radius: 8px;
  min-width: 320px;
  border: 1px solid #27272a;
}
.login-card h1 { margin: 0 0 16px; font-size: 20px; font-weight: 600; }
.login-card label { display: block; margin: 12px 0 6px; font-size: 12px; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.04em; }
.login-card input {
  width: 100%; padding: 10px 12px;
  background: #0b0b0d; color: #e4e4e7;
  border: 1px solid #3f3f46; border-radius: 4px;
  font-size: 14px;
}
.login-card button {
  margin-top: 16px; width: 100%; padding: 10px;
  background: #4f46e5; color: white;
  border: 0; border-radius: 4px; font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: #6366f1; }
.error { margin-top: 12px; color: #f87171; font-size: 13px; min-height: 1em; }

/* ------------------------------------------------------------------ layout */

.sidebar {
  width: 280px;
  background: #18181b;
  border-right: 1px solid #27272a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid #27272a;
  display: flex; justify-content: space-between; align-items: center;
}
.sidebar-header h1 { margin: 0; font-size: 16px; font-weight: 600; }
.sidebar-header button {
  background: transparent; color: #a1a1aa; border: 0;
  font-size: 16px; cursor: pointer;
}
.sidebar-header button:hover { color: #e4e4e7; }

.task-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1;
}
.task-list .empty { padding: 14px 18px; color: #71717a; font-size: 13px; }
.task-item {
  padding: 12px 18px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid #1c1c20;
}
.task-item:hover { background: #1c1c20; }
.task-item.active { background: #27272a; }
.task-item-body { flex: 1; min-width: 0; }
.task-item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item-sub { font-size: 12px; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.empty-state {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  color: #71717a;
}

/* ------------------------------------------------------------------ status dots */

.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #52525b;
  flex-shrink: 0;
}
.dot-green  { background: #22c55e; box-shadow: 0 0 0 2px #22c55e33; }
.dot-yellow { background: #eab308; box-shadow: 0 0 0 2px #eab30833; }
.dot-red    { background: #ef4444; box-shadow: 0 0 0 2px #ef444433; }
.dot-grey   { background: #52525b; }

/* ------------------------------------------------------------------ detail */

.task-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.task-header {
  padding: 20px 24px;
  border-bottom: 1px solid #27272a;
  background: #131316;
}
.task-title { display: flex; align-items: center; gap: 10px; }
.task-title h2 { margin: 0; font-size: 18px; font-weight: 600; }
.task-title .muted { font-size: 12px; margin-left: 6px; }

#task-description { margin: 6px 0 12px; }

.task-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0 0 16px;
  font-size: 13px;
}
.task-meta dt { color: #a1a1aa; }
.task-meta dd { margin: 0; }

.task-controls { display: flex; gap: 8px; }
.task-controls button {
  padding: 6px 14px;
  background: #27272a; color: #e4e4e7;
  border: 1px solid #3f3f46; border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.task-controls button:hover:not(:disabled) { background: #3f3f46; }
.task-controls button:disabled { opacity: 0.5; cursor: not-allowed; }
#btn-resume { background: #166534; border-color: #166534; }
#btn-resume:hover:not(:disabled) { background: #15803d; }

.tabs {
  display: flex;
  border-bottom: 1px solid #27272a;
  background: #131316;
}
.tab {
  padding: 10px 18px;
  background: transparent; color: #a1a1aa;
  border: 0; border-bottom: 2px solid transparent;
  cursor: pointer; font-size: 13px;
}
.tab:hover { color: #e4e4e7; }
.tab.active { color: #e4e4e7; border-bottom-color: #4f46e5; }

.tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}
.tab-panel.active { display: block; }

/* ------------------------------------------------------------------ timeline */

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.entry {
  background: #18181b;
  border: 1px solid #27272a;
  border-left: 3px solid #3f3f46;
  border-radius: 4px;
  padding: 10px 14px;
  position: relative;
}
.entry-time { font-size: 11px; color: #71717a; margin-bottom: 4px; }
.entry-content { white-space: pre-wrap; word-break: break-word; }

.entry.prio-low    { opacity: 0.75; }
.entry.prio-high   { border-left-color: #f59e0b; }
.entry.prio-critical { border-left-color: #ef4444; background: #2a0d10; }

.entry-row .kind {
  display: inline-block; padding: 2px 6px;
  background: #3f3f46; color: #e4e4e7;
  border-radius: 3px; font-size: 11px; margin-right: 8px;
}
.entry-row pre, .entry-data-body pre {
  background: #0b0b0d; color: #e4e4e7;
  padding: 6px 8px; margin: 4px 0 0;
  border-radius: 3px;
  overflow-x: auto; font-size: 12px;
  white-space: pre-wrap; word-break: break-word;
}
.entry-batch summary { cursor: pointer; color: #c7d2fe; }
.batch-items { margin: 8px 0 0 16px; padding: 0; }
.batch-items li { margin: 4px 0; }
.batch-items pre {
  background: #0b0b0d; padding: 6px 8px; margin: 0;
  border-radius: 3px; font-size: 11px;
  white-space: pre-wrap; word-break: break-word;
}

/* ------------------------------------------------------------------ data table */

.data-toolbar {
  margin-bottom: 12px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.data-toolbar label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #a1a1aa; }
.data-toolbar select,
.data-toolbar input[type="search"] {
  background: #0b0b0d; color: #e4e4e7;
  border: 1px solid #3f3f46; border-radius: 3px;
  padding: 6px 10px; font-size: 13px;
  outline: none;
}
.data-toolbar input[type="search"] { min-width: 240px; }
.data-toolbar select:focus, .data-toolbar input[type="search"]:focus { border-color: #4f46e5; }

.table-section { margin-bottom: 24px; }
.table-section-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.table-section-header h3 {
  margin: 0; font-size: 14px; font-weight: 600;
}
.table-scroll {
  overflow-x: auto;
  border: 1px solid #27272a;
  border-radius: 4px;
}

.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #27272a;
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table th {
  color: #a1a1aa; font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: #131316;
  position: sticky; top: 0;
}
.data-table pre {
  margin: 0; font-size: 12px;
  max-width: 480px;
  white-space: pre-wrap; word-break: break-word;
}
.data-table code { background: #3f3f46; padding: 2px 4px; border-radius: 2px; }
.data-table .num { font-variant-numeric: tabular-nums; }
.data-table th.col-integer, .data-table td.col-integer,
.data-table th.col-number,  .data-table td.col-number  { text-align: right; }
.data-table th.col-boolean, .data-table td.col-boolean { text-align: center; }

/* ------------------------------------------------------------------ events */

.events-list { list-style: none; margin: 0; padding: 0; }
.events-list li { padding: 8px 0; border-bottom: 1px solid #27272a; font-size: 13px; }
.events-list strong { color: #c7d2fe; font-weight: 500; margin: 0 6px; }
.event-errored strong { color: #f87171; }
.event-stale strong { color: #eab308; }
