        :root {
            --brand: #6c757d;
            --brand-2: #495057;
            --ok: #28a745;
            --warn: #ffc107;
            --error: #dc3545;
            --text: #212529;
            --muted: #6c757d;
            --bg-soft: #f8f9fa;
            --border: #dee2e6;
        }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background: #f8f9fa;
            min-height: 100vh;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }
        .main-panel {
            background: white;
            border-radius: 10px;
            padding: 0;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            overflow: hidden;
            margin-top: 20px;
        }
        h1 {
            color: var(--text);
            text-align: center;
            margin-bottom: 20px;
            text-shadow: none;
        }
        .sidebar {
            position: fixed;
            top: 120px;
            left: 0;
            width: 240px;
            height: calc(100vh - 120px);
            background: white;
            border-right: 1px solid var(--border);
            z-index: 999;
            box-shadow: 2px 0 8px rgba(0,0,0,0.1);
            overflow-y: auto;
        }
        .tabs {
            display: flex;
            flex-direction: column;
            margin: 0;
            padding: 10px 0;
            gap: 2px;
        }
        .tab {
            flex: none;
            padding: 15px 20px;
            text-align: left;
            color: var(--text);
            cursor: pointer;
            transition: background 0.3s;
            border: none;
            font-size: 16px;
            font-weight: 600;
            background: transparent;
            position: relative;
            margin: 0 10px;
            border-radius: 8px;
        }
        .tab:hover {
            background: var(--bg-soft);
        }
        .tab.active {
            background: var(--brand);
            color: white;
        }
        .tab-badge {
            display: inline-block;
            min-width: 22px;
            padding: 0 6px;
            margin-left: 6px;
            height: 20px;
            line-height: 20px;
            border-radius: 10px;
            background: var(--muted);
            color: white;
            font-size: 12px;
            font-weight: 700;
            vertical-align: middle;
        }
        .tab.active .tab-badge {
            background: white;
            color: var(--brand);
        }
        .tab-content {
            display: none;
            padding: 30px;
            animation: fadeIn 0.2s ease-in;
        }
        .tab-content.active {
            display: block;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        .config-section {
            background: var(--bg-soft);
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
        }
        h2 {
            color: var(--text);
            margin-top: 0;
            border-bottom: 2px solid var(--brand);
            padding-bottom: 10px;
        }
        h3 {
            color: #555;
            margin-top: 20px;
        }
        input[type="text"], input[type="number"], input[type="date"], textarea, select {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid var(--border);
            border-radius: 6px;
            box-sizing: border-box;
            font-family: inherit;
            font-size: 14px;
        }
        textarea {
            min-height: 100px;
            resize: vertical;
        }
        button {
            background: var(--brand);
            color: white;
            border: none;
            padding: 10px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            margin: 5px;
            transition: background 0.2s;
        }
        button:hover {
            background: #5a67d8;
        }
        .delete-btn { background: var(--error); }
        .delete-btn:hover { background: #c0392b; }
        .start-btn { background: var(--ok); }
        .start-btn:hover { background: #27ae60; }
        .stop-btn { background: var(--warn); }
        .stop-btn:hover { background: #e67e22; }
        
        /* 処理中のボタンスタイル */
        .processing {
            background: #95a5a6 !important;
            cursor: not-allowed !important;
            opacity: 0.7;
        }
        .processing:hover {
            background: #95a5a6 !important;
        }

        /* テンプレートカード用スタイル */
        .template-card:hover {
            transform: translateY(-2px) !important;
            box-shadow: 0 8px 16px rgba(0,0,0,0.4) !important;
        }
        
        .template-card button:hover {
            opacity: 0.9;
            transform: scale(1.02);
        }
        
        .template-card .template-actions button[style*="background: #007bff"]:hover {
            background: #0056b3 !important;
        }
        
        .template-card .template-actions button[style*="background: #dc3545"]:hover {
            background: #c82333 !important;
        }
        
        /* クイック配信カード用スタイル */
        .quick-broadcast-card {
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .quick-broadcast-card:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        }
        
        .quick-broadcast-card button:hover {
            background: #0056b3 !important;
            transform: scale(1.02);
        }
        
        /* レスポンシブデザイン */
        @media (max-width: 768px) {
            .template-grid {
                grid-template-columns: 1fr !important;
                gap: 15px !important;
            }
            
            .template-card {
                padding: 15px !important;
            }
            
            .quick-broadcast-card {
                min-width: 100% !important;
            }
            
            /* テンプレート検索バーをモバイル向けに調整 */
            #template-search {
                min-width: 100% !important;
                margin-bottom: 10px;
            }
            
            .template-card .template-actions {
                flex-direction: column !important;
                gap: 8px !important;
            }
            
            .template-card .template-actions form {
                flex: 1 !important;
            }
            
            /* 新規テンプレート作成フォームをモバイル向けに調整 */
            .template-create-form {
                grid-template-columns: 1fr !important;
                gap: 10px !important;
            }
        }
        
        @media (max-width: 480px) {
            .template-card {
                padding: 12px !important;
                margin: 0 5px;
            }
            
            .template-card h4 {
                font-size: 16px !important;
            }
            
            .quick-broadcast-card {
                padding: 10px !important;
            }
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #eee;
            font-size: 14px;
        }
        th {
            background-color: var(--brand);
            color: white;
        }
        tr:hover { background-color: #f5f5f5; }
        .status {
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: bold;
            display: inline-block;
        }
        .status-online { background: var(--ok); color: white; }
        .status-offline { background: var(--error); color: white; }
        .status-active { background: #3498db; color: white; }
        .message {
            padding: 15px;
            margin: 10px 0;
            border-radius: 5px;
        }
        .success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .warning {
            background: #fff3cd;
            color: #856404;
            border: 1px solid #ffeaa7;
        }
        .party-card {
            background: #ffffff;
            padding: 15px;
            border-radius: 8px;
            margin: 10px 0;
            border: 1px solid #eee;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .party-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            padding-bottom: 10px;
            border-bottom: 1px solid #f1f1f1;
        }
        .party-info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 10px;
            margin: 10px 0;
        }
        .party-members { margin-top: 10px; }
        .member-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 10px;
            margin-top: 10px;
        }
        .member-item {
            display: flex;
            align-items: center;
            padding: 8px;
            background: #f8f9fa;
            border-radius: 5px;
            border: 1px solid #e0e0e0;
            font-size: 14px;
        }
        .member-item.leader {
            background: #fff9e6;
            border-color: #ffd666;
        }
        .member-icon { margin-right: 8px; font-size: 18px; }
        .badge {
            display: inline-block;
            padding: 3px 8px;
            background: var(--brand);
            color: white;
            border-radius: 12px;
            font-size: 12px;
            margin: 2px;
        }
        .leader-badge { background: #ff9800; }
        .vc-badge { background: #4CAF50; }
        .progress-bar {
            width: 100%;
            height: 10px;
            background: #f1f1f5;
            border-radius: 999px;
            overflow: hidden;
            margin: 10px 0 4px;
        }
        .progress-fill {
            height: 100%;
            background: var(--brand);
            transition: width 0.3s;
        }
        .progress-text {
            text-align: right;
            margin-top: 0;
            font-size: 12px;
            color: #999;
        }
        .custom-card {
            background: white;
            border: 1px solid #eee;
            border-radius: 10px;
            padding: 16px;
            margin: 15px 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        }
        .custom-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
            margin-bottom: 12px;
        }
        .custom-title {
            font-size: 18px;
            font-weight: 800;
            color: #222;
        }
        .custom-info {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 10px;
            margin: 12px 0;
        }
        .info-item {
            display: flex;
            align-items: center;
            gap: 6px;
            color: #444;
            font-size: 14px;
        }
        .info-label {
            font-weight: 600;
            color: #666;
            min-width: 100px;
        }
        .notification-schedule {
            color: #2ecc71;
            font-weight: 600;
        }
        .notification-details {
            color: #7f8c8d;
            font-size: 12px;
            font-weight: normal;
            margin-left: 4px;
        }
        .notification-schedule-none {
            color: #95a5a6;
            font-style: italic;
        }
        .action-buttons {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        .party-details-toggle {
            cursor: pointer;
            user-select: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: var(--brand);
            font-weight: 600;
            margin-top: 8px;
            padding: 6px 0;
        }
        .party-details-toggle:hover { color: #5a67d8; }
        .party-details { display: none; margin-top: 10px; }
        .party-details.show { display: block; }
        .help-text {
            color: #666;
            font-size: 13px;
            margin-top: 5px;
        }
        .announcement-section {
            background: #e8f4fd;
            padding: 20px;
            border-radius: 8px;
            margin-top: 20px;
        }
        .party-selector {
            max-height: 200px;
            overflow-y: auto;
            border: 1px solid #ddd;
            border-radius: 5px;
            padding: 10px;
            background: white;
        }
        .party-checkbox { display: block; margin: 5px 0; padding: 5px; }
        .party-checkbox:hover { background: #f0f0f0; }
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
        }
        .modal-content {
            background-color: white;
            margin: 10% auto;
            padding: 20px;
            border-radius: 10px;
            width: 92%;
            max-width: 560px;
        }
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
        }
        .close:hover { color: #000; }
        .vc-status {
            display: inline-block;
            padding: 3px 8px;
            background: #4CAF50;
            color: white;
            border-radius: 5px;
            font-size: 12px;
            margin-left: 10px;
        }
        .bot-status-header {
            position: fixed;
            top: 20px;
            right: 20px;
            background: white;
            padding: 12px 16px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            z-index: 1050;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .bot-status-info {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .bot-status-text {
            font-size: 14px;
            font-weight: 600;
            color: #333;
        }
        .fixed-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            background: white;
            border-bottom: 1px solid var(--border);
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
            padding-bottom: 10px;
        }
        .fixed-header h1 { margin-bottom: 15px; }
        .main-content { 
            padding-top: 140px; 
            margin-left: 250px;
        }
        .toast-container {
            position: fixed;
            top: 180px;
            right: 20px;
            z-index: 1100;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .toast {
            background: white;
            padding: 16px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            border-left: 4px solid var(--brand);
            max-width: 420px;
            transform: translateX(100%);
            transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
            opacity: 0;
        }
        .toast.show { transform: translateX(0); opacity: 1; }
        .toast.success { border-left-color: var(--ok); }
        .toast.error { border-left-color: var(--error); }
        .toast.warning { border-left-color: var(--warn); }
        .toast-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }
        .toast-title { font-weight: 600; color: #333; }
        .toast-close {
            background: none;
            border: none;
            font-size: 18px;
            cursor: pointer;
            color: #999;
            padding: 0; width: 20px; height: 20px;
            display: flex; align-items: center; justify-content: center;
        }
        .toast-close:hover { color: #333; }
        .toast-message { color: #666; font-size: 14px; line-height: 1.4; }

        /* 検索・フィルターUI */
        .controls-bar {
            display: grid;
            grid-template-columns: 1fr repeat(3, minmax(140px, 220px));
            gap: 12px;
            align-items: center;
            margin: 10px 0 18px;
        }
        .controls-bar .control {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .controls-bar label {
            font-size: 12px;
            color: #666;
            font-weight: 600;
        }
        .summary-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 12px;
            margin: 10px 0 16px;
        }
        .summary-card {
            background: #fff;
            border: 1px solid #eee;
            border-radius: 10px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.04);
        }
        .summary-card .label { font-size: 12px; color: #777; font-weight: 700; }
        .summary-card .value { font-size: 20px; font-weight: 900; color: #222; }
        .summary-card.active { border-left: 4px solid #3498db; }
        .summary-card.parties { border-left: 4px solid #8e44ad; }
        .no-results {
            display: none;
            text-align: center;
            color: #666;
            background: #fafafa;
            border: 1px dashed #ddd;
            padding: 24px;
            border-radius: 8px;
            margin: 12px 0;
        }
        .scroll-top-btn {
            position: fixed;
            right: 20px;
            bottom: 20px;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: var(--brand);
            color: #fff;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            box-shadow: 0 6px 14px rgba(0,0,0,0.18);
            z-index: 1000;
        }
        .scroll-top-btn.show { display: flex; }
        .primary-btn {
            background: var(--brand);
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-weight: 600;
            transition: background 0.3s;
        }
        .primary-btn:hover {
            background: var(--brand-2);
        }
        
        /* レスポンシブ対応 */
        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-100%);
                transition: transform 0.3s ease;
            }
            .sidebar.show {
                transform: translateX(0);
            }
            .main-content {
                margin-left: 0;
                padding-top: 140px;
            }
            .sidebar-toggle {
                display: block;
                position: fixed;
                top: 130px;
                left: 10px;
                z-index: 1001;
                background: var(--brand);
                color: white;
                border: none;
                padding: 10px;
                border-radius: 5px;
                cursor: pointer;
                box-shadow: 0 2px 8px rgba(0,0,0,0.2);
            }
        }
        
        .sidebar-toggle {
            display: none;
        }
        
        /* モーダルウィンドウスタイル */
        .modal {
            display: none;
            position: fixed;
            z-index: 9999;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            backdrop-filter: blur(3px);
        }
        
        .modal-content {
            background-color: white;
            margin: 5% auto;
            border-radius: 12px;
            width: 90%;
            max-width: 500px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.3);
            animation: modalOpen 0.3s ease-out;
        }
        
        @keyframes modalOpen {
            from {
                opacity: 0;
                transform: translateY(-30px) scale(0.95);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }
        
        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 25px;
            background: var(--brand);
            color: white;
            border-radius: 12px 12px 0 0;
        }
        
        .modal-header h2 {
            margin: 0;
            font-size: 20px;
            font-weight: 600;
        }
        
        .modal-close {
            font-size: 28px;
            font-weight: bold;
            cursor: pointer;
            line-height: 1;
            color: white;
            opacity: 0.8;
            transition: opacity 0.2s;
        }
        
        .modal-close:hover {
            opacity: 1;
        }
        
        .modal-body {
            padding: 25px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 6px;
            font-weight: 600;
            color: #333;
        }
        
        .form-group input {
            width: 100%;
            padding: 12px;
            border: 2px solid #e1e5e9;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.2s, box-shadow 0.2s;
            box-sizing: border-box;
        }
        
        .form-group input:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }
        
        .modal-actions {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
            margin-top: 25px;
            padding-top: 20px;
            border-top: 1px solid #e1e5e9;
        }
        
        .modal-actions button {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .cancel-btn {
            background: #f8f9fa;
            color: #6c757d;
            border: 2px solid #e1e5e9;
        }
        
        .cancel-btn:hover {
            background: #e9ecef;
            border-color: #adb5bd;
        }
        
        .create-btn {
            background: var(--ok);
            color: white;
        }
        
        .create-btn:hover {
            background: #27ae60;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
        }
        
