/* =====================================================================
   ROSA Visit · Roto Rooter Indonesia
   Mobile-first app shell. Built like a native field-ops mini app.
   Stack: Bootstrap 5 base + custom system. Mobile-first; desktop is the
   media query (not the other way around).
===================================================================== */

/* ---------- 1. Root tokens ---------- */
:root {
    /* Brand */
    --rv-primary:        #0d4ea6;
    --rv-primary-700:    #0a3d80;
    --rv-primary-800:    #073061;
    --rv-primary-50:     #e8f0fb;
    --rv-primary-tint:   #f3f7fd;

    --rv-accent:         #ff7a1a;
    --rv-accent-600:     #e96a0d;
    --rv-accent-50:      #fff1e3;

    /* Neutral */
    --rv-bg:             #f1f4f9;
    --rv-bg-soft:        #f6f8fc;
    --rv-surface:        #ffffff;
    --rv-surface-alt:    #fafbfd;
    --rv-border:         #e6ebf3;
    --rv-border-strong:  #d4dbe6;

    --rv-ink:            #0e1a30;
    --rv-text:           #2c3852;
    --rv-muted:          #6b7691;
    --rv-faint:          #9aa4b8;

    /* Status */
    --rv-success:        #16a34a;
    --rv-success-50:     #e7f7ee;
    --rv-warning:        #d97706;
    --rv-warning-50:     #fef3e2;
    --rv-danger:         #dc2626;
    --rv-danger-50:      #fde8e8;
    --rv-info:           #2563eb;
    --rv-info-50:        #e6efff;

    /* Radius */
    --rv-r-sm: 10px;
    --rv-r-md: 14px;
    --rv-r-lg: 18px;
    --rv-r-xl: 22px;
    --rv-r-pill: 999px;

    /* Shadow */
    --rv-shadow-sm: 0 1px 2px rgba(14, 26, 48, 0.04), 0 1px 3px rgba(14, 26, 48, 0.06);
    --rv-shadow-md: 0 4px 12px rgba(14, 26, 48, 0.06), 0 2px 4px rgba(14, 26, 48, 0.04);
    --rv-shadow-lg: 0 12px 28px rgba(14, 26, 48, 0.10), 0 4px 10px rgba(14, 26, 48, 0.05);
    --rv-shadow-nav: 0 -2px 14px rgba(14, 26, 48, 0.08);

    /* Layout */
    --rv-app-max: 520px;
    --rv-header-h: 64px;
    --rv-bottom-nav-h: 68px;

    /* Type */
    --rv-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ---------- 2. Reset & base ---------- */
* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background: var(--rv-bg);
    color: var(--rv-text);
    font-family: var(--rv-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    padding-bottom: calc(var(--rv-bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

a {
    color: var(--rv-primary);
    text-decoration: none;
}

a:hover {
    color: var(--rv-primary-700);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--rv-ink);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---------- 3. App shell ---------- */
.app-shell {
    width: 100%;
    max-width: var(--rv-app-max);
    margin: 0 auto;
    padding: 16px;
    padding-top: calc(var(--rv-header-h) + 16px);
}

.app-shell--wide {
    max-width: 720px;
}

/* ---------- 4. App header (sticky top) ---------- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--rv-surface);
    border-bottom: 1px solid var(--rv-border);
    box-shadow: var(--rv-shadow-sm);
    padding-top: env(safe-area-inset-top, 0);
}

.app-header__inner {
    max-width: var(--rv-app-max);
    margin: 0 auto;
    height: var(--rv-header-h);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header--wide .app-header__inner {
    max-width: 720px;
}

.app-header__back {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.15s;
    border: none;
}

.app-header__back:hover,
.app-header__back:active {
    background: var(--rv-primary);
    color: #fff;
}

.app-header__brand {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--rv-primary), var(--rv-primary-700));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(13, 78, 166, 0.25);
}

.app-header__title-wrap {
    flex: 1;
    min-width: 0;
}

.app-header__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--rv-ink);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__subtitle {
    font-size: 11px;
    color: var(--rv-muted);
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--rv-bg-soft);
    color: var(--rv-text);
    border: none;
    font-size: 18px;
}

/* ---------- 5. Page hero (dashboard) ---------- */
.page-hero {
    background: linear-gradient(135deg, var(--rv-primary) 0%, var(--rv-primary-800) 100%);
    color: #fff;
    border-radius: var(--rv-r-xl);
    padding: 22px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(13, 78, 166, 0.18);
}

.page-hero::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.page-hero::after {
    content: "";
    position: absolute;
    bottom: -60px;
    right: 30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 122, 26, 0.18);
}

.page-hero__greeting {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.85;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.page-hero__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    margin: 0;
    position: relative;
    z-index: 1;
}

.page-hero__sub {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

/* ---------- 6. Section headings ---------- */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 12px;
    padding: 0 4px;
}

.section-head__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--rv-ink);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.section-head__link {
    font-size: 12px;
    font-weight: 600;
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---------- 7. Mobile card / form card ---------- */
.mobile-card,
.form-card {
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    padding: 18px;
    box-shadow: var(--rv-shadow-sm);
    border: 1px solid var(--rv-border);
    margin-bottom: 14px;
}

.form-card {
    padding: 20px;
}

.form-card__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--rv-ink);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-card__title i {
    color: var(--rv-primary);
}

.form-card__hint {
    font-size: 12px;
    color: var(--rv-muted);
    margin-bottom: 16px;
}

/* ---------- 8. Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.stat-card {
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    padding: 18px;
    box-shadow: var(--rv-shadow-sm);
    border: 1px solid var(--rv-border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-card__icon {
    width: 50px;
    height: 50px;
    border-radius: var(--rv-r-md);
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card__icon--accent {
    background: var(--rv-accent-50);
    color: var(--rv-accent-600);
}

.stat-card__icon--success {
    background: var(--rv-success-50);
    color: var(--rv-success);
}

.stat-card__body {
    flex: 1;
    min-width: 0;
}

.stat-card__label {
    font-size: 12px;
    color: var(--rv-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-card__value {
    font-size: 24px;
    font-weight: 800;
    color: var(--rv-ink);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card__trend {
    font-size: 11px;
    color: var(--rv-faint);
    margin-top: 2px;
}

/* ---------- 9. Quick actions ---------- */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}

.quick-action {
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    padding: 18px 14px;
    text-align: left;
    border: 1px solid var(--rv-border);
    box-shadow: var(--rv-shadow-sm);
    color: var(--rv-ink);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.12s, box-shadow 0.12s;
}

.quick-action:hover,
.quick-action:active {
    transform: translateY(-1px);
    box-shadow: var(--rv-shadow-md);
    color: var(--rv-ink);
}

.quick-action--primary {
    background: linear-gradient(135deg, var(--rv-primary), var(--rv-primary-700));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(13, 78, 166, 0.22);
}

.quick-action--primary:hover,
.quick-action--primary:active {
    color: #fff;
}

.quick-action__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.quick-action--primary .quick-action__icon {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.quick-action__label {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.quick-action__sub {
    font-size: 11px;
    color: var(--rv-muted);
    line-height: 1.3;
}

.quick-action--primary .quick-action__sub {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- 10. Per-head breakdown ---------- */
.head-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rv-border);
}

.head-row:last-child {
    border-bottom: none;
}

.head-row__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.head-row__body {
    flex: 1;
    min-width: 0;
}

.head-row__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--rv-ink);
    margin-bottom: 4px;
}

