/* Villa shell styles — built to the selected references:
   V01 courtyard home, V02 applications grid, V03 entry-point table, V05/V06 brand & product surfaces.
   Values come from tokens.css (UI/UX spec 0.2.0). Bootstrap 5 supplies only base widgets (modal, dropdown). */

:root {
  --villa-topbar-h: 3.75rem;
  --bs-body-font-family: var(--villa-font-ui);
  --bs-font-monospace: var(--villa-font-mono);
  --bs-body-bg: var(--villa-color-background);
  --bs-body-color: var(--villa-color-text);
  --bs-border-color: var(--villa-color-border);
  --bs-secondary-color: var(--villa-color-muted);
  --bs-link-color: var(--villa-color-text);
  --bs-link-color-rgb: 51, 6, 17;
  --bs-link-hover-color: var(--villa-color-text);
  --bs-border-radius: var(--villa-radius-control);
  --bs-emphasis-color: var(--villa-color-text);
  --villa-steel-1: #eceaed;
  --villa-steel-2: #dad8dc;
  /* Low-contrast mineral grain, without the old horizontal scanlines. */
  --villa-silver-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='.09'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Cpath fill='%23777770' filter='url(%23n)' d='M0 0H180V180H0z'/%3E%3C/svg%3E");
  --villa-surface-texture: var(--villa-silver-grain),
    linear-gradient(115deg, transparent 25%, #ffffff40 45%, transparent 62%),
    linear-gradient(178deg, var(--villa-steel-1), var(--villa-steel-2));
  --villa-card-fill: radial-gradient(ellipse at 40% 80%, #4b2024, #2c1117 65%, #1c1014);
}
[data-theme="dark"] {
  --bs-link-color-rgb: 228, 227, 229;
  --villa-steel-1: #3d0a17; --villa-steel-2: #2b040d;
  --villa-surface-texture: linear-gradient(178deg, #3a0915, #2a040d);
  --villa-card-fill: radial-gradient(120% 140% at 30% 0%, #5a1a2c 0%, #481323 58%, #3a0c1a 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bs-link-color-rgb: 228, 227, 229;
    --villa-steel-1: #3d0a17; --villa-steel-2: #2b040d;
    --villa-surface-texture: linear-gradient(178deg, #3a0915, #2a040d);
    --villa-card-fill: radial-gradient(120% 140% at 30% 0%, #5a1a2c 0%, #481323 58%, #3a0c1a 100%);
  }
}

html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--villa-color-background);
  background-image: var(--villa-surface-texture);
  background-attachment: scroll;
  color: var(--villa-color-text);
  font-family: var(--villa-font-ui);
  font-size: 1.0625rem;
  line-height: 1.5;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
}
a { color: var(--villa-color-text); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--villa-color-text); }
code, .mono { font-family: var(--villa-font-mono); font-size: 0.875rem; }
.villa-muted, .text-muted { color: var(--villa-color-muted) !important; }
h1, .h1 { font-size: clamp(2.25rem, 4vw, 3.5rem); line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h2, .h2 { font-size: var(--villa-type-section-title-size); line-height: var(--villa-type-section-title-line); font-weight: 650; }
h3, .h3 { font-size: var(--villa-type-card-title-size); line-height: var(--villa-type-card-title-line); font-weight: 650; }
.villa-num { font-variant-numeric: tabular-nums; }

/* Two-colour focus indicator (UX-VIS-003). */
:focus-visible {
  outline: 2px solid var(--villa-color-focus-outer) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--villa-color-focus-inner) !important;
}
.villa-card :focus-visible, .villa-room :focus-visible, .villa-login-card :focus-visible, .villa-table thead :focus-visible {
  outline-color: var(--villa-brand-silver) !important;
  box-shadow: 0 0 0 2px var(--villa-brand-cherry) !important;
}
@media (forced-colors: active) { :focus-visible { outline: 2px solid Highlight !important; box-shadow: none !important; } }
[tabindex="-1"]:focus { outline: none !important; box-shadow: none !important; } /* programmatic focus after navigation */
html { scroll-padding-top: calc(var(--villa-topbar-h) + 0.75rem); }
.villa-skip { position: absolute; z-index: 2000; left: 0.5rem; top: 0.5rem; padding: 0.5rem 1rem;
  background: var(--villa-color-surface); border: 2px solid var(--villa-color-text); }

/* ================================================================ topbar (V02/V06) */
.villa-topbar {
  position: sticky; top: 0; z-index: 1030;
  min-height: var(--villa-topbar-h);
  display: flex; align-items: stretch;
  padding: 0 1.25rem 0 1.5rem;
  background: var(--villa-silver-grain), linear-gradient(180deg, #eeedef, #dcdcdf);
  border-bottom: 1px solid #bdb8bd;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  /* clip decorations sideways only: menus (account, notifications) must drop below the bar, over the page/app */
  overflow-x: clip; overflow-y: visible;
}
.villa-topbar .dropdown-menu { z-index: 1040; }
[data-theme="dark"] .villa-topbar { background: linear-gradient(180deg, #4a1324, #330611); border-bottom-color: #5a1b2c; box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .villa-topbar { background: linear-gradient(180deg, #4a1324, #330611); border-bottom-color: #5a1b2c; box-shadow: none; } }
/* decorative architectural chamfer at the right end of the bar (V02) */
.villa-topbar::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 26rem; pointer-events: none; /* slash sits left of the user name (V01) */
  background: linear-gradient(120deg, transparent 0 40%, rgba(255, 255, 255, 0.55) 40% 41.5%, rgba(255, 255, 255, 0.18) 41.5% 100%);
}
.villa-topbar > nav { position: relative; z-index: 1; display: flex; align-items: stretch; width: 100%; gap: 0.25rem; }
.villa-home { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.25rem 0 0; text-decoration: none; }
.villa-home img { height: 44px; width: auto; display: block; } /* topbar asset: 28px symbol + 24px wordmark */
.villa-nav { display: flex; align-items: stretch; gap: 0.25rem; margin: 0 0 0 1rem; padding: 0; list-style: none; }
.villa-nav li { display: flex; }
.villa-nav a {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; padding: 0 1.4rem;
  font-size: 1.3rem; font-weight: 500; text-decoration: none; color: var(--villa-color-text);
}
.villa-nav a::before { content: ""; position: absolute; inset: 0.15rem 0 0.15rem; z-index: -1; transform: skewX(-14deg); border-radius: 0; }
.villa-nav a:hover::before { background: rgba(183, 199, 54, 0.25); }
.villa-nav a[aria-current="page"] { color: var(--villa-brand-cherry); font-weight: 600; }
.villa-nav a[aria-current="page"]::before {
  background: linear-gradient(180deg, #e2ebbc 0%, #ccd997 45%, #a9bd65 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 -1px 0 rgba(51, 6, 17, 0.18) inset;
}
.villa-bar-divider { width: 1px; align-self: center; height: 2rem; background: #a69fa5; margin: 0 1.25rem; }
.villa-app-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; min-width: 0; font-size: 1.3rem; font-weight: 500; }
.villa-app-title img { width: 28px; height: 28px; filter: brightness(0); opacity: 0.85; }
.villa-app-title .villa-child-title { font-size: 1rem; color: var(--villa-color-muted); overflow-wrap: anywhere; white-space: normal; max-width: 26ch; }
.villa-app-title a.villa-allapps { font-size: 1.25rem; }
.villa-spacer { flex: 1 1 auto; }
body.villa-app-open .villa-nav { display: none; }
.villa-app-title:empty { display: none; }
.villa-user { display: flex; align-items: center; }
.villa-user .dropdown-toggle {
  background: transparent; border: 0; color: var(--villa-color-text); font-size: 1.3rem; font-weight: 500;
  min-height: 2.75rem; padding: 0 0.25rem;
}
.villa-user .dropdown-toggle::after { margin-left: 0.4rem; vertical-align: 0.15em; opacity: 0.6; }
.villa-work-indicator { align-self: center; font-size: 0.95rem; margin-right: 1rem; }
.villa-icon { width: 20px; height: 20px; flex: none; }
.villa-btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 2.75rem; min-width: 2.75rem; }
@media (max-width: 899px) {
  .villa-nav-wide { display: none !important; }
  .villa-home img { height: 30px; }
  .villa-topbar::after { width: 8rem; }
}
@media (min-width: 900px) { .villa-nav-compact { display: none !important; } }

/* ================================================================ page */
.villa-main { --villa-page-gutter: 1rem; padding: 1.5rem var(--villa-page-gutter) 0; outline: none; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 600px) { .villa-main { --villa-page-gutter: 1.5rem; padding: 1.75rem var(--villa-page-gutter) 0; } }
@media (min-width: 1024px) { .villa-main { --villa-page-gutter: 2.5rem; padding: 1.75rem var(--villa-page-gutter) 0; } }
.villa-page { width: 100%; max-width: 1600px; margin: 0 auto; flex: 1 0 auto; display: flex; flex-direction: column; }
/* V03 architectural ribbon under the topbar: absinthe glass -> cherry -> persimmon (decorative only) */
.villa-page { position: relative; }
.villa-page:has(.villa-card)::before { display: none; }   /* V02 grid has no ribbon; V03 tables do */
.villa-page:not(:has(.villa-courtyard))::before { content: ""; position: absolute; top: -1.75rem; right: -2.5rem; width: min(42rem, 44%); height: 3.6rem;
  pointer-events: none; z-index: 0;
  background: linear-gradient(90deg, rgba(183,199,54,.0) 0%, rgba(203,217,106,.85) 8%, rgba(127,140,34,.75) 20%, rgba(183,199,54,.8) 27%,
              #4a0d1a 28%, #2b0410 55%, var(--villa-brand-persimmon) 56%, #c93902 100%);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 56% 62%, 52% 100%, 22% 100%, 12% 40%);
  filter: drop-shadow(0 4px 6px rgba(40,8,18,.2)); }
@media (max-width: 1023px) { .villa-page::before { display: none; } }
.villa-page-body { flex: 1 0 auto; padding-bottom: 2.5rem; }
.villa-page-loading { padding: 2rem; color: var(--villa-color-muted); }
.villa-breadcrumb { font-size: 1.15rem; margin-bottom: 0.4rem; }
.villa-breadcrumb ol { list-style: none; display: flex; gap: 0.6rem; padding: 0; margin: 0; flex-wrap: wrap; }
.villa-breadcrumb li + li::before { content: "/" / ""; margin-right: 0.6rem; color: var(--villa-color-text); }
.villa-subtitle { color: var(--villa-color-muted); font-size: 1.45rem; margin: 0.35rem 0 0; }
.villa-page-head { margin-bottom: 1.5rem; }
.villa-surface { background: var(--villa-color-surface); border: 1px solid #c9c4c9; border-radius: var(--villa-radius-card); padding: 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 6px rgba(51, 6, 17, 0.06); }
[data-theme="dark"] .villa-surface { border-color: rgba(228, 227, 229, 0.25); box-shadow: none; }
.villa-section { margin-top: 2rem; }
/* bottom return bar with chamfer (V02 footer) */
.villa-page-foot {
  position: relative; margin: 2.5rem calc(-1 * var(--villa-page-gutter)) 0; padding: 1rem var(--villa-page-gutter) 1.25rem; border-top: 1px solid #c2bdc2; font-size: 1.2rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent);
}
.villa-page-foot::after { content: ""; position: absolute; right: 0; bottom: 0; width: 9rem; height: 100%; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 50%, rgba(255, 255, 255, 0.5) 50% 52%, rgba(255, 255, 255, 0.15) 52% 100%); }

/* ================================================================ buttons */
.btn { min-height: 2.75rem; font-weight: 600; border-radius: var(--villa-radius-control); }
.btn-sm { min-height: 2.25rem; }
.btn-villa-primary { background: var(--villa-brand-persimmon); color: var(--villa-brand-cherry); border: 1px solid #a62e04; }
.btn-villa-primary:hover, .btn-villa-primary:focus { background: #ff6a33; color: var(--villa-brand-cherry); border-color: #a62e04; }
.btn-villa-primary:disabled { background: var(--villa-color-inset); color: var(--villa-color-muted); }
.btn-villa { background: linear-gradient(180deg, #fbfafb, #e2e0e3); color: var(--villa-color-text); border: 1px solid #b4aeb3;
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(51, 6, 17, 0.12); }
.btn-villa:hover { background: linear-gradient(180deg, #fff, #ebe9ec); color: var(--villa-color-text); }
.btn-villa-danger { background: var(--villa-color-surface); color: #8f1023; border: 1px solid #8f1023; }
.btn-villa-danger:hover { background: #8f1023; color: #fff; }
.btn-villa-quiet { background: transparent; border: 1px solid transparent; color: var(--villa-color-text); text-decoration: underline; }

/* Slanted "Open ›" action (V02 silver on cards, V03/V06 persimmon in tables & on the focused card). */
.villa-open {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 2.5rem; padding: 0 1.35rem; font-size: 1.15rem; font-weight: 500; text-decoration: none;
  color: var(--villa-brand-cherry) !important; white-space: nowrap; background: none; border: 0;
}
.villa-open::before {
  content: ""; position: absolute; inset: 0; z-index: -1; transform: skewX(-18deg); border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #e7e6e8 55%, #cfcdd0 100%);
  box-shadow: 0 1px 0 #fff inset, 0 2px 3px rgba(0, 0, 0, 0.35);
}
.villa-open.is-hot::before, .villa-open:hover::before {
  background: linear-gradient(180deg, #ff7a45 0%, #fd4706 55%, #f24605 100%);   /* bottom ≥ 4.8:1 with cherry ink */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 2px 3px rgba(0, 0, 0, 0.35);
}
.villa-open .chev { font-size: 1.2em; line-height: 1; }
.villa-open img { width: 20px; height: 20px; }

/* fields */
.form-control, .form-select { min-height: 2.75rem; background-color: var(--villa-color-surface); color: var(--villa-color-text);
  border-color: #b4aeb3; font-size: 1.05rem; }
.form-control:focus, .form-select:focus { background-color: var(--villa-color-surface); color: var(--villa-color-text); border-color: var(--villa-color-text); box-shadow: none; }
.form-label { font-weight: 600; font-size: var(--villa-type-label-size); }
.form-text { color: var(--villa-color-muted); }
.invalid-feedback { color: #8f1023; display: block; }

/* bevelled steel field with bottom-right chamfer (V02 search & filters) */
.villa-steel-field { position: relative; display: flex; align-items: center; }
.villa-steel-field::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 14px; height: 14px; pointer-events: none;
  background: linear-gradient(135deg, transparent 0 50%, #b4aeb3 50% 56%, var(--villa-steel-2) 56%); }
.villa-steel-field input, .villa-steel-field select {
  width: 100%; min-height: 3.25rem; font-size: 1.3rem; color: #330611; /* silver face in every theme: fixed cherry ink */
  background: linear-gradient(180deg, #f6f5f7, #ebe9ec); border: 1px solid #b4aeb3; border-radius: 3px;
  box-shadow: 0 2px 2px rgba(51, 6, 17, 0.08) inset, 0 1px 0 rgba(255, 255, 255, 0.9);
}
.villa-steel-field input { padding: 0 1rem 0 3.4rem; }
.villa-steel-field input::placeholder { color: #5e4a52; opacity: 1; }
.villa-steel-field .villa-field-icon { position: absolute; left: 1.1rem; width: 26px; height: 26px; pointer-events: none; filter: brightness(0); }
.villa-steel-field select { padding: 0 2.6rem 0 1.25rem; appearance: none;
  background-image: linear-gradient(180deg, #f9f8fa, #e4e2e5); }
.villa-filter::before { content: ""; position: absolute; right: 1.25rem; top: calc(50% - .4rem); z-index: 1;
  width: .65rem; height: .65rem; border-right: 2px solid var(--villa-color-text); border-bottom: 2px solid var(--villa-color-text);
  transform: rotate(45deg); pointer-events: none; }

/* Segmented radio groups styled as slanted tabs (V02; UX-A11Y-003: native radios, not ARIA tabs) */
.villa-segmented { position: relative; display: inline-flex; align-items: stretch; margin: 0; padding: 0.25rem 0.4rem; border: 1px solid #b4aeb3; border-radius: 0;
  background: linear-gradient(180deg, #f6f5f7, #e3e1e4); box-shadow: 0 1px 0 #fff inset; }
.villa-segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.villa-segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.villa-segmented label { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 0.6rem; min-height: 2.75rem;
  padding: 0 1.7rem; cursor: pointer; font-size: 1.3rem; font-weight: 500; margin: 0; color: #330611; }
.villa-segmented label:not(:last-child)::after { content: ""; position: absolute; right: 0; top: 28%; height: 44%; width: 1px; background: #8a8a90; }
.villa-segmented input:checked + label { color: var(--villa-brand-cherry); font-weight: 650; }
.villa-segmented input:checked + label::before { content: ""; position: absolute; inset: -0.2rem 0.05rem; z-index: -1; transform: skewX(-14deg);
  background: linear-gradient(180deg, #e0e9b4 0%, #cddc97 50%, #b2c577 100%); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 -1px 0 rgba(51,6,17,.2) inset; }
.villa-segmented input:checked + label::after { display: none; }
.villa-segmented input:focus-visible + label { outline: 2px solid var(--villa-color-focus-outer); outline-offset: 3px; box-shadow: 0 0 0 2px var(--villa-color-focus-inner); }
.villa-segmented label img { width: 24px; height: 24px; filter: brightness(0); }

/* ================================================================ directory (V02) */
.villa-toolbar { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; margin: 0 0 1.5rem; }
.villa-toolbar .villa-search { flex: 1 1 22rem; min-width: 0; }
.villa-toolbar .villa-filter { flex: 0 0 auto; min-width: 12rem; }
.villa-toolbar-split { justify-content: space-between; }
.villa-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.5rem 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .villa-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .villa-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .villa-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.villa-card {
  --card-edge: #dfdfdc;
  --card-outline: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  gap: .55rem; height: 100%; min-height: 13rem; padding: 1.25rem 1.4rem 1rem 3.9rem;
  color: var(--villa-brand-silver); filter: drop-shadow(0 1px 1px #5f6155) drop-shadow(0 2px 2px #33061130);
}
/* Chamfer only the decorative layers: keyboard rings and long names remain unclipped. */
.villa-card::before, .villa-card::after { content: ""; position: absolute; z-index: -1; clip-path: var(--card-outline); pointer-events: none; }
.villa-card::before { inset: 0; background: var(--card-edge); }
.villa-card::after { inset: 2px; background:
  linear-gradient(145deg, transparent 0 29%, #ffffff08 29% 38%, transparent 38%),
  linear-gradient(90deg, #b8cb80 0 1.1rem, #e0e8ae 1.1rem calc(1.1rem + 1px), #83974f calc(1.1rem + 1px) 2.3rem, #bfd58c 2.3rem calc(2.3rem + 1px), #52642d calc(2.3rem + 1px) 2.65rem, transparent 2.65rem),
  var(--villa-card-fill); }
.villa-card:hover, .villa-card:focus-within { --card-edge: #fd4706; }
.villa-card:hover .villa-open::before, .villa-card:focus-within .villa-open::before {
  background: linear-gradient(180deg, #ff7a45 0%, #fd4706 55%, #f24605 100%);   /* bottom ≥ 4.8:1 with cherry ink */
}
.villa-card a, .villa-card .btn-villa-quiet { color: var(--villa-brand-silver); }
.villa-card .villa-card-head { min-width: 0; display: flex; gap: 1.1rem; align-items: flex-start; }
.villa-card .villa-card-icon { width: 3.4rem; height: 3.4rem; flex: none; filter: brightness(0) invert(0.92); margin-top: 0.15rem; }
.villa-card h3 { margin: 0; font-size: clamp(1.8rem, 2.6vw, 2.65rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; color: #f0eff1; }
.villa-card h3 a { text-decoration: none; color: inherit; }
.villa-card h3 a:hover { text-decoration: underline; }
.villa-card-copy { min-width: 0; flex: 1; padding-right: .8rem; }
.villa-card .villa-card-sub { font-size: 1.2rem; margin: 0.15rem 0 0; color: #e8e6ea; }
.villa-card .villa-card-desc { font-size: 1.05rem; margin: 0.2rem 0 0; color: #e8e6ea;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.villa-card .villa-state { font-size: 1.2rem; font-weight: 500; color: #f0eff1; margin: 0.35rem 0 0 0.1rem; }
.villa-card .villa-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  border-top: 1px solid rgba(228, 227, 229, 0.45); padding-top: 0.85rem; flex-wrap: wrap; font-size: 1.2rem; }
.villa-card .villa-card-foot > a:first-child { text-decoration: underline; }
.villa-card .villa-pin { position: absolute; top: 0.45rem; right: 0.45rem; z-index: 2; }
.villa-card .villa-pin .btn { color: var(--villa-brand-silver); border: 0; background: transparent; min-height: 2.5rem; min-width: 2.5rem; }
.villa-card .villa-pin img { filter: brightness(0) invert(0.92); width: 22px; height: 22px; }
.villa-card .villa-pin .btn[aria-pressed="true"] img { filter: none; }
.villa-card .villa-pin .btn[aria-pressed="true"] { background: var(--villa-brand-absinthe); border-radius: 4px; }

/* Status words with a symbol (never colour alone). */
.villa-state { display: inline-flex; align-items: center; gap: 0.55rem; font-size: 1rem; font-weight: 600; }
.villa-state::before { content: ""; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: currentColor; opacity: 0.5; flex: none; }
.villa-state[data-tone="ok"]::before { background: var(--villa-brand-absinthe); opacity: 1; box-shadow: 0 0 0 1px rgba(51, 6, 17, 0.35); }
.villa-state[data-tone="busy"]::before { background: transparent; border: 2px solid var(--villa-brand-absinthe); opacity: 1; }
.villa-state[data-tone="warn"]::before { border-radius: 2px; transform: rotate(45deg); background: #ffb000; opacity: 1; }
.villa-state[data-tone="bad"]::before { border-radius: 2px; background: var(--villa-brand-persimmon); opacity: 1; }
.villa-state[data-tone="unknown"]::before { background: transparent; border: 2px dashed currentColor; }
/* table state: filled check badge (V03) */
.villa-table .villa-state { white-space: nowrap; font-weight: 500; font-size: 1.15rem; }
.villa-table .villa-state[data-tone="ok"]::before { content: "✓" / ""; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 800; color: #fff; background: radial-gradient(circle at 35% 30%, #6fa63a, #3f7a1f); }
.villa-badge { display: inline-block; padding: 0.1rem 0.65rem; border-radius: 4px; font-size: 1.05rem; font-weight: 500;
  background: linear-gradient(180deg, #e3edb6, #cddc85); color: var(--villa-brand-cherry); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset; }
.villa-badge-outline { background: transparent; border: 1px solid currentColor; color: inherit; box-shadow: none; }

/* ================================================================ tables (V03) */
.villa-table-wrap { overflow-x: auto; border: 1px solid #b4aeb3; border-radius: 0; background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 6px rgba(51, 6, 17, 0.08); }
.villa-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 1.2rem; }
.villa-table caption { caption-side: bottom; text-align: left; padding: 0.75rem 0 0; color: var(--villa-color-muted); font-size: 1.1rem; }
.villa-table-wrap:has(caption) { overflow-x: auto; }
.villa-table thead th { background: linear-gradient(180deg, #4a1324, #330611); color: var(--villa-brand-silver); font-weight: 600; font-size: 1.25rem;
  padding: 0.6rem 1.1rem; text-align: left; white-space: nowrap; }
.villa-table thead th button { background: none; border: none; color: inherit; font-weight: 600; padding: 0; min-height: 2rem; font-size: inherit; }
.villa-table td, .villa-table tbody th { padding: 0.4rem 1.1rem; border-top: 1px solid #a3a3a8; vertical-align: middle; line-height: 1.3; }
.villa-table tbody tr > :first-child { min-width: 12rem; max-width: 28rem; overflow-wrap: anywhere; }
.villa-table tbody th { font-weight: 650; }
.villa-table tbody tr > :first-child a { text-decoration: none; font-weight: 650; }
.villa-table tbody tr > :first-child a:hover, .villa-table tbody tr > :first-child a:focus-visible { text-decoration: underline; }
.villa-table tbody tr:hover, .villa-table tbody tr:focus-within { background: linear-gradient(90deg, rgba(183, 199, 54, 0.4), rgba(183, 199, 54, 0.22)); }
.villa-table tbody tr:hover > :first-child, .villa-table tbody tr:focus-within > :first-child { box-shadow: 5px 0 0 var(--villa-brand-persimmon) inset; }
.villa-table .villa-row-icon { width: 28px; height: 28px; margin-right: 0.9rem; vertical-align: -6px; filter: brightness(0); opacity: 0.85; }
.villa-link-action { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: underline; background: none; border: 0; padding: 0;
  font-size: inherit; color: var(--villa-color-text); cursor: pointer; min-height: 2.25rem; }
.villa-link-action img { width: 22px; height: 22px; filter: brightness(0); opacity: .85; }
.villa-table-count { margin-top: 0.9rem; color: var(--villa-color-muted); font-size: 1.15rem; }
.villa-pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }
[data-theme="dark"] .villa-table-wrap { background: rgba(72, 19, 35, 0.6); border-color: #5a1b2c; }
[data-theme="dark"] .villa-table .villa-row-icon, [data-theme="dark"] .villa-link-action img { filter: brightness(0) invert(0.9); }

/* ================================================================ home courtyard (V01) */
.villa-home-page { max-width: none; }
.villa-home-page > p:last-child { padding: 0 0 1rem; }
.villa-courtyard {
  /* Local light palette: the building keeps silver faces and dark ink in either theme. */
  --villa-color-text: #20201d;
  --villa-color-muted: #4c4c45;
  --villa-color-focus-inner: #f0efea;
  --villa-color-focus-outer: #330611;
  position: relative; isolation: isolate; display: grid;
  grid-template-columns: 20% 20.5% 25% 34.5%;
  grid-template-rows: minmax(min-content, 31fr) minmax(min-content, 40fr) minmax(min-content, 29fr);
  grid-template-areas: "a a b f" "c g g f" "d d e f";
  margin: -1.75rem -2.5rem 0;
  min-height: max(calc(100dvh - var(--villa-topbar-h)), 59vw);
  color: var(--villa-color-text); background: #d4d4cc;
}
.villa-architecture { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.villa-architecture svg { display: block; width: 100%; height: 100%; }
/* Only exposed metal receives brushing: the SVG clips this CSS layer before glass is painted.
   The floor, featured panel and room copy stay smooth; no noise filter or image is needed. */
.court-brushing > div { width: 100%; height: 100%;
  background: repeating-linear-gradient(0deg, #ffffff0e 0 1px, #303b350a 1px 2px, transparent 2px 4px),
    repeating-linear-gradient(176deg, transparent 0 10px, #ffffff09 10px 11px, transparent 11px 17px); }
.villa-courtyard .slot-a { grid-area: a; }
.villa-courtyard .slot-b { grid-area: b; }
.villa-courtyard .slot-c { grid-area: c; }
.villa-courtyard .slot-d { grid-area: d; }
.villa-courtyard .slot-e { grid-area: e; }
.villa-courtyard .slot-f { grid-area: f; }
/* Vacant rooms are quiet architectural recesses, not empty application cards. */
.villa-courtyard:has(.slot-a.is-empty) .alcove-a,
.villa-courtyard:has(.slot-b.is-empty) .alcove-b,
.villa-courtyard:has(.slot-c.is-empty) .alcove-c,
.villa-courtyard:has(.slot-d.is-empty) .alcove-d,
.villa-courtyard:has(.slot-e.is-empty) .alcove-e { fill: url(#court-empty); }
.villa-room {
  --villa-room-dark: #100b0c;
  --villa-room-title-size: clamp(2rem, 3.35vw, 3.5rem);
  position: relative; isolation: isolate; min-width: 0;
  padding: 2.9vw 12.5vw 3.7vw 7.5vw; color: #d8d7d4; background-color: var(--villa-room-dark);
}
/* These clips follow the visible dark walls in architecture(), excluding sills and glass.
   Each gradient uses the SVG alcove's bounding box, so adjoining SVG/HTML paint stays aligned. */
.villa-room.slot-a {
  clip-path: polygon(16.0494% 8.2361%, 72.9938% 20.9334%, 72.9938% 75.4976%, 22.8395% 91.2835%, 11.464% 45.8185%);
  --wall-left: 10.6481%; --wall-top: 8.2361%; --wall-width: 62.3457%; --wall-height: 83.0474%;
}
.villa-room.slot-b {
  --villa-room-title-extra: 5.75vw;
  padding: 2.9vw 1.25vw 3.5vw 7.5vw;
  clip-path: polygon(24.75% 5.1476%, 131.5% 22.9925%, 128.048% 37.4013%, 124% 38.7783%, 99.6477% 76.2177%, 6.75% 86.1359%);
  --wall-left: 6.75%; --wall-top: 5.1476%; --wall-width: 124.75%; --wall-height: 80.9883%;
}
.villa-room.slot-c {
  --villa-room-title-extra: .75vw;
  /* Keep the earlier narrow-width floor so the shared preferred size cannot force a new wrap. */
  --villa-room-title-floor: calc(clamp(1.5rem, 2.65vw, 2.75rem) * .6);
  padding: 3.3vw 3.2vw 5vw 2.7vw;
  clip-path: polygon(7.8125% -9.9468%, 89.0625% 10.3989%, 89.0625% 82.3723%, 0 59.4681%);
  --wall-left: 0%; --wall-top: -9.9468%; --wall-width: 89.0625%; --wall-height: 99.4681%;
}
.villa-room.slot-d {
  padding: 3vw 12vw 3vw 5.5vw;
  clip-path: polygon(9.9414% -23.0924%, 72.9938% 24.4974%, 72.9938% 83.1255%, 8.179% 68.8188%);
  --wall-left: 0%; --wall-top: -27.6596%; --wall-width: 72.9938%; --wall-height: 110.785%;
}
.villa-room.slot-e {
  padding: 4.8vw 1.6vw 3vw .8vw;
  clip-path: polygon(-3.25% 13.7931%, 98% 26.6801%, 97.4925% 76.2839%, 88% 74.3213%, -12.25% 92.6632%);
  --wall-left: -12.25%; --wall-top: 13.7931%; --wall-width: 112.75%; --wall-height: 78.8701%;
}
/* Solid substrates let contrast tools resolve the text background. The positioned gradient
   paints across those substrates as one wall, below the links/state/copy, avoiding dark text boxes. */
.villa-room h2, .villa-room-lines { background-color: var(--villa-room-dark); }
.villa-room::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: var(--wall-left); top: var(--wall-top); width: var(--wall-width); height: var(--wall-height);
  background: linear-gradient(180deg, #0009, transparent 30%),
    linear-gradient(100deg, #0006, transparent 36%),
    radial-gradient(ellipse 100% 100% at 55% 100%, #64202a, #280c12 60%, #100b0c);
}
.villa-room.is-empty { background: none; }
.villa-room.is-empty::before { display: none; }
.villa-room h2 {
  display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: end; column-gap: .4vw;
  min-height: calc(var(--villa-room-title-size) * 1.1);
  /* b extends beyond its grid track into its own opening; c stops before the glass edge.
     Spend that space before the measured title shrinks. Metadata keeps its existing layout. */
  margin: 0 calc(-1 * var(--villa-room-title-extra, 0px)) 0 0;
  font-size: var(--villa-room-title-size); line-height: 1.1; font-weight: 400; letter-spacing: -.025em;
  color: inherit;
}
.villa-room h2 > .villa-room-name { container-type: inline-size; min-width: 0; z-index: 1; overflow-wrap: normal; }
.villa-room-name > span { display: block;
  font-size: clamp(var(--villa-room-title-floor, calc(var(--villa-room-title-size) * .6)), calc(100cqi / var(--villa-room-name-width)), var(--villa-room-title-size)); }
.villa-room a { color: inherit; text-decoration: none; }
.villa-room a:hover { text-decoration: underline; }
.villa-room-state { position: relative; z-index: 1; padding-left: .5vw; border-left: 1px solid #bdbab7; white-space: nowrap;
  font-size: clamp(1rem, 1.15vw, 1.3rem); line-height: 1.5; font-weight: 400; letter-spacing: 0; }
.villa-room.slot-c h2 { column-gap: .35vw; }
.villa-room.slot-c .villa-room-state { padding-left: .35vw; font-size: clamp(.75rem, .9vw, .95rem); }
.villa-room-lines { margin: 1.35rem 0 0 .25rem; padding: 0; list-style: none;
  font-family: var(--villa-font-mono); font-size: clamp(.875rem, 1.06vw, 1.0625rem); line-height: 1.85; overflow-wrap: anywhere; }
.villa-room.slot-d .villa-room-lines { margin-top: .9rem; }
.villa-room-lines > span, .villa-room-lines > li { position: relative; z-index: 1; }
.villa-ground { position: relative; grid-area: g; min-width: 0; padding: 6.8vw 4.3vw 2vw 2.4vw; display: flex; flex-direction: column; gap: 3.3vw; }
.villa-ground .villa-find { display: block; width: 100%; min-height: 2.75rem; padding: .4rem 0 .55rem; border: 0;
  border-bottom: 2px solid #3b3b33; border-radius: 0; color: #20201d; background: transparent;
  font-size: clamp(1.4rem, 1.9vw, 1.95rem); }
.villa-ground .villa-find::placeholder { color: #30302b; opacity: 1; }
/* The two-colour focus ring follows the underline, with a 2px silver separation and 2px cherry ring. */
.villa-ground .villa-search::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  pointer-events: none; }
.villa-ground .villa-search:has(.villa-find:focus-visible)::after { background: #330611;
  box-shadow: 0 0 0 2px #f0efea, 0 0 0 4px #330611; }
.villa-ground .villa-find:focus-visible { outline: none !important; box-shadow: none !important; }
/* Restyle the native button, retaining its pointer/keyboard clearing and input events. */
.villa-ground .villa-find::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none;
  width: 1.125rem; height: 1.125rem; margin-inline-start: .75rem; cursor: pointer;
  background: linear-gradient(45deg, transparent 43%, #330611 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, #330611 43% 57%, transparent 57%); }
.villa-ground h2 { margin: 0 0 .25rem; font-size: clamp(1.6rem, 2.2vw, 2.25rem); line-height: 1.15; font-weight: 600; letter-spacing: -.025em; }
.villa-work { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.villa-work > div { flex: 1 1 10rem; min-width: 0; }
.villa-work p, .villa-work li { margin: 0; font-size: clamp(1rem, 1.45vw, 1.45rem); line-height: 1.35; overflow-wrap: anywhere; }
.villa-work ul { margin: 0; padding: 0; list-style: none; }
.villa-work a { text-decoration: none; }
.villa-work a:hover { text-decoration: underline; }
.villa-shared-btn { position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center;
  gap: .8rem; min-height: 3.4rem; margin-top: .4rem; padding: .6rem 1.6rem;
  font-size: clamp(1rem, 1.3vw, 1.3rem); font-weight: 500; white-space: nowrap; text-decoration: none; }
.villa-shared-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: skewX(-16deg);
  background: linear-gradient(165deg, #f5f5f0, #d1d0c9); border: 1px solid #a6a69c;
  box-shadow: 3px 6px 0 #787a6a66, 0 1px 0 #fff inset; }
.villa-shared-btn img { width: 27px; height: 27px; filter: brightness(0); }
.villa-ground .villa-allapps { position: absolute; right: 1.5vw; bottom: .8vw; margin: 0;
  min-height: 2.75rem; display: inline-flex; align-items: center; font-size: clamp(1rem, 1.35vw, 1.35rem); text-decoration: none; }
.villa-ground .villa-allapps:hover { text-decoration: underline; }
.villa-featured { min-width: 0; padding: 11.8vw 1.4vw 7vw 6.3vw; color: #171715; }
.villa-featured h2 { margin: 0 0 2vw 2.7vw; font-size: clamp(2.7rem, 4.65vw, 4.75rem); line-height: 1.08; font-weight: 500; letter-spacing: -.035em; overflow-wrap: anywhere; }
.villa-featured a { color: inherit; text-decoration: none; }
.villa-featured a:hover { text-decoration: underline; }
.villa-featured-desc { color: #484842; margin: 0 0 1.7rem; padding-bottom: .75rem;
  border-bottom: 1px solid #85867e; font-size: clamp(1rem, 1.4vw, 1.4rem); line-height: 1.5; overflow-wrap: anywhere; }
.villa-featured ul { list-style: none; margin: 0; padding: 0; }
.villa-featured li { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1.2rem;
  padding: 1.05rem 0; border-bottom: 1px solid #94958d; font-size: clamp(1.05rem, 1.45vw, 1.45rem); }
.villa-featured li img { width: 34px; height: 34px; filter: brightness(0); }
.villa-featured li a { flex: 1 1 8rem; min-width: 0; overflow-wrap: anywhere; }
.villa-featured li .meta { margin-left: auto; font-size: clamp(.875rem, 1.2vw, 1.2rem); color: #484842; }
/* Flat, ordered fallback: the same destinations and work, without perspective or vacant rooms. */
@media (max-width: 1099px) {
  .villa-courtyard { display: flex; flex-direction: column; gap: 1rem; margin: 0; min-height: 0; background: none; }
  .villa-architecture, .villa-room.is-empty { display: none; }
  .villa-courtyard .villa-room { margin: 0; padding: 1.5rem 1.5rem 1.5rem 2.25rem;
    clip-path: none; --villa-room-title-size: 2rem; --villa-room-title-floor: 1.2rem; border-left: .65rem solid #a2b647; }
  .villa-room::before { inset: 0; width: auto; height: auto; background: var(--villa-card-fill); }
  .villa-room h2 { margin: 0; grid-template-columns: minmax(0, calc(var(--villa-room-name-width) * 2rem)) max-content; column-gap: .75rem; }
  .villa-room h2 > .villa-room-name { overflow-wrap: anywhere; }
  .villa-room-state { padding-left: .75rem; }
  .villa-room.slot-c h2 { column-gap: .75rem; }
  .villa-room.slot-c .villa-room-state { padding-left: .75rem; font-size: 1rem; }
  .villa-room-lines { font-size: 1rem; }
  .villa-ground { padding: 1.5rem; gap: 1.5rem; background: #dcdad2; }
  .villa-ground .villa-allapps { position: static; align-self: flex-end; margin: 0; }
  .villa-featured { position: relative; padding: 1.75rem 1.5rem 1.5rem 2rem; border: 0;
    background: #e4e3e5; box-shadow: inset 6px 6px #ac2e00; }
  .villa-featured::before { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(135deg, #ff8450, #fd4706 45%, #ac2e00);
    clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 4px, 4px 4px, 4px calc(100% - 4px), 0 100%); }
  .villa-featured h2 { margin: 0 0 1rem; font-size: 2.5rem; }
  .villa-featured-desc, .villa-featured li { font-size: 1.1rem; }
}
/* Large metadata uses the same ordered presentation at desktop widths, keeping names complete. */
.villa-courtyard.is-flat { display: flex; flex-direction: column; gap: 1rem; margin: 0; min-height: 0; background: none; }
.villa-courtyard.is-flat .villa-architecture, .villa-courtyard.is-flat .villa-room.is-empty { display: none; }
.villa-courtyard.is-flat .villa-room { margin: 0; padding: 1.5rem 1.5rem 1.5rem 2.25rem;
  clip-path: none; --villa-room-title-size: 2rem; --villa-room-title-floor: 1.2rem; border-left: .65rem solid #a2b647; }
.villa-courtyard.is-flat .villa-room::before { inset: 0; width: auto; height: auto; background: var(--villa-card-fill); }
.villa-courtyard.is-flat .villa-room h2 { margin: 0; grid-template-columns: minmax(0, calc(var(--villa-room-name-width) * 2rem)) max-content; column-gap: .75rem; }
.villa-courtyard.is-flat .villa-room h2 > .villa-room-name { overflow-wrap: anywhere; }
.villa-courtyard.is-flat .villa-room-state { padding-left: .75rem; font-size: 1rem; }
.villa-courtyard.is-flat .villa-room-lines { font-size: 1rem; }
.villa-courtyard.is-flat .villa-ground { padding: 1.5rem; gap: 1.5rem; background: #dcdad2; }
.villa-courtyard.is-flat .villa-allapps { position: static; align-self: flex-end; }
.villa-courtyard.is-flat .villa-featured { position: relative; padding: 1.75rem 1.5rem 1.5rem 2rem; border: 0;
  background: #e4e3e5; box-shadow: inset 6px 6px #ac2e00; }
.villa-courtyard.is-flat .villa-featured::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, #ff8450, #fd4706 45%, #ac2e00);
  clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 4px, 4px 4px, 4px calc(100% - 4px), 0 100%); }
.villa-courtyard.is-flat .villa-featured h2 { margin: 0 0 1rem; font-size: 2.5rem; }
.villa-courtyard.is-flat .villa-featured-desc, .villa-courtyard.is-flat .villa-featured li { font-size: 1.1rem; }
@media (forced-colors: active) {
  .villa-architecture { display: none; }
  .villa-courtyard { display: flex; flex-direction: column; gap: 1rem; margin: 0; min-height: 0; background: Canvas; }
  .villa-courtyard .villa-room, .villa-ground, .villa-featured { margin: 0; padding: 1.5rem; color: CanvasText; border: 1px solid CanvasText; }
  .villa-courtyard .villa-room { clip-path: none; --villa-room-title-size: 2rem; --villa-room-title-floor: 1.2rem; background: Canvas; }
  .villa-courtyard .villa-room h2, .villa-room-lines { background: Canvas; }
  .villa-courtyard .villa-room h2 { margin: 0; }
  .villa-room::before, .villa-featured::before { display: none; }
  .villa-featured { box-shadow: none; }
  .villa-courtyard .villa-room.is-empty { display: none; }
  .villa-room-state { border-color: CanvasText; }
  .villa-ground .villa-search::after { display: none; }
  .villa-ground .villa-find:focus-visible { outline: 2px solid Highlight !important; outline-offset: 2px; }
  .villa-ground .villa-find::-webkit-search-cancel-button { -webkit-appearance: auto; appearance: auto; }
}

/* ================================================================ app frame (V06 shell) */
body.villa-app-open .villa-main { display: none; }
.villa-main, .villa-frame-host { grid-row: 2; grid-column: 1; }
.villa-frame-host { display: flex; flex-direction: column; min-height: 0; }
.villa-frame-host[hidden] { display: none; }
.villa-frame-status { padding: 0.6rem 1.5rem; border-bottom: 1px solid #c2bdc2; background: var(--villa-color-surface);
  display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; font-size: 1.05rem; }
.villa-frame-status:empty { display: none; }
.villa-frame-body { flex: 1 1 auto; display: flex; min-height: 0; }
.villa-frame-body iframe { flex: 1 1 auto; border: 0; background: #fff; display: block; width: 100%;
  min-height: calc(100dvh - var(--villa-topbar-h) - 2.4rem); }
.villa-frame-exit { padding: 0.3rem 1.5rem; font-size: 0.95rem; border-top: 1px solid #c2bdc2; background: var(--villa-color-background); }

/* ================================================================ sign in (V06) */
.villa-login { min-height: calc(100dvh - 4rem); display: grid; place-items: center; padding: 1rem; }
.villa-login-card {
  --login-outline: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
  position: relative; isolation: isolate; width: min(27rem, 100%); color: var(--villa-brand-silver);
  padding: 1.9rem 2.2rem 1.6rem; filter: drop-shadow(0 5px 8px #33061140);
}
.villa-login-card::before, .villa-login-card::after { content: ""; position: absolute; clip-path: var(--login-outline); pointer-events: none; }
.villa-login-card::before { inset: -9px; z-index: -2; background: linear-gradient(140deg, #f8f8f6, #aaa9ac); }
.villa-login-card::after { inset: 0; z-index: -1; background: var(--villa-card-fill); }
.villa-login-card .villa-lockup { display: block; width: 13rem; max-width: 100%; height: auto; margin: 0 auto .75rem; }
.villa-login-card h1 { font-size: 1.65rem; line-height: 1.2; font-weight: 600; text-align: left; margin-bottom: 1.3rem; color: #f2f0f3; }
.villa-login-card a, .villa-login-card .form-label, .villa-login-card .form-text, .villa-login-card .btn-villa-quiet, .villa-login-card p { color: var(--villa-brand-silver); }
.villa-login-card .form-label { font-weight: 500; font-size: 1.1rem; }
.villa-login-card .form-control { background: linear-gradient(180deg, #fbfafb, #ebe9ec); color: var(--villa-brand-cherry); border: 1px solid #d6d4d8;
  min-height: 2.5rem; font-size: 1.2rem; }
.villa-login-card .form-text { font-size: 0.85rem; line-height: 1.35; }
.villa-login-card .invalid-feedback, .villa-login-card .villa-alert { color: #ffd3d9; }
.villa-login-card .form-check-input { width: 1.3rem; height: 1.3rem; margin-top: 0.15rem; }
.villa-login-card .form-check-input:checked { background-color: var(--villa-brand-absinthe); border-color: var(--villa-brand-absinthe); }
.villa-login-card .form-check-label { font-size: 1.1rem; }
.villa-login-card .btn-villa-primary { min-height: 2.75rem; font-size: 1.4rem; border-radius: 3px; width: 100%; }
.villa-login-card .villa-switch { display: block; margin: 1rem auto 0; font-size: 1.1rem; }
.villa-code { font-family: var(--villa-font-mono); letter-spacing: 0.25em; font-size: 1.45rem; }

/* ================================================================ feedback & misc */
.villa-toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; width: min(26rem, calc(100vw - 2rem)); }
.villa-toast { background: var(--villa-color-surface); color: var(--villa-color-text); border: 1px solid var(--villa-color-border);
  border-left: 0.4rem solid var(--villa-brand-absinthe); border-radius: var(--villa-radius-card); padding: 0.75rem 1rem;
  display: flex; gap: 0.75rem; align-items: flex-start; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); }
.villa-toast[data-tone="bad"] { border-left-color: var(--villa-brand-persimmon); }
.villa-banner { border: 1px solid #b4aeb3; border-left: 0.4rem solid #c08a00; background: var(--villa-color-surface);
  border-radius: 4px; padding: 0.85rem 1.1rem; margin: 1rem 0; }
.villa-banner[data-tone="bad"] { border-left-color: var(--villa-brand-persimmon); }
.villa-banner[data-tone="ok"] { border-left-color: var(--villa-brand-absinthe); }
.villa-empty { text-align: center; padding: 2.5rem 1rem; }
.villa-empty img { width: 110px; height: auto; margin-bottom: 1rem; }
.villa-kv { display: grid; grid-template-columns: minmax(9rem, max-content) 1fr; gap: 0.45rem 1.25rem; margin: 0; }
.villa-kv dt { font-weight: 600; color: var(--villa-color-muted); }
.villa-kv dd { margin: 0; overflow-wrap: anywhere; }
.villa-log { font-family: var(--villa-font-mono); font-size: 0.9rem; white-space: pre-wrap; max-height: 24rem; overflow: auto;
  background: var(--villa-color-inset); padding: 0.75rem; border-radius: var(--villa-radius-control); }
.villa-steps { list-style: none; padding: 0; margin: 0; }
.villa-steps li { padding: 0.45rem 0; border-bottom: 1px solid var(--villa-color-inset); display: flex; gap: 0.75rem; flex-wrap: wrap; }
.villa-qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 6px; }
.modal-content { background: var(--villa-color-surface); color: var(--villa-color-text); }
.dropdown-menu { background: var(--villa-color-surface); border-color: var(--villa-color-border); font-size: 1.05rem; }
.dropdown-item { color: var(--villa-color-text); min-height: 2.6rem; display: flex; align-items: center; gap: 0.6rem; }
.dropdown-item:hover, .dropdown-item:focus { background: rgba(183, 199, 54, 0.35); color: var(--villa-color-text); }
/* secondary page tabs: slanted, like the segmented controls */
.nav-tabs { border-bottom: 1px solid #b4aeb3; gap: 0.3rem; margin-bottom: 1.5rem !important; }
.nav-tabs .nav-link { position: relative; isolation: isolate; border: 0; color: var(--villa-color-text); font-weight: 500; font-size: 1.2rem; padding: 0.55rem 1.4rem; background: none; }
.nav-tabs .nav-link.active { font-weight: 650; color: var(--villa-brand-cherry); background: none; }
.nav-tabs .nav-link.active::before { content: ""; position: absolute; inset: 0.1rem 0; z-index: -1; transform: skewX(-14deg);
  background: linear-gradient(180deg, #e2ecaa, #b7c736); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* system dark preference mirrors the explicit dark theme for components */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .villa-topbar { background: linear-gradient(180deg, #4a1324, #330611); border-bottom-color: #5a1b2c; box-shadow: none; }
  :root:not([data-theme="light"]) .villa-surface { border-color: rgba(228, 227, 229, 0.25); box-shadow: none; }
  :root:not([data-theme="light"]) .villa-table-wrap { background: rgba(72, 19, 35, 0.6); border-color: #5a1b2c; }
  :root:not([data-theme="light"]) .villa-table .villa-row-icon, :root:not([data-theme="light"]) .villa-link-action img { filter: brightness(0) invert(0.9); }
}

/* ================================================================ M2 cooperation surfaces */
.villa-bell { position: relative; align-self: center; display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.75rem; min-height: 2.75rem; margin-right: 0.75rem; background: transparent; border: 0; border-radius: 3px; }
.villa-bell img { width: 24px; height: 24px; }
.villa-bell:hover { background: rgba(183,199,54,.25); }
.villa-badge-count { position: absolute; top: 0.2rem; right: 0.1rem; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; border-radius: 0.65rem;
  background: var(--villa-brand-persimmon); color: #2a040d; font-size: 0.75rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
[data-theme="dark"] .villa-bell img { filter: brightness(0) invert(0.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .villa-bell img { filter: brightness(0) invert(0.9); } }
.villa-empty-inline { color: var(--villa-color-muted); font-style: italic; margin: 0.5rem 0; }
.villa-row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* picker */
.villa-picker-list { margin-top: 0.75rem; max-height: 50vh; overflow: auto; border-top: 1px solid #c9c4c9; }
.villa-picker-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.4rem; border-bottom: 1px solid #c9c4c9; }
.villa-picker-row:hover, .villa-picker-row:focus-within { background: linear-gradient(90deg, rgba(183,199,54,.35), rgba(183,199,54,.15)); box-shadow: 4px 0 0 var(--villa-brand-persimmon) inset; }
.villa-picker-row label { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; flex: 1; cursor: pointer; margin: 0; }
.villa-picker-row .villa-icon { filter: brightness(0); opacity: .8; }
.villa-picker-name { font-weight: 650; }
.villa-picker-meta { color: var(--villa-color-muted); font-size: 0.9rem; flex-basis: 100%; padding-left: 1.9rem; }
/* Open with */
.villa-ow-list, .villa-ow-openers { list-style: none; padding: 0; margin: 0; }
.villa-ow-action { padding: 0.8rem 0; border-bottom: 1px solid #c9c4c9; }
.villa-ow-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.villa-ow-head .villa-open { flex: none; }
.villa-ow-fields { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.6rem; }
.villa-ow-field { min-width: 14rem; flex: 1 1 14rem; }
.villa-ow-openers { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* notifications */
.villa-notif-list { list-style: none; padding: 0; margin: 0; }
.villa-notif-list li { display: flex; gap: 0.75rem; padding: 0.7rem 0.2rem; border-bottom: 1px solid #c9c4c9; }
.villa-notif-dot { flex: none; width: 0.6rem; height: 0.6rem; margin-top: 0.45rem; border-radius: 50%; background: transparent; }
.villa-notif-list li.is-unread .villa-notif-dot { background: var(--villa-brand-persimmon); }
.villa-notif-list li.is-unread a, .villa-notif-list li.is-unread > div > span { font-weight: 650; }
.villa-recipe-mapping { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Row actions stay quiet; orange marks the row the pointer/keyboard is on (UI spec: corrections to V03). */
.villa-table tbody tr:hover .villa-open::before, .villa-table tbody tr:focus-within .villa-open::before {
  background: linear-gradient(180deg, #ff7a45 0%, #fd4706 55%, #f24605 100%);   /* bottom ≥ 4.8:1 with cherry ink */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 2px 3px rgba(0, 0, 0, 0.35);
}

/* buttons carrying an icon keep it apart from the label */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
/* dark mode separation: deeper page, framed cards, dark fields (review item 25) */
[data-theme="dark"] { --villa-steel-1: #24040b; --villa-steel-2: #1a0207; }
[data-theme="dark"] .villa-steel-field input, [data-theme="dark"] .villa-steel-field select { background: #2a0910; color: #efedf0; border-color: #8f8a90; }
[data-theme="dark"] .villa-steel-field input::placeholder { color: #cbbfc4; }
[data-theme="dark"] .villa-steel-field .villa-field-icon { filter: brightness(0) invert(.9); }
[data-theme="dark"] .villa-page-foot { background: transparent; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --villa-steel-1: #24040b; --villa-steel-2: #1a0207; }
  :root:not([data-theme="light"]) .villa-steel-field input, :root:not([data-theme="light"]) .villa-steel-field select { background: #2a0910; color: #efedf0; border-color: #8f8a90; }
  :root:not([data-theme="light"]) .villa-steel-field input::placeholder { color: #cbbfc4; }
  :root:not([data-theme="light"]) .villa-steel-field .villa-field-icon { filter: brightness(0) invert(.9); }
  :root:not([data-theme="light"]) .villa-page-foot { background: transparent; }
}

@media (max-width: 599px) {
  .villa-toolbar-split > .villa-segmented { flex: 1 1 auto; max-width: 100%; }
  .villa-segmented label { flex: 1; justify-content: center; padding: 0 .65rem; font-size: 1rem; }
  .villa-login { padding: .75rem; }
  .villa-login-card { padding: 1.5rem 1.1rem; }
  .villa-user .dropdown-toggle { font-size: 1rem; white-space: normal; overflow-wrap: anywhere; }
}

@media (forced-colors: active) {
  .villa-card, .villa-login-card { border: 1px solid CanvasText; color: CanvasText; filter: none; }
  .villa-card::before, .villa-card::after, .villa-login-card::before, .villa-login-card::after { display: none; }
}

/* Home find field: scoped search suggestions (combobox listbox under the find line). */
.villa-search { position: relative; }
.villa-search-results { position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 30; max-height: min(60vh, 26rem);
  overflow-y: auto; padding: var(--villa-space-8) 0; background: #e4e3e5; color: #330611;
  border: 1px solid #84767c; border-top: 2px solid #330611; border-radius: 0 0 var(--villa-radius-control) var(--villa-radius-control);
  box-shadow: 0 12px 24px #210a1233, inset 0 1px 0 #ffffffb3; }
.villa-search-heading { padding: var(--villa-space-8) var(--villa-space-16) var(--villa-space-4); font-size: var(--villa-type-metadata-size);
  line-height: var(--villa-type-metadata-line); letter-spacing: .04em; text-transform: uppercase; color: #65535a; }
.villa-search-option { display: flex; justify-content: space-between; align-items: baseline; gap: var(--villa-space-16);
  min-height: 2.75rem; padding: .55rem var(--villa-space-16); cursor: pointer; border-left: 3px solid transparent; }
.villa-search-label { font-size: var(--villa-type-body-size); overflow-wrap: anywhere; }
.villa-search-meta { flex: none; font-size: var(--villa-type-metadata-size); color: #65535a; }
.villa-search-option[aria-selected="true"] { background: var(--villa-semantic-selection, #dfe8c4);
  color: var(--villa-semantic-selection-text, #330611); border-left-color: #330611; }
.villa-search-option[aria-selected="true"] .villa-search-meta { color: inherit; }
.villa-search-empty { padding: var(--villa-space-12) var(--villa-space-16); color: #65535a; }
@media (forced-colors: active) { .villa-search-option[aria-selected="true"] { outline: 2px solid Highlight; } }

/* Room previews (preview contract v1): text-only content supplied through Villa; layout mirrors concept V01. */
.villa-room-preview { min-width: 0; }
/* Keep the solid .villa-room-lines substrate below the shared wall (::before).
   Only its text children rise above the gradient, just like the room's metadata. */
.villa-room-preview .villa-room-lines > li { display: block; padding: 0; border: 0; font: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.villa-room-preview.is-log .villa-log-time { font: inherit; color: inherit; opacity: 1; font-variant-numeric: tabular-nums; }
.villa-room-wave { position: relative; z-index: 1; display: block; width: min(calc(100% - .25rem), 22rem);
  height: clamp(1.8rem, 3.1vw, 3.2rem); margin: 1.1rem 0 .2rem .25rem; }
.villa-room-wave svg { display: block; width: 100%; height: 100%; }
.villa-room-wave line { stroke: var(--villa-room-ink, #ece7e4); stroke-width: 1.2; stroke-linecap: round;
  vector-effect: non-scaling-stroke; }
.villa-room-wave line.axis { stroke-width: .6; opacity: .6; }
.villa-room-preview.is-wave .villa-room-lines { margin-top: .25rem; line-height: 1.35; }
.villa-room-preview.is-wave .villa-room-lines > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.villa-room-doc { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem;
  box-sizing: border-box; width: min(calc(100% - .75rem), 19rem); margin: 1rem 0 0 .25rem; padding: .85rem 1rem 1rem;
  background: #f3f1ed; color: #2a0b12; border-radius: 2px; box-shadow: 6px 6px 0 -1px #d9d5cf, 12px 12px 0 -2px #c7c2bb,
  0 10px 18px rgba(0, 0, 0, .35); font-size: .95rem; line-height: 1.25; transform: rotate(-1deg); }
.villa-room-doc strong { font-weight: 600; }
.villa-room-doc strong, .villa-room-doc span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.villa-room-doc span { font-family: var(--villa-font-mono); font-size: .8rem; color: #4b3e40; }
.villa-room-doc i { display: block; height: .35rem; background: #c9c4bd; border-radius: 1px; }
.villa-room-doc i + i { width: 70%; }
@media (min-width: 1100px) and (forced-colors: none) {
  /* The lower-left sill slopes up beneath the description; two tighter lines fit even at 1100px. */
  .villa-courtyard:not(.is-flat) .villa-room.slot-d > p.villa-room-lines { margin-top: min(.9rem, .8vw); line-height: 1.55; }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d > p.villa-room-lines > span {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d .is-log .villa-room-lines {
    margin-top: .5vw; font-size: clamp(.75rem, .95vw, 1rem); line-height: 1.35; }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d .villa-room-wave {
    height: clamp(1.25rem, 2vw, 2.25rem); margin-top: .5vw; }
  /* Miniature sheets reserve space for all three allowed mono lines and both bars.
     Absolute placement in a–d follows each opening's sill, clear of the title and glass. */
  .villa-courtyard:not(.is-flat) .villa-room .villa-room-doc {
    width: min(calc(100% - .75rem), 14rem); margin-top: .35vw;
    padding: clamp(.2rem, .3vw, .5rem) clamp(.5rem, .75vw, .75rem);
    gap: clamp(.125rem, .18vw, .1875rem); font-size: clamp(.75rem, .95vw, .9375rem); line-height: 1.15;
    box-shadow: 4px 4px 0 -1px #d9d5cf, 8px 8px 0 -2px #c7c2bb, 0 6px 12px #0005; transform: none; }
  .villa-courtyard:not(.is-flat) .villa-room .villa-room-doc span { font-size: clamp(.625rem, .75vw, .8125rem); }
  .villa-courtyard:not(.is-flat) .villa-room .villa-room-doc i { height: clamp(2px, .2vw, 3px); }
  .villa-courtyard:not(.is-flat) .villa-room:is(.slot-a, .slot-b, .slot-c, .slot-d) > .is-doc {
    position: absolute; left: var(--doc-left); right: var(--doc-right); bottom: var(--doc-bottom); }
  .villa-courtyard:not(.is-flat) .villa-room:is(.slot-a, .slot-b, .slot-c, .slot-d) > .is-doc .villa-room-doc {
    width: min(100%, 17rem); margin: 0; }
  .villa-room.slot-a { --doc-left: 10vw; --doc-right: 13vw; --doc-bottom: 28%; }
  .villa-room.slot-b { --doc-left: 7.5vw; --doc-right: 1.8vw; --doc-bottom: 28.5%; }
  .villa-room.slot-c { --doc-left: 2.7vw; --doc-right: 3.2vw; --doc-bottom: 42%; }
  .villa-room.slot-d { --doc-left: 7vw; --doc-right: 12vw; --doc-bottom: 34%; }
  /* d has the shallowest space below its heading: tighten the sheet rather than crop its text. */
  .villa-courtyard:not(.is-flat) .villa-room.slot-d:has(> .is-doc) { padding-top: 2.5vw; }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d .villa-room-doc {
    padding: clamp(2px, .15vw, 4px) .5rem; gap: clamp(1px, .1vw, 2px);
    font-size: clamp(.625rem, .75vw, .8125rem); line-height: 1.1; }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d .villa-room-doc span { font-size: clamp(.5625rem, .65vw, .6875rem); }
  .villa-courtyard:not(.is-flat) .villa-room.slot-d .villa-room-doc i { height: 2px; }
}
/* Featured (silver) area: previews use cherry ink on the light wall; the document card keeps its paper look. */
.villa-room-preview.is-featured { position: relative; z-index: 1; margin: 0 0 1.2rem; }
.villa-room-preview.is-featured .villa-room-lines { background: transparent; color: #2a0b12; margin-left: 0; }
.villa-room-preview.is-featured .villa-room-wave line { stroke: #2a0b12; }
.villa-room-preview.is-featured .villa-room-doc { margin-left: 0; transform: none; }

/* Contrast fixes from deploy/dev/theme_sweep.py (dark mode): silver controls always carry cherry ink; danger buttons
   switch to a light red on dark fields; code uses the text colour instead of Bootstrap's pink. */
.btn-villa, .btn-villa:hover, .btn-villa:focus, .btn-villa:active { color: var(--villa-brand-cherry); }
code { color: inherit; }
[data-theme="dark"] .btn-villa-danger { background: transparent; color: #ffb3bd; border-color: #ffb3bd; }
[data-theme="dark"] .btn-villa-danger:hover, [data-theme="dark"] .btn-villa-danger:focus { background: #8f1023; color: #fff; border-color: #8f1023; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-villa-danger { background: transparent; color: #ffb3bd; border-color: #ffb3bd; }
  :root:not([data-theme="light"]) .btn-villa-danger:hover, :root:not([data-theme="light"]) .btn-villa-danger:focus {
    background: #8f1023; color: #fff; border-color: #8f1023; }
}
