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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

body.has-layout {
    padding: 0;
    align-items: stretch;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 500px;
    width: 100%;
}

/* Dashboard two-column layout */
.layout {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.sidebar-logo span {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.sidebar-user {
    margin-bottom: 16px;
}

.sidebar-user .user-name {
    font-weight: 500;
    color: #1a1a1a;
    font-size: 15px;
}

.sidebar-user .user-email {
    color: #666;
    font-size: 13px;
    word-break: break-all;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 20px;
}

.status-badge.subscriber {
    background: #e6f4ea;
    color: #2ea44f;
}

.status-badge.guest {
    background: #e8f0fe;
    color: #4285f4;
}

.sidebar-calendars {
    margin-bottom: 20px;
}

.sidebar-calendars h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin-bottom: 8px;
}

.sidebar-calendars ul {
    list-style: none;
    padding: 0;
}

.sidebar-calendars li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
}

.calendar-icon {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background-color: #4285f4;
    flex-shrink: 0;
    margin-top: 4px;
}

.calendar-info {
    flex: 1;
    min-width: 0;
}

.calendar-name {
    font-size: 14px;
    color: #444;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-owner {
    font-size: 12px;
    color: #888;
    margin-top: 1px;
}

.sidebar .logout-link {
    margin-top: auto;
}

.layout .main {
    flex: 1;
    padding: 40px;
    max-width: 600px;
}

.layout .main .container {
    box-shadow: none;
    padding: 0;
    max-width: none;
}

/* Invite page logo */
.invite-logo {
    text-align: center;
    margin-bottom: 20px;
}

.invite-logo img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 16px 20px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        gap: 12px;
    }

    .sidebar-logo {
        margin-bottom: 0;
    }

    .sidebar-user {
        margin-bottom: 0;
        flex: 1;
    }

    .status-badge {
        margin-bottom: 0;
    }

    .sidebar-calendars {
        width: 100%;
        margin-bottom: 0;
    }

    .sidebar .logout-link {
        margin-top: 0;
    }

    .layout .main {
        padding: 20px;
    }
}

h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #1a1a1a;
}

h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.subtitle {
    color: #666;
    margin-bottom: 24px;
}

.invite-info {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.invite-info .calendar-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.invite-info .inviter {
    color: #666;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #4285f4;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #3367d6;
}

.btn-secondary {
    background: #e8e8e8;
    color: #333;
}

.btn-secondary:hover {
    background: #d8d8d8;
}

.btn-danger {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.google-icon {
    width: 20px;
    height: 20px;
}

.credentials-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.credentials-box h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credential-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.credential-row:last-child {
    border-bottom: none;
}

.credential-label {
    color: #666;
    font-size: 14px;
    flex-shrink: 0;
}

.credential-value {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 14px;
}

.copy-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.copy-btn:hover {
    color: #333;
    background: #e8e8e8;
}

.copy-btn.copied {
    color: #2ea44f;
}

.credential-input {
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex: 1;
}

.password-list {
    margin: 20px 0;
}

.password-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
}

.password-info {
    flex: 1;
}

.password-description {
    font-weight: 500;
    color: #1a1a1a;
}

.password-meta {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.instructions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

.instructions h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.instruction-section {
    margin-bottom: 20px;
}

.instruction-section h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instruction-section ol {
    padding-left: 20px;
    color: #444;
}

.instruction-section li {
    margin-bottom: 8px;
}

.error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.success {
    background: #efe;
    border: 1px solid #cfc;
    color: #060;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.hidden {
    display: none !important;
}

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

.logout-link {
    display: block;
    text-align: center;
    margin-top: 24px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.logout-link:hover {
    color: #333;
    text-decoration: underline;
}

.tos-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 24px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.tos-box h3 {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.tos-box p {
    margin-bottom: 12px;
    color: #444;
}

.tos-box ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.tos-box li {
    margin-bottom: 10px;
    color: #444;
}

.tos-box a {
    color: #4285f4;
}

.tos-disclosure {
    color: #444;
    margin: 24px 0;
    line-height: 1.8;
}

.tos-disclosure a {
    color: #4285f4;
}

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

.tos-actions .btn-primary {
    flex: 2;
}

.tos-actions .btn-secondary {
    flex: 1;
}

.store-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex !important;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.modal h3 {
    font-size: 18px;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #323232;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
