/* Components. Borders carry the structure and shadows are reserved for things that float,
   so the page stays flat and quiet and nothing competes with the content. */

/* ── buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg);
  font-size: var(--t-small);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background var(--fast),
    border-color var(--fast),
    color var(--fast);
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn:active {
  background: var(--surface-3);
}

.btn[data-variant="primary"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.btn[data-variant="primary"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn[data-variant="accent"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

.btn[data-variant="accent"]:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn[data-variant="ghost"] {
  background: none;
  border-color: transparent;
  color: var(--fg-2);
}

.btn[data-variant="ghost"]:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.btn[data-variant="danger"] {
  color: var(--bad);
  border-color: var(--bad-line);
  background: var(--surface);
}

.btn[data-variant="danger"]:hover {
  background: var(--bad-soft);
  border-color: var(--bad);
}

.btn[data-size="sm"] {
  height: 28px;
  padding: 0 10px;
  font-size: var(--t-micro);
}

.btn[data-size="lg"] {
  height: 40px;
  padding: 0 var(--s4);
  font-size: var(--t-body);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  color: var(--fg-2);
  transition:
    background var(--fast),
    color var(--fast);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.icon-btn[data-size="sm"] {
  width: 28px;
  height: 28px;
}

.icon-btn[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--fg);
}

.btn-row {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.badge-dot {
  position: relative;
}

.badge-dot::after {
  content: attr(data-count);
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="dark"] .badge-dot::after {
  color: #1a1a17;
}

/* ── cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: var(--s5);
}

.card[data-pad="sm"] {
  padding: var(--s4);
}

.card[data-pad="none"] {
  padding: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}

a.card,
button.card {
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
  transition:
    border-color var(--fast),
    background var(--fast);
}

a.card:hover,
button.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
}

/* ── tiles: the soft square behind a section icon ──────────────────── */
.tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--t-stone);
  color: var(--t-stone-fg);
}

.tile[data-size="sm"] {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.tile[data-size="lg"] {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.tile[data-tint="violet"] {
  background: var(--t-violet);
  color: var(--t-violet-fg);
}

.tile[data-tint="sky"] {
  background: var(--t-sky);
  color: var(--t-sky-fg);
}

.tile[data-tint="mint"] {
  background: var(--t-mint);
  color: var(--t-mint-fg);
}

.tile[data-tint="sand"] {
  background: var(--t-sand);
  color: var(--t-sand-fg);
}

.tile[data-tint="rose"] {
  background: var(--t-rose);
  color: var(--t-rose-fg);
}

/* ── shortcut card: icon tile, title, line, arrow ──────────────────── */
.shortcut {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-height: 148px;
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  text-align: left;
  color: inherit;
  transition:
    border-color var(--fast),
    background var(--fast),
    transform var(--fast);
}

.shortcut:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.shortcut:active {
  transform: translateY(1px);
}

.shortcut-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-size: var(--t-h3);
}

.shortcut-line {
  color: var(--fg-2);
  font-size: var(--t-small);
  line-height: 1.5;
}

.shortcut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: auto;
  padding-top: var(--s2);
}

.shortcut-go {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  color: var(--fg-3);
  transition:
    background var(--fast),
    color var(--fast),
    border-color var(--fast);
}

.shortcut:hover .shortcut-go {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-fg);
}

/* ── greeting banner ───────────────────────────────────────────────── */
.greeting {
  position: relative;
  overflow: hidden;
  padding: var(--s5);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-xl);
  background: var(--accent-soft);
}

.greeting-kicker {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-small);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--s2);
}

.greeting h1 {
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  max-width: 24ch;
}

.greeting p {
  margin-top: var(--s2);
  color: var(--fg-2);
  font-size: var(--t-small);
  max-width: 52ch;
}

.greeting-art {
  position: absolute;
  right: var(--s5);
  bottom: 0;
  width: 200px;
  opacity: 0.95;
  pointer-events: none;
}

@media (max-width: 760px) {
  .greeting-art {
    display: none;
  }
}

.timechip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: var(--t-micro);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

/* ── pills, status, chips ──────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--fg-2);
  font-size: var(--t-micro);
  font-weight: 600;
  white-space: nowrap;
}

.pill[data-tone="ok"] {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}

.pill[data-tone="warn"] {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}

.pill[data-tone="bad"] {
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: var(--bad);
}

.pill[data-tone="accent"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.pill[data-tone="flat"] {
  background: var(--surface-2);
}

.pill .swatch {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  flex: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-small);
  color: var(--fg-2);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--fg-3);
  flex: none;
}

.status[data-state="ok"]::before {
  background: var(--ok);
}

.status[data-state="running"]::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status[data-state="bad"]::before {
  background: var(--bad);
}

.status[data-state="waiting"]::before {
  background: var(--warn);
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--fg-2);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.avatar[data-size="sm"] {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.avatar[data-size="lg"] {
  width: 40px;
  height: 40px;
  font-size: var(--t-small);
}

.avatar[data-tone="accent"] {
  background: var(--accent);
  color: var(--accent-fg);
}

/* ── forms ─────────────────────────────────────────────────────────── */
.field {
  display: flex;
  align-items: center;
  gap: var(--s2);
  height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--t-small);
  transition: border-color var(--fast);
}

.field:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
  outline-offset: -1px;
}

.field > span {
  color: var(--fg-3);
  flex: none;
}

.field input,
.field select,
.field textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-size: var(--t-small);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--fg-3);
}

.field-box {
  height: auto;
  align-items: stretch;
  padding: var(--s3);
}

.field-box textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.55;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label > .eyebrow {
  letter-spacing: 0.04em;
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  transition:
    background var(--fast),
    border-color var(--fast);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--r-full);
  background: var(--fg-3);
  transition:
    transform var(--fast),
    background var(--fast);
}

.switch[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.switch[aria-checked="true"]::after {
  transform: translateX(14px);
  background: var(--accent-fg);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex: none;
}

/* ── tabs & segmented ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--s1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s5);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  padding: var(--s2) var(--s3) 10px;
  color: var(--fg-3);
  font-size: var(--t-small);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--fast);
}

.tab:hover {
  color: var(--fg-2);
}

.tab[aria-selected="true"] {
  color: var(--fg);
  font-weight: 600;
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: -1px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--fg);
}

.tab .count {
  margin-left: 5px;
  font-size: var(--t-micro);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.segmented button {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--t-micro);
  font-weight: 500;
  color: var(--fg-2);
  transition:
    background var(--fast),
    color var(--fast);
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(26 26 23 / 0.06);
}

/* ── filters ───────────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s4);
}

.filters .field {
  height: 32px;
}

.filters .search {
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}

/* A grid whose tracks are fixed, so one card does not stretch across the whole row the way
   `auto-fit` makes it. Used wherever the number of cards is whatever the data holds. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s3);
}
