:root {
    --brand: #e85a1a;
    --brand-dark: #c9480f;
    --ink: #1c1c1c;
    --muted: #5b5b5b;
    --line: #e6e6e6;
    --bg: #ffffff;
    --bg-alt: #fdf6f0;
    --ok: #1f9d55;
    --info: #2563eb;
    --warn: #b7791f;
    --bad: #d1352b;
    --whatsapp: #25d366;
    --radius: 14px;
    --radius-sm: 10px;
    --wrap: 740px;
    --shadow: 0 8px 24px rgba(28, 28, 28, .08);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.app-body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: #f5f6f8;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }

.app-wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 18px;
}

/* Skip link */
.app-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 50;
    background: #fff;
    color: var(--brand);
    padding: 10px 16px;
    border-radius: 0 0 8px 0;
    box-shadow: var(--shadow);
}
.app-skip:focus { left: 12px; top: 12px; }

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(28, 28, 28, .05);
}
.app-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.app-logo { display: inline-flex; align-items: center; text-decoration: none; flex: 0 0 auto; }
.app-logo img { height: 42px; width: auto; }
.app-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}
.app-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    color: var(--ink);
}
.app-nav-link:hover { background: var(--bg-alt); color: var(--brand); }
.app-nav-call {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: .95rem;
}
.app-nav-call:hover { background: var(--brand-dark); color: #fff; }

/* Main */
.app-main { display: block; min-height: 60vh; padding-bottom: 24px; }

/* Headings block */
.app-head { margin: 22px 0 6px; }
.app-head h1 { margin-bottom: 6px; }
.app-head .app-sub { color: var(--muted); margin: 0; }

/* Cards */
.app-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 18px;
}
.app-card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

