/* ── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}
html, body {
    height: 100%;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont,
                 Roboto, sans-serif;
    font-size: 14px; color: #1f1f1f;
}
body { background: #f5f5f5; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── LOGIN ────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
    padding: 20px;
}
.login-box {
    background: white; border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.2);
    width: 100%; max-width: 420px; overflow: hidden;
}
.login-brand {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    padding: 40px 40px 32px;
    text-align: center; color: white;
}
.brand-icon {
    font-size: 48px; display: block; margin-bottom: 12px;
}
.login-brand h1 {
    font-size: 24px; font-weight: 700; margin-bottom: 8px;
}
.login-brand p { opacity: .85; font-size: 14px; }
.login-form { padding: 36px 40px; }
.input-group { margin-bottom: 20px; }
.input-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: #5f6368; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: .5px;
}
.input-group input {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; transition: all .2s; background: #fafafa;
}
.input-group input:focus {
    outline: none; border-color: #1a73e8;
    background: white;
    box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
.login-form button {
    width: 100%; padding: 13px;
    background: #1a73e8; color: white;
    border: none; border-radius: 8px;
    font-size: 15px; font-weight: 600;
    transition: all .2s; margin-top: 8px;
}
.login-form button:hover {
    background: #1557b0; transform: translateY(-1px);
}
.login-form button:active { transform: translateY(0); }
.login-form button:disabled {
    background: #9aa0a6; cursor: not-allowed; transform: none;
}
.login-error {
    color: #d93025; font-size: 13px;
    margin-top: 14px; text-align: center; min-height: 20px;
}

/* ── APP SHELL ────────────────────────────────────────────────── */
.app-page {
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
}

