:root {
  color-scheme: light;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #020817;
  --muted: #64748b;
  --line: #e2e8f0;
  --input: #cbd5e1;
  --accent: #0f172a;
  --accent-strong: #020817;
  --accent-soft: #f1f5f9;
  --ready: #15803d;
  --disabled: #f8fafc;
  --ring: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.topbar h1,
.section-heading h2,
.section-heading p,
.calendar-header h3,
.job-row h3,
.job-row p {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 750;
}

.logout-btn {
  padding: 0 10px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.logout-btn:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.logout-form {
  margin: 0;
}

.status-pill,
.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.restore-grid {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}

.search-panel,
.restore-panel,
.login-panel {
  padding: 14px;
}

.section-heading,
.calendar-header,
.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h1,
.section-heading h2 {
  font-size: 16px;
  font-weight: 750;
}

.section-heading span,
.calendar-header span,
.site-row small,
.job-row p {
  color: var(--muted);
  font-size: 13px;
}

.search-box,
.login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.search-box input,
.login-form input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--input);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
}

.search-box input:focus,
.login-form input:focus {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.site-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.site-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

a.site-row:hover {
  border-color: var(--ring);
  background: var(--accent-soft);
}

a.site-row.is-active:hover {
  background: var(--accent);
}

.site-row.is-active,
.year-tabs .is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.site-row.is-active small {
  color: #cbd5e1;
}

.year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.year-tabs button,
.year-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.year-tabs a:hover {
  border-color: var(--ring);
  background: var(--accent-soft);
}

.year-tabs a.is-active:hover {
  background: var(--accent);
}

.calendar-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.year-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, 150px);
  gap: 12px;
  justify-content: start;
  margin-top: 10px;
}

.month-block {
  min-width: 0;
}

.month-block h4 {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 750;
}

.weekday-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 18px);
  gap: 3px;
}

.weekday-row {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.day {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--disabled);
  color: #94a3b8;
  font-size: 10px;
  line-height: 1;
  text-decoration: none;
}

.day.has-backup {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}

a.day.has-backup {
  cursor: pointer;
}

a.day.has-backup:hover {
  background: var(--accent-strong);
  box-shadow: 0 0 0 2px var(--ring);
}

.day.has-backup.is-disabled {
  border-color: var(--input);
  background: var(--accent-soft);
  color: var(--muted);
  box-shadow: none;
}

.day-empty {
  border-color: transparent;
  background: transparent;
}

.restore-disabled-note {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.job-row {
  min-height: 54px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.job-status {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--ready);
}

.job-status.is-failed {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b42318;
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.job-error {
  margin: 4px 0 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 650;
}

.confirm-form {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.confirm-text {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}

.confirm-text a {
  color: var(--accent);
  font-weight: 700;
}

.confirm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.confirm-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.confirm-btn:hover,
.download-btn:hover {
  background: var(--accent-strong);
}

.confirm-cancel,
.retry-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.confirm-cancel:hover,
.retry-btn:hover {
  border-color: var(--ring);
  background: var(--accent-soft);
  color: var(--text);
}

.login-panel {
  max-width: 420px;
  margin: 12vh auto 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

.login-form button:hover {
  background: var(--accent-strong);
}

.form-error {
  margin: 0 0 14px;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

/* ---- Host management + forms (shadcn-style, reuses the tokens above) ---- */
body > nav {
  display: flex;
  gap: 10px;
  align-items: center;
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
body > nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
}
body > nav a:hover {
  color: var(--text);
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 16px;
}
.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
}
.back-link {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.back-link:hover {
  color: var(--text);
}
.form-panel {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
}
.list-panel {
  padding: 4px 16px;
}
.form-stack {
  display: grid;
  gap: 16px;
  margin: 0;
}
.field {
  display: grid;
  gap: 6px;
  margin: 0;
}
.field > span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
.field input,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--input);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--text);
  background: var(--surface);
}
.field textarea {
  min-height: auto;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 23 42 / 12%);
}
.field input::placeholder {
  color: #94a3b8;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
}
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--accent-strong);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary:hover {
  border-color: var(--ring);
  background: var(--accent-soft);
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--surface);
  color: #b42318;
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
}
.btn-danger:hover {
  border-color: #fca5a5;
  background: #fef2f2;
}
.flash-ok {
  margin: 0 0 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 9px 12px;
  background: #f0fdf4;
  color: var(--ready);
  font-size: 13px;
  font-weight: 650;
}
.flash-error {
  margin: 0 0 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  background: #fef2f2;
  color: #b42318;
  font-size: 13px;
  font-weight: 650;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.data-table a:hover {
  text-decoration: underline;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 4px;
}
.detail-table th {
  width: 210px;
  padding: 8px 10px 8px 0;
  text-align: left;
  color: var(--muted);
  font-weight: 650;
  vertical-align: top;
}
.detail-table td {
  padding: 8px 0;
  word-break: break-all;
}
.section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.section:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.section h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 750;
}
.empty-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding: 12px 0;
  }

  .topbar {
    min-height: 54px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .restore-grid {
    grid-template-columns: 1fr;
  }

  .year-calendar {
    grid-template-columns: repeat(2, 150px);
    gap: 10px;
  }

  .day {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 430px) {
  .year-calendar {
    grid-template-columns: repeat(2, 150px);
  }
}

@media (max-width: 340px) {
  .year-calendar {
    grid-template-columns: 150px;
  }
}