.head-row__bar {
    height: 6px;
    background: var(--rv-bg);
    border-radius: 999px;
    overflow: hidden;
}

.head-row__bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--rv-primary), var(--rv-accent));
    border-radius: 999px;
    transition: width 0.4s;
}

.head-row__count {
    font-size: 14px;
    font-weight: 700;
    color: var(--rv-primary);
    min-width: 28px;
    text-align: right;
}

/* ---------- 11. Visit card (list/recent) ---------- */
.visit-card {
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    box-shadow: var(--rv-shadow-sm);
    border: 1px solid var(--rv-border);
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.15s;
}

.visit-card:hover {
    box-shadow: var(--rv-shadow-md);
}

.visit-card__top {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.visit-card__thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--rv-r-md);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rv-bg);
    border: 1px solid var(--rv-border);
}

.visit-card__head {
    flex: 1;
    min-width: 0;
}

.visit-card__company {
    font-size: 15px;
    font-weight: 700;
    color: var(--rv-ink);
    line-height: 1.25;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.visit-card__customer {
    font-size: 13px;
    color: var(--rv-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visit-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    color: var(--rv-muted);
    margin-bottom: 10px;
}

.visit-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.visit-card__meta-item i {
    font-size: 13px;
    color: var(--rv-faint);
}

.visit-card__excerpt {
    font-size: 12.5px;
    color: var(--rv-text);
    background: var(--rv-bg-soft);
    border-radius: var(--rv-r-sm);
    padding: 8px 10px;
    margin-bottom: 12px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.visit-card__excerpt strong {
    color: var(--rv-ink);
    font-weight: 600;
}

.visit-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.visit-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 38px;
    border-radius: var(--rv-r-md);
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid var(--rv-border);
    background: var(--rv-surface);
    color: var(--rv-text);
    transition: background 0.12s;
}

.visit-card__action:hover,
.visit-card__action:active {
    background: var(--rv-bg-soft);
    color: var(--rv-text);
}

.visit-card__action--primary {
    background: var(--rv-primary);
    color: #fff;
    border-color: var(--rv-primary);
}

.visit-card__action--primary:hover,
.visit-card__action--primary:active {
    background: var(--rv-primary-700);
    color: #fff;
}

.visit-card__action--danger {
    color: var(--rv-danger);
    border-color: var(--rv-border);
}

.visit-card__action--danger:hover,
.visit-card__action--danger:active {
    background: var(--rv-danger-50);
    color: var(--rv-danger);
}

.visit-card__action--map {
    background: var(--rv-accent-50);
    color: var(--rv-accent-600);
    border-color: var(--rv-accent-50);
}

.visit-card__action--map:hover,
.visit-card__action--map:active {
    background: var(--rv-accent);
    color: #fff;
    border-color: var(--rv-accent);
}

/* Recent compact (dashboard) */
.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--rv-border);
    color: inherit;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item:hover {
    color: inherit;
}

.recent-item__thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--rv-r-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--rv-bg);
}

