:root {
  --bg: #f4f2ec;
  --panel: #fffdf8;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #ddd6c8;
  --accent: #b45309;
  --accent-soft: #f59e0b;
  --ok: #166534;
  --bad: #b91c1c;
  --warn: #9a3412;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.16), transparent 32%),
    linear-gradient(180deg, #f7f4ed 0%, var(--bg) 100%);
}
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}
.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(180, 83, 9, 0.18);
}
h1, h2, h3 { margin: 0; }
h1 { font-size: 36px; line-height: 1; }
.subtle { color: var(--muted); margin-top: 8px; }
nav a {
  color: var(--ink);
  text-decoration: none;
  margin-left: 14px;
  font-weight: 600;
}
.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid rgba(180, 83, 9, 0.16);
}
.nav-auth strong {
  color: var(--warn);
  font-size: 14px;
}
.flash {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 12px;
}
.flash.error {
  border-color: rgba(185, 28, 28, 0.3);
  color: var(--bad);
}
.grid {
  display: grid;
  gap: 20px;
}
.card {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(120, 53, 15, 0.06);
}
.login-card {
  max-width: 520px;
  margin: 40px auto 0;
}
.source-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
  background: #efe7d7;
  color: var(--warn);
}
.pill.ok { background: #e3f5e8; color: var(--ok); }
.pill.bad { background: #fee2e2; color: var(--bad); }
form.inline, .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
input[type="text"], input[type="url"], input[type="time"], input[type="password"], select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
  font: inherit;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: white;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}
.button.secondary {
  background: #ede7da;
  color: var(--ink);
}
.button.warn {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}
table {
  width: 100%;
  border-collapse: collapse;
}
.table-shell {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  z-index: 0;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(221, 214, 200, 0.8);
  vertical-align: top;
  white-space: nowrap;
}
th { color: var(--muted); font-size: 13px; }
.hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.schedule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 0;
}
.schedule-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
}
.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.sticky-action-col {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fffdf8;
  box-shadow: -10px 0 18px rgba(120, 53, 15, 0.08);
}
th.sticky-action-col {
  z-index: 3;
  background: #f8f3ea;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.tooltip-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tooltip-bubble {
  position: absolute;
  display: none;
  left: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  max-width: min(60vw, 420px);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(180, 83, 9, 0.14);
  background: rgba(31, 41, 55, 0.96);
  color: #fff;
  z-index: 10;
  white-space: normal;
  word-break: break-word;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
}
.tooltip-anchor:hover .tooltip-bubble,
.tooltip-anchor:focus-within .tooltip-bubble {
  display: block;
}
.cell-ellipsis {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.name-cell {
  max-width: 160px;
}
.url-cell {
  max-width: 280px;
}
.error-preview-text {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dialog-body {
  width: min(860px, 92vw);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  background: #fffdf8;
}
@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: start;
  }
  table {
    min-width: 760px;
  }
}
