/* AI-FinConsole V2.0 — Design System */
:root {
    --bg: #F8F8FA;
    --sidebar-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --text: #1A1A2E;
    --text-sec: #6B7280;
    --accent: #1cb968;
    --accent-hover: #1e9156;
    --profit: #059669;
    --loss: #DC2626;
    --warn: #D97706;
    --border: #E5E7EB;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-width: 1500px;
    overflow-x: auto;
}

/* ===== Layout ===== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 256px;
    min-width: 256px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding: 0 8px;
}

.brand .logo {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.brand h2 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.brand .version {
    font-size: 11px;
    color: var(--text-sec);
    margin-top: 2px;
    display: block;
}

.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-sec);
    padding: 12px 8px 4px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    text-decoration: none;
    color: var(--text-sec);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-item.active {
    background: rgba(19, 196, 104, 0.08);
    color: var(--accent);
    font-weight: 600;
}

/* ===== Main ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    height: 60px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 248, 250, 0.85);
    backdrop-filter: blur(16px);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 7px 14px;
    width: 280px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
}

.search-bar .icon {
    color: var(--text-sec);
    font-size: 13px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile .user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sec);
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.views {
    padding: 32px;
    flex: 1;
}

.view-section {
    display: none;
    animation: fadeIn 0.25s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.4px;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.mt-16 {
    margin-top: 16px;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

/* ===== Dashboard Metric Cards ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.metric-card.accent-blue::before {
    background: var(--accent);
}

.metric-card.accent-red::before {
    background: var(--loss);
}

.metric-card.accent-green::before {
    background: var(--profit);
}

.metric-card.accent-purple::before {
    background: #9333EA;
}

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 12px;
}

.accent-blue .metric-icon {
    background: rgba(19, 196, 104, 0.1);
    color: var(--accent);
}

.accent-red .metric-icon {
    background: rgba(220, 38, 38, 0.1);
    color: var(--loss);
}

.accent-green .metric-icon {
    background: rgba(5, 150, 105, 0.1);
    color: var(--profit);
}

.accent-purple .metric-icon {
    background: rgba(147, 51, 234, 0.1);
    color: #9333EA;
}

.metric-card h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.metric-card .value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.metric-card .trend {
    font-size: 12px;
    color: var(--text-sec);
}

.section-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* Cash flow summary */
.cashflow-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 8px 0;
}

.cf-in span:last-child {
    color: var(--profit);
    font-weight: 600;
}

.cf-out span:last-child {
    color: var(--loss);
    font-weight: 600;
}

.cf-net {
    font-weight: 700;
    font-size: 15px;
}

.cf-divider {
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* ===== Tables ===== */
.table-card h3,
.table-card .card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg);
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:hover {
    background: var(--bg);
}

tbody tr:last-child td {
    border-bottom: none;
}

.empty-row {
    text-align: center;
    color: var(--text-sec);
    padding: 32px 0 !important;
}

.profit-cell {
    color: var(--profit);
    font-weight: 600;
}

.loss-cell {
    color: var(--loss);
    font-weight: 600;
}

.cost-cell {
    color: var(--warn);
    font-weight: 600;
}

.neutral-cell {
    color: var(--text-sec);
}

.remark-cell {
    color: var(--text-sec);
    font-size: 13px;
    max-width: 180px;
    white-space: normal;
    word-break: break-word;
}

/* ===== Statements ===== */
.statements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.statement-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.stmt-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-sec);
    margin: 14px 0 4px;
}

.stmt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.stmt-row .val {
    font-weight: 600;
}

.stmt-row .cost {
    color: var(--loss);
}

.stmt-row .profit {
    color: var(--profit);
}

.stmt-row .loss {
    color: var(--warn);
}

.stmt-row.highlight {
    font-weight: 700;
    font-size: 15px;
}

.stmt-row.warn-row .val {
    color: var(--warn);
}

.stmt-divider {
    border-top: 2px solid var(--border);
    margin: 8px 0;
}

.stmt-note {
    font-size: 12px;
    color: var(--text-sec);
    padding: 2px 0 6px;
}

/* Bank entry form */
.bank-entry-form {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.mini-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.mini-form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.mini-form-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
}

/* ===== Two Col Layout ===== */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}



.form-card .subtitle {
    font-size: 13px;
    color: var(--text-sec);
    margin-bottom: 20px;
    line-height: 1.5;
}

.form-card code {
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    font-family: var(--font);
    background: var(--card-bg);
    transition: border-color 0.15s;
}

