/* The team panel's look: the website's, applied to Unfold.
 *
 * Written by hand. It uses only the colour, font and corner names that
 * `tokens.generated.css` defines (--tx-ground, --tx-ink, --tx-ember ...), which
 * scripts/admin_theme.py writes from packages/tokens/tokens.json. Do not type a colour
 * value in here: change the token instead (CLAUDE.md: the theme is generated).
 * The only literals below are sizes, and the one that is not a token is the card corner,
 * 14px, because the website's own cards use 14px (tokens.json has no name for it).
 *
 * HOW THIS FILE WINS OVER UNFOLD. Unfold's stylesheet is Tailwind 4, which puts all its
 * rules inside CSS "layers". CSS that is outside every layer (everything in this file)
 * beats CSS inside a layer, whatever the order of the files or the weight of the
 * selectors. So a plain `.bg-primary-600 { color: ... }` here overrides Unfold's
 * `text-white` without `!important`. The cost: a broad rule here beats every Unfold
 * utility too, so rules below name what they change as narrowly as they can.
 *
 * Contents: 1 fonts, 2 base, 3 brand rules (ember fills, links, focus), 4 page chrome
 * (sidebar, header, tabs), 5 lists and forms, 6 tags, 7 dashboard, 8 confirm page, 9 login.
 */

/* ============================================================== 1. fonts
 * Self-hosted: copied from the website's own build (see fonts/README.md). The panel
 * makes no request to Google and works with no internet. Latin letters only; anything
 * else (the rupee sign, for one) falls back to the next font in the stack. */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-variable.392aed3eb142.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-variable.b7df97614c8e.woff2") format("woff2");
}
@font-face {
  font-family: "Merienda";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/merienda-variable.395b13a08416.woff2") format("woff2");
}
@font-face {
  font-family: "Caveat Brush";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/caveat-brush.0cad421fa945.woff2") format("woff2");
}

/* ============================================================== 2. base */
:root {
  /* Unfold sets --font-sans to Inter; every `font-sans` (the body) follows this. */
  --font-sans: var(--tx-font-sans);
  --default-font-family: var(--tx-font-sans);
  --tx-radius-card: 14px; /* the website's card corner */
  --tx-lift: 0 10px 24px -14px rgba(0, 0, 0, 0.35); /* the website's card hover shadow */
  /* A tint of an accent: 12% for icon tiles, 14% for tags (as on the website). */
  --tx-tint-12: 12%;
  --tx-tint-14: 14%;
}

html,
body {
  background: var(--tx-ground);
  color: var(--tx-ink);
  font-family: var(--tx-font-sans);
}
#main {
  background: var(--tx-ground);
}

/* Page and section headings use the website's display face. */
h1,
h2,
h3,
h4 {
  font-family: var(--tx-font-display);
  letter-spacing: -0.01em;
}

/* ============================================ 3. brand rules */

/* The website's rule: text on an ember fill is the dark "on fill" colour, never white
 * (white on ember fails contrast). Unfold writes `bg-primary-600 text-white` on its
 * buttons, its submit row and its badges; this beats the `text-white` on any element
 * that has an ember fill. */
.bg-primary-500,
.bg-primary-600,
.bg-primary-700 {
  color: var(--tx-on-fill);
}
/* A tick box or switch that is on is an ember fill too: the tick drawn inside it must
 * be dark. Unfold draws the tick as a white image. */
input[type="checkbox"]:checked {
  background-color: var(--tx-ember);
  border-color: var(--tx-ember);
  background-image: var(--tx-tick-on-fill);
  background-size: 100% 100%;
}

/* Ember is too pale to read as small text on white (about 3.4:1). Where Unfold uses it
 * for a link or a lit-up word, use the darker step of the same scale (about 5:1). */
.text-primary-600,
.text-primary-500,
.text-link {
  color: var(--color-primary-700);
}

/* The website's keyboard focus ring: 2px ember, 2px away. */
:focus-visible {
  outline: 2px solid var(--tx-ember);
  outline-offset: 2px;
}

/* ====================================================== 4. page chrome */

