/* Shared parts: keys (buttons), chips, pills, cards, menu, empty state, inputs, icons */

.icon {
  width: var(--icon-size); height: var(--icon-size); flex: none;
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke);
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--lg { width: var(--icon-size-lg); height: var(--icon-size-lg); }

/* ---- keys: ink / white / plain word, plus the one accent key ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  min-height: var(--btn-h); padding: var(--space-4) var(--space-16);
  border: 0; border-radius: var(--radius-8); background: none; color: var(--text-strong);
  font-size: var(--btn-fs); font-weight: var(--weight-medium); line-height: var(--lh-tight);
  text-align: center; overflow-wrap: anywhere;
  transition: transform var(--ms-fast) var(--ease-out), background-color var(--ms-fast) var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(var(--press-scale)); }
.btn--accent { background: var(--accent); color: var(--on-accent); }
.btn--ink { background: var(--key-ink); color: var(--on-key-ink); }
.btn--white { background: var(--key-white); box-shadow: inset 0 0 0 var(--hairline) var(--line-strong); }
.btn--word { padding-inline: var(--space-8); }
.btn--icon { flex: none; width: var(--btn-h); height: var(--btn-h); padding: 0; }
.btn.is-danger { color: var(--alert-fg); }
.btn--ink.is-danger { color: var(--on-key-ink); }
@media (hover: hover) {
  .btn--accent:hover:not(:disabled) { background: var(--accent-hover); }
  .btn--ink:hover:not(:disabled) { background: var(--key-ink-hover); }
  .btn--white:hover:not(:disabled), .btn--word:hover:not(:disabled) { background: var(--surface-sunken); }
}
.btn:disabled { background: var(--surface-sunken); color: var(--text-muted); box-shadow: none; cursor: not-allowed; }
.btn--word:disabled { background: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-row { display: flex; gap: var(--gap-items); }
.btn-row > .btn { flex: 1 1 0; }
.btn-row > .btn--grow { flex: 1 1 0; }
.btn-row > .btn--fixed { flex: 0 0 auto; white-space: nowrap; }
.btn--nowrap { flex: 0 0 auto; white-space: nowrap; }
.btn-row--end { justify-content: flex-end; }
.btn-row--end > .btn { flex: 0 0 auto; }

.spinner {
  width: var(--spinner-size); height: var(--spinner-size); flex: none; border-radius: var(--radius-full);
  border: var(--spinner-stroke) solid currentColor; border-right-color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin var(--ms-spin) linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- chips (filters): 34 high, 44 touch area on phone ---- */
.chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--space-8); flex: none;
  min-height: var(--h-chip); padding: 0 var(--space-12);
  border: 0; border-radius: var(--radius-full);
  background: var(--key-white); box-shadow: inset 0 0 0 var(--hairline) var(--line-strong);
  font-size: var(--fs-14); font-weight: var(--weight-medium); white-space: nowrap;
  transition: transform var(--ms-fast) var(--ease-out);
}
.chip::before { content: ""; position: absolute; inset: calc((var(--h-chip) - var(--target-min)) / 2) 0; }
.chip:active { transform: scale(var(--press-scale)); }
.chip[aria-pressed="true"], .chip--chosen { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.chip .icon { width: var(--spinner-size); height: var(--spinner-size); }

/* ---- pills ---- */
.pills { display: flex; flex-wrap: wrap; gap: var(--gap-group); }
.pill {
  display: inline-flex; align-items: center; gap: var(--gap-group);
  padding: var(--space-4) var(--space-8); border-radius: var(--radius-full);
  background: var(--surface-sunken); color: var(--text-strong);
  font-size: var(--fs-12); font-weight: var(--weight-medium); line-height: var(--lh-tight);
  overflow-wrap: anywhere;
}
.pill--done { background: var(--done-bg); color: var(--done-fg); }
.pill--alert { background: var(--alert-bg); color: var(--alert-fg); }
.pill--soon { background: var(--soon-bg); color: var(--soon-fg); }

/* ---- card: white, one soft shadow, no outline ---- */
.card {
  background: var(--surface-card); border-radius: var(--radius-16);
  box-shadow: var(--shadow-card); padding: var(--card-pad);
}
.link-btn {
  padding: 0; border: 0; background: none; text-align: left;
  font-size: var(--fs-16); font-weight: var(--weight-heavy); line-height: var(--lh-tight);
  overflow-wrap: anywhere;
}
@media (hover: hover) { .link-btn:hover { text-decoration: underline; } }

/* ---- menu (More) ---- */
.menu {
  position: fixed; z-index: 100; display: flex; flex-direction: column; gap: var(--gap-group);
  min-width: var(--menu-min-w); max-width: calc(100vw - var(--space-32));
  padding: var(--space-8); border-radius: var(--radius-16);
  background: var(--surface-raised); box-shadow: var(--shadow-raised);
}
.menu__item {
  display: flex; align-items: center; min-height: var(--target-min); padding: var(--space-4) var(--space-12);
  border: 0; border-radius: var(--radius-8); background: none; text-align: left;
  font-size: var(--fs-16); font-weight: var(--weight-medium); overflow-wrap: anywhere;
}
.menu__item.is-danger { color: var(--alert-fg); }
@media (hover: hover) { .menu__item:hover { background: var(--surface-sunken); } }

/* ---- empty / error state: icon, title, what will show here ---- */
.empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap-items); }
.empty__icon { color: var(--text-muted); }
.empty__title { font-size: var(--fs-20); font-weight: var(--weight-heavy); line-height: var(--lh-tight); }
.empty__body { font-size: var(--fs-14); color: var(--text-muted); max-width: 60ch; }
.calm { display: flex; align-items: center; gap: var(--gap-items); color: var(--done-fg); font-size: var(--fs-14); }

/* ---- inputs ---- */
.input {
  width: 100%; min-height: var(--btn-h); padding: var(--space-8) var(--space-12);
  border: 0; border-radius: var(--radius-8); background: var(--surface-sunken);
  box-shadow: inset 0 0 0 var(--hairline) var(--line-strong);
  font-size: var(--fs-16); line-height: var(--lh-text);
}
.input::placeholder { color: var(--text-muted); }
textarea.input { min-height: calc(var(--target-min) * 2); resize: vertical; }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 var(--focus-w) var(--alert-fg); }
.search { position: relative; flex: 1 1 auto; min-width: 0; }
.search .icon { position: absolute; left: var(--space-8); top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search .input { padding-left: var(--space-32); }
.date-row { display: flex; align-items: center; gap: var(--gap-items); }
.datebox { position: relative; flex: 1 1 auto; min-width: 0; }
.datebox__input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
}
.datebox__face {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap-items);
  min-height: var(--btn-h); padding: var(--space-8) var(--space-12); border-radius: var(--radius-8);
  background: var(--surface-sunken); box-shadow: inset 0 0 0 var(--hairline) var(--line-strong);
  font-size: var(--fs-16);
}
.datebox__text.is-empty { color: var(--text-muted); }
.datebox__input:focus-visible + .datebox__face { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-off); }
.check { display: flex; align-items: center; gap: var(--space-12); min-height: var(--target-min); font-size: var(--fs-16); }
.check input { width: var(--icon-size); height: var(--icon-size); flex: none; margin: 0; }
