/* Kerala.RealEstate — single stylesheet. Mobile-first. */

:root {
    --kre-primary: #0B6B3A;
    --kre-primary-dark: #084F2B;
    --kre-primary-soft: #E3F1E9;
    --kre-bg: #F5F1E8;
    --kre-surface: #FFFFFF;
    --kre-text: #1A1A1A;
    --kre-muted: #5F6B63;
    --kre-accent: #E8A33D;
    --kre-accent-dark: #C9871F;
    --kre-border: #E2DCCF;
    --kre-danger: #B42318;
    --kre-danger-soft: #FDECEA;
    --kre-radius: 12px;
    --kre-radius-sm: 8px;
    --kre-shadow: 0 1px 2px rgba(26, 26, 26, 0.06), 0 4px 16px rgba(26, 26, 26, 0.05);
    --kre-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --kre-tap: 48px;
    --kre-gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--kre-font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--kre-text);
    background: var(--kre-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--kre-primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.kre-h3 { font-size: 1.1rem; margin-top: 1.5rem; }
p { margin: 0 0 1em; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--kre-accent); outline-offset: 2px; }

.kre-sr-only, .kre-skip:not(:focus) {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.kre-skip:focus { position: fixed; top: 8px; left: 8px; z-index: 1000; background: var(--kre-surface); padding: 10px 14px; border-radius: var(--kre-radius-sm); }
.kre-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Layout */
.kre-container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--kre-gutter); }
.kre-narrow { max-width: 760px; }
.kre-narrow--xs { max-width: 480px; }
.kre-narrow--left { margin-left: 0; }
.kre-section { padding: 28px 0; }
.kre-section--alt { background: var(--kre-surface); border-top: 1px solid var(--kre-border); }
.kre-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.kre-section__head h1, .kre-section__head h2 { margin: 0; }
.kre-mt { margin-top: 28px; }
.kre-main { min-height: 60vh; }

/* Header */
.kre-header { background: var(--kre-surface); border-bottom: 1px solid var(--kre-border); position: sticky; top: 0; z-index: 50; }
.kre-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.kre-wordmark { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--kre-text); white-space: nowrap; }
.kre-wordmark:hover { text-decoration: none; }
.kre-wordmark__a { color: var(--kre-primary); }
.kre-wordmark__dot { color: var(--kre-accent); }
.kre-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.kre-nav__link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 8px; border-radius: var(--kre-radius-sm); color: var(--kre-text); font-weight: 500; font-size: 0.9rem; }
.kre-nav__link:hover { background: var(--kre-bg); text-decoration: none; }
@media (max-width: 419px) {
    .kre-wordmark { font-size: 1rem; }
    .kre-nav__link--browse { display: none; }
}

/* Footer */
.kre-footer { border-top: 1px solid var(--kre-border); padding: 24px 0; margin-top: 32px; color: var(--kre-muted); font-size: 0.9rem; }
.kre-footer__inner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.kre-footer a { color: var(--kre-muted); padding: 6px 0; }

