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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 720px;
    height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.header button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
}

.header button:hover {
    background: #f5f5f5;
}

.approval-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    background: #fff8e8;
    border-bottom: 1px solid #ead9a7;
    color: #4f3f13;
    font-size: 13px;
}

.approval-banner.hidden {
    display: none;
}

.approval-banner a {
    color: #1a1a1a;
    font-weight: 600;
    text-decoration: none;
}

.approval-banner a:hover {
    text-decoration: underline;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user {
    background: #1a1a1a;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.agent {
    background: #f0f0f0;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.thinking {
    color: #999;
    font-style: italic;
}

.input-area {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.input-area input:focus {
    border-color: #1a1a1a;
}

.input-area button {
    padding: 10px 20px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

.input-area button:hover {
    background: #333;
}

/* Settings */
.nav-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
}

.nav-link:hover { color: #1a1a1a; }

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section h2 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.section-title-row h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.subsection {
    margin-bottom: 14px;
}

.subsection h3 {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
}

.field label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 6px;
}

.field-row {
    display: flex;
    gap: 8px;
}

.field-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.field-row input:focus { border-color: #1a1a1a; }

.field-row button {
    padding: 8px 16px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.secondary-btn {
    padding: 6px 10px;
    background: white;
    color: #444;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #f5f5f5;
}

.hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.tool-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tool-list li {
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #444;
}

.permission-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.permission-item h3 {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
}

.code-value,
.path-list code {
    display: block;
    width: 100%;
    padding: 7px 9px;
    background: #f7f7f7;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    color: #262626;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
}

.path-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.path-list .empty-state {
    color: #999;
    font-size: 12px;
}

.status-pill {
    flex: 0 0 auto;
    padding: 3px 8px;
    background: #edf7ee;
    border: 1px solid #cfe8d2;
    border-radius: 999px;
    color: #276733;
    font-size: 12px;
}

.status-pill.warning {
    background: #fff8e8;
    border-color: #ead9a7;
    color: #735b16;
}

.approval-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.approval-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
}

.approval-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.approval-header strong {
    min-width: 0;
    font-size: 13px;
    color: #1a1a1a;
    overflow-wrap: anywhere;
}

.approval-reason {
    font-size: 12px;
    color: #555;
    line-height: 1.4;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.approval-args {
    max-height: 160px;
    overflow: auto;
    padding: 8px;
    background: white;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #262626;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-bottom: 10px;
}

.approval-actions {
    display: flex;
    gap: 8px;
}

.approval-actions button {
    padding: 7px 12px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

.approval-actions .danger-btn {
    background: white;
}

.danger-btn {
    padding: 8px 16px;
    background: white;
    color: #e53e3e;
    border: 1px solid #e53e3e;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.danger-btn:hover {
    background: #fff5f5;
}

.login-container {
    max-width: 400px;
    height: auto;
}

.login-form {
    padding: 24px 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 6px;
}

.login-error {
    font-size: 13px;
    color: #c0392b;
    margin-top: 8px;
}

@media (max-width: 480px) {
    body { padding: 0 16px; }
}