/* The sidebar: raised white, with a hairline, like the website's header. */
#nav-sidebar,
#nav-sidebar-inner,
#nav-sidebar > nav {
  background: var(--tx-raised);
}
#nav-sidebar {
  border-color: var(--tx-line);
}
#nav-sidebar h2 {
  font-family: var(--tx-font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--tx-ink-muted);
}
#nav-sidebar-apps a.active {
  /* The lit-up item: a wash of ember, dark text. */
  background: color-mix(in srgb, var(--tx-ember) var(--tx-tint-12), var(--tx-raised));
  color: var(--tx-ink);
  font-weight: 700;
}
#nav-sidebar-apps a.active .material-symbols-outlined {
  color: var(--color-primary-700);
}
#nav-sidebar .sidebar-badge {
  /* The "waiting for review" count. Ember fill, dark text. */
  background: var(--tx-ember);
  color: var(--tx-on-fill);
  border-radius: var(--tx-radius-pill);
  padding: 0 7px;
  margin-left: auto;
}

.tx-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.tx-sidebar-logo {
  height: 46px;
  width: auto;
  flex: none;
}
.tx-sidebar-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-ink-muted);
  white-space: nowrap;
}

/* The top bar. */
#main > div.bg-white {
  background: var(--tx-raised);
  border-color: var(--tx-line);
}

/* The tabs above a list (Unfold's "pill" tabs). The bar is a recessed track; the
 * current tab is a raised white pill. */
#tabs-items {
  background: color-mix(in srgb, var(--tx-ink) 6%, var(--tx-ground));
  border-radius: var(--tx-radius-sm);
}
#tabs-items > a {
  color: var(--tx-ink-muted);
}
#tabs-items > a.active {
  background: var(--tx-raised);
  color: var(--tx-ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ======================================================= 5. lists, forms */

/* The change form's tabs (Profile, Store page ...): one raised white card, like the
 * website's cards. Unfold draws the panel on the page colour. */
div[x-data*="activeFieldsetTab"] {
  background: var(--tx-raised);
  border: 1px solid var(--tx-line);
  border-radius: var(--tx-radius-card);
  overflow: hidden;
}
div[x-data*="activeFieldsetTab"] > div:first-child {
  border-color: var(--tx-line);
  background: color-mix(in srgb, var(--tx-ink) 3%, var(--tx-ground));
}
/* The tab that is open: darker ember for the words (readable), plain white behind. */
div[x-data*="activeFieldsetTab"] nav > a.active {
  color: var(--tx-ink);
  background: var(--tx-raised);
  box-shadow: inset 0 -3px 0 var(--tx-ember);
}
div[x-data*="activeFieldsetTab"] nav > a:hover {
  color: var(--tx-ink);
}

/* Cards: the list table, the filter panel, the change form's sections. */
#changelist .results,
#changelist-filter,
.module {
  border-color: var(--tx-line);
}
#changelist .results {
  background: var(--tx-raised);
  border-radius: var(--tx-radius-card);
  overflow: hidden;
}

/* Short facts in a list row stay on one line ("1 of 5 live"). */
#result_list td.field-listings,
#result_list td.field-kind_tags,
#result_list td.field-status_tag,
#result_list td.field-category_badge {
  white-space: nowrap;
}

/* The small round thumbnail beside a stay's name. */
.tx-thumb {
  display: inline-grid;
  place-items: center;
  height: 40px;
  width: 40px;
  border-radius: var(--tx-radius-sm);
  object-fit: cover;
  background: color-mix(in srgb, var(--tx-ink) 8%, var(--tx-raised));
  color: var(--tx-ink-muted);
}

