:root {
  --charcoal: #4a4a4a;
  --green: #2f4f4f;
  --green-deep: #203838;
  --gold: #baa27e;
  --mist: #f5f5f5;
  --paper: #ffffff;
  --ink: #202525;
  --line: rgba(47, 79, 79, 0.15);
  --danger: #a94a46;
  --shadow: 0 22px 60px rgba(24, 43, 43, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--mist);
  font-family: Lato, Arial, sans-serif;
}

body.dialog-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Montserrat, Arial, sans-serif; letter-spacing: 0; }
.muted { color: #687070; line-height: 1.6; }
.eyebrow { margin-bottom: 9px; color: var(--gold); font: 900 0.72rem Montserrat, Arial, sans-serif; text-transform: uppercase; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.12fr) minmax(420px, 0.88fr); background: var(--paper); }
.login-visual { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 44px clamp(32px, 5vw, 76px); color: var(--paper); overflow: hidden; background: linear-gradient(0deg, rgba(26, 46, 46, .82), rgba(26, 46, 46, .26)), url("https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?auto=format&fit=crop&w=1600&q=85") center / cover; }
.login-visual::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.16); pointer-events: none; }
.login-brand { position: relative; z-index: 1; display: grid; gap: 5px; width: 240px; padding: 13px 16px; background: rgba(255,255,255,.92); }
.login-brand span { color: var(--green); font: 900 .53rem Montserrat, Arial, sans-serif; text-align: center; }
.login-message { position: relative; z-index: 1; max-width: 680px; }
.login-message h1 { margin-bottom: 0; max-width: 13ch; font-size: clamp(2.5rem, 5vw, 5.4rem); line-height: 1; }
.login-panel { display: grid; place-items: center; padding: 48px; }
.login-box { width: min(420px, 100%); }
.login-box h2 { margin-bottom: 10px; color: var(--green); font-size: 2.4rem; }
.login-form { display: grid; gap: 16px; margin: 30px 0 20px; }
.form-status { min-height: 20px; margin: 0; color: var(--danger); font-weight: 700; text-align: center; }
.back-link { color: var(--green); font-weight: 900; }

label { display: grid; gap: 7px; color: var(--charcoal); font-size: .78rem; font-weight: 900; text-transform: uppercase; }
input, select, textarea { width: 100%; min-height: 46px; padding: 11px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; outline: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(186,162,126,.2); }

.button { min-height: 44px; padding: 11px 18px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 900; transition: transform 150ms ease, background 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: var(--paper); background: var(--green); }
.button.primary:hover { background: var(--green-deep); }
.button.secondary { color: var(--green); background: var(--paper); border-color: var(--line); }
.button.full { width: 100%; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; color: var(--paper); background: var(--green); }
.sidebar-brand { display: grid; gap: 5px; width: 185px; margin: 0 10px 42px; padding: 11px 14px; background: var(--mist); }
.sidebar-brand span { color: var(--green); font: 900 .46rem Montserrat, Arial, sans-serif; text-align: center; }
.sidebar-nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 13px; color: rgba(255,255,255,.76); background: transparent; border: 0; border-radius: 6px; cursor: pointer; font-weight: 900; text-align: left; }
.nav-item.active { color: var(--paper); background: rgba(255,255,255,.12); }
.nav-icon { display: grid; place-items: center; width: 24px; height: 24px; font-size: 1.2rem; }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.14); }
.sidebar-footer a, .sidebar-footer button { padding: 9px 12px; color: rgba(255,255,255,.76); background: transparent; border: 0; cursor: pointer; font-weight: 700; text-align: left; }

