:root {
  color-scheme: light;
  --orange: #f47717;
  --orange-light: #ff9d3f;
  --orange-soft: #fff2e8;
  --ink: #111a21;
  --ink-soft: #26343d;
  --background: #f2f4f6;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --border: #dfe4e7;
  --muted: #74808a;
  --success: #278a63;
  --success-soft: #e9f7f1;
  --danger: #c74a3d;
  --danger-soft: #fff0ee;
  --blue: #3678a8;
  --blue-soft: #eaf4fb;
  --sidebar-open: 260px;
  --sidebar-closed: 88px;
  --shadow-sm: 0 8px 24px rgba(17, 26, 33, .06);
  --shadow-md: 0 18px 48px rgba(17, 26, 33, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-open);
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  box-shadow: 12px 0 30px rgba(17, 26, 33, .12);
  transition: width .24s ease, transform .24s ease;
}

.brand {
  display: flex;
  min-height: 100px;
  align-items: center;
  gap: 13px;
  padding: 19px 20px 15px;
  color: #fff;
  text-decoration: none;
}
.brand-mark { width: 52px; height: 52px; flex: 0 0 52px; }
.brand-copy { display: grid; min-width: 0; line-height: 1; }
.brand-copy strong { font-size: 25px; letter-spacing: -.04em; }
.brand-copy small { margin-top: 7px; color: #ffb77d; font-size: 10px; font-weight: 850; letter-spacing: .16em; }

.sidebar-toggle {
  display: flex;
  width: calc(100% - 24px);
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 12px 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #d9dfe2;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  transition: background .2s ease, color .2s ease;
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform .24s ease; }

.sidebar-nav {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding: 4px 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.nav-item {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 13px;
  border-radius: 13px;
  padding: 0 15px;
  color: #aeb8be;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active { background: var(--orange); color: #fff; box-shadow: 0 8px 24px rgba(244, 119, 23, .26); }
.nav-item svg { width: 22px; height: 22px; flex: 0 0 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 750; }

.sidebar-account {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 15px 14px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .12);
}
.account-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--orange);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.account-copy { display: grid; min-width: 0; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 13px; }
.account-copy small { margin-top: 3px; color: #9da9b0; font-size: 10px; }
.sidebar-account form { margin: 0; }
.logout-button {
  display: flex;
  min-width: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #aeb8be;
  cursor: pointer;
}
.logout-button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.logout-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.logout-button span { display: none; }

.sidebar.is-collapsed { width: var(--sidebar-closed); }
.sidebar.is-collapsed .brand { justify-content: center; padding-inline: 14px; }
.sidebar.is-collapsed .brand-copy,
.sidebar.is-collapsed .sidebar-toggle span,
.sidebar.is-collapsed .nav-item span,
.sidebar.is-collapsed .account-copy { display: none; }
.sidebar.is-collapsed .sidebar-toggle { width: calc(100% - 20px); margin-inline: 10px; }
.sidebar.is-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.is-collapsed .nav-item { justify-content: center; padding-inline: 0; }
.sidebar.is-collapsed .sidebar-account { grid-template-columns: 1fr; justify-items: center; padding-inline: 10px; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar-open); transition: margin-left .24s ease; }
.sidebar-collapsed .app-shell { margin-left: var(--sidebar-closed); }
.page { width: min(1500px, 100%); margin: 0 auto; padding: 42px clamp(22px, 4vw, 56px) 72px; }

.mobile-menu-button {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 25;
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  padding: 9px 12px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 800;
}
.mobile-menu-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }
.sidebar-backdrop { display: none; }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}
.eyebrow { color: var(--orange); font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.page-heading h1 { margin: 8px 0 9px; font-size: clamp(32px, 5vw, 55px); line-height: .98; letter-spacing: -.052em; }
.page-heading p { max-width: 720px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.live-status { display: flex; align-items: center; gap: 9px; padding-top: 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(39, 138, 99, .11); }
.security-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #f4c59f;
  border-radius: 999px;
  background: var(--orange-soft);
  padding: 9px 13px;
  color: #9b4a0c;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.security-chip svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.stat { padding: 18px 19px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.stat b { display: block; color: var(--ink); font-size: 28px; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 12px; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, auto);
  gap: 9px;
  margin: 0 -8px 24px;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(223, 228, 231, .9);
  background: rgba(242, 244, 246, .93);
  backdrop-filter: blur(16px);
}
.field input,
.field select,
.toolbar input,
.toolbar select,
.reset-password input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  padding: 12px 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus,
.field select:focus,
.toolbar input:focus,
.toolbar select:focus,
.reset-password input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 119, 23, .12);
}
.toolbar input { min-width: 120px; }

