:root {
  --brand-900: #011526;
  --brand-800: #012e40;
  --brand-700: #025959;
  --brand-600: #02735e;
  --brand-500: #038c65;

  --surface-page: #f7fbfc;
  --surface-panel: #ffffff;
  --surface-subtle: #f8fcfc;
  --surface-strong: var(--brand-900);
  --text-primary: var(--brand-900);
  --text-secondary: #47626f;
  --text-inverse: #ffffff;
  --border-subtle: #c9d8de;
  --focus-ring: rgba(3, 140, 101, 0.24);
  --shadow: 0 10px 30px rgba(1, 21, 38, 0.12);

  --color-primary: var(--brand-600);
  --color-primary-hover: var(--brand-500);
  --color-secondary: var(--brand-700);
  --color-secondary-hover: var(--brand-600);

  --glass-bg: rgba(255, 255, 255, 0.64);
  --glass-bg-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: 0 14px 38px rgba(1, 21, 38, 0.12);

  --state-danger-text: var(--brand-800);
  --state-danger-bg: rgba(1, 46, 64, 0.12);
  --state-danger-border: rgba(1, 46, 64, 0.35);
  --state-success-text: var(--brand-600);
  --state-success-bg: rgba(3, 140, 101, 0.14);
  --state-success-border: rgba(3, 140, 101, 0.4);
  --state-info-text: var(--brand-700);
  --state-info-bg: rgba(2, 89, 89, 0.12);
  --state-info-border: rgba(2, 89, 89, 0.35);

  --bg: var(--surface-page);
  --surface: var(--surface-panel);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-subtle);
  --accent: var(--brand-600);
  --accent-soft: rgba(3, 140, 101, 0.16);
  --danger: var(--brand-800);
}

* {
  box-sizing: border-box;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(3, 140, 101, 0.1), transparent 40%),
    radial-gradient(circle at 95% 90%, rgba(2, 89, 89, 0.1), transparent 35%),
    var(--bg);
}

.auth-page {
  min-height: 100vh;
}

.auth-page-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-shell {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.login-head h1 {
  margin: 0;
}

.login-head p {
  color: var(--muted);
  margin-bottom: 1rem;
}

.login-form {
  display: grid;
  gap: 0.6rem;
}

.login-form label {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

.login-form input[type="text"]:focus,
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--accent);
}

input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid #7c97a3;
  border-radius: 5px;
  background: #fff;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform 0.12s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--accent);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

input[type="checkbox"]:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.login-remember {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
}

.login-error {
  margin-bottom: 0.8rem;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--state-danger-border);
  background: var(--state-danger-bg);
  color: var(--state-danger-text);
  font-size: 0.9rem;
}

