@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@500;600;700;800;900&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f1e9;
  --bg-deep: #171b1e;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #fffdf7;
  --surface-strong: #f7f4ea;
  --text: #171b1e;
  --muted: #73716a;
  --line: rgba(23, 27, 30, 0.12);
  --line-strong: rgba(23, 27, 30, 0.22);
  --primary: #101820;
  --primary-strong: #050708;
  --primary-soft: #e5f7f4;
  --accent: #14b8a6;
  --accent-strong: #0f766e;
  --acid: #d7ff42;
  --ember: #ff7a3d;
  --danger: #b42318;
  --danger-soft: #fff0ed;
  --warn: #a05a00;
  --warn-soft: #fff4d5;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --shadow-soft: 0 18px 60px rgba(24, 28, 31, 0.12);
  --shadow-hard: 8px 8px 0 rgba(23, 27, 30, 0.95);
  --max: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(20, 184, 166, 0.28), transparent 28rem),
    radial-gradient(circle at 88% 5%, rgba(255, 122, 61, 0.2), transparent 24rem),
    linear-gradient(135deg, #fbf7ed 0%, #f2efe5 42%, #ecf7f3 100%);
  color: var(--text);
  font-family: Manrope, Avenir Next, Segoe UI, sans-serif;
  font-size: 15px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(23, 27, 30, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 27, 30, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(23, 27, 30, 0.06) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 10%, rgba(23, 27, 30, 0.04) 0 1px, transparent 1px);
  background-size: 18px 18px, 26px 26px;
  mix-blend-mode: multiply;
  opacity: 0.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: -0.055em;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.6rem, 6vw, 6.4rem);
  font-weight: 900;
  line-height: 0.9;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.45rem);
  font-weight: 900;
  line-height: 0.98;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 900;
}

.hidden,
.auth-view.hidden,
.app-view.hidden {
  display: none !important;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(20, 184, 166, 0.12);
}

label,
.full {
  display: grid;
  gap: 8px;
}

label,
label span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  padding: 12px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 184, 166, 0.9);
  background: white;
  box-shadow: 0 0 0 5px rgba(20, 184, 166, 0.15), 0 16px 38px rgba(23, 27, 30, 0.08);
  transform: translateY(-1px);
}

.input-shell {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.input-shell:focus-within {
  border-color: rgba(20, 184, 166, 0.9);
  box-shadow: 0 0 0 5px rgba(20, 184, 166, 0.14), 0 16px 38px rgba(23, 27, 30, 0.08);
  transform: translateY(-1px);
}

.input-shell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--accent-strong);
  background: rgba(20, 184, 166, 0.1);
}

.input-shell input {
  min-height: 52px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.button,
.icon-button,
.link-button,
.auth-tab,
.home-card,
.home-menu button {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover,
.auth-tab:hover {
  transform: translateY(-2px);
}

.button--primary {
  background: linear-gradient(135deg, var(--primary), #263238 58%, #2f4f4a);
  color: white;
  box-shadow: 0 18px 38px rgba(16, 24, 32, 0.22);
}

.button--primary:hover {
  background: linear-gradient(135deg, #050708, #132125 58%, #0f766e);
  box-shadow: 0 22px 48px rgba(16, 24, 32, 0.28);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--text);
  backdrop-filter: blur(16px);
}

.button--ghost:hover {
  border-color: var(--line-strong);
  background: white;
  box-shadow: 0 12px 28px rgba(23, 27, 30, 0.08);
}

.button--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button i {
  font-size: 0.98em;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(16px);
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  box-shadow: 0 12px 28px rgba(20, 184, 166, 0.16);
}

.file-button input {
  display: none;
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: inline-flex !important;
}

body.modal-open {
  overflow: hidden;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 46px);
}

.auth-shell {
  width: min(1160px, 100%);
}

.auth-frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(360px, 1.08fr);
  min-height: min(740px, calc(100vh - 48px));
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(24px);
}

.auth-frame::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(23, 27, 30, 0.07);
  border-radius: 24px;
  pointer-events: none;
}

.auth-brand {
  position: relative;
  display: flex;
  min-height: 620px;
  color: white;
  background:
    linear-gradient(135deg, rgba(10, 14, 16, 0.92), rgba(16, 24, 32, 0.74)),
    url("https://images.unsplash.com/photo-1558494949-ef010cbdcc31?auto=format&fit=crop&w=1400&q=80");
  background-position: center;
  background-size: cover;
}

