:root {
  color-scheme: dark;
  --page-bg-a: #05070a;
  --page-bg-b: #111922;
  --page-radial: rgba(34, 48, 58, .33);

  --phone-bg-a: rgba(18, 24, 32, .96);
  --phone-bg-b: rgba(7, 10, 14, .99);
  --phone-border: rgba(255, 255, 255, .18);

  --text: #f6f7fb;
  --text-strong: #ffffff;
  --muted: #99a2ad;
  --muted-2: #707985;

  --card: rgba(18, 24, 32, .78);
  --card-solid: #121820;
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .18);

  --nav-bg: rgba(10, 14, 19, .97);
  --sheet-bg-a: rgba(24, 31, 39, .98);
  --sheet-bg-b: rgba(14, 19, 25, .99);

  --red: #ff5046;
  --red-2: #d83732;
  --red-soft: rgba(255, 72, 58, .14);

  --orange: #ff9f14;
  --orange-soft: rgba(255, 159, 20, .13);

  --yellow: #ffc400;
  --yellow-soft: rgba(255, 196, 0, .12);

  --green: #52d44a;

  --shadow: rgba(0, 0, 0, .72);
  --inner-glow: rgba(255, 255, 255, .06);

  /* Subtle inset overlay used by nested form blocks (e.g.
     .admin-form-fieldset). On dark themes a faint white wash reads as
     "raised"; on light themes the inverse — see body[data-theme="light"]
     below. */
  --surface-subtle: rgba(255, 255, 255, .015);
}

body[data-theme="light"] {
  color-scheme: light;
  --page-bg-a: #eef3f7;
  --page-bg-b: #f8fbfd;
  --page-radial: rgba(255, 92, 70, .12);

  --phone-bg-a: rgba(250, 252, 255, .99);
  --phone-bg-b: rgba(235, 241, 247, .98);
  --phone-border: rgba(32, 42, 54, .13);

  --text: #171d25;
  --text-strong: #0d1218;
  --muted: #637080;
  --muted-2: #8a95a3;

  --card: rgba(255, 255, 255, .82);
  --card-solid: #ffffff;
  --line: rgba(22, 32, 45, .10);
  --line-strong: rgba(22, 32, 45, .15);

  --nav-bg: rgba(255, 255, 255, .95);
  --sheet-bg-a: rgba(255, 255, 255, .98);
  --sheet-bg-b: rgba(245, 249, 252, .98);

  --shadow: rgba(31, 43, 56, .18);
  --inner-glow: rgba(255, 255, 255, .75);

  /* Subtle overlay; on light themes it renders as a soft slate tint so
     nested form blocks read as recessed against the lighter card surface. */
  --surface-subtle: rgba(22, 32, 45, .025);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 30%, var(--page-radial), transparent 42%),
    linear-gradient(135deg, var(--page-bg-a), var(--page-bg-b) 55%, var(--page-bg-a));
}

.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--card);
  box-shadow: 0 14px 35px var(--shadow);
  cursor: pointer;
  font-weight: 800;
}

.theme-icon {
  font-size: 16px;
}

.theme-label {
  font-size: 13px;
}

.stage {
  min-height: 100vh;
  display: flex;
  gap: 70px;
  align-items: center;
  justify-content: center;
  padding: 76px 22px 22px;
}

.phone {
  position: relative;
  width: 390px;
  height: 840px;
  overflow: hidden;
  border-radius: 34px;
  border: 1px solid var(--phone-border);
  background: linear-gradient(180deg, var(--phone-bg-a), var(--phone-bg-b));
  box-shadow: 0 44px 100px var(--shadow), inset 0 0 0 1px rgba(255,255,255,.06);
}

.statusbar {
  height: 31px;
  padding: 12px 21px 0;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-strong);
}

.statusbar span {
  font-size: 10px;
  color: var(--muted);
}

.topbar {
  height: 62px;
  padding: 15px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 39px;
  height: 39px;
  filter: drop-shadow(0 0 14px rgba(255, 80, 70, .34));
}

.logo svg {
  width: 100%;
  height: 100%;
}

.logo rect,
.logo path {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand h1 {
  margin: 0;
  color: var(--text-strong);
  font-size: 20px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: -.5px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 11px;
}

.bell {
  position: relative;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 24px;
}

.bell i {
  position: absolute;
  right: 0;
  top: -3px;
  width: 15px;
  height: 15px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-style: normal;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 35%, #efc19f 0 17%, transparent 18%),
    radial-gradient(circle at 50% 72%, #244336 0 34%, transparent 35%),
    linear-gradient(#37414b, #171b20);
}

.hello {
  height: 57px;
  padding: 20px 20px 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hello h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
}

.danger-pill {
  height: 25px;
  padding: 0 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  border-radius: 16px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(255, 72, 58, .22);
  font-size: 11px;
  font-weight: 800;
}

.danger-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 13px rgba(255, 81, 71, .6);
}

.earn {
  position: relative;
  height: 117px;
  margin: 0 20px 12px;
  padding: 23px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 38%, rgba(255, 77, 54, .27), transparent 25%),
    linear-gradient(105deg, color-mix(in srgb, var(--card-solid), #1d242b 30%), color-mix(in srgb, var(--red), transparent 80%));
  box-shadow: inset 0 1px 0 var(--inner-glow);
}

body[data-theme="light"] .earn {
  background:
    radial-gradient(circle at 88% 38%, rgba(255, 80, 70, .18), transparent 25%),
    linear-gradient(105deg, #ffffff, #fff0ed);
}

.earn p {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 14px;
}

.earn strong {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--text-strong);
  font-size: 44px;
  line-height: .95;
  letter-spacing: -1.7px;
}

.earn em {
  display: block;
  margin-top: 10px;
  color: var(--orange);
  font-style: normal;
  font-size: 13px;
  font-weight: 850;
}

.chart {
  position: absolute;
  right: 6px;
  bottom: 7px;
  width: 185px;
  height: 110px;
}

.chart rect {
  fill: rgba(255, 97, 74, .52);
}

.chart polyline {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
}

.chart circle {
  fill: var(--red);
}

.chart text {
  font-size: 42px;
  font-weight: 900;
  fill: var(--red);
}

.card {
  margin: 0 20px 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--inner-glow);
}

.plan {
  height: 150px;
  padding: 14px 13px 12px;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.title-row h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
}

.title-row span {
  height: 24px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  border-radius: 14px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 11px;
  font-weight: 850;
}

.row {
  display: grid;
  grid-template-columns: 24px 88px 1fr 48px;
  align-items: center;
  gap: 10px;
  margin: 9px 0;
  font-size: 11px;
  font-weight: 800;
}

.row p {
  margin: 0;
  color: var(--text);
}

.row b {
  font-size: 18px;
}

.row em {
  font-style: normal;
  text-align: right;
  color: var(--muted);
}

.row.red b,
.row.red em {
  color: var(--red);
}

.row.orange b,
.row.orange em {
  color: var(--orange);
}

.row.yellow b,
.row.yellow em {
  color: var(--yellow);
}

.bar {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(128, 139, 150, .18);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  box-shadow: 0 0 9px rgba(255, 81, 71, .42);
}

.orange .bar i {
  background: var(--orange);
}

.yellow .bar i {
  background: var(--yellow);
}

.warning {
  height: 55px;
  margin: 0 20px 10px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 35px 1fr 16px;
  align-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 92, 54, .32);
  background: linear-gradient(90deg, rgba(255, 89, 42, .16), rgba(255, 89, 42, .05));
}

.warning b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 2px solid var(--orange);
  color: var(--orange);
}