/* Buttons */
.kre-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: var(--kre-tap); padding: 0 20px; border-radius: var(--kre-radius-sm);
    font-weight: 600; font-size: 1rem; line-height: 1; cursor: pointer; border: 2px solid transparent;
    text-decoration: none !important; transition: background 0.15s, border-color 0.15s, transform 0.05s;
    white-space: nowrap;
}
.kre-btn:active { transform: translateY(1px); }
.kre-btn--primary { background: var(--kre-primary); color: #fff; border-color: var(--kre-primary); }
.kre-btn--primary:hover { background: var(--kre-primary-dark); border-color: var(--kre-primary-dark); }
.kre-btn--accent { background: var(--kre-accent); color: var(--kre-text); border-color: var(--kre-accent); }
.kre-btn--accent:hover { background: var(--kre-accent-dark); border-color: var(--kre-accent-dark); }
.kre-btn--ghost { background: transparent; color: var(--kre-primary); border-color: var(--kre-border); }
.kre-btn--ghost:hover { background: var(--kre-primary-soft); }
.kre-btn--danger { background: transparent; color: var(--kre-danger); border-color: var(--kre-border); }
.kre-btn--danger:hover { background: var(--kre-danger-soft); }
.kre-btn--sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.kre-btn--lg { min-height: 54px; padding: 0 26px; font-size: 1.05rem; }
.kre-btn[disabled], .kre-btn.is-busy { opacity: 0.6; pointer-events: none; }
.kre-link { background: none; border: 0; padding: 8px 0; color: var(--kre-primary); font-weight: 600; cursor: pointer; }
.kre-link--muted { color: var(--kre-muted); font-weight: 500; font-size: 0.9rem; }

/* Hero */
.kre-hero { background: var(--kre-surface); border-bottom: 1px solid var(--kre-border); padding: 36px 0 32px; }
.kre-hero__inner { display: flex; flex-direction: column; gap: 20px; }
.kre-hero__title { font-size: 1.6rem; max-width: 720px; margin: 0; }
.kre-hero__cta { align-self: flex-start; }
.kre-search { display: grid; grid-template-columns: 1fr; gap: 10px; background: var(--kre-bg); padding: 12px; border-radius: var(--kre-radius); }
.kre-search__field input, .kre-search__field select { width: 100%; }
.kre-search__tabs { grid-column: 1 / -1; }

/* Segmented choice (Sell / Rent out / Lease out, search tabs) */
.kre-segment { margin: 0; padding: 0; border: 0; min-width: 0; }
.kre-segment > legend { margin-bottom: 6px; padding: 0; }
.kre-segment__options { display: flex; gap: 4px; padding: 4px; background: var(--kre-bg); border: 1px solid var(--kre-border); border-radius: var(--kre-radius-sm); }
.kre-search .kre-segment__options { background: var(--kre-surface); }
.kre-segment__opt { position: relative; flex: 1 1 0; cursor: pointer; }
.kre-segment__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kre-segment__opt span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 6px; font-weight: 600; color: var(--kre-muted); text-align: center; transition: background 0.15s, color 0.15s; }
.kre-segment__opt input:checked + span { background: var(--kre-primary); color: #fff; }
.kre-segment__opt input:focus-visible + span { outline: 3px solid var(--kre-accent); outline-offset: 1px; }

/* Contact card: "Posted by" + Show phone number */
.kre-contact-card { padding: 18px 20px; background: var(--kre-surface); border: 2px solid var(--kre-primary); border-radius: var(--kre-radius); }
.kre-contact-card__label { margin: 0; color: var(--kre-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.kre-contact-card__name { margin: 2px 0 14px; font-size: 1.2rem; font-weight: 700; }
.kre-reveal { margin: 0; }
.kre-contact-card .kre-reveal__btn { width: 100%; max-width: 420px; }
.kre-reveal__result { margin-top: 0; }
.kre-reveal__name { margin: 0; color: var(--kre-muted); font-weight: 600; }
.kre-reveal__number { display: inline-block; margin: 2px 0 12px; color: var(--kre-text); font-size: 1.7rem; font-weight: 800; letter-spacing: 0.02em; }
.kre-reveal__number:hover { color: var(--kre-primary); text-decoration: none; }
.kre-reveal__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kre-reveal__actions .kre-btn { flex: 1 1 140px; }
.kre-reveal__result .kre-form__note { margin-top: 12px; }
.kre-btn--whatsapp { background: var(--kre-surface); color: #0E7A5F; border-color: #0E7A5F; }
.kre-btn--whatsapp:hover { background: #E6F5EF; }
.kre-listing__contact > .kre-link { display: inline-block; margin-top: 4px; }
.kre-row__views { margin: 4px 0 0; font-size: 0.85rem; color: var(--kre-primary-dark); font-weight: 600; }

/* Forms */
.kre-form { display: flex; flex-direction: column; gap: 16px; }
.kre-form--listing, .kre-form--inline { background: var(--kre-surface); padding: 20px; border-radius: var(--kre-radius); border: 1px solid var(--kre-border); }
.kre-form__grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.kre-form__actions { display: flex; flex-direction: column; gap: 10px; }
.kre-form__note { font-size: 0.9rem; color: var(--kre-muted); margin: 0; }
.kre-field { display: flex; flex-direction: column; gap: 6px; }
.kre-field__label { font-weight: 600; font-size: 0.95rem; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kre-field__hint, .kre-field__count { font-weight: 400; color: var(--kre-muted); font-size: 0.85rem; }
.kre-field__error { color: var(--kre-danger); font-size: 0.9rem; }
input[type="text"], input[type="search"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], select, textarea {
    width: 100%; min-height: var(--kre-tap); padding: 10px 14px; font: inherit; color: var(--kre-text);
    background: var(--kre-surface); border: 2px solid var(--kre-border); border-radius: var(--kre-radius-sm);
}
input:focus, select:focus, textarea:focus { border-color: var(--kre-primary); outline: none; }
textarea { min-height: 120px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235F6B63' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input[type="file"] { padding: 8px; }
input[disabled] { background: var(--kre-bg); color: var(--kre-muted); }
.kre-input-prefix { display: flex; align-items: stretch; }
.kre-input-prefix__sym { display: flex; align-items: center; padding: 0 14px; background: var(--kre-bg); border: 2px solid var(--kre-border); border-right: 0; border-radius: var(--kre-radius-sm) 0 0 var(--kre-radius-sm); font-weight: 700; }
.kre-input-prefix input { border-radius: 0 var(--kre-radius-sm) var(--kre-radius-sm) 0; }
.kre-check { display: flex; align-items: flex-start; gap: 10px; min-height: var(--kre-tap); padding: 8px 0; cursor: pointer; }
.kre-check input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--kre-primary); }
.kre-inline-form { display: inline; }
.kre-admin-box { margin: 0; padding: 14px 16px 16px; border: 2px dashed var(--kre-accent); border-radius: var(--kre-radius-sm); background: #FFF9EE; display: flex; flex-direction: column; gap: 12px; }
.kre-admin-box legend { padding: 0 6px; font-weight: 700; }
.kre-row__seller { margin: 4px 0 0; font-size: 0.85rem; font-weight: 600; color: #7A4F05; }
.kre-photo-current { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.kre-photo-current img { max-width: 240px; border-radius: var(--kre-radius-sm); }

/* Notices */
.kre-notice { padding: 14px 16px; border-radius: var(--kre-radius-sm); margin-bottom: 16px; border: 1px solid; font-size: 0.95rem; }
.kre-notice--success { background: var(--kre-primary-soft); border-color: #B9DCC7; color: var(--kre-primary-dark); }
.kre-notice--error { background: var(--kre-danger-soft); border-color: #F3C2BC; color: var(--kre-danger); }
.kre-notice--info { background: #FFF6E5; border-color: #F3DBAE; color: #7A4F05; }

/* Chips & badges */
.kre-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kre-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; background: var(--kre-bg); color: var(--kre-muted); font-size: 0.8rem; font-weight: 600; }
.kre-chip--cat { background: var(--kre-primary-soft); color: var(--kre-primary-dark); }
.kre-chip--type { background: #FDF0DA; color: #7A4F05; }
.kre-card__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kre-listing__advance { margin: -4px 0 10px; color: var(--kre-muted); }
.kre-listing__advance strong { color: var(--kre-text); }
.kre-chip--link { min-height: 40px; padding: 0 16px; background: var(--kre-bg); color: var(--kre-text); font-size: 0.95rem; border: 1px solid var(--kre-border); }
.kre-chip--link:hover { background: var(--kre-primary-soft); border-color: var(--kre-primary); text-decoration: none; }
.kre-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.kre-badge--pending { background: #FFF6E5; color: #7A4F05; }
.kre-badge--active { background: var(--kre-primary-soft); color: var(--kre-primary-dark); }
.kre-badge--expired { background: #ECECEC; color: #555; }
.kre-badge--rejected { background: var(--kre-danger-soft); color: var(--kre-danger); }

/* Cards */
.kre-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.kre-card { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); box-shadow: var(--kre-shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.12s, box-shadow 0.12s; }
.kre-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26, 26, 26, 0.09); }
.kre-card__media { display: block; aspect-ratio: 3 / 2; background: var(--kre-bg); }
.kre-card__media img { width: 100%; height: 100%; object-fit: cover; }
.kre-card__body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kre-card__title { font-size: 1.05rem; margin: 2px 0 0; }
.kre-card__title a { color: var(--kre-text); }
.kre-card__title a::after { content: ""; position: absolute; inset: 0; }
.kre-card { position: relative; }
.kre-card__price { font-weight: 800; font-size: 1.15rem; color: var(--kre-primary); margin: 0; }
.kre-card__meta { margin: 0; color: var(--kre-muted); font-size: 0.875rem; display: flex; gap: 6px; flex-wrap: wrap; }

/* Page heads, empty states */
.kre-page-head { margin-bottom: 20px; }
.kre-page-head__intro { color: var(--kre-muted); margin: 0; }
.kre-results-count { color: var(--kre-muted); font-size: 0.9rem; margin: 0 0 12px; }
.kre-empty { text-align: center; padding: 40px 16px; background: var(--kre-surface); border: 1px dashed var(--kre-border); border-radius: var(--kre-radius); }
.kre-empty p { color: var(--kre-muted); }
.kre-empty .kre-btn { margin: 4px; }
.kre-prose { background: var(--kre-surface); padding: 20px; border-radius: var(--kre-radius); border: 1px solid var(--kre-border); }
.kre-prose h2 { margin-top: 1.4em; font-size: 1.15rem; }
.kre-prose ul { padding-left: 1.2em; }
.kre-contact__email a { font-size: 1.3rem; font-weight: 700; }

/* Filters */
.kre-filters { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 14px; margin-bottom: 18px; }
.kre-filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kre-filters__row .kre-field:first-child { grid-column: 1 / -1; }
.kre-filters__actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.kre-filters__actions .kre-btn { flex: 1; }

/* Pagination */
.pagination, .kre-pagination { margin-top: 24px; }
.nav-links, .kre-pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.page-numbers, .kre-pagination a, .kre-pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: var(--kre-radius-sm); background: var(--kre-surface); border: 1px solid var(--kre-border); color: var(--kre-text); font-weight: 600; }
.page-numbers.current, .kre-pagination .is-current { background: var(--kre-primary); color: #fff; border-color: var(--kre-primary); }
.page-numbers.dots { border: 0; background: none; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* Single listing */
.kre-listing__inner { max-width: 820px; }
.kre-crumbs { font-size: 0.875rem; color: var(--kre-muted); margin-bottom: 12px; }
.kre-listing__head { margin-bottom: 18px; }
.kre-listing__title { font-size: 1.5rem; margin-bottom: 6px; }
.kre-listing__price { font-size: 1.6rem; font-weight: 800; color: var(--kre-primary); margin: 0 0 8px; }
.kre-listing__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--kre-muted); font-size: 0.875rem; margin: 0; }
.kre-listing__ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.kre-listing__media { margin: 0 0 18px; border-radius: var(--kre-radius); overflow: hidden; background: var(--kre-surface); }
.kre-listing__body { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 20px; margin-bottom: 20px; font-size: 1.02rem; }
.kre-listing__body p:last-child { margin-bottom: 0; }
.kre-listing__contact { margin-bottom: 20px; }
.kre-listing__contact .kre-form { margin-top: 14px; }
.kre-listing__foot { border-top: 1px solid var(--kre-border); padding-top: 12px; }
.kre-listing__foot .kre-form { margin-top: 10px; }

/* Tabs (login/register) */
.kre-tabs { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); overflow: hidden; }
.kre-tabs__bar { display: flex; border-bottom: 1px solid var(--kre-border); }
.kre-tabs__tab { flex: 1; min-height: 52px; background: var(--kre-bg); border: 0; font-weight: 600; color: var(--kre-muted); cursor: pointer; }
.kre-tabs__tab[aria-selected="true"] { background: var(--kre-surface); color: var(--kre-primary); box-shadow: inset 0 -3px 0 var(--kre-primary); }
.kre-tabs__panel { padding: 20px; }

/* Dashboard */
.kre-dash { display: flex; flex-direction: column; gap: 20px; }
.kre-dash__nav { display: flex; flex-wrap: wrap; gap: 6px; background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 10px; }
.kre-dash__hello { width: 100%; margin: 4px 8px 6px; font-weight: 700; }
.kre-dash__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--kre-radius-sm); color: var(--kre-text); font-weight: 500; }
.kre-dash__link:hover { background: var(--kre-bg); text-decoration: none; }
.kre-dash__link.is-active { background: var(--kre-primary-soft); color: var(--kre-primary-dark); font-weight: 700; }
.kre-dash__link--muted { color: var(--kre-muted); }
.kre-dash__main { flex: 1; min-width: 0; }

/* Member dashboard (/my-account/ when logged in) */
.kre-member__title { margin-bottom: 18px; }
.kre-member__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.kre-member__who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.kre-avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 60px; height: 60px; border-radius: 50%; background: var(--kre-primary-soft); color: var(--kre-primary-dark); font-size: 1.6rem; font-weight: 800; }
.kre-member__hello { margin: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.kre-member__meta { margin: 2px 0 0; color: var(--kre-muted); }
.kre-member-stats { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 20px; }
.kre-member-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--kre-surface); border: 1px solid var(--kre-border); border-left: 4px solid var(--kre-primary); border-radius: var(--kre-radius); }
.kre-member-stat .kre-icon { width: 24px; height: 24px; margin-bottom: 4px; color: var(--kre-primary); }
.kre-member-stat--pending { border-left-color: var(--kre-accent); }
.kre-member-stat--pending .kre-icon { color: var(--kre-accent-dark); }
.kre-member-stat--total { border-left-color: #C9C2B4; }
.kre-member-stat--total .kre-icon { color: var(--kre-muted); }
.kre-member-stat__n { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.kre-member-stat__l { color: var(--kre-muted); }
.kre-card-panel { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); }
.kre-card-panel__title { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--kre-border); font-size: 1.1rem; }
.kre-card-panel__body { padding: 20px; }
.kre-card-panel .kre-field__hint { line-height: 1.4; }
.kre-divider { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--kre-border); }
.kre-mlisting { display: flex; align-items: flex-start; gap: 12px; }
.kre-mlisting__thumb { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 72px; height: 54px; overflow: hidden; border-radius: var(--kre-radius-sm); background: var(--kre-bg); color: #B8B0A0; }
.kre-mlisting__thumb img { width: 100%; height: 100%; object-fit: cover; }
.kre-mlisting__text { min-width: 0; }
.kre-mlisting__text .kre-row__views { display: block; }
.kre-table--member td { vertical-align: top; }
.kre-table--member .kre-btn .kre-icon { width: 16px; height: 16px; }
@media (min-width: 600px) {
    .kre-member-stats { grid-template-columns: repeat(3, 1fr); }
}

/* Rows (listing lists in dashboard + manage) */
.kre-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.kre-row { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.kre-row__top { display: flex; align-items: center; gap: 10px; }
.kre-row__ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--kre-muted); }
.kre-row__title { margin: 6px 0 2px; font-size: 1.05rem; }
.kre-row__title a { color: var(--kre-text); }
.kre-row__meta { margin: 0; color: var(--kre-muted); font-size: 0.9rem; }
.kre-row__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kre-row.is-removing { opacity: 0.4; }

/* Admin dashboard (/manage/) */
.kre-icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }
.kre-dash-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.kre-dash-head h1 { margin: 0 0 4px; }
.kre-dash-head__who { margin: 0; color: var(--kre-muted); }
.kre-dash-head__who strong { color: var(--kre-text); }
.kre-dash-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.kre-tabbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 20px; }
.kre-tabbar__link { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border-radius: var(--kre-radius-sm); color: var(--kre-text); font-weight: 500; }
.kre-tabbar__link .kre-icon { color: var(--kre-muted); }
.kre-tabbar__link:hover { background: var(--kre-surface); text-decoration: none; }
.kre-tabbar__link.is-active { background: var(--kre-primary); color: #fff; font-weight: 600; }
.kre-tabbar__link.is-active .kre-icon { color: #fff; }
.kre-tabbar__count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--kre-accent); color: var(--kre-text); font-size: 0.75rem; font-weight: 700; }

.kre-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
.kre-stat { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 14px; display: flex; flex-direction: column; color: inherit; transition: border-color 0.15s; }
.kre-stat:hover { border-color: var(--kre-primary); text-decoration: none; }
.kre-stat__n { font-size: 1.6rem; font-weight: 800; color: var(--kre-primary); line-height: 1.1; }
.kre-stat__l { font-size: 0.8rem; color: var(--kre-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.kre-panels { display: grid; grid-template-columns: 1fr; gap: 14px; }
.kre-panel { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 16px 18px; }
.kre-panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.kre-panel__head h2 { font-size: 1.05rem; margin: 0; }
.kre-panel__empty { color: var(--kre-muted); margin: 0; }
.kre-mini { list-style: none; margin: 0; padding: 0; }
.kre-mini li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--kre-border); font-size: 0.92rem; break-inside: avoid; }
.kre-mini li:last-child { border-bottom: 0; }
.kre-mini li > a, .kre-mini li > .kre-cell__strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kre-mini li > span:last-child { color: var(--kre-muted); font-size: 0.85rem; text-align: right; flex-shrink: 0; }
.kre-mini li > .kre-mini__n { color: var(--kre-text); font-weight: 700; }
.kre-mini--cols { columns: 2; column-gap: 28px; }
.kre-mini--cols li:last-child { border-bottom: 1px solid var(--kre-border); }
.kre-health { margin: 0; padding: 10px 12px; border-radius: var(--kre-radius-sm); font-weight: 600; font-size: 0.92rem; }
.kre-health--ok { background: var(--kre-primary-soft); color: var(--kre-primary-dark); }
.kre-health--bad { background: var(--kre-danger-soft); color: var(--kre-danger); }

.kre-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.kre-toolbar__search { flex: 1 1 280px; }
.kre-toolbar__select { flex: 1 1 180px; max-width: 260px; }
.kre-toolbar .kre-btn { flex: 0 0 auto; min-width: 120px; }
.kre-toolbar__count { margin-left: auto; color: var(--kre-muted); font-size: 0.9rem; }
.kre-filter-chip { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 6px 14px; border-radius: 999px; background: var(--kre-primary-soft); color: var(--kre-primary-dark); font-size: 0.88rem; }
.kre-cell__strong { display: block; font-weight: 600; color: var(--kre-text); }
a.kre-cell__strong:hover { color: var(--kre-primary); }
.kre-cell__sub { display: block; margin-top: 2px; color: var(--kre-muted); font-size: 0.82rem; }
[data-listing].is-removing { opacity: 0.35; transition: opacity 0.25s; }

/* Import / Export tab */
.kre-panel__head h2 { display: flex; align-items: center; gap: 8px; }
.kre-panel .kre-form { gap: 12px; }
.kre-import-preview { margin-bottom: 18px; border-color: var(--kre-primary); }
.kre-import-counts { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 6px 0 4px; }
.kre-import-count { padding: 12px 14px; border-radius: var(--kre-radius-sm); font-size: 0.92rem; }
.kre-import-count strong { display: block; font-size: 1.5rem; line-height: 1.1; }
.kre-import-count--new { background: var(--kre-primary-soft); color: var(--kre-primary-dark); }
.kre-import-count--update { background: #EEF3FB; color: #1E4C8F; }
.kre-import-count--skip { background: var(--kre-danger-soft); color: var(--kre-danger); }
.kre-problems { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; border: 1px solid var(--kre-border); border-radius: var(--kre-radius-sm); }
.kre-problems li { padding: 10px 12px; border-bottom: 1px solid var(--kre-border); font-size: 0.9rem; }
.kre-problems li:last-child { border-bottom: 0; }
.kre-problems li span { display: block; margin-top: 2px; color: var(--kre-danger); }
.kre-import-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.kre-adjust { list-style: none; margin: 0; padding: 0; border: 1px solid #F3DBAE; border-radius: var(--kre-radius-sm); background: #FFF9EE; }
.kre-adjust li { padding: 10px 12px; border-bottom: 1px solid #F3DBAE; font-size: 0.9rem; }
.kre-adjust li:last-child { border-bottom: 0; }
.kre-adjust li span { display: block; margin-top: 2px; color: var(--kre-muted); font-size: 0.82rem; }
.kre-details { margin-top: 12px; }
.kre-details summary { cursor: pointer; padding: 8px 0; color: var(--kre-primary); font-weight: 600; }
.kre-help { margin: 6px 0 12px; padding-left: 1.1em; font-size: 0.88rem; color: var(--kre-muted); }
.kre-help li { margin-bottom: 6px; }
.kre-help code { padding: 1px 6px; border-radius: 4px; background: var(--kre-bg); color: var(--kre-text); font-size: 0.8rem; }
.kre-backup { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
@media (min-width: 600px) {
    .kre-import-counts { grid-template-columns: repeat(3, 1fr); }
}

/* Emails tab */
.kre-emails { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.kre-email { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 14px 16px; }
.kre-email__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.kre-email__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 2px; font-size: 1rem; }
.kre-email__when { margin: 0; color: var(--kre-muted); font-size: 0.88rem; }
.kre-email__edit { margin-top: 8px; }
.kre-email__edit summary { cursor: pointer; padding: 8px 0; color: var(--kre-primary); font-weight: 600; }
.kre-email__edit .kre-field { margin-top: 10px; }
.kre-email__edit textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; line-height: 1.5; }
.kre-email__tags { margin: 10px 0; color: var(--kre-muted); font-size: 0.82rem; line-height: 2; }
.kre-email__tags code { padding: 2px 6px; border-radius: 4px; background: var(--kre-bg); color: var(--kre-text); font-size: 0.8rem; }
.kre-email__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kre-emails__save { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(rgba(245, 241, 232, 0), var(--kre-bg) 35%); }
.kre-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; flex-shrink: 0; cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.kre-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kre-switch__track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: #CFC8B8; transition: background 0.15s; }
.kre-switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.kre-switch input:checked + .kre-switch__track { background: var(--kre-primary); }
.kre-switch input:checked + .kre-switch__track::after { transform: translateX(18px); }
.kre-switch input:focus-visible + .kre-switch__track { outline: 3px solid var(--kre-accent); outline-offset: 2px; }
.kre-switch--locked { color: var(--kre-muted); font-weight: 500; cursor: default; }
.kre-queue { display: flex; flex-direction: column; gap: 14px; }
.kre-queue__item { background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); padding: 18px; }
.kre-queue__item.is-done { opacity: 0.5; }
.kre-queue__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.kre-queue__time { margin-left: auto; color: var(--kre-muted); font-size: 0.85rem; }
.kre-queue__title { font-size: 1.2rem; margin-bottom: 4px; }
.kre-queue__media img { max-width: 320px; border-radius: var(--kre-radius-sm); margin-bottom: 10px; }
.kre-queue__body { background: var(--kre-bg); padding: 12px 14px; border-radius: var(--kre-radius-sm); margin-bottom: 10px; }
.kre-queue__body p:last-child { margin: 0; }
.kre-queue__owner { color: var(--kre-muted); font-size: 0.85rem; }
.kre-queue__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.kre-queue__result { font-weight: 700; }
.kre-table-wrap { overflow-x: auto; background: var(--kre-surface); border: 1px solid var(--kre-border); border-radius: var(--kre-radius); }
.kre-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.kre-table th, .kre-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--kre-border); vertical-align: middle; }
.kre-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--kre-muted); }
.kre-table tr.is-blocked td { color: var(--kre-muted); }
.kre-table tr.is-blocked td:first-child::after { content: " · blocked"; color: var(--kre-danger); font-size: 0.8rem; }
.kre-table--stack { min-width: 0; }
.kre-table tbody tr:last-child td { border-bottom: 0; }
.kre-table__actions { text-align: right; }
.kre-table__actions .kre-btn { margin: 2px 0 2px 4px; }
.kre-table-wrap--flat { border: 0; border-radius: 0; }

