/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #EEF2FF;
    --text: #111827;
    --text-light: #6B7280;
    --bg: #F9FAFB;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --success: #059669;
    --warning: #D97706;
    --danger: #DC2626;
    --radius: 8px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
.container { max-width: 900px; margin: 0 auto; padding: 0 24px; }
h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }
a { color: var(--primary); text-decoration: none; }

/* Buttons */
.btn { display: inline-block; padding: 10px 24px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 2px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-small { padding: 6px 16px; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* Nav */
nav { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 900px; margin: 0 auto; padding: 0 24px; display: flex; justify-content: space-between; align-items: center; height: 56px; }
.logo { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.nav-links { display: flex; gap: 24px; align-items: center; font-size: 0.85rem; }
.nav-links a { color: var(--text-light); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
#nav-user { color: var(--text-light); font-size: 0.8rem; }

/* Auth Pages */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--bg); }
.auth-card { background: var(--white); padding: 40px; border-radius: var(--radius); border: 1px solid var(--border); width: 100%; max-width: 400px; text-align: center; }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.auth-card p { color: var(--text-light); margin-bottom: 24px; font-size: 0.9rem; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card input { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.auth-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.auth-switch { margin-top: 16px; font-size: 0.85rem; color: var(--text-light); }
.error { color: var(--danger); font-size: 0.85rem; margin-top: 12px; padding: 8px; background: #FEF2F2; border-radius: var(--radius); }

/* Page */
.page { padding: 32px 24px; max-width: 900px; margin: 0 auto; }

/* Cards */
.card { background: var(--white); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.card-link { display: block; margin-top: 12px; font-size: 0.85rem; font-weight: 500; }

/* Usage Meter */
.usage-card { margin-bottom: 8px; }
.usage-bar { height: 24px; background: #E5E7EB; border-radius: 12px; overflow: hidden; margin: 8px 0; }
.usage-fill { height: 100%; background: var(--primary); border-radius: 12px; transition: width 0.5s ease; min-width: 2px; }
.usage-fill.warning { background: var(--warning); }
.usage-fill.danger { background: var(--danger); }
.usage-text { font-size: 0.9rem; color: var(--text-light); }
.usage-plan { margin-top: 8px; font-size: 0.85rem; color: var(--text-light); }

/* Call List */
.call-item { padding: 16px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.call-item:last-child { border-bottom: none; }
.call-title { font-weight: 600; font-size: 0.95rem; }
.call-meta { font-size: 0.8rem; color: var(--text-light); }
.call-duration { font-size: 0.85rem; color: var(--text-light); }

/* Call Detail */
.back-link { font-size: 0.85rem; display: inline-block; margin-bottom: 16px; }
.call-summary { background: var(--primary-light); padding: 16px; border-radius: var(--radius); margin: 16px 0; }
.call-transcript { background: var(--white); padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); white-space: pre-wrap; font-family: monospace; font-size: 0.85rem; max-height: 400px; overflow-y: auto; margin: 16px 0; }

/* Documents */
.doc-item { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.doc-item:last-child { border-bottom: none; }
.doc-name { font-weight: 500; }
.doc-meta { font-size: 0.8rem; color: var(--text-light); }

/* Billing */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-option { padding: 16px; border: 2px solid var(--border); border-radius: var(--radius); text-align: center; cursor: pointer; transition: all 0.2s; }
.plan-option:hover { border-color: var(--primary); }
.plan-option.current { border-color: var(--success); background: #F0FDF4; }
.plan-price { font-size: 1.5rem; font-weight: 800; }
.plan-price span { font-size: 0.85rem; font-weight: 400; color: var(--text-light); }
.plan-hours { font-size: 0.85rem; color: var(--text-light); margin: 4px 0 12px; }

.credit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.credit-option { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.credit-price { font-size: 1.25rem; font-weight: 700; }
.credit-hours { font-size: 0.85rem; color: var(--text-light); margin: 4px 0 12px; }

/* Empty State */
.empty { text-align: center; padding: 32px; color: var(--text-light); font-size: 0.9rem; }

/* Spinner */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: white; padding: 12px 24px; border-radius: var(--radius); font-size: 0.9rem; z-index: 1000; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Verify Banner */
.verify-banner { background: #FEF3C7; color: #92400E; padding: 12px 24px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* Password field with toggle */
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 60px; }
.toggle-pw { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.8rem; font-weight: 500; }

/* Password strength */
.pw-strength { margin-top: 4px; }
.pw-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.pw-fill { height: 100%; border-radius: 2px; transition: width 0.3s, background 0.3s; }
.pw-strength span { font-size: 0.75rem; }

/* Search */
.search-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 16px; }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Tabs */
.tab-bar { display: flex; gap: 0; margin-bottom: 0; }
.tab { padding: 10px 20px; background: var(--bg); border: 1px solid var(--border); border-bottom: none; cursor: pointer; font-size: 0.85rem; font-weight: 500; color: var(--text-light); border-radius: var(--radius) var(--radius) 0 0; }
.tab.active { background: var(--white); color: var(--primary); border-bottom-color: var(--white); }
.kb-tab { border-top-left-radius: 0; }

/* Textarea */
textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; font-family: inherit; resize: vertical; }
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Profile forms */
#profile-info div { margin-bottom: 8px; font-size: 0.9rem; }
#name-form, #pw-form { display: flex; flex-direction: column; gap: 10px; }
#name-form input, #pw-form input { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }

/* Hamburger */
.hamburger { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); }

/* Mobile */
@media (max-width: 768px) {
    .card-grid, .plan-grid, .credit-grid { grid-template-columns: 1fr; }
    .call-item { flex-direction: column; align-items: flex-start; gap: 4px; }
    .hamburger { display: block; }
    .nav-links { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--border); padding: 16px 24px; gap: 12px; }
    .nav-links.open { display: flex; }
    .tab-bar { overflow-x: auto; }
    .tab { font-size: 0.8rem; padding: 8px 14px; white-space: nowrap; }
}