.login-success,
.login-info {
  margin-bottom: 0.8rem;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.login-success {
  border: 1px solid var(--state-success-border);
  background: var(--state-success-bg);
  color: var(--state-success-text);
}

.login-info {
  border: 1px solid var(--state-info-border);
  background: var(--state-info-bg);
  color: var(--state-info-text);
}

.login-actions {
  display: flex;
  justify-content: flex-end;
}

.login-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

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

.login-help {
  margin-top: 0.85rem;
}

.login-submit {
  margin-top: 0.4rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(165deg, var(--glass-bg-strong) 0%, var(--glass-bg) 100%);
  color: var(--text-primary);
  padding: 1rem;
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 12px;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-title {
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

.sidebar-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.menu-link,
.menu-group summary {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.68rem;
  padding: 0.62rem 0.72rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  font-weight: 500;
}

.menu-link:hover,
.menu-group summary:hover,
.menu-link.active {
  background: rgba(3, 140, 101, 0.1);
  border-color: rgba(3, 140, 101, 0.18);
}

.menu-link.active {
  background: rgba(3, 140, 101, 0.16);
  border-color: rgba(3, 140, 101, 0.24);
  transform: translateX(1px);
}

.menu-group {
  border-radius: 12px;
}

.menu-group summary {
  list-style: none;
}

.menu-group summary::-webkit-details-marker {
  display: none;
}

.menu-group > ul {
  margin-left: 0.5rem;
  padding-left: 0.4rem;
  border-left: 1px solid rgba(3, 140, 101, 0.22);
  display: grid;
  gap: 0.2rem;
}

.menu-group[open] > summary {
  background: rgba(2, 89, 89, 0.08);
  border-color: rgba(2, 89, 89, 0.16);
}

.menu-icon-symbol {
  font-size: 18px;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  color: var(--color-secondary);
}

.menu-label {
  line-height: 1.2;
}

.menu-caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
  transition: transform 0.2s ease;
}

.menu-group[open] .menu-caret {
  transform: rotate(180deg);
}

.menu-empty {
  color: var(--muted);
  padding: 0.5rem;
}

.sidebar-house-switcher {
  margin-top: auto;
  border: 1px solid rgba(3, 140, 101, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  padding: 0.65rem;
  position: relative;
}

.sidebar-house-head {
  font-size: 0.75rem;
  color: var(--color-secondary);
  margin-bottom: 0.3rem;
}

.sidebar-house-toggle {
  width: 100%;
  border: 1px solid rgba(3, 140, 101, 0.24);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font: inherit;
}

.sidebar-house-toggle .house-name {
  font-weight: 600;
}

.sidebar-house-meta {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.sidebar-house-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 0.5rem);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 0.45rem;
  z-index: 35;
  max-height: 260px;
  overflow-y: auto;
}

.sidebar-house-dropdown.open {
  display: grid;
  gap: 0.35rem;
}

.sidebar-house-option {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(3, 140, 101, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  display: grid;
}

.sidebar-house-option strong {
  font-size: 0.9rem;
}

.sidebar-house-option small {
  color: var(--muted);
  font-size: 0.74rem;
}

.sidebar-house-option.active,
.sidebar-house-option:hover {
  border-color: rgba(3, 140, 101, 0.4);
  background: rgba(3, 140, 101, 0.12);
}

.sidebar-house-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.35rem;
}

.app-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.btn-icon {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
}

.search-zone {
  flex: 1;
}

.search-zone input {
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.62rem 1rem;
  background: var(--surface-subtle);
}

.topbar-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notification-wrap {
  position: relative;
}

.user-shell {
  position: relative;
}

.user-trigger {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-trigger:hover,
.user-trigger[aria-expanded="true"] {
  border-color: rgba(2, 115, 94, 0.5);
  box-shadow: 0 8px 22px rgba(2, 115, 94, 0.16);
}

.user-shell.morph-open .user-trigger {
  border-color: rgba(2, 115, 94, 0.5);
  box-shadow: 0 10px 24px rgba(2, 115, 94, 0.2);
  transform: translateY(-1px);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text-inverse);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
}

.caret {
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.user-trigger[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  min-width: 220px;
  background: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.2s ease;
  padding: 0.35rem;
  pointer-events: none;
  z-index: 25;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notification-trigger {
  position: relative;
}

.bell-icon {
  font-size: 1rem;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--brand-700);
  color: var(--text-inverse);
  font-size: 0.72rem;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(420px, calc(100vw - 1.5rem));
  background: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.22s ease, transform 0.24s ease, visibility 0.22s ease;
  overflow: hidden;
  z-index: 20;
  pointer-events: none;
}

.notification-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notification-dropdown::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 14px;
  width: 14px;
  height: 14px;
  background: var(--surface-panel);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-subtle) 100%);
}

.notification-list {
  max-height: 360px;
  overflow-y: auto;
  background: var(--surface-panel);
}

.notification-item {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.7rem;
  transition: background 0.18s ease, transform 0.18s ease;
}

.notification-item.unread {
  background: rgba(3, 140, 101, 0.08);
}

.notification-item.clickable {
  cursor: pointer;
}

.notification-item.clickable:hover {
  background: rgba(2, 89, 89, 0.12);
  transform: translateX(2px);
}

.notification-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.notification-item-head strong {
  min-width: 0;
}