.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-sm {
    border: none;
    cursor: pointer;
    font-family: var(--accent);
    font-weight: 600;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 11px 20px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 11px 20px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--accent);
    color: white;
    padding: 11px 20px;
    font-size: 14px;
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

.btn-success:hover {
    background: var(--accent-hover);
}

.btn-sm {
    background: var(--bg);
    color: var(--text-sec);
    border: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-sm:hover {
    background: var(--border);
}

.btn-group {
    display: flex;
    gap: 6px;
}

.btn-group .active-filter {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ===== Card Header Row ===== */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header-row h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    border: none;
    padding: 0;
}

/* ===== Result Boxes ===== */
.result-card {
    background: var(--bg);
    padding: 20px 24px;
}

.result-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--profit);
}

.res-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.res-divider {
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

.wallet-credit-status {
    margin-top: 12px;
    font-size: 13px;
    color: var(--profit);
    padding: 10px;
    background: rgba(5, 150, 105, 0.06);
    border-radius: var(--radius-sm);
}

.tag {
    padding: 4px 10px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 13px;
}

.tag.success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--profit);
}

.tag.warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warn);
}

.tag.blue {
    background: rgba(19, 196, 104, 0.1);
    color: var(--accent);
}

.result-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.6;
}

.result-box.success {
    background: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.result-box.error {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.total-label {
    font-size: 14px;
    font-weight: 700;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    text-align: right;
}

.mini-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 3px 0;
}

.mini-row .profit {
    color: var(--profit);
    font-weight: 600;
}

/* ===== Badges ===== */
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    display: inline-block;
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--profit);
}

.badge-pending {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warn);
}

.badge-royalty {
    background: rgba(147, 51, 234, 0.1);
    color: #9333EA;
}

.badge-warning {
    background: rgba(220, 38, 38, 0.1);
    color: var(--loss);
}

.badge-debit {
    background: rgba(220, 38, 38, 0.1);
    color: var(--loss);
}

.badge-credit {
    background: rgba(5, 150, 105, 0.1);
    color: var(--profit);
}

.status-badge {
    font-size: 13px;
    font-weight: 500;
}

/* ===== RAG ===== */
.rag-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    height: calc(100vh - 245px);

}

.chat-container {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    height: 100%;
}

.chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg);
}

.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--accent);
}

.message.user .avatar {
    color: var(--text-sec);
}

.message .bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.message.system .bubble {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
}

.message.user .bubble {
    background: var(--accent);
    color: white;
    border-top-right-radius: 4px;
}

.source-tag {
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-sec);
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-tag code {
    background: rgba(19, 196, 104, 0.08);
    color: var(--accent);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
}

.chat-input-area {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    background: var(--card-bg);
}

.chat-input-area input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0 16px;
    height: 40px;
    outline: none;
    font-size: 14px;
}

.chat-input-area input:focus {
    border-color: var(--accent);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s;
}

.btn-icon:hover {
    background: var(--accent-hover);
}

.rag-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.rag-shortcuts h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sec);
    margin-bottom: 4px;
}

.shortcut-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font);
    color: var(--text);
    transition: all 0.15s;
}

.shortcut-btn i {
    color: var(--accent);
    font-size: 12px;
}

.shortcut-btn:hover {
    background: rgba(19, 196, 104, 0.06);
    border-color: var(--accent);
}

/* Loading bubble */
.loading-bubble {
    gap: 4px;
    display: flex;
    align-items: center;
}

.loading-bubble span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-sec);
    animation: blink 1.2s infinite ease-in-out;
}

.loading-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {

    0%,
    80%,
    100% {
        opacity: 0.2;
    }

    40% {
        opacity: 1;
    }
}

/* ===== Toast ===== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: #1A1A2E;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.28s ease;
    min-width: 280px;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    background: var(--profit);
}

.toast-error {
    background: var(--loss);
}

.toast-info {
    background: var(--accent);
}

/* ===== Hidden ===== */
.hidden {
    display: none;
}

/* ===== Custom iOS Style Select ===== */
.ios-select-wrapper {
    position: relative;
    user-select: none;
    font-family: var(--font);
    width: 100%;
    margin-bottom: 2px;
}

.ios-select-trigger {
    background: #F3F4F6;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    color: var(--text);
}

.ios-select-trigger:hover {
    background: #E5E7EB;
}

.ios-select-wrapper.open .ios-select-trigger {
    border-color: var(--accent);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(19, 196, 104, 0.15);
}

.ios-select-trigger .icon {
    font-size: 13px;
    color: var(--text-sec);
    transition: transform 0.2s;
}