/* ============================================================ 6. tags */
.tx-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tx-pill {
  --tone: var(--tx-ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 10px 1px 8px;
  border-radius: var(--tx-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  color: var(--tx-ink);
  background: color-mix(in srgb, var(--tone) var(--tx-tint-14), var(--tx-raised));
}
.tx-pill::before {
  content: "";
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: var(--tone);
}
.tx-pill--ember {
  --tone: var(--tx-ember);
}
.tx-pill--sky {
  --tone: var(--tx-sky);
}
.tx-pill--leaf {
  --tone: var(--tx-leaf);
}
.tx-pill--teal {
  --tone: var(--tx-teal);
}
.tx-pill--coral {
  --tone: var(--tx-coral);
}
.tx-pill--lagoon {
  --tone: var(--tx-lagoon);
}
.tx-pill--sand {
  --tone: var(--tx-sand);
}
.tx-pill--ink {
  --tone: var(--tx-ink-muted);
}

/* ======================================================= 7. dashboard */
.tx-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.tx-muted {
  color: var(--tx-ink-muted);
  font-size: 13px;
  line-height: 1.5;
}
.tx-h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}
.tx-h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.tx-card {
  background: var(--tx-raised);
  border: 1px solid var(--tx-line);
  border-radius: var(--tx-radius-card);
  padding: 20px;
}
.tx-card--flush {
  padding: 0;
}
.tx-card--link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.tx-card--link:hover {
  transform: translateY(-2px);
  box-shadow: var(--tx-lift);
}
.tx-card__head {
  margin-bottom: 12px;
}
.tx-card__head--ruled {
  margin: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tx-line);
}

.tx-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.tx-section-head--inside {
  align-items: baseline;
  margin-bottom: 8px;
}
.tx-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-primary-700);
}
.tx-link .material-symbols-outlined {
  font-size: 18px;
}

.tx-grid {
  display: grid;
  gap: 16px;
}
.tx-grid--kinds {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.tx-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.tx-grid--four {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.tx-grid--six {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.tx-grid--split {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* The accent colours, one name per kind, set in core/ui.py (KIND_TONE). */
.tx-icon-tile,
.tx-num--ember,
.tx-num--sky,
.tx-num--leaf,
.tx-num--teal,
.tx-num--coral,
.tx-num--lagoon,
.tx-num--sand {
  --tone: var(--tx-ink-muted);
}
.tx-icon-tile--ember,
.tx-num--ember {
  --tone: var(--tx-ember);
}
.tx-icon-tile--sky,
.tx-num--sky {
  --tone: var(--tx-sky);
}
.tx-icon-tile--leaf,
.tx-num--leaf {
  --tone: var(--tx-leaf);
}
.tx-icon-tile--teal,
.tx-num--teal {
  --tone: var(--tx-teal);
}
.tx-icon-tile--coral,
.tx-num--coral {
  --tone: var(--tx-coral);
}
.tx-icon-tile--lagoon,
.tx-num--lagoon {
  --tone: var(--tx-lagoon);
}
.tx-icon-tile--sand,
.tx-num--sand {
  --tone: var(--tx-sand);
}

/* The icon tile: the accent at 12% behind the icon, as on the website's homepage. */
.tx-icon-tile {
  display: grid;
  place-items: center;
  height: 48px;
  width: 48px;
  flex: none;
  border-radius: var(--tx-radius-card);
  background: color-mix(in srgb, var(--tone) var(--tx-tint-12), transparent);
  color: var(--tone);
}
.tx-icon-tile .material-symbols-outlined {
  font-size: 26px;
}
/* The accent on a big number: pulled a little toward ink so it keeps 3:1 on white. */
.tx-num--ember,
.tx-num--sky,
.tx-num--leaf,
.tx-num--teal,
.tx-num--coral,
.tx-num--lagoon,
.tx-num--sand {
  color: color-mix(in oklab, var(--tone) 78%, var(--tx-ink));
}

.tx-tile {
  gap: 4px;
}
.tx-tile .tx-icon-tile {
  margin-bottom: 8px;
}
.tx-tile__label {
  font-family: var(--tx-font-display);
  font-weight: 700;
  font-size: 16px;
}
.tx-tile__number {
  font-family: var(--tx-font-display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
}
.tx-tile__sub {
  font-size: 13px;
  color: var(--tx-ink-muted);
}
.tx-tile__sub strong {
  color: var(--tx-ink);
}

.tx-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--tx-line);
}
.tx-rows li:first-child .tx-row {
  border-top: 0;
}
.tx-row__icon {
  color: var(--tx-ink-muted);
}
.tx-row__label {
  flex: 1;
  font-weight: 600;
}
.tx-row:hover .tx-row__label {
  text-decoration: underline;
}
.tx-count {
  min-width: 28px;
  padding: 1px 8px;
  border-radius: var(--tx-radius-pill);
  text-align: center;
  font-weight: 700;
  color: var(--tx-ink-muted);
  background: color-mix(in srgb, var(--tx-ink) 6%, var(--tx-raised));
}
.tx-count--on {
  background: var(--tx-ember);
  color: var(--tx-on-fill);
}

.tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tx-status-line {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--tx-line);
  font-size: 13px;
  line-height: 1.5;
  color: var(--tx-ink-muted);
}
.tx-status-line .material-symbols-outlined {
  color: var(--tx-leaf);
}
.tx-status-line--hidden .material-symbols-outlined {
  color: var(--tx-sand);
}
.tx-status-line strong {
  color: var(--tx-ink);
}

.tx-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--tx-radius-card);
  border: 1px solid var(--tone);
  background: color-mix(in srgb, var(--tone) var(--tx-tint-12), var(--tx-raised));
  color: var(--tx-ink);
}
.tx-alert--coral {
  --tone: var(--tx-coral);
}
.tx-alert--sand {
  --tone: var(--tx-sand);
}
.tx-alert .material-symbols-outlined {
  color: var(--tone);
}
.tx-alert__title {
  font-weight: 700;
}
.tx-alert__text {
  font-size: 13px;
  color: var(--tx-ink-muted);
}

