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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #e5e5e5;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 0.9rem;
}

#ask-form {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

#question {
    flex: 1;
    padding: 14px 18px;
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#question:focus {
    border-color: #404040;
}

#question::placeholder {
    color: #525252;
}

#submit-btn {
    padding: 14px 28px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

#submit-btn:hover {
    opacity: 0.9;
}

#submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.process {
    margin-bottom: 30px;
}

.step {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    opacity: 0.4;
    transition: opacity 0.3s, border-color 0.3s;
}

.step.active {
    opacity: 1;
    border-color: #404040;
}

.step.completed {
    opacity: 1;
}

.step.skipped {
    opacity: 0.3;
}

.step-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    gap: 12px;
}

.step-icon {
    width: 24px;
    height: 24px;
    background: #262626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
}

.step.active .step-icon,
.step.completed .step-icon {
    background: #fff;
    color: #000;
}

.step-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
}

.step-status {
    font-size: 0.8rem;
    color: #666;
}

.step.completed .step-status {
    color: #22c55e;
}

.step-content {
    padding: 0 18px 14px 54px;
    font-size: 0.85rem;
    color: #a3a3a3;
    display: none;
}

.step.active .step-content,
.step.completed .step-content {
    display: block;
}

.step-content p {
    margin-bottom: 8px;
}

.step-content .label {
    color: #666;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 10px;
    margin-bottom: 4px;
}

.step-content .value {
    color: #e5e5e5;
}

.step-content .confidence {
    display: inline-block;
    padding: 2px 8px;
    background: #262626;
    border-radius: 4px;
    font-size: 0.8rem;
}

.step-content .confidence.high {
    background: #14532d;
    color: #22c55e;
}

.step-content .confidence.medium {
    background: #422006;
    color: #f97316;
}

.step-content .confidence.low {
    background: #450a0a;
    color: #ef4444;
}

.citations-list {
    margin-top: 8px;
}