.workspace { min-width: 0; padding: 38px clamp(24px, 4vw, 58px) 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.topbar h1 { margin-bottom: 0; color: var(--green); font-size: clamp(2rem, 4vw, 3.2rem); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.stats article { min-height: 134px; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.stats span, .stats small { display: block; color: #6c7474; }
.stats strong { display: block; margin: 10px 0 6px; color: var(--green); font: 800 clamp(1.6rem, 2.4vw, 2.2rem) Montserrat, Arial, sans-serif; }
.stats small { font-size: .78rem; }

.inventory-section { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.inventory-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px 180px; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.search-field { position: relative; }
.search-field span { position: absolute; left: 14px; top: 50%; color: #788080; transform: translateY(-50%); }
.search-field input { padding-left: 38px; }
.table-shell { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 18px; color: #747c7c; background: #fafafa; border-bottom: 1px solid var(--line); font-size: .72rem; text-align: left; text-transform: uppercase; }
td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.property-cell { display: grid; grid-template-columns: 76px minmax(180px, 1fr); gap: 13px; align-items: center; }
.property-cell img { width: 76px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; background: var(--mist); }
.property-cell strong { display: block; color: var(--green); }
.property-cell small { display: block; margin-top: 5px; color: #747c7c; }
.price-cell { white-space: nowrap; font-weight: 900; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; font-size: .76rem; font-weight: 900; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.published { color: #38745f; background: #e9f5ef; }
.status.hidden { color: #7a6860; background: #f2efed; }
.actions-heading { text-align: right; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.action-button { min-height: 36px; padding: 7px 10px; color: var(--green); background: var(--paper); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-size: .78rem; font-weight: 900; }
.action-button.danger { color: var(--danger); }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state strong { color: var(--green); font: 800 1.2rem Montserrat, Arial, sans-serif; }
.empty-state p { margin: 8px 0 0; color: #747c7c; }

.property-dialog { width: min(860px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.property-dialog::backdrop { background: rgba(20,34,34,.62); backdrop-filter: blur(3px); }
.property-dialog form { max-height: calc(100vh - 28px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.dialog-header, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: var(--paper); }
.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-bottom: 0; color: var(--green); font-size: 1.5rem; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.icon-button { width: 40px; height: 40px; color: var(--green); background: var(--mist); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 1.6rem; line-height: 1; }
.form-body { overflow-y: auto; padding: 0 22px; background: var(--mist); }
.form-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section-heading { display: flex; gap: 12px; }
.form-section-heading > span { color: var(--gold); font-weight: 900; }
.form-section-heading h3 { margin-bottom: 6px; color: var(--green); font-size: .98rem; }
.form-section-heading p { color: #747c7c; font-size: .82rem; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.wide { grid-column: 1 / -1; }
.image-preview { min-height: 150px; display: grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; place-items: stretch; overflow: hidden; color: #778080; background: #edf0f0; border: 1px dashed rgba(47,79,79,.28); border-radius: 6px; }
.image-preview > span { grid-column:1/-1; align-self:center; justify-self:center; }
.image-preview img { width: 100%; height:120px; object-fit: cover; }
.toggle-row { grid-template-columns: 38px 1fr; align-items: center; min-height: 62px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; text-transform: none; }
.toggle-row input { width: 20px; min-height: 20px; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 3px; color: #747c7c; font-weight: 400; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 17px; color: var(--paper); background: var(--green); border-radius: 6px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { min-height: 280px; padding: 28px; }
  .login-message h1 { font-size: 2.5rem; }
  .login-panel { padding: 42px 24px; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px 16px; }
  .sidebar-brand { width: 130px; margin: 0 auto 0 0; padding: 8px 10px; }
  .sidebar-nav { display: none; }
  .sidebar-footer { display: flex; margin: 0; padding: 0; border: 0; }
  .sidebar-footer a { display: none; }
  .workspace { padding: 28px 16px 48px; }
  .form-section { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-end; }
  .topbar .button { padding-inline: 12px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats article { min-height: 116px; padding: 15px; }
  .inventory-toolbar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody { padding: 0 14px; }
  tbody tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  td { padding: 6px 0; border: 0; }
  .property-cell { grid-template-columns: 84px minmax(0,1fr); margin-bottom: 8px; }
  .row-actions { justify-content: flex-start; margin-top: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .dialog-footer .button { flex: 1; }
}

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