.section-head, .section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 30px 0 13px; }
.section-head h2, .section-title h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.section-head span, .section-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.property-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.property-card { overflow: hidden; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease; }
.property-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.property-photo { position: relative; height: 184px; overflow: hidden; background: linear-gradient(135deg, #ffe1c9, #fff4e9); }
.property-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.property-photo.no-image::after { content: "⌂"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--orange); font-size: 64px; opacity: .45; }
.property-badges { position: absolute; inset: 11px 11px auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.property-badge { border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px; background: rgba(17, 26, 33, .84); padding: 6px 9px; color: #fff; backdrop-filter: blur(8px); font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.property-badge.priority-1 { background: rgba(244, 119, 23, .95); }
.property-badge.priority-2 { background: rgba(54, 120, 168, .92); }
.property-badge.priority-3 { background: rgba(39, 138, 99, .92); }
.property-body { padding: 17px; }
.property-place { color: var(--orange); font-size: 11px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.property-body h3 { min-height: 44px; margin: 7px 0 13px; font-size: 18px; line-height: 1.22; letter-spacing: -.015em; }
.property-numbers { display: flex; align-items: flex-end; gap: 12px; border-block: 1px solid var(--border); padding: 11px 0; }
.property-price { font-size: 23px; font-weight: 900; letter-spacing: -.04em; }
.property-numbers small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.property-discount { margin-left: auto; color: var(--success); text-align: right; font-weight: 900; }
.property-reason { min-height: 61px; color: var(--ink-soft); font-size: 13px; line-height: 1.46; }
.property-risks { color: #9a6547; font-size: 11px; line-height: 1.45; }
.property-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.archive-section .property-card { opacity: .74; }
.archive-section .property-photo { filter: grayscale(.55); }
.empty { grid-column: 1 / -1; border: 1px dashed #c8d0d5; border-radius: 15px; background: rgba(255, 255, 255, .5); padding: 30px; color: var(--muted); text-align: center; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.button-primary { background: var(--orange); color: #fff; box-shadow: 0 8px 20px rgba(244, 119, 23, .2); }
.button-primary:hover { background: #db6711; }
.button-secondary { border-color: var(--border); background: var(--surface); color: var(--ink); }
.button-secondary:hover { border-color: #bdc7cc; background: var(--surface-soft); }
.button-danger { border-color: #f0c2bc; background: var(--danger-soft); color: var(--danger); }
.button-danger:hover { border-color: #e29a91; }
.button-small { min-height: 36px; padding: 7px 10px; font-size: 11px; }
.button:disabled { cursor: not-allowed; opacity: .42; }
.property-open { background: var(--orange); color: #fff; }
.property-dismiss { border-color: #f1c8c2; background: var(--danger-soft); color: var(--danger); }
.property-restore { border-color: #bedbec; background: var(--blue-soft); color: var(--blue); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  max-width: calc(100vw - 30px);
  transform: translate(-50%, 120px);
  border-radius: 12px;
  background: var(--ink);
  padding: 12px 16px;
  color: #fff;
  box-shadow: 0 14px 42px rgba(17, 26, 33, .3);
  font-size: 13px;
  font-weight: 750;
  transition: transform .24s ease;
}
.toast.show { transform: translate(-50%, 0); }

.panel { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.user-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); align-items: start; gap: 20px; }
.create-user-panel { position: sticky; top: 20px; padding: 22px; }
.panel-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 21px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.025em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.panel-icon { display: grid; width: 43px; height: 43px; flex: 0 0 43px; place-items: center; border-radius: 13px; background: var(--orange-soft); color: var(--orange); }
.panel-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
.form-stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--ink-soft); font-size: 11px; font-weight: 800; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-help { margin: -4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.flash-stack { display: grid; gap: 8px; margin: 0 0 18px; }
.flash { border: 1px solid; border-radius: 12px; padding: 11px 13px; font-size: 13px; font-weight: 700; }
.flash-success { border-color: #b8dfcd; background: var(--success-soft); color: #1f6f51; }
.flash-error { border-color: #f0c2bc; background: var(--danger-soft); color: #9e3b31; }
.users-section .section-title { margin-top: 0; }
.user-list { display: grid; gap: 10px; }
.user-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 15px;
  box-shadow: var(--shadow-sm);
}
.user-card.is-disabled { background: #f7f8f9; opacity: .72; }
.user-avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: var(--ink); color: #fff; font-size: 18px; font-weight: 900; }
.user-main { min-width: 0; }
.user-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.user-title h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.user-main p { overflow: hidden; margin: 3px 0; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-main small { color: #929ba2; font-size: 10px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 900; letter-spacing: .035em; text-transform: uppercase; }
.badge-you { background: var(--orange-soft); color: #a7500e; }
.badge-admin { background: var(--ink); color: #fff; }
.badge-member { background: var(--blue-soft); color: var(--blue); }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-disabled { background: #eceff1; color: var(--muted); }
.user-actions { display: flex; align-items: center; gap: 7px; }
.reset-password { position: relative; }
.reset-password summary { list-style: none; cursor: pointer; color: var(--orange); font-size: 11px; font-weight: 800; white-space: nowrap; }
.reset-password summary::-webkit-details-marker { display: none; }
.reset-password[open] form {
  position: absolute;
  top: 29px;
  right: 0;
  z-index: 12;
  display: grid;
  width: 280px;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-md);
}
.field-compact { gap: 5px; }
.field-compact input { padding: 9px 10px; }

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 15% 10%, rgba(244, 119, 23, .14), transparent 32%),
    linear-gradient(135deg, #f6f7f8, #eef1f3);
  padding: 24px;
}
.login-card {
  display: grid;
  width: min(900px, 100%);
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(17, 26, 33, .14);
}
.login-brand-panel {
  position: relative;
  display: flex;
  min-height: 570px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: var(--ink);
  padding: 36px;
  color: #fff;
}
.login-brand-panel::after {
  content: "";
  position: absolute;
  right: -75px;
  bottom: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--orange);
  opacity: .95;
}
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.login-brand img { width: 58px; height: 58px; }
.login-brand .brand-copy strong { font-size: 27px; }
.login-promise { position: relative; z-index: 1; }
.login-promise h1 { max-width: 330px; margin: 0 0 14px; font-size: 39px; line-height: 1.02; letter-spacing: -.045em; }
.login-promise p { max-width: 330px; margin: 0; color: #b6c0c6; font-size: 14px; line-height: 1.55; }
.login-form-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.login-form-panel .eyebrow { margin-bottom: 8px; }
.login-form-panel h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; }
.login-form-panel > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-form { display: grid; gap: 14px; }
.login-error { border: 1px solid #f0c2bc; border-radius: 11px; background: var(--danger-soft); padding: 10px 12px; color: #9e3b31; font-size: 12px; font-weight: 750; }
.login-note { display: flex; align-items: center; gap: 7px; margin-top: 17px; color: var(--muted); font-size: 10px; }
.login-note svg { width: 15px; height: 15px; fill: none; stroke: var(--success); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

@media (max-width: 1100px) {
  .property-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-layout { grid-template-columns: 340px minmax(0, 1fr); }
  .user-card { grid-template-columns: 42px minmax(0, 1fr); }
  .user-actions { grid-column: 2; justify-content: flex-start; }
}

@media (max-width: 760px) {
  .sidebar { width: min(86vw, 320px); transform: translateX(-105%); }
  .sidebar.is-collapsed { width: min(86vw, 320px); }
  .sidebar.is-collapsed .brand { justify-content: flex-start; padding-inline: 20px; }
  .sidebar.is-collapsed .brand-copy,
  .sidebar.is-collapsed .sidebar-toggle span,
  .sidebar.is-collapsed .nav-item span,
  .sidebar.is-collapsed .account-copy { display: grid; }
  .sidebar.is-collapsed .sidebar-toggle { width: calc(100% - 24px); margin-inline: 12px; }
  .sidebar.is-collapsed .sidebar-toggle svg { transform: none; }
  .sidebar.is-collapsed .nav-item { justify-content: flex-start; padding-inline: 15px; }
  .sidebar.is-collapsed .sidebar-account { grid-template-columns: 38px minmax(0, 1fr) auto; justify-items: stretch; padding-inline: 14px; }
  .mobile-menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 29; border: 0; background: rgba(17, 26, 33, .48); }
  .mobile-menu-open .sidebar-backdrop { display: block; }
  .mobile-menu-button { display: inline-flex; }
  .app-shell, .sidebar-collapsed .app-shell { margin-left: 0; }
  .page { padding: 74px 15px 58px; }
  .page-heading { display: block; }
  .page-heading .live-status, .security-chip { margin-top: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: 1fr 1fr; top: 0; }
  .toolbar input { grid-column: 1 / -1; }
  .user-layout { grid-template-columns: 1fr; }
  .create-user-panel { position: static; }
  .login-card { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 230px; padding: 28px; }
  .login-promise h1 { margin-top: 38px; font-size: 31px; }
  .login-promise p { display: none; }
  .login-brand-panel::after { width: 210px; height: 210px; }
  .login-form-panel { padding: 32px 28px; }
}

@media (max-width: 560px) {
  .property-grid { grid-template-columns: 1fr; }
  .property-photo { height: 210px; }
  .property-body h3, .property-reason { min-height: 0; }
  .two-fields { grid-template-columns: 1fr; }
  .user-card { grid-template-columns: 42px minmax(0, 1fr); align-items: start; }
  .user-actions { grid-column: 1 / -1; }
  .reset-password[open] form { position: fixed; inset: auto 15px 15px; width: auto; }
}

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