/* Shared pieces: cards, chips, pills, badges, icon tiles, buttons, menus, toasts. */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* Square tinted icon tiles (stat cards and module cards). */
.tile-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  background: var(--green-soft);
  color: var(--green-ink);
  flex: none;
}

.tile-icon .icon {
  width: 24px;
  height: 24px;
}

.tile-icon--moss {
  background: var(--green-soft);
  color: var(--green-ink);
}

.tile-icon--cinnamon {
  background: var(--cinnamon-soft);
  color: var(--cinnamon-ink);
}

.tile-icon--amber {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

.tile-icon--slate {
  background: var(--slate-soft);
  color: var(--slate-ink);
}

.tile-icon--red {
  background: var(--red-soft);
  color: var(--red-ink);
}

/* Chips: small rounded labels with a tint. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

.chip--moss {
  background: var(--green-soft);
  color: var(--green-ink);
}

.chip--cinnamon {
  background: var(--cinnamon-soft);
  color: var(--cinnamon-ink);
}

.chip--slate {
  background: var(--slate-soft);
  color: var(--slate-ink);
}

.chip--red {
  background: var(--red-soft);
  color: var(--red-ink);
}

.chip--muted {
  background: var(--surface-2);
  color: var(--ink-2);
}

/* Text-only badge next to a number. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
}

.badge--red {
  background: var(--red-soft);
  color: var(--red-ink);
}

.badge--green {
  color: var(--green-ink);
  padding-left: 0;
}

.badge--plain {
  color: var(--ink-2);
  font-weight: 500;
  padding-left: 0;
}

/* Pills: rounded controls on the header and hero. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font-size: var(--fs-14);
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.pill--status {
  background: var(--red-soft);
  color: var(--red-ink);
  font-weight: 500;
}

.pill--status.is-online {
  background: var(--green-soft);
  color: var(--green-ink);
}

.pill--glass {
  background: rgba(255, 255, 255, 0.14);
  color: var(--on-dark);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
}

.pill--solid {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  min-height: 44px;
  padding: 0 14px 0 18px;
  font-size: var(--fs-16);
  font-weight: 600;
}

.pill--solid:hover {
  background: var(--surface-2);
}

/* Icon-only round buttons (bell, avatar, menu). */
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  color: var(--ink);
  transition: background var(--dur) var(--ease);
}

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

.icon-btn .icon {
  width: 24px;
  height: 24px;
}

.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}

.avatar {
  background: var(--green-soft);
  color: var(--green-ink);
}

.avatar:hover {
  background: #d6e8dd;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--r-md);
  font-weight: 600;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.btn--primary {
  background: var(--green);
  color: var(--on-dark);
}

.btn--primary:hover {
  background: var(--green-deep);
}

.btn--ghost {
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--surface);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

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

/* Dropdown menu */
.menu {
  position: absolute;
  z-index: 40;
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
}

.menu[hidden] {
  display: none;
}

/* Floating menus live on <body>, under their button, above everything, scrolling inside when tall. */
.menu--floating {
  position: fixed;
  z-index: 70;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: menu-in var(--dur) var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  border-radius: var(--r-sm);
  text-align: left;
  color: var(--ink);
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item[aria-checked="true"] {
  color: var(--green-ink);
  font-weight: 600;
}

/* Section headings */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: var(--sp-6) 0 var(--sp-4);
}

.section-title {
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Empty states on screens still being built */
.empty {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-2);
}

.empty .tile-icon {
  width: 60px;
  height: 60px;
}

.empty .tile-icon .icon {
  width: 30px;
  height: 30px;
}

.empty h2 {
  color: var(--ink);
  font-size: var(--fs-20);
  font-weight: 700;
}

/* Toasts */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px);
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--on-dark);
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: var(--fs-14);
  font-weight: 500;
  box-shadow: var(--shadow-float);
  animation: toast-in var(--dur) var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 900px) {
  .toasts {
    bottom: 24px;
  }
}


/* ---- Added with the Today screen ---------------------------------------------------- */

/* Status chips */
.chip--green {
  background: var(--green-soft);
  color: var(--green-ink);
}

.chip--amber {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

.chip--sky {
  background: var(--sky-soft);
  color: var(--sky-ink);
}

.chip .icon {
  width: 16px;
  height: 16px;
}

/* Buttons */
.btn .icon {
  width: 18px;
  height: 18px;
}

.btn--primary {
  background: var(--green-deep);
}

.btn--primary:hover {
  background: #04522a;
}

.btn--outline {
  background: var(--surface);
  color: var(--green-ink);
  border: 1px solid #c9e5d0;
}

.btn--outline:hover {
  background: var(--green-soft);
  border-color: #a9d6b5;
}

.btn--sm {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: var(--fs-15);
}

.btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Text link with an arrow */
.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 4px;
  border-radius: var(--r-sm);
  color: var(--green-ink);
  font-size: var(--fs-15);
  font-weight: 700;
}

.link:hover {
  text-decoration: underline;
}

.link .icon {
  width: 20px;
  height: 20px;
}

/* Menus: a heading, icons on items, and a red item for leaving */
.menu-head {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.menu-head strong {
  font-size: var(--fs-15);
}

.menu-head span {
  font-size: var(--fs-13);
  color: var(--ink-2);
}

.menu-item-text {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.menu-item .icon {
  width: 20px;
  height: 20px;
  color: var(--ink-2);
}

.menu-item--danger {
  color: var(--red-ink);
}

.menu-item--danger .icon {
  color: var(--red);
}

.menu-item--danger:hover {
  background: var(--red-soft);
}

.menu--up {
  animation-name: menu-in-up;
}

@keyframes menu-in-up {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Avatar button in the top bar, grey as in the design */
.avatar {
  background: #e6eaee;
  color: var(--ink-2);
}

.avatar:hover {
  background: #dde2e7;
}

/* Loading and failure states inside list cards */
.icon.is-spinning {
  animation: spin 1.2s linear infinite;
}

.jobs-empty--loading .icon {
  color: var(--green);
}

.jobs-empty .link {
  margin-top: 4px;
}
