* { box-sizing: border-box; }

body.admin-body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.admin-card {
    width: min(100%, 440px);
    margin: auto;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(24, 70, 26, .1);
}
.admin-body > .admin-card { width: min(calc(100% - 40px), 440px); flex: 0 0 auto; align-self: center; }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    color: var(--green-dark);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-decoration: none;
}

.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand small { display: block; margin-top: 3px; font-size: .55rem; letter-spacing: .24em; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0 0 10px; font-size: 1.75rem; line-height: 1.15; }
.intro { margin: 0 0 23px; color: var(--muted); line-height: 1.5; }
.admin-form { display: grid; gap: 10px; }
.admin-form label { margin-top: 5px; font-size: .86rem; font-weight: 700; }
.admin-form input { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #cbd8cb; border-radius: 9px; font: inherit; }
.admin-form input:focus { border-color: var(--green); outline: 3px solid rgba(49, 158, 39, .15); }
.admin-form button, .button-link { min-height: 46px; margin-top: 10px; padding: 12px 16px; border: 0; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--green); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.admin-form button:hover, .button-link:hover { background: #25821e; }
.notice { margin: 0 0 18px; padding: 12px; border-radius: 9px; font-size: .9rem; line-height: 1.45; }
.notice.error { color: #8b2525; background: #fff0ee; }
.notice.success { color: #216b20; background: #eff9e9; }
.back-link { display: inline-block; margin-top: 20px; color: var(--green-dark); font-size: .9rem; }
.secondary-button { min-height: 42px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--green-dark); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.dashboard-card { width: min(100%, 620px); }

.dashboard-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.secondary-link { color: var(--green-dark); border: 1px solid var(--border); background: #fff; }
.secondary-link:hover { color: #fff; }

body.panel-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.panel-header {
    min-height: 82px;
    padding: 12px max(22px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.panel-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .07em; text-decoration: none; }
.panel-brand img { width: 56px; height: 56px; object-fit: contain; }
.panel-brand small { display: block; margin-top: 3px; letter-spacing: .18em; }
.panel-nav { display: flex; align-items: center; gap: 24px; }
.panel-nav a { font-weight: 700; text-decoration: none; }
.panel-nav a:hover, .panel-nav .nav-current { text-decoration: underline; text-underline-offset: 5px; }
.header-logout { margin: 0; }
.text-link, .text-button { padding: 4px 0; border: 0; color: var(--green-dark); background: transparent; font: inherit; font-size: .88rem; text-decoration: none; cursor: pointer; }
.text-link:hover, .text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.panel-main { width: min(100% - 40px, 1180px); margin: 0 auto; padding: 38px 0 64px; flex: 1 0 auto; }
.account-section { padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.account-section h2 { margin: 0 0 8px; font-size: 1.2rem; }
.account-section > p, .account-section-heading p { margin: 0 0 18px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.account-section-heading { margin-bottom: 12px; display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.account-section-heading h2 { margin: 0 0 6px; }
.account-section-heading > span { flex: 0 0 auto; color: var(--muted); font-size: .85rem; }
.account-row { padding: 15px 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: minmax(170px, 1fr) auto auto auto auto; align-items: center; gap: 12px; }
.account-identity { min-width: 0; display: grid; gap: 4px; }
.account-identity span { overflow-wrap: anywhere; color: var(--muted); font-size: .9rem; }
.account-status { padding: 5px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.account-status.is-active { color: #236c24; background: #edf8e9; }
.account-status.is-inactive { color: #6f7770; background: #eef0ed; }
.account-inline-form { margin: 0; }
.account-deactivate-button { min-height: 34px; padding: 7px 10px; border: 1px solid #e2b8b3; border-radius: 7px; color: #96372e; background: #fff; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.account-deactivate-button:hover { border-color: #c97970; color: #7f211b; background: #fff3f1; }
.account-deactivate-button:focus-visible { outline: 3px solid rgba(172, 62, 51, .18); outline-offset: 2px; }
.account-delete-button { min-height: 32px; padding: 6px 9px; border: 1px solid #96372e; border-radius: 7px; color: #fff; background: #96372e; font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; }
.account-delete-button:hover { border-color: #75251e; background: #75251e; }
.account-delete-button:focus-visible { outline: 3px solid rgba(172, 62, 51, .22); outline-offset: 2px; }
.account-password-reset summary { color: var(--green-dark); font-size: .86rem; font-weight: 700; cursor: pointer; }
.account-password-reset .admin-form { min-width: 260px; margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fbfdf9; }
.account-password-reset .admin-form label { display: grid; gap: 6px; }
.account-password-reset .admin-form input { min-height: 40px; }
.account-password-reset .admin-form button { margin-top: 2px; }
.account-self-note { color: var(--muted); font-size: .84rem; }
.account-columns { margin-top: 22px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.account-section .admin-form button { justify-self: start; }
.page-heading { margin-bottom: 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.back-to-list { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; color: var(--green-dark); font-size: .9rem; font-weight: 700; text-decoration: none; }
.back-to-list span { font-size: 1.2rem; line-height: 1; }
.back-to-list:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(1.8rem, 4vw, 2.35rem); }
.page-heading .intro { margin: 0; }

.filter-bar { margin: 22px 0 14px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: end; gap: 12px; background: #fff; }
.filter-bar label { min-width: 160px; display: grid; gap: 6px; }
.filter-bar label.search-field { flex: 1; }
.filter-bar label span, .field > span { color: #405347; font-size: .82rem; font-weight: 700; }
.filter-bar input, .filter-bar select, .field input, .field select, .field textarea, .order-field input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd8cb; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; font-size: .92rem; }
.filter-bar input:focus, .filter-bar select:focus, .field input:focus, .field select:focus, .field textarea:focus, .order-field input:focus { border-color: var(--green); outline: 3px solid rgba(49, 158, 39, .13); }
.filter-button { min-height: 42px; padding: 9px 18px; border: 0; border-radius: 8px; color: #fff; background: var(--green); font: inherit; font-weight: 700; cursor: pointer; }
.filter-button:hover { background: #25821e; }
.list-summary { padding: 11px 3px; color: var(--muted); font-size: .85rem; }
.property-list { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: #fff; }
.property-row { min-height: 132px; padding: 16px; border-top: 1px solid #edf2eb; display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.property-row:first-of-type { border-top: 0; }
.property-thumb { width: 140px; height: 98px; border-radius: 8px; object-fit: cover; background: #f1f6ef; }
.property-summary { min-width: 0; }
.property-summary h2 { margin: 8px 0 5px; font-size: 1.12rem; }
.property-summary p { margin: 3px 0; color: var(--muted); font-size: .88rem; }
.property-summary .property-price { margin-top: 8px; color: var(--ink); font-weight: 700; }
.property-price span { color: var(--muted); font-size: .82rem; font-weight: 400; }
.property-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.state-badge { padding: 4px 8px; border-radius: 99px; font-weight: 700; }
.state-publica { color: #216b20; background: #eff9e9; }
.state-privada { color: #715313; background: #fbf4df; }
.edit-link { min-width: 76px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 8px; color: var(--green-dark); font-size: .88rem; font-weight: 700; text-align: center; text-decoration: none; }
.edit-link:hover { border-color: var(--green); background: #f4faef; }
.delete-button { min-height: 38px; padding: 8px 11px; border: 1px solid #e8c8c4; border-radius: 8px; color: #8b3029; background: #fff; font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer; }
.delete-button:hover { border-color: #c97970; background: #fff5f3; }
.delete-button:focus-visible { outline: 3px solid rgba(172, 62, 51, .18); outline-offset: 2px; }
.delete-zone { margin-top: 34px; padding: 20px 22px; border: 1px solid #efd6d2; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fffafa; }
.delete-zone h2 { margin: 0 0 6px; color: #71362f; font-size: 1rem; }
.delete-zone p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.delete-zone form { margin: 0; flex: 0 0 auto; }
.delete-zone .delete-button { min-height: 42px; padding-inline: 14px; }
.empty-state { padding: 56px 24px; text-align: center; }
.empty-state h2 { margin: 0 0 8px; font-size: 1.25rem; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }

.form-main { max-width: 980px; }
.property-form { display: grid; gap: 16px; }
.form-section { padding: clamp(20px, 4vw, 30px); border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.section-heading { margin-bottom: 22px; display: flex; align-items: flex-start; gap: 13px; }
.section-heading > span { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center; color: var(--green-dark); background: #eef7e8; font-size: .74rem; font-weight: 800; }
.section-heading h2 { margin: 2px 0 5px; font-size: 1.15rem; }
.section-heading p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; display: grid; align-content: start; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field small { color: var(--muted); font-size: .77rem; }
.field textarea { min-height: 145px; resize: vertical; line-height: 1.5; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check-option { min-height: 44px; padding: 10px 12px; border: 1px solid #e2ebe0; border-radius: 8px; display: flex; align-items: center; gap: 9px; color: #33463a; font-size: .89rem; cursor: pointer; }
.check-option:has(input:checked) { border-color: #abd39e; background: #f6fbf3; }
.check-option input, .cover-option input, .delete-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.photo-help { margin: -7px 0 16px; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.photo-card { min-width: 0; overflow: hidden; border: 1px solid #e1e9df; border-radius: 10px; background: #fff; }
.sortable-photo { cursor: grab; transition: opacity .15s ease, box-shadow .15s ease, transform .15s ease; }
.sortable-photo:active { cursor: grabbing; }
.sortable-photo.is-dragging { opacity: .42; transform: scale(.98); }
.sortable-photo.is-marked-delete { opacity: .48; }
.sortable-photo.is-marked-delete > img { filter: grayscale(1); }
.photo-card > img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: #f2f6f0; }
.photo-card-controls { padding: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; }
.cover-option, .delete-option { display: flex; align-items: center; gap: 6px; color: #425449; font-size: .8rem; cursor: pointer; }
.delete-option { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid #edf2eb; }
.upload-field { min-height: 104px; padding: 20px; border: 1px dashed #9cbe91; border-radius: 10px; display: grid; align-content: center; gap: 5px; background: #fbfdf9; cursor: pointer; }
.upload-field.is-drag-over { border-color: var(--green); background: #eff8e9; box-shadow: 0 0 0 3px rgba(49, 158, 39, .12); }
.upload-title { color: var(--green-dark); font-size: .95rem; font-weight: 800; }
.upload-copy { color: var(--muted); font-size: .82rem; }
.upload-field input { margin-top: 8px; max-width: 100%; color: var(--muted); font: inherit; font-size: .82rem; }
.image-count { min-height: 20px; margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.image-count.limit-error { color: #9b2f2f; font-weight: 700; }
.new-photo-grid { margin: 12px 0 0; }
.new-photo-name { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.remove-new-photo { justify-self: start; padding: 3px 0; border: 0; color: #8b3c34; background: transparent; font: inherit; font-size: .76rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.form-actions { padding: 6px 2px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.cancel-link { color: var(--muted); font-size: .9rem; text-decoration: none; }
.cancel-link:hover { color: var(--green-dark); text-decoration: underline; }
.form-actions .button-link { margin: 0; }
.form-actions .cancel-button { border: 1px solid var(--border); color: var(--green-dark); background: #fff; }
.form-actions .cancel-button:hover { border-color: #b9d8b0; background: #f4faf1; }
.form-actions button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 760px) {
    .account-columns { grid-template-columns: 1fr; }
    .account-row { grid-template-columns: minmax(0, 1fr) auto; }
    .account-row .account-status { justify-self: end; }
    .account-row .account-inline-form, .account-row .account-password-reset, .account-row .account-self-note { grid-column: 1 / -1; }
    .account-password-reset .admin-form { min-width: 0; }
    .panel-header { padding-inline: 16px; flex-wrap: wrap; }
    .panel-nav { gap: 13px; }
    .panel-main { width: min(100% - 28px, 1180px); padding-top: 26px; }
    .filter-bar { align-items: stretch; flex-wrap: wrap; }
    .filter-bar label { flex: 1 1 180px; }
    .filter-bar label.search-field { flex-basis: 100%; }
    .property-row { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
    .property-thumb { width: 96px; height: 82px; }
    .edit-link { grid-column: 2; justify-self: start; }
    .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid-3, .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    body.admin-body { padding: 0; }
    .admin-card { padding: 25px 20px; }
    .panel-header { min-height: 70px; align-items: center; gap: 10px; }
    .panel-brand img { width: 46px; height: 46px; }
    .panel-nav { gap: 10px; }
    .panel-nav a, .text-link, .text-button { font-size: .78rem; }
    .header-logout { margin-left: auto; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .delete-zone { align-items: flex-start; flex-direction: column; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .check-grid, .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .property-summary h2 { font-size: .97rem; }
    .property-summary p { font-size: .8rem; }
    .property-meta { gap: 5px; font-size: .68rem; }
}
