:root {
    --bg: #0f0820;
    --bg-card: #1a0f33;
    --bg-elevated: #241544;
    --border: #3a2a5e;
    --text: #f4eeff;
    --text-muted: #a89bc7;
    --accent: #d4a574;
    --accent-hover: #e0b585;
    --danger: #ff6b8a;
    --success: #7ad9a4;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: linear-gradient(160deg, #0f0820 0%, #1a0b2e 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ===== LOGIN ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 28px;
    border: 1px solid var(--border);
}
.brand { text-align: center; margin-bottom: 32px; }
.brand-icon { font-size: 40px; color: var(--accent); margin-bottom: 8px; }
.brand h1 { font-size: 24px; font-weight: 600; letter-spacing: 0.5px; }
.brand-tagline { color: var(--text-muted); font-size: 13px; margin-top: 4px; font-style: italic; }

label { display: block; margin-bottom: 18px; }
label span { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
input[type=email], input[type=password], input[type=search], input[type=text], textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

.btn-primary, .btn-secondary, .btn-text {
    display: inline-block;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    padding: 12px 18px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, transform 0.05s;
    font-family: inherit;
}
.btn-primary {
    background: var(--accent);
    color: #1a0b2e;
    width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-text {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
    font-size: 13px;
}
.btn-text:hover { color: var(--text); }

.error {
    color: var(--danger);
    font-size: 14px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 107, 138, 0.1);
    border-radius: var(--radius-sm);
}
.footer-note { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 24px; }

/* ===== APP ===== */
.app-page { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.brand-mini .brand-icon { font-size: 18px; color: var(--accent); }
.user-menu { display: flex; align-items: center; gap: 4px; }
.user-name { font-size: 13px; color: var(--text-muted); margin-right: 6px; }

.tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 14px 18px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    font-family: inherit;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.app-main { padding: 20px; flex: 1; max-width: 720px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.date-pill {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: 999px;
}

.client-list { display: flex; flex-direction: column; gap: 10px; }
.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}
.client-card:hover { background: var(--bg-elevated); }
.client-card:active { transform: scale(0.99); }
.client-sign {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #c8956b);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    color: #1a0b2e;
}
.client-info { flex: 1; min-width: 0; }
.client-name { font-size: 15px; font-weight: 500; }
.client-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.client-badge {
    font-size: 11px;
    background: rgba(122, 217, 164, 0.15);
    color: var(--success);
    padding: 3px 8px;
    border-radius: 999px;
    margin-left: 8px;
}

.upcoming-day { margin-bottom: 24px; }
.upcoming-day-title {
    font-size: 13px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.loading, .empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

.muted { color: var(--text-muted); font-size: 13px; }

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    padding: 0;
    backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-card {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px 20px 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-bottom: none;
}
@media (min-width: 600px) {
    .modal { align-items: center; padding: 20px; }
    .modal-card { border-radius: var(--radius); border-bottom: 1px solid var(--border); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 10px;
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}
.modal textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    line-height: 1.5;
    font-size: 15px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.modal-actions .btn-primary, .modal-actions .btn-secondary {
    flex: 1;
    min-width: 140px;
}
.modal-actions .btn-primary[disabled] { opacity: 0.5; pointer-events: none; }

#search-input { margin-bottom: 16px; }
