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

:root {
    --bg: #0a0a0a;
    --bg-2: #141414;
    --bg-3: #1a1a1a;
    --border: rgba(255,255,255,0.06);
    --text: #f5f5f5;
    --text-dim: #888;
    --primary: #667eea;
    --primary-dark: #5568d3;
    --danger: #ef4444;
    --success: #22c55e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* AUTH PAGE */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1a1a2e, #0a0a0a);
    padding: 20px;
}
.auth-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.brand {
    font-family: 'Helvetica Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 6px;
    font-weight: 700;
    margin-bottom: 4px;
}
.brand span { color: var(--primary); }
.subtitle { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 30px; letter-spacing: 1px; }

/* FORM */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--primary);
}
.field textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 8px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.btn-icon {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 1.2rem;
}
.btn-icon:hover { border-color: var(--primary); }

.error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; min-height: 20px; }

/* TOPBAR */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}
.topbar-left .brand { font-size: 1.2rem; margin: 0; }
.topbar-right { display: flex; gap: 12px; align-items: center; }
.topbar-right span { color: var(--text-dim); font-size: 0.85rem; }

.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.toolbar h2 {
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.toolbar .btn { width: auto; margin: 0; }

/* CALENDAR */
.calendar {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.cal-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    background: var(--bg-3);
    border-bottom: 1px solid var(--border);
}
.cal-time-col { padding: 10px; }
.cal-day-header {
    padding: 10px;
    text-align: center;
    border-left: 1px solid var(--border);
}
.cal-day-header.today { background: rgba(102,126,234,0.1); }
.cal-day-name {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    font-weight: 600;
}
.cal-day-num {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 4px;
}

.cal-grid {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    position: relative;
    min-height: 960px;
}
.cal-hour-label {
    padding: 4px 8px;
    font-size: 0.7rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    height: 40px;
}
.cal-cell {
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    height: 40px;
    cursor: pointer;
    transition: background 0.15s;
}
.cal-cell:hover { background: rgba(102,126,234,0.05); }

.cal-day-bookings {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
}
.cal-booking {
    position: absolute;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
    font-size: 0.72rem;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-left: 3px solid rgba(0,0,0,0.3);
    z-index: 5;
}
.cal-booking strong { display: block; font-size: 0.8rem; }
.cal-notes {
    font-size: 0.65rem;
    opacity: 0.85;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-content {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content.modal-wide { max-width: 700px; }
.modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}
.modal-actions .btn { width: auto; margin: 0; padding: 10px 20px; }

/* USERS */
.users-list { margin-top: 16px; }
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 12px;
}
.user-email { color: var(--text-dim); font-size: 0.8rem; margin-left: 8px; }
.user-meta { display: flex; gap: 12px; align-items: center; }
.user-meta select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
}
.switch { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-dim); }

/* MOBILE */
@media (max-width: 768px) {
    .main { padding: 12px; }
    .topbar { padding: 12px 16px; }
    .topbar-right span { display: none; }
    .cal-header, .cal-grid { grid-template-columns: 40px repeat(7, 1fr); }
    .cal-day-num { font-size: 1rem; }
    .cal-day-name { font-size: 0.6rem; }
    .cal-booking { font-size: 0.6rem; padding: 2px 4px; }
    .cal-booking strong { font-size: 0.65rem; }
    .form-row { grid-template-columns: 1fr; }
}
