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

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --entry-user: #f0f9ff;
    --entry-system: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --radius: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent);
    color: white;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace, .archive {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.entry-list, .archive-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 15px;
}

.entry {
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.entry.user-entry {
    background: var(--entry-user);
    border-color: #bfdbfe;
    margin-left: 40px;
}

.entry.system-entry {
    background: var(--entry-system);
    margin-right: 40px;
}

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

.entry-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entry-time {
    font-size: 12px;
    color: var(--text-muted);
}

.entry-content {
    font-size: 15px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.entry-content p {
    margin-bottom: 12px;
}

.entry-content p:last-child {
    margin-bottom: 0;
}

.entry-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
}

.entry-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.entry-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.input-area {
    padding: 16px 24px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 12px 16px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

#inputField {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    color: var(--text-primary);
    min-height: 24px;
    max-height: 200px;
    line-height: 1.5;
}

#inputField::placeholder {
    color: var(--text-muted);
}

.submit-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.submit-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.status.processing::before {
    background: var(--accent);
    animation: pulse 1s infinite;
}

.status.error::before {
    background: #ef4444;
}

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

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

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

@media (max-width: 640px) {
    .header {
        padding: 12px 16px;
    }

    .logo span {
        display: none;
    }

    .entry-list, .archive-list {
        padding: 16px;
    }

    .entry.user-entry {
        margin-left: 20px;
    }

    .entry.system-entry {
        margin-right: 20px;
    }

    .input-area {
        padding: 12px 16px 16px;
    }
}