.warning strong {
  color: var(--red);
  font-size: 12px;
}

.warning p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 11px;
}

.warning span {
  color: var(--muted);
  font-size: 24px;
}

.buttons {
  height: 58px;
  margin: 0 20px 12px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.buttons button {
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.start {
  color: var(--orange);
  background: var(--orange-soft);
  border-color: rgba(255, 159, 20, .22);
}

.pause {
  color: var(--yellow);
  background: var(--yellow-soft);
  border-color: rgba(255, 196, 0, .2);
}

.finish {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 72, 58, .28);
}

.bottom-cards {
  margin: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.calendar,
.pay {
  height: 112px;
  margin: 0;
  padding: 11px;
}

.mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}

.mini-head h3,
.pay h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
}

.mini-head a {
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
}

.week,
.dates {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}

.week {
  color: var(--muted);
  font-size: 10px;
}

.dates {
  margin-top: 6px;
}

.dates b {
  width: 22px;
  height: 22px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: rgba(128, 139, 150, .18);
  font-size: 10px;
}

.dates .bad {
  color: #fff;
  background: rgba(255, 81, 71, .66);
}

.dates .warn {
  color: #111;
  background: var(--orange);
}

.legend {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.g { background: var(--green); }
.y { background: var(--orange); }
.r { background: var(--red); }

.pay {
  text-align: center;
}

.pay p {
  margin: 6px 0 3px;
  color: var(--muted);
  font-size: 10px;
}

.pay strong {
  display: block;
  margin-bottom: 9px;
  color: var(--text-strong);
  font-size: 25px;
}

.pay button {
  width: 100%;
  height: 31px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(var(--red), var(--red-2));
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 59px;
  padding: 4px 14px 7px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--nav-bg);
  border-top: 1px solid var(--line);
}

.nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 20px;
  text-decoration: none;
}

.nav a span {
  font-size: 10px;
  font-weight: 800;
}

.nav .active {
  color: var(--orange);
}

.nav .active::before {
  content: "";
  position: absolute;
  top: -6px;
  width: 34px;
  height: 2px;
  border-radius: 5px;
  background: var(--orange);
}

.dim {
  opacity: .45;
}

.with-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(1px);
}

body[data-theme="light"] .with-menu::before {
  background: rgba(24, 32, 44, .18);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 59px;
  z-index: 3;
  min-height: 575px;
  padding: 11px 14px 18px;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--line);
  background: linear-gradient(var(--sheet-bg-a), var(--sheet-bg-b));
  box-shadow: 0 -30px 70px var(--shadow);
}

.handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 99px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sheet-head h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 19px;
}

.sheet-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
}

.sheet ul {
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: 11px;
  border: 1px solid var(--line);
}

.sheet li {
  height: 43px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 25px 1fr 15px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.sheet li:last-child {
  border-bottom: 0;
}

.sheet li b {
  color: var(--red);
  font-size: 17px;
}

.sheet li span {
  color: var(--muted);
  font-size: 21px;
}

@media (max-width: 940px) {
  .stage {
    flex-direction: column;
    gap: 26px;
    padding: 76px 18px 18px;
  }
}

@media (max-width: 430px) {
  .theme-toggle {
    top: 10px;
    right: 10px;
    height: 36px;
    padding: 0 10px;
  }

  .theme-label {
    display: none;
  }

  .stage {
    padding: 54px 0 0;
  }

  .phone {
    width: 100vw;
    height: calc(100vh - 54px);
    border: 0;
    border-radius: 0;
  }
}
/*
 * app/assets/stylesheets/admin.css
 *
 * Desktop admin chrome for owners / admins / managers / platform admins.
 * Renders under app/views/layouts/admin.html.erb. The mobile layout
 * (application.html.erb + bottom_nav) is unaffected — these styles only
 * activate when `body.admin-body` is present.
 *
 * Design tokens are sourced from design_tokens.css. Do NOT redefine colors —
 * use --page-bg-a/b, --card, --card-solid, --line, --line-strong, --text,
 * --text-strong, --muted, --nav-bg, --red, --green, --orange, --shadow,
 * --inner-glow.
 */

/* =========================================================================
   Body / shell
   ========================================================================= */
body.admin-body {
  /* Single source of truth for the topbar height. Consumed by every sticky
     element below the topbar (e.g. table headers) so a future topbar resize
     only touches one number. Kept on `body.admin-body` rather than `:root`
     so the public-facing layouts (devise, mailer) are unaffected. */
  --admin-topbar-h: 56px;
  margin: 0;
  padding: 0;
  max-width: none;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  color: var(--text);
}

body.admin-body * {
  box-sizing: border-box;
}

/* =========================================================================
   Sidebar
   ========================================================================= */
.admin-sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  overflow-y: auto;
  z-index: 50;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background-color 0.12s ease;
}