.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.auth-brand::before {
  inset: 0;
  background:
    radial-gradient(circle at 22% 22%, rgba(215, 255, 66, 0.32), transparent 12rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: auto, 38px 38px, 38px 38px;
  mix-blend-mode: screen;
}

.auth-brand::after {
  right: -84px;
  bottom: -84px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(215, 255, 66, 0.54);
  border-radius: 50%;
  box-shadow: inset 0 0 0 34px rgba(215, 255, 66, 0.08), 0 0 90px rgba(20, 184, 166, 0.25);
}

.auth-brand__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  padding: clamp(30px, 5vw, 62px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 18px 38px rgba(0, 0, 0, 0.22);
  color: var(--acid);
  font-size: 1.8rem;
  backdrop-filter: blur(18px);
}

.auth-brand .eyebrow,
.auth-brand h1,
.auth-brand .auth-copy {
  color: white;
}

.auth-brand .eyebrow::before {
  background: var(--acid);
  box-shadow: 0 0 0 6px rgba(215, 255, 66, 0.16);
}

.auth-brand h1 {
  max-width: 470px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 400;
  letter-spacing: -0.07em;
}

.auth-copy {
  max-width: 440px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.05rem;
  line-height: 1.7;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.auth-points span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  padding: 0 14px;
  font-weight: 800;
  backdrop-filter: blur(12px);
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 64px);
}

.auth-card {
  width: min(470px, 100%);
}

.auth-heading {
  margin-bottom: 22px;
}

.auth-heading h2 {
  max-width: 390px;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 22px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.auth-tab.active {
  background: var(--text);
  color: white;
  box-shadow: 0 12px 28px rgba(23, 27, 30, 0.18);
}

.auth-form,
.compact-form {
  display: grid;
  gap: 14px;
}

.auth-form .button--primary,
.compact-form .button--primary,
#deviceForm .button--primary {
  width: 100%;
  margin-top: 4px;
}

.home-view,
.dashboard-view {
  min-height: 100vh;
  width: min(var(--max), calc(100% - clamp(28px, 6vw, 76px)));
  margin: 0 auto;
  padding: 32px 0 52px;
}

.home-hero,
.dashboard-topbar,
.entity-toolbar,
.section-heading,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-hero {
  position: relative;
  margin-bottom: 28px;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 82% 24%, rgba(215, 255, 66, 0.48), transparent 15rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(22px);
}

.home-hero::after {
  content: "";
  position: absolute;
  right: clamp(14px, 4vw, 46px);
  bottom: -48px;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(23, 27, 30, 0.14);
  border-radius: 50%;
  box-shadow: inset 0 0 0 28px rgba(20, 184, 166, 0.12);
}

.home-hero > *,
.dashboard-topbar > * {
  position: relative;
  z-index: 1;
}

.home-hero__actions,
.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.home-card,
.home-empty,
.home-create,
.entity-panel,
.house-panel,
.modal-card {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.home-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 128px;
  padding: 20px;
  overflow: visible;
  text-align: left;
}

.home-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), transparent 42%, rgba(255, 122, 61, 0.1));
  opacity: 0;
  transition: opacity 160ms ease;
}

.home-card:hover {
  border-color: rgba(23, 27, 30, 0.22);
  box-shadow: var(--shadow-hard);
  transform: translate(-4px, -4px);
}

.home-card.is-menu-open {
  z-index: 20;
}

.home-card:hover::before {
  opacity: 1;
}

.home-card > * {
  position: relative;
  z-index: 1;
}

.home-card strong,
.home-card small {
  display: block;
}

.home-card strong {
  margin-bottom: 7px;
  font-size: 1.12rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.home-card small {
  width: fit-content;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-strong);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: capitalize;
}

.home-card__icon,
.home-empty i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #101820, #0f766e);
  color: var(--acid);
  font-size: 1.35rem;
  box-shadow: 0 18px 34px rgba(16, 24, 32, 0.18);
}

.home-card__actions {
  position: relative;
  display: flex;
  gap: 8px;
}

.home-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 12;
  display: grid;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 60px rgba(23, 27, 30, 0.18);
  backdrop-filter: blur(18px);
}