.recent-item__body {
    flex: 1;
    min-width: 0;
}

.recent-item__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--rv-ink);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-item__sub {
    font-size: 12px;
    color: var(--rv-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-item__chev {
    color: var(--rv-faint);
    font-size: 16px;
    flex-shrink: 0;
}

/* ---------- 12. Badges ---------- */
.rv-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--rv-r-pill);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.rv-badge--primary { background: var(--rv-primary-50); color: var(--rv-primary); }
.rv-badge--accent  { background: var(--rv-accent-50);  color: var(--rv-accent-600); }
.rv-badge--success { background: var(--rv-success-50); color: var(--rv-success); }
.rv-badge--warning { background: var(--rv-warning-50); color: var(--rv-warning); }
.rv-badge--danger  { background: var(--rv-danger-50);  color: var(--rv-danger); }
.rv-badge--muted   { background: var(--rv-bg);         color: var(--rv-muted); }

/* ---------- 13. Forms ---------- */
.field {
    margin-bottom: 16px;
}

.field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--rv-ink);
    margin-bottom: 7px;
}

.field__label .req {
    color: var(--rv-danger);
    margin-left: 2px;
}

.field__hint {
    font-size: 11.5px;
    color: var(--rv-muted);
    margin-top: 6px;
}

.field__input,
.field__select,
.field__textarea {
    width: 100%;
    background: var(--rv-surface);
    border: 1.5px solid var(--rv-border);
    border-radius: var(--rv-r-md);
    padding: 13px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--rv-ink);
    min-height: 48px;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.field__input:focus,