.admin-sidebar__brand:hover,
.admin-sidebar__brand:focus-visible {
  background: var(--card);
  text-decoration: none;
}

.admin-sidebar__brand:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.admin-sidebar__brand-logo {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: block;
}

.admin-sidebar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-sidebar__brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sidebar__brand-name {
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0.4px;
  color: var(--text-strong);
}

.admin-sidebar__brand-tag {
  display: inline-block;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.7px;
  border-radius: 4px;
  background: var(--red-soft);
  color: var(--red);
  text-transform: uppercase;
}

.admin-sidebar__brand-tenant {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.admin-sidebar__section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--muted-2);
  text-transform: uppercase;
  padding: 6px 10px 4px;
}

.admin-sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.admin-sidebar__item:hover {
  background: var(--card);
  color: var(--text-strong);
}

.admin-sidebar__item--active {
  background: var(--card-solid);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.admin-sidebar__item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  opacity: 0.8;
}

.admin-sidebar__bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Sidebar bottom user block: avatar + stacked name/email. */
.admin-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 8px;
  min-width: 0;
}

.admin-sidebar__user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.admin-sidebar__user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar__user-email {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar__sign-out {
  display: block;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
}

.admin-sidebar__sign-out:hover {
  background: var(--red-soft);
}

.admin-sidebar__sign-out-form {
  margin: 0;
}

/* =========================================================================
   Main column
   ========================================================================= */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================================================================
   Topbar
   ========================================================================= */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--admin-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.admin-topbar__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar__user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  max-width: 240px;
}

.admin-topbar__user-name {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-topbar__tenant-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-topbar__tenant-button {
  display: inline-block;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.admin-topbar__tenant-button--current {
  background: var(--card-solid);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.admin-topbar__theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.admin-topbar__theme-toggle:hover {
  background: var(--card);
  color: var(--text-strong);
  border-color: var(--line);
}

.admin-topbar__theme-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.admin-topbar__theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 1;
}

.admin-topbar__theme-toggle-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* =========================================================================
   Avatar — round initials chip used in sidebar bottom & topbar user blocks.
   Default size is 32×32; `--sm` (28×28) sits in the topbar, `--lg` (36×36)
   sits in the sidebar bottom.
   ========================================================================= */
.admin-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}

.admin-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.admin-avatar--lg {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

/* =========================================================================
   Content
   ========================================================================= */
.admin-content {
  padding: 28px 32px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.admin-content > h1 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 850;
  color: var(--text-strong);
}

/* =========================================================================
   Toolbar (above tables / content)
   ========================================================================= */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 10px;
  flex-wrap: wrap;
}

.admin-toolbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-toolbar__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Mobile: pack toolbar buttons into a tight row that wraps as needed,
   shrink the primary CTA to match ghost-button height so the whole
   header bar stays under ~80px instead of stacking each button on its
   own line. */
@media (max-width: 1023px) {
  .admin-toolbar__right .btn {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
  }
  .admin-toolbar__right .btn--primary {
    padding: 6px 12px;
  }
}

.admin-toolbar__search {
  height: 36px;
  padding: 0 12px;
  min-width: 220px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-solid);
  color: var(--text);
  font-size: 13px;
}

.admin-toolbar__search:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn,
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card-solid);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}

.btn:hover,
.admin-btn:hover {
  background: var(--card);
  border-color: var(--text);
}

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

.btn--primary,
.admin-btn--primary {
  background: linear-gradient(var(--red), var(--red-2));
  border-color: var(--red-2);
  color: #fff;
}

.btn--primary:hover,
.admin-btn--primary:hover {
  filter: brightness(1.05);
  border-color: var(--red);
}

.btn--ghost,
.admin-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn--ghost:hover,
.admin-btn--ghost:hover {
  color: var(--text-strong);
  background: var(--card);
}

.btn--danger,
.admin-btn--danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}

.btn--danger:hover,
.admin-btn--danger:hover {
  background: var(--red-soft);
}

.btn--small,
.admin-btn--small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* =========================================================================
   Cards
   ========================================================================= */
.admin-card {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 8px 24px var(--shadow);
  margin-bottom: 18px;
}

.admin-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong);
}

.admin-card__subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.admin-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-card dl {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 10px 18px;
  margin: 0;
}

.admin-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.admin-card dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

/* =========================================================================
   Table
   ========================================================================= */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  /* `overflow: hidden` would clip the sticky `thead th` cells below as soon
     as their offsetParent (the table) scrolled past, defeating the sticky
     header. We rely on `border-radius` + cell backgrounds to keep the
     rounded silhouette without clipping. */
  overflow: visible;
  box-shadow: 0 8px 24px var(--shadow);
}

/* Optional internal scroll wrapper. When `.admin-table--scroll` wraps the
   table, the `<tbody>` rows scroll inside the wrapper while the `<thead>`
   row stays pinned to the top of the visible viewport. Without the wrapper
   class the sticky offset still works against the page scroll. */
.admin-table-scroll {
  position: relative;
  overflow-y: auto;
  max-height: calc(100vh - var(--admin-topbar-h) - 160px);
  border-radius: 12px;
}

/* When the table has its own scroll container, sticky `<th>` should
   stick to the TOP of that container, not below the page-level
   topbar (the container already lives below the topbar, so the
   default `top: var(--admin-topbar-h)` opens an empty 56px gap where
   `<tbody>` rows bleed through). */
.admin-table-scroll .admin-table thead th,
.admin-table-scroll .admin-table__th {
  top: 0;
}

/* The cells (not the row) carry `position: sticky`. Sticking the row breaks
   in some browsers because `<tr>` has no offsetParent in CSS layout. Each
   `<th>` sticks individually, anchored just below the admin topbar. */
