/* ==========================================================================
   Shared in-app components
   ========================================================================== */

/* --- typography ----------------------------------------------------------- */

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--ink-700);
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.section-title--sm {
  font-size: var(--text-lg);
  color: var(--ink-900);
}

.section-title__note {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--cyan-400);
  font-family: var(--font-body);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink-900);
}

.card-date {
  font-size: var(--text-sm);
  color: var(--ink-400);
  margin-top: 1px;
}

.muted {
  color: var(--ink-500);
}

.link-all {
  font-size: var(--text-sm);
  color: var(--blue-500);
  font-weight: 500;
}

/* --- card ----------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.card--tight {
  padding: 14px;
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--ink-100);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card__divider {
  height: 1px;
  background: var(--ink-100);
  margin: 12px -16px 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

/* Lets a sibling pair of cards agree on height and pin content to the bottom. */
.card--fill {
  display: flex;
  flex-direction: column;
}

.push-down {
  margin-top: auto;
}

/* Cards react to touch so the prototype feels alive. */
.tappable {
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out-expo),
    box-shadow var(--dur-fast) ease;
}

.tappable:hover {
  box-shadow: var(--shadow-raised);
}

.tappable:active {
  transform: scale(0.985);
}

/* --- pills, chips, badges -------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--blue-300);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-500);
  background: var(--surface);
  white-space: nowrap;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

.chip[aria-selected="true"] {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: #fff;
}

.chiprow {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 20px 6px;
  margin-inline: -20px;
  scrollbar-width: none;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  border: 1px solid currentColor;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
}

.tag--urgent {
  color: var(--red-500);
}

.tag--ongoing {
  color: var(--yellow-500);
}

.tag--done {
  color: var(--green-400);
}

.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--red-500);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  display: grid;
  place-items: center;
}

.pill-state {
  padding: 5px 14px;
  border-radius: var(--r-sm);
  background: var(--blue-050);
  color: var(--blue-500);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
}

/* --- avatars -------------------------------------------------------------- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--ink-100);
}

.avatar--ring {
  padding: 2px;
  border: 2px solid var(--red-300);
}

.avatar--ring-blue {
  border-color: var(--blue-300);
}

.avatar--ring-yellow {
  border-color: var(--yellow-400);
}

/* --- list rows ------------------------------------------------------------ */

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.row__body {
  flex: 1;
  min-width: 0;
}

/* Rows live inside buttons, so the parts are spans that have to be blocked out. */
.row__title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__sub {
  display: block;
  font-size: var(--text-md);
  color: var(--ink-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__meta {
  font-size: var(--text-sm);
  color: var(--ink-400);
  text-align: right;
  flex: none;
  display: grid;
  gap: 6px;
  justify-items: end;
}

.rowlist > li + li {
  border-top: 1px solid var(--ink-100);
}

.rowlist > li {
  padding: 14px 0;
}

.dots {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-xs);
  color: var(--ink-400);
  flex: none;
}

.dots:hover {
  background: var(--ink-100);
}

/* --- search --------------------------------------------------------------- */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-300);
  font-size: var(--text-lg);
}

.search:focus-within {
  border-color: var(--blue-300);
}

.search input {
  border: 0;
  outline: 0;
  font: inherit;
  color: var(--ink-900);
  background: none;
  width: 100%;
}

/* --- progress ------------------------------------------------------------- */

.bar {
  display: block;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  overflow: hidden;
}

.bar__fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--yellow-500);
  transform-origin: left center;
  animation: bar-grow var(--dur-slow) var(--ease-out-expo) both;
}

@keyframes bar-grow {
  from {
    transform: scaleX(0);
  }
}

/* --- segmented control (Care) --------------------------------------------- */

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 6px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.segmented__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 6px;
  border-radius: var(--r-pill);
  color: var(--ink-500);
  font-size: var(--text-md);
  font-weight: 500;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.segmented__btn[aria-selected="true"] {
  color: var(--blue-500);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(89, 132, 246, 0.22);
}

.segmented__btn[aria-selected="true"] .segmented__text {
  display: inline;
}

.segmented__text {
  display: none;
}

/* --- data table ------------------------------------------------------------ */

.dtable {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
  color: var(--ink-500);
}

.dtable th,
.dtable td {
  padding: 10px 8px;
  text-align: left;
  font-weight: 400;
}

.dtable thead th {
  background: var(--blue-050);
  color: var(--ink-600);
}

.dtable thead th:first-child,
.dtable tbody td:first-child {
  width: 34px;
  text-align: center;
  background: var(--blue-050);
  color: var(--ink-500);
}

.dtable tbody tr:nth-child(even) td {
  background: var(--surface-tint);
}

.dtable tbody tr:nth-child(even) td:first-child {
  background: var(--blue-050);
}

/* --- icon tile ------------------------------------------------------------- */

.itile {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.itile--blue {
  background: var(--blue-050);
  color: var(--blue-500);
}

.itile--red {
  background: var(--red-100);
  color: var(--red-500);
}

.itile--yellow {
  background: var(--yellow-100);
  color: var(--yellow-500);
}

.itile--green {
  background: #e2f6ec;
  color: var(--green-400);
}

.itile--violet {
  background: #ece9fd;
  color: var(--violet-400);
}

.itile--slate {
  background: var(--ink-100);
  color: var(--ink-500);
}

/* --- misc ----------------------------------------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: var(--text-sm);
  color: var(--ink-500);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}

.quote {
  border-left: 3px solid var(--blue-500);
  padding-left: 10px;
}

.note-box {
  background: var(--surface-tint);
  border-radius: var(--r-md);
  padding: 14px;
  font-size: var(--text-md);
  color: var(--ink-500);
  line-height: 1.65;
  position: relative;
  max-height: 132px;
  overflow: hidden;
}

.note-box::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 44px;
  background: linear-gradient(180deg, rgba(247, 249, 252, 0), var(--surface-tint));
}
