/*
 * Rosync web interface. Propshaft's `stylesheet_link_tag :app` includes every
 * .css file under app/assets, so extra files here are picked up automatically.
 */

:root {
  color-scheme: light dark;

  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --border: #e0e0da;
  --text: #1c1c1a;
  --muted: #6b6b64;
  --accent: #3b6ea5;
  --push: #2f7d4f;
  --pull: #7a6296;
  --warn: #a8621b;
  --danger: #a33a3a;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1d1e23;
    --surface-2: #25262c;
    --border: #33353d;
    --text: #e6e6e3;
    --muted: #97998f;
    --accent: #7aa7d9;
    --push: #6cc08a;
    --pull: #b49ad3;
    --warn: #d99a52;
    --danger: #e0736f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
}

/* ---- chrome ------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.masthead__inner,
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.nav { display: flex; gap: 18px; margin-left: auto; }
.nav a { color: var(--muted); }
.nav a.is-active { color: var(--text); font-weight: 550; }

main.wrap { padding-top: 28px; padding-bottom: 64px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); }
.lede { color: var(--muted); margin: 0 0 24px; }

.flash {
  margin-bottom: 20px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--push);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---- cards & stats ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat__value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.stat__label { color: var(--muted); font-size: 13px; }

/* ---- tables ------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-weight: 550;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; padding-right: 0; }

.empty {
  color: var(--muted);
  padding: 28px 0;
  text-align: center;
}

/* ---- bits --------------------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.tag--push { color: var(--push); }
.tag--pull { color: var(--pull); }
.tag--behind { color: var(--warn); }
.tag--current { color: var(--push); }

.bar {
  position: relative;
  height: 6px;
  min-width: 90px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar__fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); }

.pct { display: flex; align-items: center; gap: 10px; }
.pct__value { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 42px; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---- forms & buttons ---------------------------------------------------- */

.field { margin-bottom: 16px; max-width: 380px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

input[type=text], input[type=password], input[type=search], select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.btn {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--danger { color: var(--danger); }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.filters .field { margin-bottom: 0; max-width: 220px; }

.errors {
  border-left: 3px solid var(--danger);
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--surface);
  border-radius: var(--radius);
}
.errors ul { margin: 0; padding-left: 18px; }

/* ---- pagination --------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ---- sign in ------------------------------------------------------------ */

.signin { max-width: 420px; margin: 6vh auto 0; }
.signin .card { padding: 22px 24px; }
.signin .field { max-width: none; }

.flash--alert { border-left-color: var(--danger); }

/* A form button that should read as a nav link. */
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.linkish:hover { color: var(--text); text-decoration: underline; }