.admin-table thead th,
.admin-table__th {
  position: sticky;
  top: var(--admin-topbar-h);
  z-index: 5;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-strong);
  /* Solid background — translucent backgrounds bleed table-body content
     through the sticky header during scroll. */
  background: var(--nav-bg);
  white-space: nowrap;
}

.admin-table td,
.admin-table__td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.014);
}

.admin-table tbody tr:hover td {
  background: var(--card);
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table__actions,
.admin-table td.admin-table__actions {
  text-align: right;
  white-space: nowrap;
}

.admin-table__actions a,
.admin-table__actions form {
  margin-left: 6px;
  display: inline-block;
}

.admin-table__link {
  color: var(--text-strong);
  font-weight: 700;
  text-decoration: none;
}

.admin-table__link:hover {
  text-decoration: underline;
}

.admin-table__muted {
  color: var(--muted);
  font-size: 12px;
}

/* Status pills inside tables / cards */
.admin-status {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid transparent;
}

.admin-status--active,
.admin-status--success,
.admin-status--green {
  background: rgba(82, 212, 74, 0.12);
  color: var(--green);
  border-color: rgba(82, 212, 74, 0.3);
}

.admin-status--pending,
.admin-status--warning,
.admin-status--yellow {
  background: var(--yellow-soft);
  color: var(--yellow);
  border-color: rgba(255, 196, 0, 0.3);
}

.admin-status--suspended,
.admin-status--danger,
.admin-status--red {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(255, 80, 70, 0.3);
}

.admin-status--neutral,
.admin-status--muted,
.admin-status--cancelled,
.admin-status--draft,
.admin-status--expired {
  background: var(--card);
  color: var(--muted);
  border-color: var(--line-strong);
}

/*
   Domain-specific status modifiers. Map AASM states to one of the four
   visual buckets (green/yellow/red/muted). Defined here so views can write
   `admin-status--<%= record.status %>` without a per-domain helper.
*/
.admin-status--done,
.admin-status--approved,
.admin-status--completed,
.admin-status--reactivated {
  background: rgba(82, 212, 74, 0.12);
  color: var(--green);
  border-color: rgba(82, 212, 74, 0.3);
}

.admin-status--submitted {
  background: var(--yellow-soft);
  color: var(--yellow);
  border-color: rgba(255, 196, 0, 0.3);
}

.admin-status--rejected {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(255, 80, 70, 0.3);
}

/*
   Active/work-in-progress accent. Uses --orange because the design palette
   reserves blue tones for links only; orange reads as "attention, ongoing"
   and matches the start/pause buttons in the mobile design tokens.
   NB: `--active` is already green above (tenants/companies/employees use it
   for healthy/active state); orange is reserved for the "task is being
   worked on right now" / "force-review reopened" semantics.
*/
.admin-status--in_progress,
.admin-status--force_review {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: rgba(255, 159, 20, 0.3);
}

/* =========================================================================
   Forms
   ========================================================================= */
.admin-form-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 560px);
  gap: 14px 24px;
  align-items: start;
  margin-bottom: 18px;
}

.admin-form-grid > label,
.admin-form-grid > .admin-form-grid__label {
  padding-top: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.admin-form-grid input[type="text"],
.admin-form-grid input[type="email"],
.admin-form-grid input[type="password"],
.admin-form-grid input[type="url"],
.admin-form-grid input[type="number"],
.admin-form-grid input[type="tel"],
.admin-form-grid input[type="date"],
.admin-form-grid input[type="datetime-local"],
.admin-form-grid input[type="search"],
.admin-form-grid select,
.admin-form-grid textarea,
.admin-form-row input[type="text"],
.admin-form-row input[type="email"],
.admin-form-row input[type="password"],
.admin-form-row input[type="url"],
.admin-form-row select,
.admin-form-row textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-sizing: border-box;
  font-family: inherit;
}

.admin-form-grid textarea,
.admin-form-row textarea {
  min-height: 84px;
  resize: vertical;
}

.admin-form-grid input:focus,
.admin-form-grid select:focus,
.admin-form-grid textarea:focus,
.admin-form-row input:focus,
.admin-form-row select:focus,
.admin-form-row textarea:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}

/* Placeholder text in admin inputs/textareas. Browser default sits at
   ~50% of the input's `color`, which on the dark theme renders as a
   washed-out grey that's borderline-illegible. Pin to `--muted-2` so
   the example values stay visible without competing with the user's
   real input. */
.admin-form-grid input::placeholder,
.admin-form-grid textarea::placeholder,
.admin-form-row input::placeholder,
.admin-form-row textarea::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.admin-form-grid input:focus::placeholder,
.admin-form-grid textarea:focus::placeholder,
.admin-form-row input:focus::placeholder,
.admin-form-row textarea:focus::placeholder {
  color: var(--muted);
}

.admin-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.admin-form-row label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.admin-form-help {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* Inline 16×16 SVG glyph rendered at the start of a form-field label.
   Inherits the label's text colour through `currentColor`, so the icon
   tints with the surrounding label. */
.admin-form-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: -3px;
  color: var(--muted);
}

/* Keep the icon and label text on a single baseline-aligned row. The
   `.admin-form-label-text` span makes it possible to truncate or
   restyle the wording without affecting the icon. */
.admin-form-grid > label,
.admin-form-row > label {
  display: inline-flex;
  align-items: center;
}

.admin-form-label-text {
  display: inline-block;
}

/* Stack the input + help/hint inside a single grid cell so the
   `.admin-form-grid` two-column layout still aligns the label to the
   first row. Without this wrapper the help text would steal a third
   column. */
.admin-form-grid__field {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* Required-field marker. Decorative — actual required-ness is conveyed to
   assistive tech via the `<input required>` attribute and `speak: never`
   tells screen readers to skip the visual asterisk. */
.admin-form-grid > label.admin-form-required::after {
  content: ' *';
  color: var(--red);
  font-weight: 800;
  margin-left: 2px;
  speak: never;
}

/* One-line legend that explains the meaning of `*` once per form. */
.admin-form-required-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

/* Native <select> styling — matches input height/border, drops the
   browser caret in favour of a chevron drawn as a background-image. */
.admin-form-grid select,
.admin-form-row select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%2393a4b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  padding-right: 32px;
  cursor: pointer;
}