.field__select:focus,
.field__textarea:focus {
    outline: none;
    border-color: var(--rv-primary);
    box-shadow: 0 0 0 3px var(--rv-primary-50);
}

.field__input::placeholder,
.field__textarea::placeholder {
    color: var(--rv-faint);
}

.field__textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.field__select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7691' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ---------- 14. Upload card ---------- */
.upload-card {
    border: 2px dashed var(--rv-border-strong);
    border-radius: var(--rv-r-lg);
    background: var(--rv-bg-soft);
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: block;
}

.upload-card:hover,
.upload-card:active {
    border-color: var(--rv-primary);
    background: var(--rv-primary-tint);
}

.upload-card--filled {
    border-style: solid;
    border-color: var(--rv-success);
    background: var(--rv-success-50);
    padding: 0;
    overflow: hidden;
}

.upload-card__icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.upload-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--rv-ink);
    margin-bottom: 4px;
}

.upload-card__hint {
    font-size: 12px;
    color: var(--rv-muted);
}

.upload-card__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.upload-card__preview {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
}

.upload-card__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 12.5px;
    color: var(--rv-text);
}

.upload-card__bar i {
    color: var(--rv-success);
    margin-right: 6px;
}

.upload-card__change {
    color: var(--rv-primary);
    font-weight: 600;
    font-size: 12px;
}

/* ---------- 15. Location status ---------- */
.location-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--rv-r-md);
    border: 1px solid var(--rv-border);
    background: var(--rv-bg-soft);
    margin-bottom: 12px;
    transition: all 0.2s;
}

.location-status__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--rv-bg);
    color: var(--rv-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.location-status__body {
    flex: 1;
    min-width: 0;
}

.location-status__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--rv-ink);
    line-height: 1.2;
}

.location-status__sub {
    font-size: 11.5px;
    color: var(--rv-muted);
    margin-top: 2px;
    word-break: break-all;
}

.location-status--loading {
    border-color: var(--rv-info);
    background: var(--rv-info-50);
}

.location-status--loading .location-status__icon {
    background: var(--rv-info);
    color: #fff;
    animation: rv-pulse 1.4s ease-in-out infinite;
}

.location-status--success {
    border-color: var(--rv-success);
    background: var(--rv-success-50);
}

.location-status--success .location-status__icon {
    background: var(--rv-success);
    color: #fff;
}

.location-status--error {
    border-color: var(--rv-danger);
    background: var(--rv-danger-50);
}

.location-status--error .location-status__icon {
    background: var(--rv-danger);
    color: #fff;
}

@keyframes rv-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.7; transform: scale(0.94); }
}

.location-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--rv-primary);
    font-weight: 600;
    margin-top: 8px;
}

/* ---------- 16. Action buttons ---------- */
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 50px;
    padding: 0 18px;
    border-radius: var(--rv-r-md);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    text-align: center;
    line-height: 1;
}

.action-button:active {
    transform: scale(0.98);
}

.action-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.action-button--primary {
    background: var(--rv-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 78, 166, 0.22);
}

.action-button--primary:hover {
    background: var(--rv-primary-700);
    color: #fff;
}

.action-button--accent {
    background: var(--rv-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 122, 26, 0.22);
}

.action-button--accent:hover {
    background: var(--rv-accent-600);
    color: #fff;
}

.action-button--ghost {
    background: var(--rv-surface);
    color: var(--rv-text);
    border-color: var(--rv-border);
}

.action-button--ghost:hover {
    background: var(--rv-bg-soft);
    color: var(--rv-text);
}