/* Alerts */
.app-alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: .95rem;
    border: 1px solid var(--line);
    background: var(--bg-alt);
}
.app-alert-error { background: #fdecea; border-color: #f3c3bd; color: #7d241d; }
.app-alert-info { background: #eaf1fd; border-color: #c6d8f7; color: #1b3d7a; }
.app-alert-ok { background: #e9f7ee; border-color: #bfe6cd; color: #14532d; }
.app-alert ul { margin: 6px 0 0; padding-left: 18px; }

/* Forms */
.app-field { margin-bottom: 16px; }
.app-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.app-input,
.app-select,
.app-textarea {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.app-textarea { min-height: 110px; resize: vertical; }
.app-input:focus,
.app-select:focus,
.app-textarea:focus {
    outline: 2px solid rgba(232, 90, 26, .35);
    border-color: var(--brand);
}
.app-input.is-invalid,
.app-select.is-invalid,
.app-textarea.is-invalid { border-color: var(--bad); background: #fff7f6; }
.app-help { display: block; color: var(--muted); font-size: .85rem; margin-top: 5px; }
.app-error { display: block; color: var(--bad); font-size: .85rem; margin-top: 5px; font-weight: 600; }
.app-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Steps indicator */
.app-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
}
.app-steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
}
.app-steps li .n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--brand);
    font-size: .8rem;
}
.app-steps li.is-active { border-color: var(--brand); color: var(--ink); background: var(--bg-alt); }
.app-steps li.is-active .n { background: var(--brand); color: #fff; }
.app-steps li.is-done .n { background: var(--ok); color: #fff; }

/* Step panes */
.app-step { display: none; }
.app-step.is-active { display: block; }
.app-step-title { margin-top: 0; }

/* Choice grids (selects rendered as cards on small screens is avoided; keep selects) */
.app-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.app-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
}
.app-choice input { position: absolute; opacity: 0; pointer-events: none; }
.app-choice:hover { border-color: var(--brand); }
.app-choice:has(input:checked) { border-color: var(--brand); background: var(--bg-alt); box-shadow: 0 0 0 2px rgba(232, 90, 26, .18); }

/* Date cards */
.app-dates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.app-date {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
}
.app-date input { position: absolute; opacity: 0; pointer-events: none; }
.app-date .d-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.app-date .d-day { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.app-date .d-mon { font-size: .78rem; color: var(--muted); }
.app-date:hover { border-color: var(--brand); }
.app-date:has(input:checked) { border-color: var(--brand); background: var(--bg-alt); box-shadow: 0 0 0 2px rgba(232, 90, 26, .18); }

/* Time windows */
.app-windows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}
.app-window {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}
.app-window input { position: absolute; opacity: 0; pointer-events: none; }
.app-window:hover { border-color: var(--brand); }
.app-window:has(input:checked) { border-color: var(--brand); background: var(--bg-alt); box-shadow: 0 0 0 2px rgba(232, 90, 26, .18); }

/* Buttons */
.app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}
.app-actions .app-btn-block { flex: 1 1 100%; }
.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}
.app-btn:hover { transform: translateY(-1px); }
.app-btn-primary { background: var(--brand); color: #fff; }
.app-btn-primary:hover { background: var(--brand-dark); color: #fff; }
.app-btn-outline { background: #fff; color: var(--brand); border-color: var(--brand); }
.app-btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.app-btn-wa { background: var(--whatsapp); color: #fff; border-color: var(--whatsapp); }
.app-btn-block { width: 100%; }

/* Summary / review */
.app-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    margin: 0 0 8px;
}
.app-summary div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
}
.app-summary dt { color: var(--muted); font-weight: 600; }
.app-summary dd { margin: 0; font-weight: 600; text-align: right; }

/* Status badges */
.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    background: var(--bg-alt);
    color: var(--ink);
    border: 1px solid var(--line);
}
.app-badge-pending { background: #fdf3d8; border-color: #f0dc9b; color: #7a5a12; }
.app-badge-ok { background: #e9f7ee; border-color: #bfe6cd; color: #14532d; }
.app-badge-info { background: #eaf1fd; border-color: #c6d8f7; color: #1b3d7a; }
.app-badge-done { background: #e7f6ef; border-color: #a9e2c4; color: #14532d; }
.app-badge-bad { background: #fdecea; border-color: #f3c3bd; color: #7d241d; }

/* Appointment list */
.app-list { list-style: none; padding: 0; margin: 0; }
.app-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.app-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.app-item-num { font-weight: 800; font-size: 1.05rem; }
.app-item-svc { font-weight: 600; }
.app-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    color: #3a3a3a;
    font-size: .92rem;
    margin: 0 0 10px;
}
.app-meta span { display: inline-flex; gap: 6px; }
.app-item-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Detail rows */
.app-detail { margin: 0; padding: 0; }
.app-detail div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.app-detail dt { color: var(--muted); font-weight: 600; }
.app-detail dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }

/* Timeline */
.app-timeline { list-style: none; padding: 0; margin: 0; }
.app-timeline li {
    position: relative;
    padding: 0 0 16px 28px;
    border-left: 2px solid var(--line);
}
.app-timeline li:last-child { padding-bottom: 0; }
.app-timeline li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand);
}
.app-timeline .t-time { display: block; color: var(--muted); font-size: .82rem; }

/* Success screen */
.app-success { text-align: center; padding: 12px 0 6px; }
.app-success .tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e9f7ee;
    color: var(--ok);
    font-size: 2rem;
    margin-bottom: 12px;
}
.app-success-num { font-size: 1.5rem; font-weight: 800; color: var(--brand); }

/* Offline / empty state */
.app-empty { text-align: center; padding: 28px 12px; }
.app-empty h2 { margin-bottom: 6px; }

/* Footer */
.app-footer {
    background: #17161a;
    color: #cfcfcf;
    padding: 28px 0;
    text-align: center;
    font-size: .9rem;
    margin-top: 24px;
}
.app-footer-brand { color: #fff; font-size: 1.02rem; margin-bottom: 4px; font-weight: 700; }
.app-footer-note { color: #a9a9a9; margin-bottom: 4px; }
.app-footer-copy { color: #8d8d8d; margin: 0; }

/* Admin read-only view */
.app-admin-flag {
    background: #1b3d7a;
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 12px;
}

/* Utility */
.app-muted { color: var(--muted); }
.app-mt { margin-top: 16px; }
.app-hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.app-hidden { display: none !important; }

@media (max-width: 600px) {
    .app-row { grid-template-columns: 1fr; }
    .app-header-inner { gap: 10px; }
    .app-logo img { height: 36px; }
    .app-nav { gap: 4px; }
    .app-nav-link { padding: 7px 9px; font-size: .9rem; }
    .app-nav-call { padding: 8px 13px; font-size: .9rem; }
    .app-card { padding: 16px; }
    .app-steps li { padding: 6px 11px; font-size: .8rem; }
    .app-date .d-day { font-size: 1.2rem; }
    .app-detail div,
    .app-summary div { flex-direction: column; gap: 2px; }
    .app-detail dd,
    .app-summary dd { text-align: left; }
}