* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f7fa;
    color: #1f2937;
    min-height: 100vh;
    display: flex;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.sidebar-logo {
    height: 40px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: #f9fafb;
    color: #2563eb;
}
.nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}
.nav-item-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    opacity: 0.7;
}
.nav-item.active .nav-item-icon {
    opacity: 1;
}
.nav-item.has-submenu {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}
.nav-item.has-submenu > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}
.nav-item.has-submenu > div:first-child:hover {
    background: #f9fafb;
    color: #2563eb;
}
.nav-item-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    opacity: 0.7;
    margin-left: auto;
}
.nav-item.expanded .nav-item-arrow {
    transform: rotate(90deg);
}
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}
.nav-item.expanded .nav-submenu {
    max-height: 500px;
}
.nav-subitem {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.5rem 0.625rem 3rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}
.nav-subitem:hover {
    background: #f3f4f6;
    color: #2563eb;
}
.nav-subitem.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}
.user-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.user-email-sidebar {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}
.user-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    width: fit-content;
}
.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}
.badge-user {
    background: #f3f4f6;
    color: #374151;
}
.badge-pending {
    background: #fef3c7;
    color: #92400e;
}
.logout-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    transition: color 0.2s;
}
.logout-link:hover {
    color: #ef4444;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.top-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Page Content */
.page-content {
    width: 100%;
    display: block;
}

/* Alert */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid;
}
.alert-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}
.card-header {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #111827;
}
.card-content {
    color: #6b7280;
    line-height: 1.6;
}

/* Admin Section */
.admin-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}
.admin-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}
.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover {
    color: #2563eb;
}
.tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.user-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.user-details {
    flex: 1;
}
.user-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}
.user-email-text {
    font-size: 0.875rem;
    color: #6b7280;
}
.user-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}
.user-actions {
    display: flex;
    gap: 0.5rem;
}
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}
.btn-primary {
    background: #2563eb;
    color: white;
}
.btn-primary:hover {
    background: #1d4ed8;
}
.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}
.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-secondary {
    background: #6b7280;
    color: white;
}
.btn-secondary:hover {
    background: #4b5563;
}
.role-select {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 0.875rem;
    margin-right: 0.5rem;
}
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}
.hidden {
    display: none;
}

/* Agents Table */
.agents-table-container {
    margin-top: 1.5rem;
}
.agents-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.agents-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}
.agents-table th {
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.agents-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
}
.agents-table tbody tr:hover {
    background: #f9fafb;
}
.agents-table tbody tr:last-child td {
    border-bottom: none;
}
.agent-name {
    font-weight: 600;
    color: #111827;
}
.agent-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-active {
    background: #d1fae5;
    color: #065f46;
}
.status-off {
    background: #fee2e2;
    color: #991b1b;
}
.agent-description {
    color: #6b7280;
    font-size: 0.875rem;
}
.agent-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
/* SubAgent styles */
.subagent-row {
    background: #f9fafb;
}
.subagent-row:hover {
    background: #f3f4f6;
}
.subagent-name {
    padding-left: 2.5rem !important;
    font-weight: 500;
    color: #4b5563;
}
.subagent-indicator {
    color: #9ca3af;
    margin-right: 0.5rem;
    font-weight: normal;
}
.agent-row {
    border-bottom: 1px solid #e5e7eb;
}
.subagent-row {
    border-bottom: 1px solid #e5e7eb;
}
.subagent-row:last-child {
    border-bottom: 1px solid #e5e7eb;
}
/* Ensure parent agent row has a border when followed by subagents */
.agent-row + .subagent-row {
    border-top: none;
}
.action-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}
.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.action-btn:active {
    transform: translateY(0);
}
/* Different colors for action buttons */
.action-btn-color-0 {
    background: #2563eb;
    color: white;
}
.action-btn-color-0:hover {
    background: #1d4ed8;
}
.action-btn-color-1 {
    background: #10b981;
    color: white;
}
.action-btn-color-1:hover {
    background: #059669;
}
.action-btn-color-2 {
    background: #f59e0b;
    color: white;
}
.action-btn-color-2:hover {
    background: #d97706;
}
.action-btn-color-3 {
    background: #ef4444;
    color: white;
}
.action-btn-color-3:hover {
    background: #dc2626;
}
.action-btn-color-4 {
    background: #8b5cf6;
    color: white;
}
.action-btn-color-4:hover {
    background: #7c3aed;
}
.action-btn-color-5 {
    background: #ec4899;
    color: white;
}
.action-btn-color-5:hover {
    background: #db2777;
}
.action-btn-color-6 {
    background: #06b6d4;
    color: white;
}
.action-btn-color-6:hover {
    background: #0891b2;
}
.action-btn-color-7 {
    background: #84cc16;
    color: white;
}
.action-btn-color-7:hover {
    background: #65a30d;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}
.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
}

/* Inline Form Styles */
.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
}
.form-label-inline {
    display: inline-block;
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
}
.form-input-inline {
    width: auto;
    flex: 1;
    min-width: 200px;
}
.form-select-inline {
    width: auto;
    flex: 1;
    min-width: 200px;
}
.form-note {
    margin-top: 0.5rem;
    margin-left: 0;
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
    line-height: 1.5;
}

/* HTMX Loading States */
.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}
.htmx-swapping {
    opacity: 0.5;
}

/* Feedback Form Styles */
.feedback-question {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    min-height: 2.5rem;
}

.feedback-question-textarea {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.feedback-label {
    flex: 0 0 auto;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: 280px;
}

.required-asterisk {
    color: #ef4444;
    margin-left: 0.25rem;
}

.rating-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 auto;
}

.rating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
}

.rating-emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.rating-btn:hover {
    border-color: #d1d5db;
    transform: scale(1.1);
}

.rating-btn.active {
    border-width: 3px;
    transform: scale(1.15);
}

.rating-btn.rating-good.active {
    border-color: #10b981;
    background: #ecfdf5;
}

.rating-btn.rating-ok.active {
    border-color: #f59e0b;
    background: #fffbeb;
}

.rating-btn.rating-bad.active {
    border-color: #ef4444;
    background: #fef2f2;
}

.thumbs-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 auto;
}

.thumbs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
}

.thumbs-emoji {
    font-size: 1.25rem;
    line-height: 1;
}

.thumbs-btn:hover {
    border-color: #d1d5db;
    transform: scale(1.1);
}

.thumbs-btn.active {
    border-width: 3px;
    transform: scale(1.15);
}

.thumbs-btn.thumbs-up.active {
    border-color: #10b981;
    background: #ecfdf5;
}

.thumbs-btn.thumbs-down.active {
    border-color: #ef4444;
    background: #fef2f2;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    
    .feedback-question {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .feedback-label {
        min-width: auto;
        white-space: normal;
    }
    
    .rating-options,
    .thumbs-options {
        width: 100%;
        justify-content: flex-start;
    }
}