.admin-form-grid select:focus,
.admin-form-row select:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%23ff5046' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* HTML5 :invalid styling — lights up the field once the user has
   touched it and left it empty (or in a wrong format). Only kicks in
   after a focus pass to avoid screaming red on first paint. */
.admin-form-grid input:user-invalid,
.admin-form-grid select:user-invalid,
.admin-form-grid textarea:user-invalid,
.admin-form-row input:user-invalid,
.admin-form-row select:user-invalid,
.admin-form-row textarea:user-invalid {
  border-color: var(--red);
  background-color: var(--red-soft);
}

.admin-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-form-errors {
  list-style: none;
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.admin-form-errors li + li {
  margin-top: 4px;
}

/* Sub-section inside an admin form (e.g. nested-attributes contacts on
   the Company form). Visually a soft-bordered block so the operator
   reads it as a related-but-detachable group without a hard rule. */
.admin-form-fieldset {
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.admin-form-fieldset__legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--text-strong);
  text-transform: uppercase;
}

.admin-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 12px 0 16px;
}

.admin-contact-row {
  position: relative;
  padding: 14px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-solid);
}

.admin-contact-row[hidden] {
  display: none;
}

.admin-contact-row__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

@media (max-width: 720px) {
  .admin-contact-row__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.admin-contact-row__destroy-flag {
  display: none;
}

.admin-contact-row__remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.admin-contact-row__remove:hover {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red);
}

/* Address suggester (Yandex Geocoder proxy). The wrapper is `position:
   relative` so the dropdown anchors to the input below it. */
.address-suggest {
  position: relative;
}

/* `.address-block` carries `data-controller="address-suggest"` and wraps
   BOTH the search input and the structured sub-fields (postal_code, city,
   street, house, office) so Stimulus targets resolve. `display: contents`
   makes the wrapper invisible to the layout so its label + field children
   stay direct grid items of the parent `.admin-form-grid` (label | field). */
.address-block {
  display: contents;
}

/* Sub-field collapsible. Spans both columns of the parent admin-form-grid
   and re-establishes its own grid for the label/input pairs inside, so
   the dense form layout stays consistent. Hidden by default — revealed
   either by a successful suggestion pick OR by clicking the toggle. */
.address-block__details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 560px);
  gap: 14px 24px;
  align-items: start;
  margin-top: 6px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.address-block__details[hidden] {
  display: none;
}

.address-block__details > label {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* Readonly sub-fields look quieter than active inputs so the operator
   sees at a glance "this came from the geocoder". `enableEdit` flips
   readOnly off; the muted style fades back to normal once the attribute
   is gone. */
.address-block__details input[readonly] {
  background: var(--card-solid);
  color: var(--muted);
  cursor: not-allowed;
}

/* Container for the toggle button under the address search input. Sits
   inside the field column so it aligns with the input, not the label. */
.address-block__toggles {
  display: flex;
  margin-top: 6px;
}

.address-block__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 4px 0;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.address-block__toggle:hover {
  color: var(--accent-strong, var(--accent));
}

.address-block--expanded .address-block__toggle-arrow {
  transform: rotate(180deg);
}

.address-block__toggle-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

/* "Изменить вручную" sits at the end of the details panel, spans both
   columns, and is right-aligned so it reads as a footer action. */
.address-block__edit-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.address-block__edit-toggle {
  background: transparent;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.address-block__edit-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.address-suggest__list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 12px 24px var(--shadow);
}

.address-suggest__list[hidden] {
  display: none;
}

.address-suggest__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.address-suggest__item:hover,
.address-suggest__item:focus {
  background: var(--card);
  color: var(--text-strong);
}

.address-suggest__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-suggest__meta {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Show pages — read-only details for `companies/show`, `tasks/show`, etc.
   ========================================================================= */

/* Inline 16×16 icon at the start of a `<dt>` label. Mirrors the
   `.admin-form-icon` baseline tweak so icon + text align on the same row. */
.admin-card dt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-card dt .admin-form-icon {
  margin-right: 0;
  color: var(--muted);
}

/* Numeric values that benefit from monospaced digits (INN, postal code,
   phone). `<code>`-like font so 10/12-digit strings line up cleanly. */
.admin-show-mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
}

/* Inline copy-to-clipboard button. Lives next to a value (INN, email,
   phone) inside an `<dd>` — kept small + ghost so it does not compete
   with the value itself. `is-copied` is added by the Stimulus
   `copy-button` controller for ~1.2s. */
.admin-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 8px;
  font-size: 11px;
  line-height: 1;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.admin-copy-btn:hover {
  background: var(--card-solid);
  color: var(--text-strong);
  border-color: var(--text);
}

.admin-copy-btn.is-copied {
  background: rgba(82, 212, 74, 0.12);
  color: var(--green);
  border-color: rgba(82, 212, 74, 0.3);
}

/* Structured address block on `companies/show`. One `<dd>` value per line
   with the postal_code muted-and-monospaced ahead of the locality block. */
.admin-show-address {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.admin-show-address__postal {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
}

/* Highlighted card for free-form prose inside a show page (task
   instructions, result notes). Reads as a separate panel rather than a
   flat `<dd>` line. */
.admin-show-card {
  margin: 0;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* =========================================================================
   Empty state
   ========================================================================= */
.admin-empty-state {
  background: var(--card-solid);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  margin: 18px 0;
}

.admin-empty-state__icon {
  font-size: 30px;
  margin-bottom: 8px;
  color: var(--muted);
}

.admin-empty-state__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
}

.admin-empty-state__body {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================================
   Pagination (kaminari / will_paginate friendly)
   ========================================================================= */
.admin-pagination,
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.admin-pagination a,
.admin-pagination span,
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--card-solid);
  text-decoration: none;
  cursor: pointer;
}

.admin-pagination a:hover,
.pagination a:hover {
  border-color: var(--text);
}

.admin-pagination .current,
.pagination .current {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 800;
  cursor: default;
}

/* =========================================================================
   Flash messages (admin layout)
   ========================================================================= */
.admin-body .flash {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
}

.admin-body .flash--notice {
  background: rgba(82, 212, 74, 0.10);
  border-color: rgba(82, 212, 74, 0.4);
  color: var(--green);
}

.admin-body .flash--alert {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

/* =========================================================================
   Devise pre-auth screens
   ========================================================================= */
body.devise-body {
  margin: 0;
  padding: 0;
  max-width: none;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.devise-shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.devise-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-strong);
}

.devise-brand__name {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0.4px;
}

.devise-brand__tagline {
  font-size: 12px;
  color: var(--muted);
}

.devise-card {
  width: 100%;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 24px;
  box-shadow: 0 18px 40px var(--shadow);
}

.devise-card__title {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong);
}