.notification-item p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notification-empty {
  margin: 0;
  padding: 0.9rem;
  color: var(--muted);
}

.notification-foot {
  border-top: 1px solid var(--line);
  padding: 0.6rem 0.7rem;
}

.notification-foot a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.user-dropdown a,
.user-dropdown .user-dropdown-action {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  cursor: pointer;
}

.user-dropdown a:hover,
.user-dropdown .user-dropdown-action:hover {
  background: rgba(2, 89, 89, 0.1);
}

.profile-morph-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, calc(100vw - 1rem));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff 0%, var(--surface-subtle) 100%);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.24s ease, transform 0.26s ease, visibility 0.24s ease;
  z-index: 26;
}

.profile-morph-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.profile-morph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.profile-morph-id {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.profile-morph-id strong {
  display: block;
}

.profile-morph-id p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.profile-morph-body {
  padding: 0.7rem 0.9rem;
  display: grid;
  gap: 0.55rem;
}

.profile-morph-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--surface-panel);
}

.profile-morph-row span {
  color: var(--muted);
}

.profile-morph-actions {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0.9rem 0.9rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.content-area {
  padding: 1.25rem;
}

.page-head h1 {
  margin: 0;
}

.page-head p {
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.kpi-title {
  color: var(--muted);
  margin: 0;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.4rem 0 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.panel-head h2 {
  margin: 0;
}

.activity-list {
  margin: 0;
  padding-left: 1.1rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.table-empty {
  text-align: center;
  color: var(--muted);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
}

.badge.ok {
  background: var(--accent-soft);
  color: var(--brand-700);
}

.badge.ko {
  background: var(--state-danger-bg);
  color: var(--danger);
}

.pagination {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.pagination a {
  text-decoration: none;
  color: var(--accent);
}

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

.btn-primary,
.btn-secondary {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.52rem 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--text-inverse);
  box-shadow: 0 8px 22px rgba(2, 115, 94, 0.25);
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text);
  border-color: var(--line);
}

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

.btn-secondary:hover {
  border-color: rgba(2, 89, 89, 0.28);
  color: var(--color-secondary);
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-small {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.global-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.global-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.global-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 21, 38, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.global-modal.open .global-modal-backdrop {
  opacity: 1;
}

.global-modal-dialog {
  position: relative;
  width: min(560px, calc(100vw - 2rem));
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.global-modal.open .global-modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.global-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem 1rem;
}

.global-modal-head h3 {
  margin: 0;
}

.modal-close-btn {
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.global-modal-form {
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.global-modal-form h4 {
  margin: 0.2rem 0 0;
}

.modal-field {
  display: grid;
  gap: 0.34rem;
}

.modal-field label {
  font-size: 0.88rem;
  color: var(--muted);
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem 0.7rem;
  font: inherit;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--accent);
}

.modal-field input.readonly-field {
  background: var(--surface-subtle);
  color: var(--muted);
  cursor: not-allowed;
}

.global-modal-form select[multiple] {
  min-height: 180px;
}

.house-admin-modal .global-modal-backdrop {
  background: rgba(1, 21, 38, 0.32);
}

.house-admin-dialog {
  width: min(1120px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.house-admin-error {
  margin-bottom: 0.4rem;
}

.house-admin-content {
  overflow-y: auto;
  padding: 0 1rem 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  align-content: start;
}

.house-admin-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
  padding: 0.95rem;
}

.house-admin-form {
  padding: 0;
}

.house-admin-actions {
  border-top: none;
  padding: 0.2rem 0 0;
  justify-content: flex-start;
}

.house-admin-danger {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  margin-top: 0.2rem;
  padding: 0.9rem 0 0;
}

.house-admin-danger .btn-secondary {
  border-color: var(--state-danger-border);
  color: var(--state-danger-text);
  background: var(--state-danger-bg);
}

.modal-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-check label {
  color: var(--text);
}

.global-modal-error {
  display: none;
  margin: 0.8rem 1rem 0;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--state-danger-border);
  background: var(--state-danger-bg);
  color: var(--state-danger-text);
  font-size: 0.9rem;
}

.global-modal-error.show {
  display: block;
}

.global-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  border-top: 1px solid var(--line);
  padding: 0.9rem 1rem;
}

.profile-panel {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
}

.profile-avatar-placeholder {
  border: 1px dashed var(--line);
  border-radius: 14px;
  min-height: 220px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.45rem;
  background: var(--surface-subtle);
}

.profile-avatar-placeholder span {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--text-inverse);
  margin: 0 auto;
  font-weight: 700;
  font-size: 1.35rem;
}

.profile-avatar-placeholder p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-details {
  display: grid;
  gap: 0.7rem;
}

.profile-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--surface-panel);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.profile-row strong {
  color: var(--muted);
}

.preferences-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.catalog-switches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.catalog-switches label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100vw - 2rem));
  display: grid;
  gap: 0.5rem;
  z-index: 80;
}

