:root {
    --brand: #4f46e5;
    --brand-dark: #3730a3;
    --brand-light: #eef2ff;
    --bg: #f6f7fb;
    --card: #ffffff;
    --border: #e5e7f0;
    --text: #1f2130;
    --muted: #6b7280;
    --danger: #dc2626;
    --success: #16a34a;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 16px 40px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

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

a { color: inherit; }

/* --- Top bar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; text-decoration: none; }
.topbar .brand-logo { height: 30px; display: block; }

.nav-toggle-checkbox { display: none; }
.nav-toggle-label {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.nav-toggle-label span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}
.topbar nav a:hover { background: var(--brand-light); color: var(--brand-dark); }
.topbar nav a.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.topbar .account { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); }
.topbar .account .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.topbar .account .avatar-image { object-fit: cover; background: none; display: block; }
.topbar .account a {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background .15s ease, color .15s ease;
}
.topbar .account a:hover { background: #fef2f2; color: var(--danger); }

@media (max-width: 760px) {
    .nav-toggle-label { display: flex; }
    .topbar { flex-wrap: wrap; }
    .topbar nav {
        order: 3;
        flex-basis: 100%;
        flex-direction: column;
        gap: 2px;
        max-height: 0;
        overflow: hidden;
        transition: max-height .2s ease;
    }
    .topbar nav a { padding: 10px 14px; }
    .nav-toggle-checkbox:checked ~ nav { max-height: 320px; margin-top: 10px; }
    .topbar .account { order: 2; margin-left: auto; }
}

.content { max-width: 1000px; margin: 32px auto; padding: 0 16px 48px; }

h1 { font-size: 26px; font-weight: 700; margin: 0 0 20px; letter-spacing: -0.01em; }

/* --- Buttons --- */
.btn, button[type="submit"], .form-card button, .auth-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: white;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover, button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.04);
}
.btn:active, button[type="submit"]:active { transform: translateY(0); }
.btn.secondary {
    background: var(--card);
    color: var(--brand);
    border: 1px solid var(--border);
    box-shadow: none;
}
.btn.secondary:hover { background: var(--brand-light); border-color: var(--brand); }
.btn.small { padding: 7px 12px; font-size: 12px; }

.actions { display: flex; gap: 12px; margin-bottom: 24px; }

/* --- Cards / forms --- */
.auth-card, .form-card {
    max-width: 420px;
    margin: 48px auto;
    background: var(--card);
    padding: 36px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}
.auth-card h1, .form-card h1 { margin-bottom: 6px; }
.auth-card form, .form-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }

.auth-split {
    display: flex;
    max-width: 900px;
    margin: 48px auto;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.auth-illustration { flex: 1 1 50%; min-width: 0; background: var(--brand-light); }
.auth-illustration img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-split .auth-card { flex: 1 1 50%; margin: 0; max-width: none; border: none; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; justify-content: center; }
@media (max-width: 720px) {
    .auth-illustration { display: none; }
    .auth-split { display: block; box-shadow: var(--shadow-md); }
}

label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
label.checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, textarea {
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}
.error {
    color: var(--danger);
    font-size: 13px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

/* --- Meetings table --- */
table.meetings {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
table.meetings th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
table.meetings td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
table.meetings tbody tr:last-child td { border-bottom: none; }
table.meetings tbody tr { transition: background .12s ease; }
table.meetings tbody tr:hover { background: var(--bg); }
table.meetings code {
    background: var(--brand-light);
    color: var(--brand-dark);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--brand-light);
    color: var(--brand-dark);
}
.badge-live { background: #dcfce7; color: #166534; }
.badge-scheduled { background: #fef9c3; color: #854d0e; }
.badge-ended { background: #f3f4f6; color: #4b5563; }

.empty {
    color: var(--muted);
    text-align: center;
    padding: 40px 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
}

/* --- Calendar / contact list cards --- */
ul.calendar-list, ul.contact-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.calendar-list li, .contact-row {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 14px;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease, transform .15s ease;
}
ul.calendar-list li:hover, .contact-row:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
ul.calendar-list li a { color: var(--brand); text-decoration: none; font-weight: 600; font-size: 13px; }
ul.calendar-list li a:hover { text-decoration: underline; }

.contacts-search { display: flex; gap: 10px; margin-bottom: 24px; max-width: 480px; }
.contacts-search input { flex: 1; }

.contact-row .avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.contact-row .avatar-image { object-fit: cover; background: none; }
.contact-row .contact-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.contact-row .muted { color: var(--muted); font-size: 13px; }
.contact-row form { margin: 0; }

.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-online .status-dot { background: var(--success); box-shadow: 0 0 0 3px #dcfce7; }
.status-online { color: #166534; }
.status-offline .status-dot { background: #9ca3af; }
