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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
}

/* ロゴスタイル */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.logo-img {
    height: 36px;
    width: auto;
}

.guide-link {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 6px 14px !important;
    font-size: 13px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: 500;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.messages {
    padding: 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert p {
    margin: 5px 0;
}

main {
    padding: 30px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

section h2 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.5em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.account-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.account-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.account-card.main-account {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.account-card.empty {
    text-align: center;
    padding: 40px;
}

.account-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.account-details {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.account-email {
    font-weight: 600;
    color: #495057;
    font-size: 1.1em;
}

.account-status {
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
}

.account-status.connected {
    background: #28a745;
}

.account-type {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.badge-google {
    background: #4285f4;
    color: white;
}

.badge-teams {
    background: #6264a7;
    color: white;
}

.account-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.visibility-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.sync-visibility-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-visibility-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9em;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sync-visibility-options label:hover {
    background-color: #f8f9fa;
}

.warning-text {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.85em;
}

.custom-name-input {
    margin-top: 10px;
    margin-left: 24px;
}

.custom-name-input input {
    width: 200px;
    padding: 6px 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9em;
}

.section-description {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.delete-form {
    margin-left: auto;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.1em;
}

.sync-section {
    text-align: center;
}

.sync-info {
    margin-top: 15px;
    color: #6c757d;
    font-size: 0.9em;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.empty-state p {
    margin-bottom: 15px;
}

.hint {
    font-size: 0.9em;
    color: #adb5bd;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.logs-table thead {
    background: #667eea;
    color: white;
}

.logs-table th,
.logs-table td {
    padding: 12px 15px;
    text-align: left;
}

.logs-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

.logs-table tbody tr:hover {
    background: #f8f9fa;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #6c757d;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9em;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-links .separator {
    color: #adb5bd;
}

.footer-links-secondary {
    margin-top: 8px;
}

/* 認証画面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #495057;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-block {
    width: 100%;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    color: #6c757d;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-description {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.reset-url-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.url-display {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.url-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9em;
    background: white;
}

.url-hint {
    margin-top: 10px;
    font-size: 0.85em;
    color: #6c757d;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #6c757d;
}

/* 設定画面 */
.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.3em;
}

.settings-section h4 {
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 1.1em;
}

.settings-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.connection-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.connected-account {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.not-connected {
    color: #6c757d;
    margin-bottom: 15px;
}

.connection-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.add-account-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* 他の同期先から追加セクション */
.quick-add-section {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

.quick-add-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.quick-add-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-add-buttons .btn {
    font-size: 0.85em;
}

/* フッター注意事項 */
.footer-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 15px;
}

.notice-text {
    margin: 5px 0;
    font-size: 12px;
    color: #856404;
}

/* プライバシー通知 */
.privacy-notice {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #a5d6a7;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
}

.privacy-notice p {
    margin: 4px 0;
    font-size: 14px;
    color: #2e7d32;
}

.privacy-notice p:first-child {
    font-size: 15px;
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo {
        height: 28px;
    }
    
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .account-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .account-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .logs-table {
        font-size: 0.9em;
    }
    
    .logs-table th,
    .logs-table td {
        padding: 8px;
    }
    
    .connection-buttons,
    .add-account-buttons {
        flex-direction: column;
    }
    
    .connection-buttons .btn,
    .add-account-buttons .btn {
        width: 100%;
    }
}

