body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1rem;
    color: #222;
    background: #f7f7f9;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
header nav a {
    margin-inline-start: 1rem;
    color: #2a5db0;
    text-decoration: none;
}
header nav a:hover {
    text-decoration: underline;
}
label {
    display: block;
    margin-top: 1rem;
    font-weight: 600;
}
input[type="text"], input[type="password"], textarea, select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    margin-top: 0.25rem;
    font-size: 1rem;
    font-family: inherit;
}
button {
    margin-top: 0.75rem;
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    cursor: pointer;
}
.hidden {
    display: none;
}
.muted {
    color: #777;
    font-size: 0.9rem;
}
#status {
    margin-top: 0.5rem;
    color: #555;
}
.field-status {
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: #555;
}
section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

/* ---- step log (index page + log page) ---- */
.steps-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    overflow: hidden;
}
.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
.step:last-child {
    border-bottom: none;
}
.step-ok {
    background: #f3fbf3;
}
.step-error {
    background: #fdf2f2;
}
.step-icon {
    font-weight: bold;
}
.step-ok .step-icon {
    color: #2a8a3d;
}
.step-error .step-icon {
    color: #c0392b;
}
.step-label {
    font-weight: 600;
    min-width: 11rem;
}
.step-detail {
    color: #555;
    flex: 1;
}
.step-duration {
    color: #999;
    font-size: 0.8rem;
}

/* ---- knowledge base ---- */
.knowledge-form {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.knowledge-group-title {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #444;
}
.knowledge-list {
    list-style: none;
    padding: 0;
}
.knowledge-list li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eee;
}
.knowledge-item-text {
    flex: 1;
    white-space: pre-wrap;
}

/* ---- request log page ---- */
.log-list {
    list-style: none;
    padding: 0;
}
.log-entry {
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.log-success {
    border-inline-start: 4px solid #2a8a3d;
}
.log-error {
    border-inline-start: 4px solid #c0392b;
    color: #c0392b;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}
.log-entry-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.9rem;
}
.log-status {
    font-weight: 700;
}
.log-url {
    color: #555;
    word-break: break-all;
}
.log-time, .log-duration {
    color: #999;
    margin-inline-start: auto;
}
.log-suggestion {
    white-space: pre-wrap;
    background: #fafafa;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}
details {
    margin-top: 0.5rem;
}
details summary {
    cursor: pointer;
    color: #2a5db0;
}

/* ---- main dashboard page ---- */
.url-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 1rem;
}
.url-bar input {
    margin-top: 0;
    flex: 1;
}
.url-bar button {
    margin-top: 0;
    white-space: nowrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-top: 1.25rem;
}
@media (max-width: 800px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.client-panel, .intelligence-panel {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 1.25rem;
}
.client-panel h2 {
    margin-top: 0;
    font-size: 1.3rem;
}
.info-group {
    margin-top: 1.25rem;
}
.info-group h3 {
    margin: 0 0 0.4rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #888;
}
.info-group dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
}
.info-group dt {
    color: #777;
    font-size: 0.9rem;
}
.info-group dd {
    margin: 0;
    font-weight: 600;
}

.intelligence-panel h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}
.intelligence-panel h3:first-of-type {
    margin-top: 0.5rem;
}
.bullet-list {
    margin: 0;
    padding-inline-start: 1.25rem;
}
.next-action {
    background: #eef4fc;
    border-inline-start: 4px solid #2a5db0;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    font-weight: 600;
}

.sentiment-badge {
    display: inline-flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: #f0f0f0;
    font-weight: 700;
}
.sentiment-badge .sentiment-explanation {
    font-weight: 400;
    font-size: 0.85rem;
    color: #555;
}
.sentiment-positive, .sentiment-excited { background: #e5f7e8; }
.sentiment-neutral { background: #eee; }
.sentiment-price_sensitive, .sentiment-confused { background: #fdf3d9; }
.sentiment-frustrated { background: #fbe3e1; }
.sentiment-urgent { background: #eee0fb; }

.timeline-list {
    margin: 0;
    padding-inline-start: 1.25rem;
}
.timeline-list li {
    margin-bottom: 0.3rem;
}

.reply-box {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eee;
}
.reply-box textarea {
    font-family: inherit;
}
