@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap");

:root {
  --bg: #e9eef5;
  --ink: #0f1b2d;
  --muted: #5a6b80;
  --panel: #ffffff;
  --line: #cfd8e6;
  --blue: #0b3d6e;
  --blue-2: #1565a8;
  --teal: #0d6b5c;
  --green: #0f7a4a;
  --amber: #9a6700;
  --red: #b42318;
  --shadow: 0 10px 28px rgba(15, 27, 45, 0.07);
  --font: "Manrope", "Segoe UI", sans-serif;
  --display: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background:
    linear-gradient(180deg, #dfe8f4 0%, var(--bg) 42%, #eef3f8 100%);
}

.top-shell {
  width: 100%;
}
.top {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
}
.brand h1 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
}
.nav a:hover { color: var(--ink); background: rgba(255,255,255,0.55); }
.nav a.active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 1px 0 var(--line);
}
.inline-form { display: inline; margin: 0; }

.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 24px 48px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.panel.narrow { max-width: 420px; margin: 24px auto 0; }
.panel h2 { margin: 0 0 12px; font-size: 1.12rem; }

body.landing .wrap { max-width: 1040px; }
.hero {
  padding: 56px 4px 28px;
  max-width: 680px;
}
.eyebrow {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--blue);
  margin: 0 0 14px;
  line-height: 1.05;
}
.hero h2 {
  margin: 0 0 12px;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.lead {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 0 0 24px;
  max-width: 36rem;
}
.hero-actions { display: flex; gap: 10px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-bottom: 20px;
}
.feature-grid article {
  padding: 4px 2px 8px;
  border-top: 2px solid var(--blue);
}
.feature-grid h3 {
  margin: 12px 0 6px;
  font-size: 1rem;
}
.feature-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.94rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  padding: 9px 14px;
  text-decoration: none;
  font: inherit;
  font-weight: 650;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-accent { background: var(--teal); color: #fff; }
.btn-danger { background: #fff; border-color: #efc4bf; color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 0.88rem; }
.btn-xs { padding: 3px 8px; font-size: 0.72rem; border-radius: 7px; }

.date-row, .month-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.date-row input, .stack-form input, .filter-grid input {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  width: 100%;
}

.stack-form {
  display: grid;
  gap: 12px;
}
.stack-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.filter-grid label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
.filter-grid .span-2 { grid-column: span 2; }

.storage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f3f7fb;
  border: 1px solid var(--line);
}
.storage-bar strong {
  display: block;
  font-size: 1.15rem;
  margin-top: 2px;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.cal-toolbar h2 { margin: 0; font-size: 1.2rem; }
.month-actions { margin-bottom: 12px; }
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 0 0 12px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}
.swatch-data { background: #c9daf0; }
.swatch-done { background: #a8dfc0; }
.swatch-run { background: #f0d48a; }

.calendar {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.cal-head, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-head {
  background: #edf3f9;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
  color: var(--muted);
}
.cal-head > div { padding: 10px 6px; }
.cal-cell {
  min-height: 112px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.out { background: #f5f7fa; color: #9aa7b5; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--blue-2); }
.cal-cell.has-data { background: #f4f8fc; }
.cal-cell.done { background: #eef9f3; }
.cal-cell.running { background: #fff8e8; }
.cal-num { font-weight: 700; font-size: 0.92rem; }
.cal-actions { display: flex; flex-direction: column; gap: 4px; }
.cal-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cal-state { font-size: 0.75rem; font-weight: 700; }
.run-label { color: var(--amber); }
.cal-size { width: 100%; font-size: 0.72rem; color: var(--muted); }

.schedule-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f7fb;
}
.schedule-bar h2 { margin: 0 0 6px; font-size: 1.05rem; }
.schedule-bar p { margin: 0 0 6px; }
.schedule-status .ok { color: var(--green); }
.schedule-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.schedule-interval {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
  font-size: 0.92rem;
}
.schedule-interval select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.schedule-pdf {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.table-scroll {
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  background: #edf3f9;
  z-index: 1;
}
tr:hover td { background: #f7fafc; }
.nowrap { white-space: nowrap; }
.title { font-weight: 600; }
.cat { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.muted { color: var(--muted); }
.message { min-height: 1.2em; color: var(--muted); margin: 10px 0 0; }
.empty td {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid;
}
.alert-error {
  background: #fde8e6;
  border-color: #f3c1bb;
  color: var(--red);
}
.alert-ok {
  background: #e5f6ee;
  border-color: #b7e2cb;
  color: var(--green);
}

.users-table { width: 100%; margin-top: 8px; }
.users-table th, .users-table td { font-size: 0.9rem; }

.table-head-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.filter-grid select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  width: 100%;
}
.code-box {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #f3f7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0;
}
.code-box code {
  flex: 1;
  word-break: break-all;
  font-size: 0.88rem;
}
.code-block {
  background: #0f1b2d;
  color: #e8eef7;
  padding: 14px 16px;
  border-radius: 10px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}
.usage-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.usage-split h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}
.table-scroll.short { max-height: 280px; }

@media (max-width: 860px) {
  .usage-split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .feature-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-grid .span-2 { grid-column: span 1; }
  .top, .wrap { padding-left: 14px; padding-right: 14px; }
  .cal-cell { min-height: 110px; }
  .hero { padding-top: 36px; }
  .usage-split { grid-template-columns: 1fr; }
}