/* ── TOP NAV ──────────────────────────────────────────────────── */
.topnav {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 16px; height: 56px;
    background: white; border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    flex-shrink: 0; gap: 12px; z-index: 100;
}
.nav-left  { display: flex; align-items: center; gap: 12px; }
.nav-center {
    display: flex; align-items: center; gap: 8px;
    flex: 1; justify-content: center;
}
.nav-right { display: flex; align-items: center; gap: 10px; }
.hamburger {
    background: none; border: none;
    font-size: 20px; color: #5f6368;
    padding: 6px; border-radius: 50%;
    transition: background .2s;
}
.hamburger:hover { background: #f1f3f4; }
.nav-brand {
    font-size: 18px; font-weight: 600;
    color: #1f1f1f; white-space: nowrap;
}
.nav-btn {
    background: none; border: 1px solid transparent;
    color: #3c4043; padding: 6px 14px;
    border-radius: 20px; font-size: 13px; font-weight: 500;
    transition: all .2s;
}
.nav-btn:hover { background: #f1f3f4; border-color: #dadce0; }
.nav-arrow { font-size: 20px; padding: 4px 10px; }
.nav-month {
    font-size: 18px; font-weight: 500;
    color: #1f1f1f; min-width: 200px; text-align: center;
}
.nav-user  { font-size: 13px; color: #5f6368; white-space: nowrap; }
.nav-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #1a73e8; color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.signout {
    background: #fce8e6; color: #d93025;
    border-color: #f5c6c2 !important; font-weight: 600;
}
.signout:hover { background: #f5c6c2; }

/* ── APP LAYOUT ───────────────────────────────────────────────── */
.app-layout {
    display: flex; flex: 1; overflow: hidden;
}

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar {
    width: 240px; flex-shrink: 0;
    background: white; border-right: 1px solid #e0e0e0;
    padding: 16px 0; display: flex; flex-direction: column;
    gap: 20px; overflow-y: auto;
    transition: width .3s, padding .3s;
}
.sidebar.collapsed {
    width: 0; overflow: hidden; padding: 0;
}
.new-event-btn {
    margin: 0 16px; padding: 12px 20px;
    background: white; color: #1a73e8;
    border: 2px solid #dadce0; border-radius: 24px;
    font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    transition: all .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.new-event-btn span { font-size: 20px; font-weight: 400; }
.new-event-btn:hover {
    background: #f8f9fa; border-color: #c6c6c6;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.mini-cal-wrap { padding: 0 8px; }
.mini-cal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 4px; margin-bottom: 8px;
}
.mini-cal-header span {
    font-size: 13px; font-weight: 600; color: #3c4043;
}
.mini-cal-header button {
    background: none; border: none; color: #5f6368;
    font-size: 18px; padding: 4px; border-radius: 50%;
    transition: background .2s;
}
.mini-cal-header button:hover { background: #f1f3f4; }
.mini-cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}
.mini-cal-weekdays span {
    text-align: center; font-size: 11px; font-weight: 600;
    color: #70757a; padding: 4px 0;
}
.mini-cal-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.mini-day {
    text-align: center; font-size: 12px; padding: 5px 0;
    border-radius: 50%; cursor: pointer; color: #3c4043;
    transition: background .15s;
}
.mini-day:hover:not(.md-other) { background: #f1f3f4; }
.mini-day.md-other { color: #bdc1c6; cursor: default; }
.mini-day.md-today { color: #1a73e8; font-weight: 700; }
.mini-day.md-selected {
    background: #1a73e8 !important;
    color: white !important; border-radius: 50%;
}
.mini-day.md-has-event::after {
    content: ''; display: block;
    width: 4px; height: 4px; border-radius: 50%;
    background: #1a73e8; margin: 1px auto 0;
}
.mini-day.md-selected.md-has-event::after { background: white; }
.sidebar-section { padding: 0 16px; }
.sidebar-label {
    font-size: 11px; font-weight: 700; color: #70757a;
    letter-spacing: .8px; margin-bottom: 8px; padding: 0 4px;
}
.sidebar-cal-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: background .15s; font-size: 13px;
}
.sidebar-cal-item:hover { background: #f1f3f4; }
.sidebar-cal-dot {
    width: 12px; height: 12px; border-radius: 3px;
    background: #1a73e8; flex-shrink: 0;
}

/* ── CALENDAR MAIN ────────────────────────────────────────────── */
.cal-main {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; min-width: 0;
}
.cal-weekday-row {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: white; border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}
.cal-weekday-row div {
    padding: 10px 12px; text-align: center;
    font-size: 12px; font-weight: 700; color: #70757a;
    letter-spacing: .5px; text-transform: uppercase;
    border-right: 1px solid #f0f0f0;
}
.cal-weekday-row div:last-child { border-right: none; }
.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    flex: 1; overflow-y: auto;
    background: #e8eaed; gap: 1px; padding: 1px;
}

/* ── DAY CELL ─────────────────────────────────────────────────── */
.cal-cell {
    background: white; padding: 8px;
    min-height: 110px; display: flex;
    flex-direction: column; cursor: pointer;
    transition: background .15s; overflow: hidden;
}
.cal-cell:hover:not(.cc-other) { background: #f8f9fa; }
.cal-cell.cc-other  { background: #f8f9fa; cursor: default; }
.cal-cell.cc-today  { background: #e8f0fe; }
.cal-cell.cc-selected {
    outline: 2px solid #1a73e8; outline-offset: -2px;
}
.cc-num {
    font-size: 13px; font-weight: 500; color: #3c4043;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; margin-bottom: 4px; flex-shrink: 0;
}
.cc-today .cc-num { background: #1a73e8; color: white; }
.cc-other .cc-num { color: #bdc1c6; }
.cc-pill {
    font-size: 11px; padding: 2px 6px; border-radius: 4px;
    background: #1a73e8; color: white; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer; transition: background .15s;
}
.cc-pill:hover    { background: #1557b0; }
.cc-pill.rsvp-yes   { background: #0f9d58; }
.cc-pill.rsvp-no    { background: #ea4335; }
.cc-pill.rsvp-maybe { background: #f9ab00; }
.cc-more {
    font-size: 11px; color: #1a73e8; padding: 2px 6px;
    cursor: pointer; font-weight: 600;
}
.cc-more:hover { text-decoration: underline; }

/* ── RIGHT PANEL ──────────────────────────────────────────────── */
.right-panel {
    width: 380px; flex-shrink: 0;
    background: white; border-left: 1px solid #e0e0e0;
    display: flex; flex-direction: column; overflow: hidden;
}
.rp-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa; flex-shrink: 0;
}
.rp-header span { font-size: 15px; font-weight: 600; color: #1f1f1f; }
.rp-close {
    background: none; border: none; font-size: 18px;
    color: #5f6368; padding: 4px 8px;
    border-radius: 4px; transition: background .15s;
}
.rp-close:hover { background: #e0e0e0; }
.rp-content { flex: 1; overflow-y: auto; padding: 16px; }

/* ── EVENT CARD ───────────────────────────────────────────────── */
.ev-card {
    background: white; border: 1px solid #e0e0e0;
    border-left: 4px solid #1a73e8;
    border-radius: 8px; padding: 14px; margin-bottom: 12px;
    transition: box-shadow .2s;
}
.ev-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.ev-time {
    font-size: 12px; font-weight: 700;
    color: #1a73e8; margin-bottom: 4px;
}
.ev-title {
    font-size: 14px; font-weight: 600;
    color: #1f1f1f; margin-bottom: 6px;
}
.ev-meta {
    font-size: 12px; color: #5f6368;
    margin-bottom: 3px;
    display: flex; align-items: flex-start; gap: 6px;
}
.ev-actions   { display: flex; gap: 8px; margin-top: 10px; }
.ev-btn {
    flex: 1; padding: 7px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
    border: 1.5px solid; transition: all .2s;
}
.ev-btn-edit  { border-color: #1a73e8; color: #1a73e8; background: white; }
.ev-btn-edit:hover  { background: #1a73e8; color: white; }
.ev-btn-delete { border-color: #ea4335; color: #ea4335; background: white; }
.ev-btn-delete:hover { background: #ea4335; color: white; }
.no-events {
    text-align: center; color: #9aa0a6;
    padding: 40px 20px; font-size: 14px;
}

/* ── ATTENDEE STATUS ─────────────────────────────────────────── */
.attendee-list {
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px; overflow: hidden;
}
.attendee-header {
    padding: 6px 10px;
    background: #f8f9fa;
    font-size: 11px; font-weight: 700;
    color: #5f6368; letter-spacing: .5px;
    border-bottom: 1px solid #e0e0e0;
}
.attendee-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}
.attendee-row:last-child { border-bottom: none; }
.attendee-email { color: #3c4043; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendee-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
    margin-left: 8px;
}
.badge-accepted { background: #e6f4ea; color: #137333; }
.badge-declined { background: #fce8e6; color: #d93025; }
.badge-maybe    { background: #fef7e0; color: #b05d00; }
.badge-pending  { background: #f1f3f4; color: #5f6368; }

/* ── EVENT FORM ───────────────────────────────────────────────── */
.ev-form { display: flex; flex-direction: column; gap: 14px; }
.ev-form .form-group { display: flex; flex-direction: column; gap: 5px; }
.ev-form label {
    font-size: 12px; font-weight: 600; color: #5f6368;
    text-transform: uppercase; letter-spacing: .4px;
}
.ev-form input,
.ev-form textarea,
.ev-form select {
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; transition: all .2s; background: #fafafa;
}
.ev-form input:focus,
.ev-form textarea:focus,
.ev-form select:focus {
    outline: none; border-color: #1a73e8;
    background: white;
    box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}
.ev-form textarea { resize: vertical; min-height: 80px; }
.form-row-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ev-form .btn-primary {
    padding: 11px; background: #1a73e8; color: white;
    border: none; border-radius: 8px;
    font-size: 14px; font-weight: 600; transition: all .2s;
}
.ev-form .btn-primary:hover { background: #1557b0; }
.ev-form .btn-primary:disabled {
    background: #9aa0a6; cursor: not-allowed;
}
.ev-form .btn-secondary {
    padding: 11px; background: white; color: #5f6368;
    border: 1.5px solid #e0e0e0; border-radius: 8px;
    font-size: 14px; font-weight: 600; transition: all .2s;
}
.ev-form .btn-secondary:hover { background: #f1f3f4; }
.form-btns { display: flex; gap: 10px; }
.form-msg {
    padding: 10px 12px; border-radius: 8px;
    font-size: 13px; text-align: center;
}
.form-msg.error   { background: #fce8e6; color: #d93025; }
.form-msg.success { background: #e6f4ea; color: #137333; }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center;
    justify-content: center; padding: 20px;
}
.modal {
    background: white; border-radius: 16px;
    width: 100%; max-width: 520px; max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
    animation: modalIn .25s ease-out;
}
@keyframes modalIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.modal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: white; border-radius: 16px 16px 0 0;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-header button {
    background: rgba(255,255,255,.2); border: none;
    color: white; font-size: 20px;
    width: 32px; height: 32px;
    border-radius: 50%; transition: background .2s;
}
.modal-header button:hover { background: rgba(255,255,255,.35); }
.modal-body { padding: 24px; }

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 1200px) { .right-panel { width: 320px; } }
@media (max-width: 1024px) { .sidebar { width: 200px; } }
@media (max-width: 900px) {
    .sidebar {
        position: fixed; left: 0; top: 56px; bottom: 0;
        z-index: 200; box-shadow: 4px 0 12px rgba(0,0,0,.15);
        width: 260px;
    }
    .sidebar.collapsed { width: 0; }
    .right-panel {
        position: fixed; right: 0; top: 56px; bottom: 0;
        z-index: 200; box-shadow: -4px 0 12px rgba(0,0,0,.15);
        width: 100%; max-width: 380px;
    }
    .nav-center { display: none; }
}
@media (max-width: 600px) {
    .cal-cell   { min-height: 70px; }
    .cc-pill    { display: none; }
    .cc-more    { display: block; }
    .modal      { border-radius: 0; max-width: 100%; }
    .right-panel{ max-width: 100%; }
}