:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --hero-bg: #111827;
    --hero-text: #cbd5e1;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --hero-bg: #020617;
    --hero-text: #94a3b8;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.public-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

.public-hero {
    background: var(--hero-bg);
    color: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
}

.public-hero h1 {
    margin: 0 0 6px;
    font-size: clamp(22px, 5vw, 28px);
}

.public-hero p {
    margin: 0;
    color: var(--hero-text);
    font-size: 14px;
}

.public-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}

.public-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.public-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.public-value {
    font-weight: 700;
    word-break: break-word;
}

.public-btn,
button.public-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
}

.public-btn.green { background: #16a34a; }
.public-btn.gray { background: #64748b; }
.public-btn.whatsapp { background: #15803d; }

.public-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.public-actions > * {
    flex: 1;
    min-width: 120px;
}

.public-msg {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: 700;
}

.public-msg.success { background: #dcfce7; color: #166534; }
.public-msg.error { background: #fee2e2; color: #991b1b; }

[data-theme="dark"] .public-msg.success { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .public-msg.error { background: #7f1d1d; color: #fecaca; }

.status-steps {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.status-steps::-webkit-scrollbar { display: none; }

.status-step {
    flex: 1 0 100px;
    min-width: 90px;
    padding: 10px 8px;
    border-radius: 10px;
    background: var(--border);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.status-step.done { background: #dcfce7; color: #166534; }
.status-step.current { background: var(--primary); color: #fff; }

[data-theme="dark"] .status-step.done { background: #14532d; color: #bbf7d0; }

.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.task-card-header strong {
    display: block;
    font-size: 15px;
}

.task-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.task-card-body {
    padding: 0 16px 16px;
    display: none;
}

.task-card.open .task-card-body { display: block; }

.monter-detail-nav {
    padding: 12px 16px;
}

.monter-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 700;
}

.monter-completed-card {
    text-align: center;
    padding: 28px 20px;
    border: 2px solid #16a34a;
    background: linear-gradient(180deg, #f0fdf4 0%, var(--surface) 100%);
}

.monter-completed-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 28px;
    line-height: 56px;
    font-weight: 700;
}

.monter-completed-title {
    display: block;
    font-size: 22px;
    color: #166534;
    margin-bottom: 8px;
}

.monter-completed-sub {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 18px;
}

.monter-completed-back {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    font-size: 16px;
    padding: 14px 20px;
}

[data-theme="dark"] .monter-completed-card {
    border-color: #22c55e;
    background: linear-gradient(180deg, #14532d33 0%, var(--surface) 100%);
}

[data-theme="dark"] .monter-completed-title {
    color: #86efac;
}

.task-card:not(.open) .task-card-header {
    transition: background 0.15s ease;
}

.task-card:not(.open) .task-card-header:active {
    background: var(--surface-hover, rgba(0, 0, 0, 0.04));
}

.task-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.task-section label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.task-section select,
.task-section input[type="file"],
.task-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.task-section textarea {
    min-height: 80px;
    resize: vertical;
}

.public-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin: -14px -14px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
}

.public-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    gap: 6px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.public-bottom-nav a,
.public-bottom-nav button {
    flex: 1;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    padding: 10px 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.public-bottom-nav a.active,
.public-bottom-nav button.active {
    background: var(--primary);
    color: #fff;
}

#monterPushBtn.active,
#repPushBtn.active,
#pushEnableBtn.active {
    background: #16a34a;
}

#pushCard {
    border-color: var(--primary);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 28px;
}

.login-box h1 {
    margin: 0 0 8px;
    text-align: center;
    color: var(--text);
}

.login-box p {
    margin: 0 0 22px;
    text-align: center;
    color: var(--text-muted);
}

.login-box input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 15px;
    background: var(--bg);
    color: var(--text);
}

.login-box button {
    width: 100%;
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 13px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    min-height: 48px;
}

@media (max-width: 650px) {
    .public-meta { grid-template-columns: 1fr; }
    .public-actions > * { flex: 1 1 100%; }
}