.devise-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.devise-card .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.devise-card label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.devise-card input[type="text"],
.devise-card input[type="email"],
.devise-card input[type="password"] {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--page-bg-a);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-sizing: border-box;
  font-family: inherit;
}

.devise-card input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}

.devise-card .field-hint {
  font-size: 11px;
  color: var(--muted);
}

.devise-card .actions {
  margin-top: 6px;
}

.devise-card input[type="submit"],
.devise-card button[type="submit"] {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(var(--red), var(--red-2));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.devise-card input[type="submit"]:hover,
.devise-card button[type="submit"]:hover {
  filter: brightness(1.05);
}

.devise-card .remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.devise-card .remember-me input[type="checkbox"] {
  cursor: pointer;
}

.devise-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.devise-links a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.devise-links a:hover {
  color: var(--text-strong);
  text-decoration: underline;
}

.devise-card .field_with_errors {
  display: contents;
}

.devise-card .field_with_errors input {
  border-color: var(--red);
}

/* =========================================================================
   Daily-plan progress bars (used inside .admin-card on
   `app/views/daily_plans/show.html.erb`). The base `.daily-plan__bars`
   class lives in components.css; this block adds row layout for each
   `<li>` so the label / progress / percentage line up.
   ========================================================================= */
.daily-plan__bars {
  list-style: none;
  padding: 0;
  margin: 0;
  height: auto;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.daily-plan__bar {
  display: grid;
  grid-template-columns: 110px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
}

.daily-plan__bar-label {
  font-weight: 700;
  color: var(--text-strong);
}

.daily-plan__bar progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  border: 0;
  background: rgba(128, 139, 150, 0.18);
  overflow: hidden;
}

.daily-plan__bar progress::-webkit-progress-bar {
  background: rgba(128, 139, 150, 0.18);
  border-radius: 99px;
}

.daily-plan__bar progress::-webkit-progress-value {
  background: linear-gradient(var(--red), var(--red-2));
  border-radius: 99px;
}

.daily-plan__bar progress::-moz-progress-bar {
  background: var(--red);
  border-radius: 99px;
}

.daily-plan__bar-value {
  text-align: right;
  font-weight: 700;
  color: var(--muted);
}

/* =========================================================================
   Evidence file list (used inside `.admin-card` on
   `app/views/evidences/show.html.erb`). One row per attached file —
   plain link with hover underline; the muted block below replaces a
   bullet so the list reads cleanly inside the dark card.
   ========================================================================= */
.evidence-show__files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.evidence-show__file {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
}

.evidence-show__reject-reason {
  color: var(--red);
  font-weight: 600;
}

/*
   Tenant tab strip (used inside `.admin-card` on
   `app/views/tenants/show.html.erb`). Pure layout — links inside use
   `.btn .btn--ghost` so they automatically pick up the design-system
   focus / hover states; this rule only spaces them and gives the
   `tenant-tabs` container an underline so it still reads as a "tab
   strip" against the rest of the card.
*/
.tenant-show__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tenant-show__billing-placeholder {
  margin: 0;
  padding: 18px 0;
  font-size: 13px;
}

/* Tenant suspended banner (`app/views/tenants/_suspended_banner.html.erb`).
   Keeps the legacy `.tenant-banner--<status>` BEM modifier so any
   request specs that select on the status data attribute keep working;
   visually it is a flash-like callout pinned above the tenant header. */
.tenant-banner {
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--card-solid);
}

.tenant-banner__title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-strong);
}