.toast-item {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--color-secondary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  box-shadow: var(--shadow);
}

.toast-item.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.toast-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.toast-item.priority-success {
  border-left-color: var(--color-primary);
}

.toast-item.priority-warning {
  border-left-color: var(--color-secondary);
}

.toast-item.priority-critical {
  border-left-color: var(--brand-800);
}

.pets-details {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.pets-detail-actions {
  display: flex;
  gap: 0.5rem;
}

.pets-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.pets-subpanel {
  margin: 0;
}

.pets-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.pets-kv p {
  margin: 0.35rem 0;
  font-size: 0.92rem;
}

.pets-list {
  display: grid;
  gap: 0.55rem;
}

.pets-list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  background: var(--surface-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.pets-list-actions {
  display: flex;
  gap: 0.35rem;
}

#pets-table tr.is-selected {
  background: rgba(3, 140, 101, 0.08);
}

.footer {
  border-top: 1px solid var(--line);
  padding: 0.8rem 1.25rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
}

@media (min-width: 821px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 0 1fr;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 20;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .topbar {
    padding: 0.7rem;
  }

  .notification-dropdown {
    right: 0;
    width: min(420px, calc(100vw - 1rem));
  }

  .profile-morph-panel {
    right: 0;
    width: min(360px, calc(100vw - 1rem));
  }

  .user-label {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .global-modal-dialog {
    width: calc(100vw - 1rem);
  }

  .global-modal-actions {
    justify-content: stretch;
  }

  .global-modal-actions .btn-primary,
  .global-modal-actions .btn-secondary {
    flex: 1;
  }

  .profile-panel {
    grid-template-columns: 1fr;
  }

  .house-admin-dialog {
    width: calc(100vw - 0.8rem);
    max-height: calc(100vh - 0.8rem);
  }

  .house-admin-content {
    grid-template-columns: 1fr;
    padding: 0 0.7rem 0.7rem;
  }

  .pets-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    z-index: 30;
  }

  .notification-dropdown {
    position: fixed;
    top: 3.85rem;
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    max-height: calc(100vh - 4.4rem);
    border-radius: 14px;
  }

  .notification-dropdown::before {
    display: none;
  }

  .notification-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .notification-list {
    max-height: calc(100vh - 11.4rem);
  }

  #notification-catalog-table thead {
    display: none;
  }

  #notification-catalog-table,
  #notification-catalog-table tbody,
  #notification-catalog-table tr,
  #notification-catalog-table td {
    display: block;
    width: 100%;
  }

  #notification-catalog-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.15rem 0;
    margin-bottom: 0.6rem;
    background: var(--surface-panel);
  }

  #notification-catalog-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.7rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
  }

  #notification-catalog-table td:last-child {
    border-bottom: 0;
  }

  #notification-catalog-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.82rem;
    flex: 0 0 auto;
  }

  #notification-catalog-table td.table-empty {
    display: block;
    text-align: center;
  }

  #notification-catalog-table td.table-empty::before {
    content: none;
  }

  .catalog-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
  }
}

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