.action-button--soft {
    background: var(--rv-primary-50);
    color: var(--rv-primary);
}

.action-button--soft:hover {
    background: var(--rv-primary);
    color: #fff;
}

.action-button--danger {
    background: var(--rv-surface);
    color: var(--rv-danger);
    border-color: var(--rv-danger-50);
}

.action-button--danger:hover {
    background: var(--rv-danger);
    color: #fff;
    border-color: var(--rv-danger);
}

.action-button--lg {
    min-height: 54px;
    font-size: 16px;
}

.action-stack > .action-button {
    margin-bottom: 10px;
}

.action-stack > .action-button:last-child {
    margin-bottom: 0;
}

/* Sticky submit area on form */
.submit-sticky {
    margin-top: 18px;
    padding-top: 4px;
}

/* ---------- 17. Filter card ---------- */
.filter-card {
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    padding: 14px;
    box-shadow: var(--rv-shadow-sm);
    border: 1px solid var(--rv-border);
    margin-bottom: 16px;
}

.search-input {
    position: relative;
    margin-bottom: 10px;
}

.search-input__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--rv-muted);
    font-size: 16px;
    pointer-events: none;
}

.search-input__field {
    width: 100%;
    height: 48px;
    background: var(--rv-bg-soft);
    border: 1.5px solid var(--rv-border);
    border-radius: var(--rv-r-md);
    padding: 0 14px 0 42px;
    font-size: 14px;
    font-family: inherit;
    color: var(--rv-ink);
    -webkit-appearance: none;
    appearance: none;
}

.search-input__field:focus {
    outline: none;
    border-color: var(--rv-primary);
    background: var(--rv-surface);
    box-shadow: 0 0 0 3px var(--rv-primary-50);
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.filter-row .field__select {
    height: 44px;
    min-height: 44px;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
}

.btn-reset {
    height: 44px;
    padding: 0 14px;
    background: var(--rv-bg-soft);
    border: 1.5px solid var(--rv-border);
    border-radius: var(--rv-r-md);
    color: var(--rv-muted);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-reset:hover {
    color: var(--rv-text);
    background: var(--rv-bg);
}

.results-count {
    font-size: 12px;
    color: var(--rv-muted);
    padding: 0 4px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-count strong {
    color: var(--rv-ink);
    font-weight: 700;
}

/* ---------- 18. Detail page ---------- */
.detail-photo {
    width: 100%;
    border-radius: var(--rv-r-lg);
    background: var(--rv-bg);
    overflow: hidden;
    margin-bottom: 14px;
    box-shadow: var(--rv-shadow-sm);
    border: 1px solid var(--rv-border);
    aspect-ratio: 4 / 3;
    display: block;
}

.detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-list {
    margin: 0;
    padding: 0;
}

.detail-list__row {
    padding: 12px 0;
    border-bottom: 1px solid var(--rv-border);
}

.detail-list__row:last-child {
    border-bottom: none;
}

.detail-list__row:first-child {
    padding-top: 0;
}

.detail-list__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--rv-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

.detail-list__value {
    font-size: 14px;
    color: var(--rv-ink);
    line-height: 1.5;
    word-wrap: break-word;
}

.detail-list__value a {
    color: var(--rv-primary);
    word-break: break-all;
}

.detail-link-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.contact-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 12px;
    background: var(--rv-bg-soft);
    border-radius: var(--rv-r-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rv-text);
}

.contact-pill--whatsapp { background: #e7f7ee; color: var(--rv-success); }
.contact-pill--call     { background: var(--rv-primary-50); color: var(--rv-primary); }

.contact-pill:hover {
    transform: translateY(-1px);
}

/* ---------- 19. Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 40px 24px;
    background: var(--rv-surface);
    border-radius: var(--rv-r-lg);
    border: 1px solid var(--rv-border);
}

.empty-state__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--rv-primary-50);
    color: var(--rv-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.empty-state__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--rv-ink);
    margin-bottom: 6px;
}

.empty-state__text {
    font-size: 13px;
    color: var(--rv-muted);
    margin-bottom: 18px;
    line-height: 1.5;
}

/* ---------- 20. Alerts (replace ugly Bootstrap alerts) ---------- */
.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--rv-r-md);
    border: 1px solid;
    background: var(--rv-surface);
    margin-bottom: 14px;
    box-shadow: var(--rv-shadow-sm);
}

.alert-card__icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
}