.tenant-banner__body {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.tenant-banner--suspended {
  border-color: var(--red);
  background: var(--red-soft);
}

.tenant-banner--suspended .tenant-banner__title {
  color: var(--red);
}

.tenant-banner--pending {
  border-color: rgba(255, 196, 0, 0.4);
  background: var(--yellow-soft);
}

.tenant-banner--pending .tenant-banner__title {
  color: var(--yellow);
}

.tenant-banner--deleted {
  border-color: var(--line-strong);
  background: var(--card);
}

/* =========================================================================
   Topbar hamburger (mobile only — hidden by default at >= 1024px)
   ========================================================================= */
.admin-topbar__menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.admin-topbar__menu-toggle:hover {
  background: var(--card);
  border-color: var(--line);
}

.admin-topbar__menu-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.admin-topbar__menu-toggle-icon {
  font-size: 22px;
  line-height: 1;
}

/* =========================================================================
   Off-canvas drawer backdrop (mobile only — sibling of the sidebar)
   ========================================================================= */
.admin-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1023px) {
  .admin-topbar__menu-toggle {
    display: inline-flex;
  }

  .admin-topbar {
    padding: 0 16px;
    gap: 12px;
  }

  /* Off-canvas drawer: sidebar slides in from the left over a backdrop. */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 320px);
    flex: 0 0 auto;
    height: 100vh;
    height: 100dvh;
    padding: 18px 14px 14px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 12px 32px var(--shadow);
  }

  .admin-drawer-backdrop {
    display: block;
  }

  /* Tap-friendly nav items (>= 44px per Apple HIG). */
  .admin-sidebar__item {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .admin-sidebar__sign-out {
    min-height: 44px;
    padding: 10px 12px;
  }

  .admin-sidebar__brand {
    min-height: 44px;
  }

  /* Drawer-open state: slide sidebar in, fade backdrop in, lock body scroll. */
  body.admin-body.admin-body--drawer-open {
    overflow: hidden;
  }

  body.admin-body--drawer-open .admin-sidebar {
    transform: translateX(0);
  }

  body.admin-body--drawer-open .admin-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 767px) {
  .admin-topbar {
    height: 50px;
    padding: 0 12px;
    gap: 8px;
  }

  .admin-topbar__title {
    font-size: 15px;
  }

  /* On phones the tenant switcher would steal the topbar; current tenant is
     still visible inside the drawer (admin-sidebar__brand-tenant). Hide
     until the user reaches a wider viewport. */
  .admin-topbar__tenant-switcher {
    display: none;
  }

  .admin-topbar__user-name {
    display: none;
  }

  .admin-content {
    padding: 16px 12px 32px;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-grid > label {
    padding-top: 0;
  }

  .admin-card dl {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .admin-card dt {
    margin-top: 8px;
  }

  /* Tables — let them scroll horizontally */
  .admin-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* =========================================================================
   Light theme overrides
   ========================================================================= */
body.admin-body[data-theme="light"] .admin-sidebar {
  border-right-color: var(--line-strong);
}

body.admin-body[data-theme="light"] .admin-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.018);
}

/* =========================================================================
   /companies index — filters + sortable headers + bulk actions + pagy
   ========================================================================= */
.admin-table__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.admin-table__filters-spacer {
  flex: 1 1 auto;
}

.admin-toolbar__select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card-solid);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.admin-table__per-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.admin-table__per-page select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--card-solid);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.admin-table__sort {
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.admin-table__sort.is-active {
  color: var(--text);
}

.admin-table__sort:hover {
  color: var(--text);
}

.admin-table__th--checkbox,
.admin-table__td--checkbox {
  width: 72px;
  text-align: left;
  padding-left: 12px;
}

.admin-table__th--checkbox input,
.admin-table__td--checkbox input {
  cursor: pointer;
}

/* Combined checkbox + row-menu cell. Checkbox on the left, `⋮` trigger
   to its right — replaces the dedicated trailing "Действия" column. */
.admin-table__row-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The `<td>` containing the row-menu trigger needs `position: relative`
   so the absolutely-positioned `.row-menu__panel` anchors to it. */
.admin-table td.admin-table__td--checkbox[data-controller~="row-menu"] {
  position: relative;
}

/* =========================================================================
   Per-column filter popovers (rendered inside `<th>` cells)
   ========================================================================= */
.admin-table__th--filterable {
  /* Anchor for the absolutely-positioned popover. The cell is already
     `position: sticky`; `position: relative` inside the same rule has no
     effect on sticky behaviour, but DOES create a containing block for
     the popover's `position: absolute`. */
  position: sticky;
}

.admin-table__col-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-table__filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.admin-table__filter-trigger:hover {
  background: var(--card);
  color: var(--text-strong);
}

.admin-table__filter-trigger.is-active {
  color: var(--red);
  border-color: var(--line-strong);
  background: var(--card);
}

.admin-table__filter-trigger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.admin-table__filter-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 220px;
  max-width: 280px;
  padding: 12px;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 32px var(--shadow);
}

.admin-table__filter-popover[hidden] {
  display: none;
}

.admin-table__filter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-table__filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 0;
}

.admin-table__filter-input {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--card-solid);
  color: var(--text);
  font-size: 13px;
}

.admin-table__filter-input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

.admin-table__filter-checks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  padding: 0;
  margin: 0;
  max-height: 240px;
  overflow-y: auto;
}

.admin-table__filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}

.admin-table__filter-check input {
  cursor: pointer;
}

/* =========================================================================
   Bottom bulk + per-page + pagy footer
   ========================================================================= */
.companies-bulk__footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-top: 12px;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px var(--shadow);
  z-index: 10;
}

.companies-bulk__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.companies-bulk__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.companies-bulk__actions[hidden] {
  display: none;
}

.companies-bulk__footer .admin-table__per-page {
  margin-left: auto;
}

.companies-bulk__footer .admin-table__pagination {
  flex-basis: 100%;
  padding: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
}

/* =========================================================================
   "Настроить таблицу" modal
   ========================================================================= */
.admin-table-config {
  position: relative;
  display: inline-block;
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.admin-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px 22px;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 24px 64px var(--shadow);
}

.admin-modal__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
}

.admin-modal__hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}

.admin-modal__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-modal__check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.admin-modal__check input {
  cursor: pointer;
}

.admin-modal__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

body.admin-modal--open {
  overflow: hidden;
}

/* =========================================================================
   Per-row "⋮" action menu
   ========================================================================= */
.admin-table td.admin-table__actions[data-controller~="row-menu"] {
  position: relative;
}

.row-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.row-menu__trigger:hover {
  background: var(--card);
  color: var(--text-strong);
  border-color: var(--line);
}

.row-menu__trigger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.row-menu__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 8px;
  z-index: 15;
  min-width: 180px;
  padding: 6px;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 32px var(--shadow);
  display: flex;
  flex-direction: column;
}

.row-menu__panel[hidden] {
  display: none;
}

.row-menu__item {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}

.row-menu__item:hover,
.row-menu__item:focus {
  background: var(--card);
  color: var(--text-strong);
  outline: none;
}

.row-menu__item--danger {
  color: var(--red);
}

.row-menu__item--danger:hover,
.row-menu__item--danger:focus {
  background: var(--red);
  color: #fff;
}

