:root {
  --bg: #f3efe6;
  --bg2: #e8e1d4;
  --ink: #1c1914;
  --muted: #6b6458;
  --accent: #0f6b5c;
  --accent-2: #c45c26;
  --card: #fffcf7;
  --line: #d4cdc0;
  --ok: #1f6b3a;
  --err: #9b1c1c;
  --warn: #8a5a00;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, #fff8ea 0%, transparent 45%),
    linear-gradient(160deg, var(--bg), var(--bg2));
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1100px, calc(100% - 2rem)); margin-inline: auto; }
.muted { color: var(--muted); }
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255,252,247,.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; }
.brand { font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: .01em; }
.nav { display: flex; align-items: center; gap: 1rem; }
.nav a { color: var(--ink); }
.inline { display: inline; margin: 0; }
.linkish, button.linkish {
  background: none; border: none; color: var(--ink); font: inherit; cursor: pointer; padding: 0;
}
.linkish:hover { text-decoration: underline; }
.main { padding: 1.75rem 0 3rem; }
.site-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0 0 .75rem; }
h2 { font-size: 1.35rem; margin: 1.5rem 0 .75rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--line); }
.flash-success { background: #e7f6ec; color: var(--ok); }
.flash-error { background: #fdecec; color: var(--err); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { color: var(--ink); }
.btn-danger { background: var(--err); }
.btn-sm { padding: .35rem .7rem; font-size: .9rem; }

.auth-panel, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 8px 24px rgba(28,25,20,.04);
}
.auth-panel { max-width: 420px; margin: 2rem auto; }
.form-grid { display: grid; gap: .9rem; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], textarea, select {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; color: var(--ink);
}
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem;
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem;
}
.stat .n { font-family: var(--display); font-size: 1.6rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f2e8; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: .15rem .45rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: #eee; color: var(--ink);
}
.badge-error { background: #fdecec; color: var(--err); }
.badge-warning { background: #fff4d6; color: var(--warn); }
.badge-info { background: #e8f3ff; color: #0b4f7a; }
.badge-ok, .badge-completed { background: #e7f6ec; color: var(--ok); }
.badge-pending, .badge-running { background: #fff4d6; color: var(--warn); }
.badge-failed { background: #fdecec; color: var(--err); }

.progress {
  height: 10px; background: #ebe4d8; border-radius: 999px; overflow: hidden; margin: .5rem 0;
}
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s ease; }

.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tabs a {
  padding: .4rem .75rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none;
}
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.score-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3rem; height: 3rem; border-radius: 50%; border: 3px solid var(--accent);
  font-weight: 700; font-family: var(--display);
}

.chart {
  display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: .5rem 0;
}
.chart .bar {
  flex: 1; min-width: 8px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85;
  position: relative;
}
.chart .bar span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  font-size: .65rem; color: var(--muted); white-space: nowrap;
}

.project-nav { margin-bottom: 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

@media print {
  .site-header, .site-footer, .actions, .tabs, .no-print { display: none !important; }
  body { background: #fff; }
  .panel, .table-wrap, .stat { box-shadow: none; }
}