.alert-card__body {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--rv-text);
    line-height: 1.45;
}

.alert-card__body strong {
    color: var(--rv-ink);
    display: block;
    font-size: 13.5px;
    margin-bottom: 2px;
}

.alert-card__close {
    background: transparent;
    border: none;
    color: var(--rv-faint);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.alert-card--success {
    border-color: var(--rv-success);
    background: var(--rv-success-50);
}
.alert-card--success .alert-card__icon { background: var(--rv-success); }

.alert-card--error {
    border-color: var(--rv-danger);
    background: var(--rv-danger-50);
}
.alert-card--error .alert-card__icon { background: var(--rv-danger); }

.alert-card--info {
    border-color: var(--rv-info);
    background: var(--rv-info-50);
}
.alert-card--info .alert-card__icon { background: var(--rv-info); }

/* ---------- 21. Bottom navigation ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--rv-surface);
    border-top: 1px solid var(--rv-border);
    box-shadow: var(--rv-shadow-nav);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav__inner {
    max-width: var(--rv-app-max);
    margin: 0 auto;
    height: var(--rv-bottom-nav-h);
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    position: relative;
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--rv-faint);
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    padding-top: 6px;
    transition: color 0.15s;
}

.bottom-nav__item:hover {
    color: var(--rv-muted);
}

.bottom-nav__item i {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav__item.is-active {
    color: var(--rv-primary);
}

.bottom-nav__item.is-active i {
    color: var(--rv-primary);
}

/* Center CTA */
.bottom-nav__cta-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
}

.bottom-nav__cta {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rv-accent), var(--rv-accent-600));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-top: -22px;
    box-shadow: 0 6px 14px rgba(255, 122, 26, 0.45);
    border: 4px solid var(--rv-surface);
    text-decoration: none;
    transition: transform 0.15s;
}

.bottom-nav__cta:hover,
.bottom-nav__cta:active {
    color: #fff;
    transform: translateY(-2px);
}

.bottom-nav__cta.is-active {
    background: linear-gradient(135deg, var(--rv-primary), var(--rv-primary-700));
    box-shadow: 0 6px 14px rgba(13, 78, 166, 0.4);
}

/* Safe area helper */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- 22. Utility ---------- */
.text-muted-rv { color: var(--rv-muted); }
.text-faint-rv { color: var(--rv-faint); }

.divider {
    height: 1px;
    background: var(--rv-border);
    margin: 14px 0;
}

.spinner-rv {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rv-spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes rv-spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: rv-fade 0.3s ease-out;
}

@keyframes rv-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 23. Desktop refinement (>=768px) ---------- */
@media (min-width: 768px) {
    .app-shell {
        max-width: 540px;
        padding: 20px;
        padding-top: calc(var(--rv-header-h) + 20px);
    }

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

    .visit-card__top {
        gap: 14px;
    }

    .visit-card__thumb {
        width: 76px;
        height: 76px;
    }

    .page-hero {
        padding: 26px;
    }

    .page-hero__title {
        font-size: 24px;
    }
}

@media (min-width: 992px) {
    .app-shell {
        max-width: 600px;
    }
}

/* Print */
@media print {
    .app-header, .bottom-nav, .submit-sticky, .visit-card__actions, .action-button {
        display: none !important;
    }
    body {
        background: #fff;
        padding: 0;
    }
    .mobile-card, .form-card, .visit-card, .stat-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}
