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

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --accent:    #238636;
  --accent-hl: #2ea043;
  --warn:      #d29922;
  --danger:    #da3633;
  --info:      #388bfd;
  --text:      #c9d1d9;
  --text-dim:  #8b949e;
  --text-hi:   #f0f6fc;
  --tag-bg:    #21262d;
  --radius:    8px;
  --mono:      'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── LOGIN ──────────────────────────────────────────── */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-box {
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
}

.login-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: .5px;
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 32px;
}

.login-box label {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 6px;
}

.login-box input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-hi);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}

.login-box input[type="password"]:focus {
  border-color: var(--info);
}

.btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 9px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-hl); }

.login-err {
  margin-top: 12px;
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  text-align: center;
}

/* ─── DASHBOARD LAYOUT ───────────────────────────────── */

.db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.db-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-hi);
  letter-spacing: .4px;
}

.db-logo span {
  color: var(--accent-hl);
}

.db-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--tag-bg);
  border: 1px solid var(--border);
}
.badge.green  { border-color: var(--accent); color: var(--accent-hl); }
.badge.yellow { border-color: var(--warn);   color: var(--warn); }
.badge.blue   { border-color: var(--info);   color: var(--info); }
.badge.red    { border-color: var(--danger); color: var(--danger); }

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot.green  { background: var(--accent-hl); }
.dot.yellow { background: var(--warn); }
.dot.blue   { background: var(--info); }
.dot.red    { background: var(--danger); }

.btn-logout {
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.db-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

/* ─── GRID ───────────────────────────────────────────── */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* ─── CARD ───────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::before {
  content: '';
  display: block;
  width: 3px; height: 14px;
  background: var(--info);
  border-radius: 2px;
}

/* ─── STAT CARDS ─────────────────────────────────────── */

.stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-hi);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── STATUS ROW ─────────────────────────────────────── */

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }

.status-key {
  color: var(--text-dim);
  font-size: 12px;
  min-width: 100px;
}

.status-val {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* ─── TASK LIST ──────────────────────────────────────── */

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }

.task-icon {
  font-size: 16px;
  line-height: 1.4;
  flex-shrink: 0;
}

.task-body {
  flex: 1;
}

.task-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 2px;
}

.task-desc {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ─── TIMELINE ───────────────────────────────────────── */

.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--border);
}

.tl-item {
  position: relative;
  padding: 0 0 18px 24px;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -1px; top: 5px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
}
.tl-dot.done   { background: var(--accent-hl); border-color: var(--accent-hl); }
.tl-dot.active { background: var(--info);      border-color: var(--info);
                 box-shadow: 0 0 6px var(--info); }
.tl-dot.warn   { background: var(--warn);      border-color: var(--warn); }
.tl-dot.pend   { background: var(--tag-bg);    border-color: var(--border); }

.tl-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 2px;
}

.tl-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ─── ROLES ──────────────────────────────────────────── */

.role-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.role-item:last-child { border-bottom: none; }

.role-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.role-info { flex: 1; }

.role-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 2px;
}

.role-desc {
  font-size: 12px;
  color: var(--text-dim);
}

/* ─── ACTION LIST ────────────────────────────────────── */

.action-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.action-item:last-child { border-bottom: none; }

.action-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
  margin-top: 1px;
}

.action-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.action-text strong {
  color: var(--text-hi);
  font-family: var(--mono);
}

/* ─── BLOCK ──────────────────────────────────────────── */

.block-card {
  border-color: var(--warn);
}

.block-card .card-title::before {
  background: var(--warn);
}

.block-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.block-body code {
  font-family: var(--mono);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--warn);
  font-size: 12px;
}

/* ─── CRON TABLE ─────────────────────────────────────── */

.cron-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cron-table th {
  text-align: left;
  padding: 6px 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.cron-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.cron-table tr:last-child td { border-bottom: none; }

.cron-table td:first-child {
  font-family: var(--mono);
  color: var(--info);
  white-space: nowrap;
}

.cron-table td:nth-child(2) {
  color: var(--text-hi);
  font-weight: 500;
}

.cron-table td:last-child {
  color: var(--text-dim);
}

/* ─── FOOTER ─────────────────────────────────────────── */

.db-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--mono);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .db-main { padding: 16px; }
  .db-header { padding: 12px 16px; }
}