/* Tables become cards on phones */
@media (max-width: 759px) {
    .kre-table--stack thead { display: none; }
    .kre-table--stack, .kre-table--stack tbody, .kre-table--stack tr, .kre-table--stack td { display: block; width: 100%; }
    .kre-table--stack tr { padding: 12px 14px; border-bottom: 1px solid var(--kre-border); }
    .kre-table--stack tbody tr:last-child { border-bottom: 0; }
    .kre-table--stack td { padding: 4px 0; border: 0; }
    .kre-table--stack td[data-label]::before { content: attr(data-label); display: block; color: var(--kre-muted); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
    .kre-table--stack td:first-child::before { display: none; }
    .kre-table--stack .kre-table__actions { text-align: left; padding-top: 10px; }
    .kre-table--stack .kre-table__actions .kre-btn { margin: 0 6px 6px 0; }
}

/* Tablet and up */
@media (min-width: 600px) {
    h1 { font-size: 2rem; }
    .kre-hero__title { font-size: 2rem; }
    .kre-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .kre-form__grid { grid-template-columns: 1fr 1fr; }
    .kre-form__actions { flex-direction: row; align-items: center; gap: 16px; }
    .kre-search { grid-template-columns: 1fr 1fr; }
    .kre-search__field--grow { grid-column: 1 / -1; }
    .kre-filters__row { grid-template-columns: repeat(3, 1fr); }
    .kre-filters__actions { grid-column: auto; align-items: flex-end; }
    .kre-filters__actions .kre-btn { flex: 0 0 auto; }
    .kre-stats { grid-template-columns: repeat(5, 1fr); }
    .kre-tabbar { display: flex; flex-wrap: wrap; }
    .kre-row { flex-direction: row; align-items: center; justify-content: space-between; }
    .kre-row__actions { justify-content: flex-end; }
}

@media (min-width: 900px) {
    :root { --kre-gutter: 24px; }
    .kre-section { padding: 40px 0; }
    .kre-hero { padding: 56px 0 48px; }
    .kre-hero__title { font-size: 2.4rem; }
    .kre-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .kre-search { grid-template-columns: 2fr 1fr 1fr auto; align-items: center; padding: 10px; }
    .kre-search__field--grow { grid-column: auto; }
    .kre-filters__row { display: flex; flex-wrap: wrap; align-items: flex-end; }
    .kre-filters__row > * { flex: 1 1 120px; min-width: 0; }
    .kre-filters__row > .kre-field--narrow { flex-basis: 100px; }
    .kre-filters__row > .kre-field:first-child { flex: 2 1 180px; }
    .kre-filters__row > .kre-filters__actions { flex: 0 0 auto; }
    .kre-dash { flex-direction: row; align-items: flex-start; }
    .kre-dash__nav { flex-direction: column; width: 220px; flex-shrink: 0; position: sticky; top: 76px; }
    .kre-dash__hello { margin: 6px 14px 8px; }
    .kre-dash__link { width: 100%; }
    .kre-dash-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
    .kre-panels { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
    .kre-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
