* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
        body { background: #f0f2f5; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
        .auth-container, .app-container { width: 100%; max-width: min(1600px, calc(100vw - 24px)); background: #fff; border-radius: 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.12); overflow: hidden; }
        .auth-container { max-width: 440px; padding: 40px 30px; margin: 0 auto; }
        .auth-container h1 { font-size: 28px; font-weight: 600; margin-bottom: 8px; color: #1a1a2e; text-align: center; }
        .auth-container .sub { text-align: center; color: #666; margin-bottom: 30px; font-size: 15px; }
        .auth-container .switch-link { text-align: center; margin-top: 20px; font-size: 14px; color: #666; }
        .auth-container .switch-link a { color: #4a6cf7; cursor: pointer; text-decoration: none; font-weight: 500; }
        .form-group { margin-bottom: 18px; }
        .form-group label { display: block; font-weight: 500; font-size: 14px; color: #333; margin-bottom: 6px; }
        .form-group input, .form-group select { width: 100%; padding: 12px 16px; border: 1px solid #ddd; border-radius: 10px; font-size: 15px; transition: 0.2s; outline: none; background: #fff; }
        .form-group input:focus, .form-group select:focus { border-color: #4a6cf7; box-shadow: 0 0 0 3px rgba(74,108,247,0.15); }
        .btn-primary { width: 100%; padding: 14px; background: #4a6cf7; color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.2s; }
        .btn-primary:hover { background: #3a5cdb; }
        .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
        .alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
        .alert-danger { background: #fee; color: #b33; border: 1px solid #fcc; }
        .alert-success { background: #efe; color: #2a7a2a; border: 1px solid #cfc; }
        .hidden { display: none !important; }

        .app-container { display: flex; flex-direction: column; height: 94vh; max-height: 1000px; }
        .app-header { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
        .app-header h1 { font-size: 22px; font-weight: 600; color: #1a1a2e; }
        .app-header .user-info { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #555; }
        .app-header .user-info .logout { color: #e74c3c; cursor: pointer; font-weight: 500; background: none; border: none; font-size: 14px; }
        .app-header .user-info .logout:hover { text-decoration: underline; }
        .profile-link { color:inherit; background:none; border:0; cursor:pointer; font:inherit; padding:6px 0; }
        .profile-link:hover { color:#fff; text-decoration:underline; }
        .app-body { display: flex; flex: 1; overflow: hidden; }
        .sidebar { width: 280px; min-width: 200px; background: #fafafa; border-right: 1px solid #e0e0e0; display: flex; flex-direction: column; overflow-y: auto; padding: 12px 0; }
        .sidebar .section-title { padding: 8px 18px; font-size: 13px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
        .sidebar .bot-item, .sidebar .user-item { padding: 12px 18px; cursor: pointer; border-left: 3px solid transparent; transition: 0.15s; display: flex; justify-content: space-between; align-items: center; }
        .sidebar .bot-item:hover, .sidebar .user-item:hover { background: #edf2fa; }
        .sidebar .bot-item.active { background: #e6edf7; border-left-color: #4a6cf7; }
        .sidebar .bot-item .badge { background: #4a6cf7; color: #fff; border-radius: 20px; padding: 2px 10px; font-size: 12px; }
        .sidebar .add-bot-btn { margin: 12px 18px; padding: 10px; background: #4a6cf7; color: #fff; border: none; border-radius: 10px; font-weight: 500; cursor: pointer; transition: 0.2s; font-size: 14px; }
        .sidebar .add-bot-btn:hover { background: #3a5cdb; }
        .chat-area { flex: 1; display: flex; flex-direction: column; background: #fff; }
        .chat-header { padding: 16px 24px; border-bottom: 1px solid #e0e0e0; font-weight: 500; background: #fafafa; display: flex; justify-content: space-between; align-items: center; }
        .mobile-chat-back { display:none; }
        .chat-contact-title { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
        .chat-return-bot { width:auto; margin-left:12px; }
        .chat-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
        .msg { max-width: 75%; padding: 10px 16px; border-radius: 16px; word-wrap: break-word; line-height: 1.4; font-size: 14px; }
        .msg.incoming { align-self: flex-start; background: #f1f3f4; color: #1a1a2e; }
        .msg.outgoing { align-self: flex-end; background: #4a6cf7; color: #fff; }
        .msg .time { font-size: 11px; opacity: 0.7; margin-top: 4px; text-align: right; }
        .empty-state { text-align: center; color: #aaa; padding: 40px 20px; font-size: 15px; }
        .reply-area { padding: 16px 24px; border-top: 1px solid #e0e0e0; display: flex; gap: 12px; background: #fafafa; }
        .reply-area input { flex: 1; padding: 12px 20px; border: 1px solid #ddd; border-radius: 30px; outline: none; font-size: 14px; }
        .reply-area input:focus { border-color: #4a6cf7; }
        .reply-area button { padding: 12px 28px; background: #4a6cf7; color: #fff; border: none; border-radius: 30px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 14px; }
        .reply-area button:hover { background: #3a5cdb; }
        .reply-area button:disabled { opacity: 0.5; cursor: not-allowed; }
        .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
        .modal { background: #fff; border-radius: 14px; max-width: 520px; max-height:90vh; overflow-y:auto; width: 100%; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
        .modal h2 { margin-bottom: 16px; font-size: 22px; }
        .modal .modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
        .modal .modal-actions button { padding: 10px 24px; border: none; border-radius: 10px; font-weight: 500; cursor: pointer; transition: 0.2s; }
        .modal .modal-actions .btn-cancel { background: #eee; color: #333; }
        .modal .modal-actions .btn-submit { background: #4a6cf7; color: #fff; }
        .modal .modal-actions .btn-submit:hover { background: #3a5cdb; }
        .admin-tab { padding: 16px 18px; cursor: pointer; border-left: 3px solid transparent; font-weight: 500; color: #555; transition: 0.15s; }
        .admin-tab:hover { background: #edf2fa; }
        .admin-tab.active { background: #e6edf7; border-left-color: #4a6cf7; color: #1a1a2e; }
        .user-item .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
        .user-item .actions button { border: none; background: none; cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 6px; }
        .user-item .actions .block-btn { color: #e74c3c; }
        .user-item .actions .unblock-btn { color: #27ae60; }
        .user-item .actions .reset-btn { color: #f39c12; }
        .user-item .actions .copy-btn { color: #4a6cf7; }
        .admin-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 18px; flex-wrap: wrap; gap: 8px; }
        .admin-panel-header .create-user-btn { padding: 6px 16px; background: #4a6cf7; color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
        .admin-panel-header .create-user-btn:hover { background: #3a5cdb; }
        .invite-token-display { background: #f0f4ff; padding: 12px; border-radius: 8px; margin: 12px 0; word-break: break-all; font-size: 14px; }
        .invite-token-display .token { font-weight: 600; color: #1a1a2e; }
        .form-help { color:#777; font-size:12px; line-height:1.4; margin-top:6px; }
        .callback-result { background:#f0f4ff; padding:12px; border-radius:8px; margin-top:14px; word-break:break-all; font-size:13px; }
        .connection-guide { padding:13px 14px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px; margin-bottom:16px; font-size:13px; line-height:1.5; color:#475569; }
        .connection-guide strong { color:#0f172a; }
        .connection-guide a { color:#2563eb; }
        .compatibility-box { padding:13px 14px; border-radius:8px; margin:12px 0; font-size:13px; line-height:1.5; }
        .compatibility-box.safe { background:#ecfdf5; border:1px solid #a7f3d0; color:#065f46; }
        .compatibility-box.warning { background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; }
        .app-container { border-radius: 12px; box-shadow: 0 18px 50px rgba(15,23,42,.12); }
        .app-header { min-height:64px; padding:0 24px; background:#111827; color:#fff; border:0; }
        .brand { display:flex; align-items:center; gap:10px; font-weight:700; letter-spacing:-.3px; }
        .brand-mark { width:30px; height:30px; display:grid; place-items:center; background:#2563eb; border-radius:7px; }
        .app-nav { display:flex; align-items:center; gap:6px; margin-right:auto; margin-left:28px; }
        .admin-account #adminSection { order:-30; }
        .admin-account #projectsNav { order:-20; }
        .admin-account #controlNavBtn { order:10; }
        .admin-account #calendarNavBtn { order:11; }
        .admin-account #pultNavBtn { order:12; }
        .admin-account #analyticsNavBtn { order:13; }
        .admin-account #broadcastNavBtn { order:14; }
        .nav-btn { padding:9px 13px; border:0; border-radius:7px; background:transparent; color:#9ca3af; cursor:pointer; font-weight:600; }
        .nav-btn.active,.nav-btn:hover { color:#fff; background:#1f2937; }
        .nav-dropdown { position:relative; }
        .nav-menu { position:absolute; top:calc(100% + 8px); left:0; min-width:210px; padding:6px; background:#fff; border:1px solid #e5e7eb; border-radius:9px; box-shadow:0 16px 35px rgba(15,23,42,.2); z-index:100; }
        .nav-menu button { display:block; width:100%; padding:10px 12px; border:0; border-radius:6px; background:transparent; color:#111827; text-align:left; font-weight:600; cursor:pointer; }
        .nav-menu button:hover { background:#eff6ff; color:#1d4ed8; }
        .calendar-toolbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:16px; }
        .calendar-toolbar button,.calendar-toolbar select { width:auto; }
        .calendar-layout { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:16px; }
        .calendar-weekdays,.calendar-month { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
        .calendar-weekdays div { padding:9px; color:#6b7280; font-size:12px; font-weight:700; text-align:center; }
        .calendar-day { min-height:112px; padding:8px; border-right:1px solid #e5e7eb; border-bottom:1px solid #e5e7eb; background:#fff; }
        .calendar-day:nth-child(7n+1) { border-left:1px solid #e5e7eb; }
        .calendar-day.outside { background:#f9fafb; color:#9ca3af; }
        .calendar-day.today { box-shadow:inset 0 0 0 2px #2563eb; }
        .calendar-date { font-size:12px; font-weight:700; margin-bottom:6px; }
        .calendar-event { display:block; width:100%; margin:4px 0; padding:6px; border:0; border-left:3px solid #2563eb; border-radius:5px; background:#eff6ff; color:#1e3a8a; text-align:left; font-size:11px; cursor:pointer; overflow:hidden; }
        .calendar-event.cancelled,.calendar-event.no_show { opacity:.55; border-left-color:#9ca3af; text-decoration:line-through; }
        .calendar-agenda-day { margin-bottom:14px; }
        .calendar-agenda-item { display:grid; grid-template-columns:75px 1fr auto; gap:12px; align-items:center; padding:12px; border-bottom:1px solid #e5e7eb; cursor:pointer; }
        .calendar-agenda-item:hover { background:#f8fafc; }
        .calendar-settings { display:grid; gap:10px; }
        .reminder-options { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
        .reminder-option { display:flex; align-items:center; gap:6px; padding:8px 10px; border:1px solid #d9dee8; border-radius:10px; background:#f8fafc; cursor:pointer; font-size:13px; }
        .reminder-option:has(input:checked) { border-color:#2563eb; background:#eff6ff; color:#1d4ed8; }
        .reminder-option input { width:auto; margin:0; }
        @media(max-width:900px){.calendar-layout{grid-template-columns:1fr}.calendar-day{min-height:85px}.calendar-event{font-size:10px}}
        .app-header .user-info { color:#d1d5db; }
        .tariff-chip { padding:4px 8px; border:1px solid #374151; border-radius:6px; font-size:11px; text-transform:uppercase; }
        .quota-card { margin:8px 14px 4px; padding:12px; background:#fff; border:1px solid #e5e7eb; border-radius:8px; }
        .quota-line { display:flex; justify-content:space-between; font-size:12px; color:#4b5563; margin-bottom:8px; }
        .quota-track { height:5px; background:#e5e7eb; border-radius:5px; overflow:hidden; }
        .quota-fill { height:100%; background:#2563eb; transition:.2s; }
        .admin-workspace { flex:1; overflow:auto; padding:28px; background:#f3f4f6; }
        .live-operations-section { margin-bottom:26px; padding-bottom:24px; border-bottom:1px solid #dbe1ea; }
        .live-update { display:flex; align-items:center; gap:8px; color:#64748b; font-size:12px; }
        #liveOperationsDot { width:9px; height:9px; border-radius:50%; background:#f59e0b; box-shadow:0 0 0 3px rgba(245,158,11,.14); }
        #liveOperationsDot.connected { background:#10b981; box-shadow:0 0 0 3px rgba(16,185,129,.14); }
        .live-update button { padding:7px 10px; }
        .live-metrics { display:grid; grid-template-columns:repeat(5,minmax(120px,1fr)); gap:12px; margin-bottom:14px; }
        .live-metrics .stat-card.good { border-left:4px solid #10b981; }
        .live-metrics .stat-card.warning { border-left:4px solid #f59e0b; }
        .live-bot-list { background:#fff; border:1px solid #e5e7eb; border-radius:10px; overflow:hidden; }
        .live-bot-row { display:grid; grid-template-columns:12px minmax(150px,1.1fr) 72px 120px minmax(180px,1fr) minmax(105px,.7fr) auto; gap:10px; align-items:center; padding:13px 15px; border-bottom:1px solid #eef2f7; font-size:12px; }
        .live-bot-row.problem { background:#fffafa; }
        .live-bot-row:last-child { border-bottom:0; }
        .health-dot { width:9px; height:9px; border-radius:50%; background:#94a3b8; }
        .health-dot.healthy { background:#10b981; }
        .health-dot.idle { background:#3b82f6; }
        .health-dot.setup { background:#f59e0b; }
        .health-dot.degraded,.health-dot.offline { background:#ef4444; }
        .live-bot-name { min-width:0; display:flex; flex-direction:column; gap:3px; }
        .live-bot-name strong,.live-bot-name span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
        .live-bot-name span,.live-bot-activity,.live-bot-mode { color:#64748b; }
        .health-label { font-weight:700; }
        .health-label.healthy { color:#047857; }.health-label.idle { color:#1d4ed8; }.health-label.setup { color:#b45309; }.health-label.degraded,.health-label.offline { color:#b91c1c; }
        .live-bot-activity { display:flex; flex-direction:column; gap:3px; }
        .live-bot-mode { display:flex; flex-direction:column; gap:3px; }
        .live-bot-mode small { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#b91c1c; }
        .operations-overview { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr); gap:12px; margin-bottom:14px; }
        .operations-overview .panel-card { padding:15px; }
        .operations-overview h3 { margin-bottom:10px; font-size:15px; }
        .live-problem-list { display:grid; gap:7px; }
        .live-problem { display:grid; grid-template-columns:10px minmax(0,1fr) auto; gap:9px; align-items:center; padding:9px 10px; border:1px solid #fecaca; border-radius:8px; background:#fff; text-align:left; cursor:pointer; color:#111827; }
        .live-problem span:nth-child(2) { display:grid; gap:2px; min-width:0; }
        .live-problem small { color:#b91c1c; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
        .live-problem b { color:#2563eb; font-size:11px; }
        .operations-ok { padding:20px; border-radius:8px; background:#ecfdf5; color:#047857; text-align:center; font-weight:700; }
        .platform-chart { display:grid; gap:10px; }
        .platform-chart-row { display:grid; grid-template-columns:82px minmax(80px,1fr) 24px; gap:8px; align-items:center; color:#475569; font-size:12px; }
        .platform-chart-row>div { height:8px; overflow:hidden; border-radius:10px; background:#e5e7eb; }
        .platform-chart-row i { display:block; height:100%; border-radius:10px; background:#2563eb; }
        .live-filters { display:grid; grid-template-columns:minmax(220px,1fr) 220px; gap:10px; margin:14px 0 10px; }
        .live-filters input,.live-filters select { padding:10px 12px; border:1px solid #d1d5db; border-radius:8px; background:#fff; }
        .live-owner-group { border-bottom:5px solid #f1f5f9; }
        .live-owner-group:last-child { border-bottom:0; }
        .live-owner-group.internal { background:#f8fafc; }
        .live-owner-head { display:flex; justify-content:space-between; padding:11px 15px; background:#eff6ff; border-bottom:1px solid #dbeafe; }
        .live-owner-group.internal .live-owner-head { background:#f1f5f9; }
        .live-owner-head>div { display:flex; flex-direction:column; gap:2px; }
        .live-owner-head span { color:#64748b; font-size:11px; }
        .live-bot-actions { display:flex; gap:5px; }
        .live-bot-actions button { padding:6px 8px; border:1px solid #bfdbfe; border-radius:6px; background:#eff6ff; color:#1d4ed8; cursor:pointer; font-size:11px; font-weight:700; }
        .admin-toolbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
        .admin-toolbar h2 { font-size:20px; color:#111827; }
        .admin-workspace #userList { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(470px,100%),1fr)); gap:14px; align-items:start; }
        .admin-workspace .user-item { min-width:0; background:#fff; border:1px solid #e0e6ef; border-radius:12px; padding:18px !important; box-shadow:0 3px 12px rgba(15,23,42,.04); }
        .user-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
        .user-card-head strong { min-width:0; overflow-wrap:anywhere; font-size:15px; color:#111827; }
        .user-status { flex:0 0 auto; padding:4px 8px; border-radius:999px; background:#eef2f7; color:#475569; font-size:11px; font-weight:700; }
        .user-status-active { background:#ecfdf5; color:#047857; }
        .user-status-blocked { background:#fef2f2; color:#b91c1c; }
        .user-status-pending { background:#fff7ed; color:#b45309; }
        .user-subscription-summary { display:flex; flex-wrap:wrap; gap:6px 12px; margin:12px 0; padding:10px 12px; border-radius:8px; background:#f8fafc; color:#64748b; font-size:12px; }
        .user-subscription-summary b { color:#111827; }
        .subscription-controls { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding-top:2px; }
        .subscription-field { display:grid; min-width:0; gap:5px; color:#64748b; font-size:11px; font-weight:600; }
        .subscription-field:first-child { grid-column:1/-1; }
        .subscription-field input,.subscription-field select { min-width:0; width:100%; height:40px; padding:8px 10px; border:1px solid #cfd7e3; border-radius:7px; background:#fff; color:#111827; font:inherit; font-size:13px; font-weight:400; }
        .subscription-field input:focus,.subscription-field select:focus { outline:2px solid rgba(37,99,235,.16); border-color:#2563eb; }
        .tariff-select { margin:0; }
        .subscription-save { grid-column:1/-1; min-height:40px; }
        .user-card-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; padding-top:12px; border-top:1px solid #eef2f7; }
        .user-card-actions button { padding:7px 10px; border:0; border-radius:7px; cursor:pointer; background:#f1f5f9; color:#334155; font-weight:600; }
        .user-card-actions .block-btn { color:#b91c1c; background:#fef2f2; }
        .user-card-actions .activate-btn { color:#047857; background:#ecfdf5; }
        .admin-stats { display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)); gap:12px; margin-bottom:18px; }
        .stat-card { background:#fff; border:1px solid #e5e7eb; border-radius:9px; padding:16px; }
        .stat-card span { display:block; color:#6b7280; font-size:12px; margin-bottom:7px; }
        .stat-card strong { color:#111827; font-size:25px; }
        .admin-filters { display:grid; grid-template-columns:minmax(220px,1fr) 180px 180px; gap:10px; margin-bottom:16px; }
        .admin-filters input,.admin-filters select { padding:10px 12px; border:1px solid #d1d5db; border-radius:7px; background:#fff; }
        .user-meta { display:flex; gap:10px; flex-wrap:wrap; margin-top:7px; color:#6b7280; font-size:12px; }
        .admin-request-section { margin-bottom:22px; }
        .admin-request-section h3 { font-size:16px; margin-bottom:10px; color:#111827; }
        .admin-request-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:10px; }
        .admin-request-card { background:#fff; border:1px solid #e5e7eb; border-left:4px solid #2563eb; border-radius:9px; padding:14px; }
        .admin-request-card.done { border-left-color:#10b981; opacity:.75; }
        .request-status { margin-top:10px; width:100%; padding:8px; border:1px solid #d1d5db; border-radius:6px; background:#fff; }
        .request-actions { display:flex; gap:7px; margin-top:9px; flex-wrap:wrap; }
        .request-actions button { padding:7px 9px; border:0; border-radius:6px; cursor:pointer; font-weight:600; background:#e5e7eb; color:#374151; }
        .request-actions .danger { color:#b91c1c; background:#fee2e2; }
        .request-archive { margin-top:13px; }
        .request-archive summary { cursor:pointer; color:#4b5563; font-weight:600; }
        .runtime-layout { display:grid; grid-template-columns:minmax(280px,.7fr) minmax(360px,1.3fr); gap:14px; }
        .runtime-form { display:grid; gap:11px; }
        .runtime-form input,.runtime-form select { width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:7px; }
        .runtime-instance { padding:12px; border:1px solid #e5e7eb; border-radius:8px; margin-bottom:8px; cursor:pointer; }
        .runtime-instance.active { border-color:#2563eb; background:#eff6ff; }
        .runtime-chat { min-height:260px; max-height:360px; overflow:auto; padding:12px; background:#f8fafc; border-radius:8px; display:flex; flex-direction:column; gap:8px; }
        .runtime-msg { max-width:85%; padding:9px 12px; border-radius:10px; font-size:13px; line-height:1.45; }
        .runtime-msg.user { align-self:flex-end; background:#2563eb; color:#fff; }
        .runtime-msg.bot { align-self:flex-start; background:#fff; border:1px solid #e5e7eb; }
        .runtime-compose { display:flex; gap:8px; margin-top:10px; }
        .runtime-compose input { flex:1; padding:10px 12px; border:1px solid #d1d5db; border-radius:7px; }
        .project-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:10px; }
        .project-card { background:#fff; border:1px solid #e5e7eb; border-radius:9px; padding:14px; }
        .project-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:11px; }
        .project-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
        .project-form-grid .wide { grid-column:1/-1; }
        .project-tools { margin-top:18px; padding-top:16px; border-top:1px solid #e5e7eb; }
        .booking-row { display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:8px; padding:9px 0; border-bottom:1px solid #eef0f3; font-size:13px; }
        .service-editor-row { display:grid; grid-template-columns:2fr 1fr 1fr 1fr auto; gap:8px; align-items:end; padding:10px; background:#f7f8fa; border-radius:8px; margin-bottom:8px; }
        .service-editor-row input { min-width:0; }
        .resource-editor-row { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:end; padding:10px; background:#f7f8fa; border-radius:8px; margin-bottom:8px; }
        @media(max-width:650px){.project-form-grid{grid-template-columns:1fr}.project-form-grid .wide{grid-column:auto}.booking-row,.service-editor-row,.resource-editor-row{grid-template-columns:1fr}}
        .admin-panel-header .create-user-btn { padding:9px 14px; }
        .platform-tag { font-size:10px; letter-spacing:.4px; text-transform:uppercase; }
        .feature-workspace { flex:1; overflow:auto; padding:28px; background:#f3f4f6; }
        #projectModal .modal { width:min(1180px,calc(100vw - 40px)); max-width:none !important; height:calc(100vh - 40px); }
        .feature-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:20px; }
        .feature-header h2 { color:#111827; font-size:21px; margin-bottom:5px; }
        .feature-header p { color:#6b7280; font-size:13px; }
        .period-select { padding:9px 12px; border:1px solid #d1d5db; border-radius:7px; background:#fff; }
        .metric-grid { display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)); gap:12px; margin-bottom:16px; }
        .metric-card { padding:16px; background:#fff; border:1px solid #e5e7eb; border-radius:9px; }
        .metric-card span { display:block; color:#6b7280; font-size:12px; margin-bottom:7px; }
        .metric-card strong { color:#111827; font-size:25px; }
        .analytics-grid { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(280px,.8fr); gap:14px; }
        .panel-card { background:#fff; border:1px solid #e5e7eb; border-radius:9px; padding:18px; }
        .panel-card h3 { font-size:15px; color:#111827; margin-bottom:14px; }
        .chart-wrap { width:100%; min-height:260px; overflow:hidden; }
        .analytics-table { width:100%; border-collapse:collapse; font-size:12px; }
        .analytics-table th,.analytics-table td { padding:9px 7px; text-align:left; border-bottom:1px solid #f1f5f9; }
        .analytics-table th { color:#6b7280; font-weight:600; }
        .broadcast-layout { display:grid; grid-template-columns:minmax(300px,1fr) minmax(280px,.7fr); gap:14px; }
        .broadcast-text { width:100%; min-height:150px; resize:vertical; padding:12px; border:1px solid #d1d5db; border-radius:7px; font:inherit; }
        .bot-check-list { display:grid; gap:8px; margin:12px 0 18px; }
        .bot-check { display:flex; align-items:center; gap:9px; padding:10px; border:1px solid #e5e7eb; border-radius:7px; }
        .broadcast-actions { display:flex; gap:8px; flex-wrap:wrap; }
        .action-primary,.action-secondary { padding:10px 14px; border-radius:7px; border:0; cursor:pointer; font-weight:600; }
        .action-primary { color:#fff; background:#2563eb; }
        .action-secondary { color:#1f2937; background:#e5e7eb; }
        .audience-result { display:grid; gap:8px; font-size:13px; }
        .audience-row { display:flex; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid #f1f5f9; }
        .policy-note { margin-top:14px; padding:11px; border-radius:7px; background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; font-size:12px; line-height:1.5; }
        .bot-main { min-width:0; display:flex; flex-direction:column; gap:3px; }
        .bot-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
        .bot-mode { color:#6b7280; font-size:10px; text-transform:uppercase; letter-spacing:.3px; }
        .bot-actions { display:flex; align-items:center; gap:5px; }
        .bot-action { border:0; background:transparent; color:#6b7280; cursor:pointer; padding:5px; border-radius:5px; font-size:14px; }
        .bot-action:hover { background:#e5e7eb; color:#111827; }
        .bot-action.danger:hover { background:#fee2e2; color:#b91c1c; }
        .connector-key { display:block; padding:10px; margin:9px 0; background:#111827; color:#e5e7eb; border-radius:7px; font:12px/1.5 monospace; word-break:break-all; user-select:all; }
        .connector-user-note { padding:14px; background:#ecfdf5; border:1px solid #a7f3d0; border-radius:8px; color:#065f46; line-height:1.5; margin-bottom:12px; }
        .connector-user-note strong { display:block; color:#064e3b; margin-bottom:5px; }
        .connector-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:12px 0; }
        .connector-actions button { padding:10px; border-radius:7px; border:1px solid #cbd5e1; background:#fff; cursor:pointer; color:#0f172a; font-weight:600; }
        .connector-actions button:first-child { background:#2563eb; border-color:#2563eb; color:#fff; }
        .technical-details { margin-top:10px; padding-top:10px; border-top:1px solid #dbeafe; }
        .technical-details summary { cursor:pointer; color:#475569; font-weight:600; }
        .control-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,.8fr); gap:14px; }
        .funnel-list,.intervention-list { display:grid; gap:9px; }
        .funnel-row { display:grid; grid-template-columns:130px 1fr 42px; gap:10px; align-items:center; font-size:12px; }
        .funnel-track { height:9px; border-radius:9px; background:#e5e7eb; overflow:hidden; }
        .funnel-fill { height:100%; border-radius:9px; background:#2563eb; min-width:2px; }
        .intervention-card { border:1px solid #e5e7eb; border-left:4px solid #f59e0b; border-radius:8px; padding:12px; }
        .intervention-card.urgent { border-left-color:#dc2626; }
        .intervention-head { display:flex; justify-content:space-between; gap:12px; margin-bottom:6px; }
        .intervention-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:10px; }
        .intervention-actions button { padding:7px 9px; border:0; border-radius:6px; cursor:pointer; font-weight:600; }
        .source-choice { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:16px; }
        .source-card { padding:14px; text-align:left; border:1px solid #d1d5db; border-radius:9px; background:#fff; cursor:pointer; }
        .source-card strong { display:block; color:#111827; margin-bottom:5px; }
        .source-card span { color:#6b7280; font-size:12px; line-height:1.4; }
        .source-card.active { border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,.12); background:#eff6ff; }
        .managed-offer { padding:16px; border:1px solid #bfdbfe; background:#eff6ff; border-radius:9px; color:#1e3a8a; line-height:1.5; }
        @media (max-width: 850px) { .analytics-grid,.broadcast-layout,.control-grid,.runtime-layout { grid-template-columns:1fr; } .metric-grid { grid-template-columns:repeat(2,1fr); } }
        @media (max-width: 1000px) { .live-metrics { grid-template-columns:repeat(2,1fr); } .operations-overview{grid-template-columns:1fr}.live-bot-row { grid-template-columns:12px 1fr 80px 130px; } .live-bot-activity,.live-bot-mode,.live-bot-actions { grid-column:2/-1; } }
        @media (max-width: 700px) { .sidebar { width: 200px; min-width: 140px; } .app-header h1 { font-size: 18px; } .admin-stats { grid-template-columns:repeat(2,1fr); } .admin-filters,.live-filters { grid-template-columns:1fr; } .feature-workspace { padding:18px; } .live-metrics{grid-template-columns:1fr 1fr}.live-bot-row{grid-template-columns:12px 1fr}.live-bot-row>.platform-tag,.health-label,.live-bot-activity,.live-bot-mode,.live-bot-actions{grid-column:2}.live-update{flex-wrap:wrap} }
        @media (max-width: 550px) { .app-body { flex-direction: column; } .sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e0e0e0; max-height: 200px; } }
.embed-code { display:block; margin:8px 0; padding:10px 12px; white-space:pre-wrap; overflow-wrap:anywhere; background:#101828; color:#fff; border-radius:8px; }
.managed-brief-form { display:grid; gap:12px; margin-top:14px; }
.managed-brief-form label { display:grid; gap:6px; color:#1e3a8a; font-weight:600; }
.managed-brief-form input,.managed-brief-form textarea { width:100%; padding:10px 12px; border:1px solid #bfdbfe; border-radius:8px; background:#fff; color:#111827; font:inherit; font-weight:400; resize:vertical; }
.request-platforms { display:flex; flex-wrap:wrap; gap:8px; }
.request-platforms label { display:flex; grid-auto-flow:column; align-items:center; gap:6px; padding:8px 10px; border:1px solid #bfdbfe; border-radius:8px; background:#fff; font-weight:500; }
.request-platforms input { width:auto; }
.request-brief-summary { display:grid; gap:6px; margin:10px 0; padding:10px 12px; border-radius:8px; background:#f8fafc; color:#334155; line-height:1.45; white-space:pre-line; }
.request-brief-summary small { color:#64748b; }

/* Mobile workspace */
@media (max-width: 760px) {
    html, body { min-width:0; width:100%; min-height:100%; }
    body { display:block; padding:0; overflow-x:hidden; background:#fff; }
    button, input, select, textarea { font-size:16px; }
    button, .nav-btn, .action-primary, .action-secondary { min-height:44px; touch-action:manipulation; }

    .auth-container { min-height:100vh; max-width:none; padding:32px 20px; border-radius:0; box-shadow:none; }
    .app-container { width:100%; height:100dvh; min-height:100vh; max-height:none; border-radius:0; box-shadow:none; }
    .app-header { min-height:0; padding:10px 12px 0; display:grid; grid-template-columns:1fr auto; gap:8px 12px; align-items:center; }
    .brand { min-width:0; }
    .brand-mark { width:34px; height:34px; }
    .app-header .user-info { gap:9px; justify-content:flex-end; min-width:0; }
    .app-header .user-info #userName { display:inline-flex; width:40px; height:40px; align-items:center; justify-content:center; font-size:0; }
    .app-header .user-info #userName::after { content:"⚙"; font-size:19px; }
    .app-header .user-info .logout { min-height:40px; padding:6px 4px; }
    .app-nav { grid-column:1/-1; width:calc(100% + 24px); margin:0 -12px; padding:0 8px 8px; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; white-space:nowrap; }
    .app-nav::-webkit-scrollbar { display:none; }
    .nav-btn { flex:0 0 auto; padding:8px 11px; }
    .nav-menu { position:fixed; top:96px; left:10px; right:10px; min-width:0; max-height:calc(100dvh - 110px); overflow:auto; }

    .app-body { min-height:0; flex-direction:column; }
    .sidebar { width:100%; min-width:0; max-height:none; padding:6px 0; flex:1 1 auto; border-right:0; border-bottom:0; }
    .sidebar .section-title { padding:7px 14px; }
    .quota-card { margin:5px 12px; }
    .sidebar .bot-item, .sidebar .user-item { min-height:48px; padding:10px 14px; }
    .sidebar .add-bot-btn { min-height:44px; margin:8px 12px; }
    .chat-area { display:none; min-height:0; }
    .app-body.mobile-chat-open .sidebar { display:none; }
    .app-body.mobile-chat-open .chat-area { display:flex; flex:1; min-height:0; }
    .chat-header { min-height:48px; padding:11px 14px; font-size:14px; }
    .mobile-chat-back { display:grid; flex:0 0 40px; width:40px; min-height:40px; margin:-6px 6px -6px -8px; place-items:center; border:0; background:transparent; color:#2563eb; font-size:34px; line-height:1; cursor:pointer; }
    .chat-contact-title { flex:1; }
    .chat-return-bot { min-height:38px; margin-left:6px; padding:7px 9px; font-size:11px; }
    .chat-messages { min-height:0; padding:14px 12px; gap:9px; }
    .msg { max-width:90%; padding:9px 12px; }
    .reply-area { padding:9px 10px calc(9px + env(safe-area-inset-bottom)); gap:7px; align-items:center; }
    .reply-area input { min-width:0; min-height:44px; padding:10px 13px; }
    .reply-area button { min-width:48px; padding:10px 13px; font-size:0; }
    .reply-area button::after { content:'➤'; font-size:20px; }

    .feature-workspace, .admin-workspace { padding:16px 12px calc(24px + env(safe-area-inset-bottom)); }
    .feature-header, .admin-toolbar { align-items:flex-start; flex-direction:column; gap:10px; margin-bottom:14px; }
    .feature-header h2, .admin-toolbar h2 { font-size:21px; line-height:1.2; }
    .feature-header p { font-size:13px; line-height:1.4; }
    .feature-header > select, .period-select { width:100%; }
    .panel-card, .stat-card, .metric-card, .project-card, .admin-request-card { min-width:0; padding:13px; }
    .metric-grid, .admin-stats, .live-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .metric-card strong, .stat-card strong { font-size:22px; }
    .analytics-grid, .broadcast-layout, .control-grid, .runtime-layout, .project-form-grid, .admin-filters { grid-template-columns:1fr; }
    .project-form-grid .wide { grid-column:auto; }
    .project-list, .admin-request-list, .admin-workspace #userList { grid-template-columns:minmax(0,1fr); }
    .admin-workspace .user-item { padding:14px !important; }
    .subscription-controls { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .project-actions, .request-actions, .broadcast-actions, .modal-actions, .connector-actions, .runtime-compose { display:grid; grid-template-columns:1fr; }
    .project-actions button, .request-actions button, .broadcast-actions button, .modal-actions button, .connector-actions button, .runtime-compose button { width:100%; }
    .runtime-msg { max-width:92%; }
    .service-editor-row, .resource-editor-row, .booking-row { grid-template-columns:1fr; }
    .source-choice { grid-template-columns:1fr; }
    .funnel-row { grid-template-columns:100px minmax(0,1fr) 28px; gap:7px; }

    .calendar-toolbar { display:grid; grid-template-columns:44px 1fr 44px; gap:7px; }
    .calendar-toolbar #calendarTitle, .calendar-toolbar select { grid-column:1/-1; width:100%; }
    .calendar-toolbar #calendarToday { width:100%; }
    .calendar-layout { grid-template-columns:minmax(0,1fr); }
    .calendar-layout > .panel-card { padding:6px; overflow-x:auto; }
    .calendar-weekdays, .calendar-month { min-width:336px; }
    .calendar-weekdays div { padding:7px 2px; font-size:10px; }
    .calendar-day { min-height:68px; padding:4px; }
    .calendar-date { margin-bottom:2px; }
    .calendar-event { min-height:18px; padding:3px; border-left-width:2px; font-size:9px; white-space:nowrap; text-overflow:ellipsis; }
    .calendar-agenda-item { grid-template-columns:58px minmax(0,1fr); gap:8px; padding:10px 6px; }
    .calendar-agenda-item > :last-child { grid-column:2; }

    .live-bot-row { grid-template-columns:12px minmax(0,1fr); padding:11px; }
    .live-bot-row > * { min-width:0; }
    .live-bot-row > .platform-tag, .live-bot-row > .health-label, .live-bot-row > .live-bot-activity, .live-bot-row > .live-bot-mode { grid-column:2; }
    .live-bot-name strong, .live-bot-name span, .live-bot-mode small { white-space:normal; overflow-wrap:anywhere; }

    .modal-overlay { align-items:flex-end; padding:0; }
    .modal, #projectModal .modal { width:100%; height:auto; max-height:94dvh; padding:20px 14px calc(20px + env(safe-area-inset-bottom)); border-radius:18px 18px 0 0; }
    #projectModal .modal { height:94dvh; }
    .modal h2 { font-size:20px; }
    textarea { max-width:100%; }
}

@media (max-width: 380px) {
    .subscription-controls { grid-template-columns:1fr; }
    .subscription-field:first-child, .subscription-save { grid-column:auto; }
    .metric-grid, .admin-stats, .live-metrics { grid-template-columns:1fr; }
    .tariff-chip { display:none; }
    .funnel-row { grid-template-columns:88px minmax(0,1fr) 24px; font-size:11px; }
}