.home-menu button {
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.home-menu button:hover {
  background: var(--primary-soft);
  color: var(--accent-strong);
}

.home-empty {
  grid-column: 1 / -1;
  padding: 42px;
}

.home-empty i {
  margin-bottom: 18px;
}

.home-create {
  max-width: 720px;
  margin-bottom: 24px;
  padding: 20px;
}

.home-create__form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.dashboard-topbar {
  position: sticky;
  top: 14px;
  z-index: 8;
  margin-bottom: 22px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  background: rgba(250, 247, 237, 0.78);
  box-shadow: 0 16px 48px rgba(23, 27, 30, 0.08);
  backdrop-filter: blur(22px);
}

.house-title {
  min-width: 0;
  flex: 1;
}

.house-title h1 {
  overflow: hidden;
  font-size: clamp(1.65rem, 4vw, 3.6rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.house-summary {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.entity-panel,
.house-panel {
  padding: clamp(18px, 3vw, 28px);
}

.entity-panel {
  position: relative;
  overflow: hidden;
}

.entity-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--acid), var(--ember));
}

.house-panel {
  position: sticky;
  top: 100px;
  display: grid;
  gap: 18px;
}

.info-card {
  display: grid;
  gap: 6px;
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, #101820, #19313a);
  color: white;
  padding: 18px;
  overflow: hidden;
}

.info-card strong {
  font-size: 1.1rem;
}

.info-card span {
  color: rgba(255, 255, 255, 0.68);
  text-transform: capitalize;
}

.readonly-list {
  display: grid;
  gap: 10px;
}

.readonly-list--inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.readonly-list div,
.stat,
.member-row,
.empty-inline {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.readonly-list div {
  display: grid;
  gap: 5px;
  min-height: 98px;
  padding: 16px;
}

.readonly-list span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.readonly-list strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.entity-toolbar {
  margin-bottom: 18px;
}

.compact-stats {
  width: min(390px, 100%);
  margin-bottom: 0;
}

.compact-stats .stat {
  padding: 14px;
}

.compact-stats .stat__value {
  font-size: 1.55rem;
}

.section-heading {
  margin-bottom: 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px;
}

.stat__value,
.stat__label {
  display: block;
}

.stat__value {
  margin-bottom: 5px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 0.9;
}

.stat__label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 18px;
}

.counter {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 900;
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid rgba(23, 27, 30, 0.09);
  text-align: left;
  vertical-align: middle;
}

th {
  background: rgba(16, 24, 32, 0.04);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover {
  background: rgba(20, 184, 166, 0.08);
}

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

.badge,
.ip-pill,
.device-type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 0.76rem;
  font-weight: 900;
}

.ip-pill {
  border: 1px solid rgba(23, 27, 30, 0.14);
  background: #101820;
  color: white;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.device-type-chip {
  border: 1px solid rgba(20, 184, 166, 0.2);
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-strong);
}

.badge--statico {
  background: var(--primary-soft);
  color: var(--accent-strong);
}

.badge--dinamico {
  background: #eef8df;
  color: #577300;
}

.badge--warning {
  margin-left: 8px;
  background: var(--warn-soft);
  color: var(--warn);
}

.row-note {
  display: block;
  max-width: 360px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-button {
  border: 0;
  border-radius: 999px;
  background: rgba(16, 24, 32, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  padding: 8px 11px;
}

.link-button:hover {
  background: #101820;
  color: white;
  transform: translateY(-1px);
}

.link-button--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.link-button--danger:hover {
  background: var(--danger);
  color: white;
}

.empty {
  display: none;
  padding: 54px 20px;
  text-align: center;
}

.empty-inline {
  padding: 20px;
  color: var(--muted);
}

.empty p {
  margin-bottom: 0;
  color: var(--muted);
}

.field-grid,
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.full {
  margin-top: 14px;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 10%, rgba(215, 255, 66, 0.15), transparent 24rem),
    rgba(9, 12, 14, 0.66);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(740px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255, 253, 247, 0.93);
  animation: modal-in 180ms ease both;
}

.modal-card--small {
  width: min(540px, 100%);
}

.notes-content {
  min-height: 180px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  padding: 18px;
  font: inherit;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.form-error {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 900;
}

.member-list {
  display: grid;
  gap: 8px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.member-row span,
.member-row small {
  display: block;
}

.member-row small {
  margin-top: 3px;
  color: var(--muted);
}

.table-wrap.is-empty table {
  display: none;
}

.table-wrap.is-empty .empty {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 980px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .auth-frame {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 360px;
  }

  .home-hero,
  .dashboard-topbar,
  .entity-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .dashboard-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .dashboard-actions .button {
    flex: 1;
  }

  .house-summary {
    grid-template-columns: 1fr;
  }

  .house-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 19;
    width: min(380px, calc(100vw - 44px));
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
  }

  .house-panel.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .auth-view {
    align-items: stretch;
    padding: 0;
  }

  .auth-frame {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-frame::before {
    display: none;
  }

  .auth-brand {
    min-height: 280px;
  }

  .auth-brand__content {
    padding: 24px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    margin-bottom: 44px;
    border-radius: 16px;
    font-size: 1.25rem;
  }

  .auth-brand h1 {
    font-size: 3.1rem;
  }

  .auth-copy {
    margin-top: 12px;
    font-size: 0.95rem;
  }

  .auth-points {
    display: none;
  }

  .auth-panel {
    align-items: flex-start;
    padding: 24px 18px 34px;
  }

  .auth-tabs {
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
  }

  .auth-tab {
    min-height: 38px;
    padding: 0 6px;
    font-size: 0.86rem;
  }

  .home-view,
  .dashboard-view {
    width: calc(100% - 28px);
    padding: 18px 0 32px;
  }

  .home-hero {
    gap: 14px;
    border-radius: 24px;
  }

  .home-hero__actions {
    width: 100%;
  }

  .home-hero__actions .button,
  .home-create__form .button {
    width: 100%;
  }

  .home-create__form,
  .field-grid,
  .two-cols,
  .stats,
  .filters,
  .readonly-list--inline {
    grid-template-columns: 1fr;
  }

  .dashboard-topbar {
    top: 8px;
    padding: 10px;
    border-radius: 20px;
  }

  .house-title h1 {
    font-size: 1.55rem;
  }

  .house-title .eyebrow,
  .house-title .muted {
    display: none;
  }

  .entity-panel,
  .house-panel,
  .modal-card {
    padding: 16px;
  }

  .compact-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-stats .stat {
    padding: 10px;
  }

  .compact-stats .stat__label {
    font-size: 0.68rem;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr,
  td {
    display: block;
  }

  tbody tr {
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  td {
    border-bottom: 0;
    padding: 8px 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
}