.citation {
    background: #1a1a1a;
    border-left: 2px solid #404040;
    padding: 8px 12px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.citation .source {
    color: #666;
    font-size: 0.7rem;
}

.result {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #262626;
}

.result-route {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 4px;
    background: #262626;
}

.result-route.resolve {
    background: #14532d;
    color: #22c55e;
}

.result-route.escalate {
    background: #450a0a;
    color: #ef4444;
}

.result-route.troubleshoot {
    background: #422006;
    color: #f97316;
}

.result-confidence {
    font-size: 0.85rem;
    color: #666;
}

.result-answer {
    font-size: 1rem;
    line-height: 1.7;
    color: #e5e5e5;
}

.result-citations {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #262626;
}

.result-citations .label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.result-ticket {
    margin-top: 16px;
    padding: 16px;
    background: #1a1a1a;
    border-radius: 6px;
}

.result-ticket .ticket-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-ticket .priority {
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.result-ticket .priority.high {
    background: #450a0a;
    color: #ef4444;
}

.result-ticket .priority.medium {
    background: #422006;
    color: #f97316;
}

.result-ticket .summary {
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.result-ticket .steps-attempted {
    font-size: 0.8rem;
    color: #a3a3a3;
}

.result-ticket .steps-attempted li {
    margin-left: 16px;
    margin-bottom: 4px;
}

.trace-link {
    text-align: center;
    font-size: 0.8rem;
    color: #525252;
}

.trace-link code {
    background: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.hidden {
    display: none !important;
}

.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.history-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #262626;
}

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

.history-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    color: #a3a3a3;
}

.refresh-btn {
    padding: 8px 16px;
    background: #262626;
    color: #a3a3a3;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: #333;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.history-item:hover {
    border-color: #404040;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.history-question {
    font-size: 0.95rem;
    color: #e5e5e5;
    flex: 1;
    margin-right: 12px;
}

.history-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.history-route {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    background: #262626;
}

.history-route.resolve {
    background: #14532d;
    color: #22c55e;
}

.history-route.escalate {
    background: #450a0a;
    color: #ef4444;
}

.history-route.troubleshoot {
    background: #422006;
    color: #f97316;
}

.history-answer {
    font-size: 0.85rem;
    color: #737373;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.history-time {
    font-size: 0.7rem;
    color: #525252;
    margin-top: 10px;
}

.history-empty {
    text-align: center;
    color: #525252;
    padding: 40px;
    font-size: 0.9rem;
}

.chat-container {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 12px;
    margin-bottom: 16px;
    height: 400px;
    overflow: hidden;
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.welcome-message {
    color: #a3a3a3;
    font-size: 0.9rem;
    padding: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 16px;
}

.welcome-message p {
    margin-bottom: 10px;
}

.welcome-message ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.welcome-message li {
    margin-bottom: 4px;
}

.chat-message {
    max-width: 85%;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.user-message {
    background: #2563eb;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.agent-message {
    background: #262626;
    color: #e5e5e5;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-content {
    word-wrap: break-word;
}

.message-status {
    font-size: 0.75rem;
    color: #737373;
    margin-top: 8px;
    font-style: italic;
}

.message-status.awaiting_user {
    color: #22c55e;
}

.message-status.closed {
    color: #737373;
}

.thinking {
    padding: 16px;
}

.thinking-dots {
    display: flex;
    gap: 6px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #525252;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.chat-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

#user-input {
    flex: 1;
    padding: 14px 18px;
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: #404040;
}

#user-input::placeholder {
    color: #525252;
}

#send-btn {
    padding: 14px 28px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

#send-btn:hover {
    opacity: 0.9;
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #737373;
}

.session-info code {
    background: #262626;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    color: #a3a3a3;
}

.new-session-btn {
    padding: 8px 16px;
    background: #262626;
    color: #a3a3a3;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.new-session-btn:hover {
    background: #333;
}

.inspect-btn {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.inspect-btn:hover {
    background: #1d4ed8;
}

.steps-container {
    margin-top: 12px;
    border-top: 1px solid #404040;
    padding-top: 8px;
}

.steps-header {
    cursor: pointer;
    font-size: 0.75rem;
    color: #a3a3a3;
}

.steps-toggle {
    display: inline-block;
    padding: 4px 8px;
    background: #1a1a1a;
    border-radius: 4px;
}

.steps-list {
    margin-top: 8px;
}

.step-item {
    background: #1a1a1a;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    border-left: 3px solid #404040;
}

.step-item.call_tool { border-left-color: #2563eb; }
.step-item.ask_user { border-left-color: #f97316; }
.step-item.respond { border-left-color: #22c55e; }
.step-item.escalate { border-left-color: #ef4444; }
.step-item.create_plan { border-left-color: #8b5cf6; }

.step-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.step-icon { font-size: 1rem; }
.step-name { font-size: 0.75rem; color: #737373; flex: 1; }
.step-decision {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    background: #262626;
}

.step-decision.call_tool { background: #1e3a5f; color: #60a5fa; }
.step-decision.ask_user { background: #422006; color: #fb923c; }
.step-decision.respond { background: #14532d; color: #4ade80; }
.step-decision.escalate { background: #450a0a; color: #f87171; }
.step-decision.create_plan { background: #2e1065; color: #a78bfa; }

.step-confidence {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
}

.step-confidence.high { background: #14532d; color: #22c55e; }
.step-confidence.medium { background: #422006; color: #f97316; }
.step-confidence.low { background: #450a0a; color: #ef4444; }

.step-item-details {
    font-size: 0.75rem;
    color: #a3a3a3;
}

.step-agent { color: #525252; }
.step-rationale { margin-top: 4px; line-height: 1.4; }
.step-flags { color: #f97316; margin-top: 4px; }

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

.modal-content {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #262626;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    color: #737373;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.session-details, .plans-section, .executed-section {
    margin-bottom: 24px;
}

.session-details h3, .plans-section h3, .executed-section h3 {
    font-size: 0.9rem;
    color: #a3a3a3;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.detail-row .label {
    color: #525252;
    min-width: 100px;
}

.detail-row code {
    background: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.status-badge.closed { background: #14532d; color: #22c55e; }
.status-badge.awaiting_user { background: #422006; color: #f97316; }
.status-badge.open { background: #1e3a5f; color: #60a5fa; }

.inspector-plan {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.inspector-plan h4 {
    font-size: 0.85rem;
    color: #e5e5e5;
    margin-bottom: 8px;
}

.plan-reasoning {
    font-size: 0.8rem;
    color: #a3a3a3;
    margin-bottom: 12px;
    line-height: 1.5;
}

.plan-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 8px;
    background: #141414;
    border-radius: 4px;
}

.plan-step .step-index {
    width: 20px;
    height: 20px;
    background: #262626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #a3a3a3;
}

.plan-step .step-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
}

.plan-step .step-type.call_tool { background: #1e3a5f; color: #60a5fa; }
.plan-step .step-type.ask_user { background: #422006; color: #fb923c; }
.plan-step .step-type.respond { background: #14532d; color: #4ade80; }
.plan-step .step-type.escalate { background: #450a0a; color: #f87171; }

.plan-step .step-desc {
    flex: 1;
    color: #e5e5e5;
}

.plan-step .step-tool {
    font-size: 0.7rem;
    color: #525252;
    font-family: monospace;
}

.inspector-step {
    background: #1a1a1a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid #404040;
}

.inspector-step.success { border-left-color: #22c55e; }
.inspector-step.failed { border-left-color: #ef4444; }

.inspector-step .step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.inspector-step .step-num {
    font-size: 0.75rem;
    color: #525252;
}

.inspector-step .step-status {
    margin-left: auto;
}

.inspector-step .step-body {
    font-size: 0.8rem;
}

.inspector-step .step-desc { color: #e5e5e5; margin-bottom: 4px; }
.inspector-step .step-tool { color: #60a5fa; }
.inspector-step .step-params { color: #a3a3a3; font-family: monospace; font-size: 0.75rem; }
.inspector-step .step-result { color: #4ade80; font-family: monospace; font-size: 0.75rem; }
.inspector-step .step-error { color: #f87171; }

.inspector-step .step-type.planner { background: #1e3a5f; color: #60a5fa; }
.inspector-step .step-type.scheduling { background: #14532d; color: #4ade80; }
.inspector-step .step-type.communications { background: #422006; color: #fb923c; }
.inspector-step .step-type.knowledge { background: #3b0764; color: #c084fc; }
.inspector-step .step-type.response { background: #164e63; color: #22d3d1; }
.inspector-step .step-type.executor { background: #262626; color: #a3a3a3; }

.inspector-step .step-name {
    flex: 1;
    color: #a3a3a3;
    font-size: 0.75rem;
}

.inspector-step .step-section {
    margin-bottom: 8px;
}

.inspector-step .step-section strong {
    display: block;
    color: #737373;
    margin-bottom: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.inspector-step .step-data {
    background: #0a0a0a;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.inspector-step.scheduling { border-left-color: #4ade80; }
.inspector-step.response { border-left-color: #22d3d1; }
.inspector-step.planner, .inspector-step.plan_created { border-left-color: #60a5fa; }
.inspector-step.communications { border-left-color: #fb923c; }
.inspector-step.knowledge { border-left-color: #c084fc; }

.empty {
    color: #525252;
    font-style: italic;
}

.session-turn {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.turn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #262626;
}

.turn-header h4 {
    color: #60a5fa;
    font-size: 0.9rem;
    margin: 0;
}

.turn-trace {
    font-size: 0.7rem;
    color: #525252;
    font-family: monospace;
}

.turn-user-input {
    background: #1e3a5f;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    color: #e5e5e5;
}

.turn-reasoning {
    background: #1a1a1a;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
    color: #a3a3a3;
    font-size: 0.85rem;
}

.turn-events {
    margin-top: 12px;
}

.turns-section h3 {
    margin-bottom: 16px;
}

.turn-count {
    font-size: 0.7rem;
    background: #262626;
    padding: 2px 6px;
    border-radius: 4px;
    color: #a3a3a3;
}