.admin-table__pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.admin-table__pagination .pagy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-table__pagination .pagy a,
.admin-table__pagination .pagy .current,
.admin-table__pagination .pagy .gap {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.admin-table__pagination .pagy a:hover {
  background: var(--card);
}

.admin-table__pagination .pagy .current {
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.admin-table__pagination .pagy .disabled {
  color: var(--muted);
  cursor: default;
}
/* Minimal component layer — Phase 0 gap-fill until proper design system.
   Uses tokens from design_tokens.css. */

html, body {
  background: linear-gradient(180deg, var(--page-bg-a) 0%, var(--page-bg-b) 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }

body {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 18px 96px;
}

h1, h2, h3, h4 { color: var(--text-strong); margin: 0 0 12px; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }

p, ul, ol { margin: 0 0 12px; }

a {
  color: #6aa9ff;
  text-decoration: none;
}
a:hover { text-decoration: underline; }

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #6aa9ff;
  box-shadow: 0 0 0 3px rgba(106,169,255,.18);
}

/* Mobile-only button defaults. The `body:not(.admin-body)` guard keeps these
   from cascading into the desktop admin chrome, where admin.css owns the
   `.btn` family and uses the red-gradient primary / ghost / danger variants
   defined under `body.admin-body`. Without the guard, this block would beat
   admin.css purely on source order (require_tree . loads alphabetically:
   admin → components). */
body:not(.admin-body) button,
body:not(.admin-body) input[type="submit"],
body:not(.admin-body) .btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  background: #6aa9ff;
  color: #04101f;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  font-family: inherit;
}
body:not(.admin-body) button:hover,
body:not(.admin-body) input[type="submit"]:hover,
body:not(.admin-body) .btn:hover { filter: brightness(1.08); text-decoration: none; }

body:not(.admin-body) .btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
body:not(.admin-body) .btn--danger { background: var(--red); color: #fff; }

input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; accent-color: #6aa9ff;
}

table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

form > div, form > p { margin-bottom: 10px; }

.flash, .errors {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.flash--notice { border-color: var(--green); }
.flash--alert  { border-color: var(--red); background: var(--red-soft); }
.errors { border-color: var(--red); background: var(--red-soft); }

/* Cards & lists */
.card,
.company,
.contact,
.daily-plan,
.employee-profile,
.calendar,
.approval-detail,
.approval-queue,
.billing-tab,
.companies,
.contacts,
.daily-plans,
.csv-import,
.earn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}

/* Bottom nav (mobile-first) */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--nav-bg);
  border-top: 1px solid var(--line);
  padding: 8px 4px env(safe-area-inset-bottom);
  z-index: 50;
  backdrop-filter: blur(14px);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
}
.nav-item:hover { color: var(--text); text-decoration: none; }
.nav-item--active { color: var(--text-strong); }
.nav-item--disabled { opacity: 0.5; pointer-events: none; }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-label { font-size: 11px; }

/* Brand / status bar */
.brand, .brand-text {
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-strong);
  margin-bottom: 8px;
}

/* More-menu sheet */
.more-menu {
  background: var(--sheet-bg-a);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
}
.more-menu__list { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; list-style: none; }

/* Status pills */
.companies__status,
.daily-plans__status,
.employees-table__status,
.contacts__email,
.company__status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* Generic table-ish blocks */
.employees-table,
.approval-queue__row { padding: 12px 0; border-bottom: 1px solid var(--line); }

/* Forms within cards spacing */
form { margin: 0; }
form input, form select, form textarea, form button { margin-bottom: 6px; }

/* Calendar (basic legibility) */
.calendar__cell { display: inline-block; width: 26px; height: 26px; margin: 2px; border-radius: 6px; background: var(--card-solid); }
.calendar__cell--green  { background: var(--green); }
.calendar__cell--yellow { background: var(--yellow); }
.calendar__cell--red    { background: var(--red); }
.calendar__cell--muted  { background: var(--card-solid); }
.calendar__legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.calendar__legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* Daily plan bars */
.daily-plan__bars { display: flex; gap: 8px; align-items: flex-end; height: 60px; }

/* Earn widget */
.earn { font-size: 18px; font-weight: 600; }

/* Responsive */
@media (max-width: 600px) {
  body { padding: 16px 12px 96px; }
  h1 { font-size: 24px; }
}
/* app/assets/stylesheets/quality_calendar.css */
/* Stream-V — Quality calendar (heatmap) widget styles using design tokens. */

.quality-calendar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-width: 480px;
}

.calendar__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text);
  background: var(--card-solid);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.calendar__cell:hover,
.calendar__cell:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px var(--line-strong);
  outline: none;
}

.calendar__cell--green  { background: var(--green);    color: #05070a; }
.calendar__cell--yellow { background: var(--yellow);   color: #05070a; }
.calendar__cell--red    { background: var(--red);      color: var(--text-strong); }
.calendar__cell--muted  { background: var(--card);     color: var(--muted); }

.calendar__legend {
  list-style: none;
  display: flex;
  gap: 1rem;
  padding: 0;
  margin: 0;
}

.calendar__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.calendar__legend-item::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.calendar__legend-item--green::before  { background: var(--green); }
.calendar__legend-item--yellow::before { background: var(--yellow); }
.calendar__legend-item--red::before    { background: var(--red); }
.calendar__legend-item--muted::before  { background: var(--card); }

.calendar__today-link {
  align-self: flex-start;
  color: var(--text);
  text-decoration: underline;
  cursor: pointer;
}

.calendar__today-link:hover { color: var(--text-strong); }

.quality-day__score--green  { color: var(--green); }
.quality-day__score--yellow { color: var(--yellow); }
.quality-day__score--red    { color: var(--red); }
.quality-day__score--muted  { color: var(--muted); }

/* Evidence form / list / detail */
.evidence-new .field {
  margin-bottom: 1rem;
}

.evidence__status,
.evidences__status {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
}

.btn {
  cursor: pointer;
}
/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * design_tokens.css MUST be loaded first because every other stylesheet —
 * including components.css and admin.css — references the CSS variables it
 * publishes (--page-bg-a, --text, --card, --line, --red, etc.).
 *
 * After design_tokens, require_tree picks up:
 *   * components.css (mobile body sizing + base components),
 *   * admin.css      (desktop chrome gated by `body.admin-body`),
 *   * quality_calendar.css.
 *
 * `body.admin-body` rules in admin.css override the bare `body` rules in
 * components.css thanks to specificity (one class + one element > one
 * element), so source order between admin.css and components.css is
 * non-load-bearing.
 *



 */
