:root {
    --primary: #2d6a4f;
    --primary-dark: #1b4332;
    --accent: #d4a373;
    --bg: #f7f7f5;
    --card-bg: #ffffff;
    --text: #1b1b1f;
    --text-muted: #6b6b70;
    --danger: #b3261e;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

#pin-screen, #app-screen { min-height: 100vh; }

.hidden { display: none !important; }

.centered-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    text-align: center;
}

.logo-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.logo-sub { color: var(--text-muted); margin-bottom: 28px; }

.pin-dots { display: flex; gap: 14px; margin-bottom: 24px; }
.pin-dot {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;
}
.pin-dot.filled { background: var(--primary); }

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 14px;
}
.pin-key {
    width: 72px; height: 72px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: var(--card-bg);
    font-size: 1.5rem;
    cursor: pointer;
}
.pin-key:active { background: #eee; }
.pin-error { color: var(--danger); min-height: 1.4em; margin-top: 12px; }

header.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--primary);
    color: white;
}
header.topbar h1 { font-size: 1.1rem; margin: 0; }
header.topbar button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

.view-toggle {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
}
.view-toggle button {
    flex: 1;
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid #ddd;
    background: var(--card-bg);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
}
.view-toggle button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

main { padding: 16px; padding-bottom: 90px; max-width: 760px; margin: 0 auto; }

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 14px 0;
}
.calendar-nav button {
    border: none; background: var(--card-bg); border-radius: 8px;
    padding: 8px 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.calendar-day-label { text-align: center; font-size: 0.75rem; color: var(--text-muted); padding: 4px 0; }
.calendar-cell {
    min-height: 64px;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 4px;
    font-size: 0.75rem;
    position: relative;
    cursor: pointer;
}
.calendar-cell.outside-month { opacity: 0.35; }
.calendar-cell.today { border: 2px solid var(--primary); }
.calendar-cell .day-num { font-weight: 600; }
.calendar-cell .appt-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    margin: 1px;
}

.appointment-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.appointment-card .appt-type {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-dark);
    background: #e6f0ea;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 4px;
}
.appointment-card .appt-time { font-weight: 700; color: var(--primary-dark); }
.appointment-card .appt-name { font-size: 1rem; margin: 2px 0; }
.appointment-card .appt-meta { font-size: 0.8rem; color: var(--text-muted); }
.appointment-card .appt-actions { display: flex; flex-direction: column; gap: 6px; }
.appointment-card button {
    border: none; border-radius: 6px; padding: 6px 10px; font-size: 0.75rem; cursor: pointer;
}
.btn-cancel { background: #fbe9e7; color: var(--danger); }
.btn-edit { background: #eef2ff; color: #3b4dbb; }

.badge-deposit-paid { color: #2d6a4f; font-weight: 600; }
.badge-deposit-pending { color: #b36b00; font-weight: 600; }

.fab {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.8rem;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    cursor: pointer;
}

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 50;
}
@media (min-width: 640px) {
    .modal-overlay { align-items: center; }
}
.modal-sheet {
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    width: 100%; max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 20px;
}
@media (min-width: 640px) {
    .modal-sheet { border-radius: 16px; }
}
.modal-sheet h2 { margin-top: 0; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.form-row input, .form-row select, .form-row textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn-primary {
    flex: 1; background: var(--primary); color: white; border: none;
    padding: 12px; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-secondary {
    flex: 1; background: #eee; color: var(--text); border: none;
    padding: 12px; border-radius: 8px; cursor: pointer;
}
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; }
.form-success { color: var(--primary); font-size: 0.85rem; margin-top: 8px; }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 10px; }

.settings-section { margin-bottom: 20px; }
.settings-section h3 { font-size: 0.95rem; color: var(--primary-dark); margin-bottom: 8px; }
.settings-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: -6px; margin-bottom: 10px; }