.tx-progress {
  height: 8px;
  margin: 12px 0 20px;
  border-radius: var(--tx-radius-pill);
  background: color-mix(in srgb, var(--tx-ink) 8%, var(--tx-raised));
  overflow: hidden;
}
.tx-progress__bar {
  height: 100%;
  border-radius: var(--tx-radius-pill);
  background: var(--tx-ember);
}
.tx-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: var(--tx-radius-card);
  border: 1px dashed var(--tx-line);
  color: var(--tx-ink-muted);
}
.tx-mini:hover {
  border-color: var(--tx-ember);
}
.tx-mini--done {
  border-style: solid;
  color: var(--tx-ink);
  background: color-mix(in srgb, var(--tx-leaf) var(--tx-tint-12), var(--tx-raised));
}
.tx-mini__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tx-mini__number {
  font-family: var(--tx-font-display);
  font-weight: 800;
  font-size: 26px;
}
.tx-mini--done .material-symbols-outlined {
  color: var(--tx-leaf);
}
.tx-mini__label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.tx-mini__hint {
  font-size: 12px;
  color: var(--color-primary-700);
}

.tx-stat__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tx-ink-muted);
}
.tx-stat__label .material-symbols-outlined {
  font-size: 20px;
}
.tx-stat__value {
  font-family: var(--tx-font-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.1;
}

.tx-attention {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tx-attention__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--tx-line);
}
.tx-attention__item:first-child {
  border-top: 0;
}
.tx-attention__body {
  flex: 1;
  min-width: 240px;
}
.tx-attention__title {
  font-weight: 700;
}
.tx-attention__detail {
  font-size: 13px;
  color: var(--tx-ink);
}
.tx-attention__why {
  margin-top: 2px;
  font-size: 12px;
  color: var(--tx-ink-muted);
}
.tx-attention__icon--blocker {
  color: var(--tx-coral);
}
.tx-attention__icon--warning {
  color: var(--tx-sand);
}
.tx-attention__icon--info {
  color: var(--tx-ink-muted);
}
.tx-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 40px 20px;
  text-align: center;
}
.tx-empty .material-symbols-outlined {
  font-size: 40px;
  color: var(--tx-leaf);
}

/* ================================================== 8. confirm pages */
.tx-confirm {
  max-width: 720px;
}
.tx-confirm__head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tx-confirm__title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
}
.tx-confirm__list {
  margin: 16px 0;
  padding: 12px 16px;
  list-style: none;
  border-radius: var(--tx-radius-sm);
  background: color-mix(in srgb, var(--tx-ink) 4%, var(--tx-raised));
  display: grid;
  gap: 8px;
}
.tx-confirm__explain {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  line-height: 1.55;
}
.tx-confirm__form {
  border-top: 1px solid var(--tx-line);
  padding-top: 20px;
}

/* ============================================================ 9. login */
.login #page,
.login .bg-white {
  background: var(--tx-ground);
}
.tx-login-logo {
  display: block;
  margin-bottom: 20px;
}
.tx-login-logo img {
  height: 84px;
  width: auto;
}