.ios-select-wrapper.open .ios-select-trigger .icon {
    transform: rotate(180deg);
}

.ios-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 100;
    display: none;
    overflow-y: auto;
    max-height: 250px;
    padding: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ios-select-wrapper.open .ios-select-dropdown {
    display: block;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ios-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.15s;
    border-bottom: 1px solid #F9FAFB;
}

.ios-option:last-child {
    border-bottom: none;
}

.ios-option.selected {
    background: rgba(19, 196, 104, 0.08);
}

.ios-option.selected .ios-opt-left span {
    font-weight: 600;
    color: var(--accent);
}

.ios-option:hover {
    background: #F8F9FA;
}

.ios-opt-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ios-opt-left i {
    width: 16px;
    text-align: center;
    font-size: 15px;
    color: var(--text-sec);
}

.ios-option.selected .ios-opt-left i {
    color: var(--accent);
}

.ios-opt-right {
    font-size: 12px;
    color: var(--text-sec);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Verification Code Modal ===== */
.verify-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.verify-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.verify-modal {
    background: #FFFFFF;
    border-radius: 18px;
    width: 380px;
    padding: 32px 28px 24px;
    transform: scale(0.92) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
    opacity: 0;
}

.verify-overlay.open .verify-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.verify-modal .verify-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(217, 119, 6, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #D97706;
    margin: 0 auto 16px;
}

.verify-modal h3 {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
    border: none;
    padding: 0;
}

.verify-modal .verify-desc {
    text-align: center;
    font-size: 13px;
    color: var(--text-sec);
    line-height: 1.5;
    margin-bottom: 20px;
}

.verify-modal .verify-canvas-container {
    text-align: center;
    background: var(--bg);
    border-radius: 12px;
    padding: 10px 0;
    margin-bottom: 16px;
    user-select: none;
    cursor: pointer;
    overflow: hidden;
}

.verify-modal .verify-canvas-container canvas {
    border-radius: 8px;
    vertical-align: middle;
}

.verify-modal .verify-input {
    width: 100%;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 8px;
    padding: 12px 0;
    border: 2px solid var(--border);
    border-radius: 12px;
    outline: none;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    transition: border-color 0.2s;
    color: var(--text);
    margin-bottom: 6px;
}

.verify-modal .verify-input:focus {
    border-color: var(--accent);
}

.verify-modal .verify-input::placeholder {
    font-family: var(--font);
    font-size: 15px;
    letter-spacing: normal;
    font-weight: 400;
    color: var(--text-sec);
}

.verify-modal .verify-input.shake {
    animation: shakeInput 0.35s ease;
    border-color: var(--loss);
}

@keyframes shakeInput {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.verify-modal .verify-error {
    text-align: center;
    font-size: 12px;
    color: var(--loss);
    height: 16px;
    margin-bottom: 12px;
}

.verify-modal .verify-btns {
    display: flex;
    gap: 10px;
}

.verify-modal .verify-btns button {
    flex: 1;
    padding: 11px 0;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}

.verify-modal .btn-verify-cancel {
    background: var(--bg);
    color: var(--text-sec);
    border: 1px solid var(--border);
}

.verify-modal .btn-verify-cancel:hover {
    background: var(--border);
}

.verify-modal .btn-verify-confirm {
    background: var(--accent);
    color: white;
}

.verify-modal .btn-verify-confirm:hover {
    background: var(--accent-hover);
}

.verify-modal .btn-verify-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== AI Typing Cursor ===== */
.ai-typing-cursor {
    display: inline;
    color: var(--accent);
    animation: blink 0.6s infinite;
    font-weight: 400;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ===== Markdown Rendering Styles ===== */
.bubble p {
    line-height: 1.6;
    margin-bottom: 0.8em;
}

.bubble p:last-child {
    margin-bottom: 0;
}

.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
    margin-top: 1.25em;
    margin-bottom: 0.6em;
    line-height: 1.4;
    font-weight: 600;
}

.bubble h1 {
    font-size: 1.4em;
}

.bubble h2 {
    font-size: 1.25em;
}

.bubble h3 {
    font-size: 1.1em;
}

.bubble ul,
.bubble ol {
    margin-top: 0.5em;
    margin-bottom: 1em;
    padding-left: 1.5em;
    /* Ensure left padding for list items */
}

.bubble li {
    margin-bottom: 0.4em;
    line-height: 1.6;
}

.bubble table {
    margin-top: 1em;
    margin-bottom: 1em;
    width: 100%;
}