:root {
    --pm-primary: #2563eb;
    --pm-primary-dark: #1e40af;
    --pm-secondary: #0f172a;
    --pm-muted: #64748b;
    --pm-border: #e2e8f0;
    --pm-bg: #f4f7fb;
    --pm-card: #ffffff;
    --pm-sidebar: #0b1220;
}

* { box-sizing: border-box; }
body { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #0f172a; }
a { text-decoration: none; }

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .18), transparent 34%),
        linear-gradient(135deg, #eef4ff 0%, #f8fafc 50%, #edf2ff 100%);
}
.auth-wrapper { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .16);
    background: #fff;
}
.login-brand-panel {
    padding: 56px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(30, 64, 175, .94)),
        url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='.08'%3E%3Cpath d='M0 0h60v60H0zM60 60h60v60H60z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-brand-panel h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; margin: 28px 0 18px; }
.login-brand-panel p { color: rgba(255,255,255,.78); font-size: 17px; max-width: 520px; }
.login-points { display: grid; gap: 12px; margin-top: 34px; }
.login-points span { display: inline-flex; align-items: center; gap: 10px; color: rgba(255,255,255,.88); }
.login-card { padding: 56px; display: flex; flex-direction: column; justify-content: center; }

.app-body { background: var(--pm-bg); min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 286px;
    flex: 0 0 286px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    background:
        radial-gradient(circle at 20% 0%, rgba(37, 99, 235, .35), transparent 28%),
        linear-gradient(180deg, #0b1220 0%, #111827 100%);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.brand-mark {
    width: 46px; height: 46px; border-radius: 16px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 14px 32px rgba(37, 99, 235, .38);
    color: #fff;
    font-size: 22px;
}
.brand-mark.large { width: 62px; height: 62px; border-radius: 22px; font-size: 28px; }
.brand-title { font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand-subtitle { color: rgba(255,255,255,.56); font-size: 12px; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav .nav-link {
    color: rgba(255,255,255,.68);
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px;
    border-radius: 15px;
    font-weight: 600;
    transition: .18s ease;
}
.sidebar-nav .nav-link i { font-size: 18px; }
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.11); }
.sidebar-footer { margin-top: auto; padding-top: 24px; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.08); }
.user-avatar { width: 40px; height: 40px; border-radius: 14px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 800; }
.user-name { color: #fff; font-weight: 700; max-width: 160px; }
.logout-link { color: rgba(255,255,255,.6); font-size: 12px; }
.logout-link:hover { color: #fff; }
.min-w-0 { min-width: 0; }

.main-area { flex: 1; min-width: 0; }
.topbar {
    height: 86px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 34px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226,232,240,.8);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-kicker { color: var(--pm-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.topbar-title { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.content-area { padding: 32px 34px 44px; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid #bbf7d0;
    color: #166534;
    background: #f0fdf4;
    padding: 9px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
.status-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }

.btn { border-radius: 13px; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #2563eb; box-shadow: 0 10px 24px rgba(37, 99, 235, .20); }
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); border-color: #1d4ed8; }
.btn-light { background: #fff; border-color: var(--pm-border); }
.form-control, .form-select, .input-group-text { border-color: var(--pm-border); border-radius: 13px; }
.input-group > .form-control:not(:first-child), .input-group > .form-select:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group-text { background: #f8fafc; color: var(--pm-muted); }

.hero-panel {
    border-radius: 28px;
    padding: 34px;
    background:
        radial-gradient(circle at 85% 0%, rgba(96, 165, 250, .34), transparent 30%),
        linear-gradient(135deg, #0f172a, #1d4ed8);
    color: #fff;
    box-shadow: 0 24px 54px rgba(30, 64, 175, .22);
}
.eyebrow { display: inline-flex; align-items: center; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.hero-title { font-size: clamp(30px, 4vw, 46px); font-weight: 850; letter-spacing: -.05em; }
.hero-text { color: rgba(255,255,255,.78); font-size: 17px; max-width: 760px; }
.page-title { font-size: 32px; font-weight: 850; letter-spacing: -.04em; }

.stat-card, .panel-card, .chat-panel {
    background: var(--pm-card);
    border: 1px solid rgba(226,232,240,.84);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}
.stat-card { border-radius: 22px; padding: 22px; display: flex; align-items: center; gap: 16px; min-height: 114px; }
.stat-icon { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 23px; }
.stat-primary { color: #1d4ed8; background: #dbeafe; }
.stat-info { color: #0369a1; background: #e0f2fe; }
.stat-warning { color: #b45309; background: #fef3c7; }
.stat-success { color: #15803d; background: #dcfce7; }
.stat-label { color: var(--pm-muted); font-weight: 700; font-size: 13px; }
.stat-value { font-size: 34px; font-weight: 850; letter-spacing: -.04em; line-height: 1; margin-top: 4px; }
.panel-card { border-radius: 22px; overflow: hidden; }
.panel-card-header { padding: 22px 24px; border-bottom: 1px solid var(--pm-border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-card-body { padding: 24px; }
.header-icon { font-size: 26px; color: #2563eb; }
.panel-table thead th { background: #f8fafc; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--pm-border); padding: 14px 18px; }
.panel-table td { padding: 16px 18px; border-color: #edf2f7; }
.soft-code { background: #f1f5f9; color: #334155; border-radius: 9px; padding: 5px 8px; font-size: 12px; }
.table-link { color: #1d4ed8; font-weight: 700; }
.site-cell { display: flex; align-items: center; gap: 12px; }
.site-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: #2563eb; background: #dbeafe; }
.site-cell small { display: block; color: var(--pm-muted); margin-top: 2px; }

.timeline-list { padding: 8px 24px 24px; display: grid; gap: 14px; }
.timeline-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 18px; background: #f8fafc; }
.timeline-item span { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px; display: grid; place-items: center; background: #dbeafe; color: #1d4ed8; font-weight: 850; }
.timeline-item small { display: block; color: var(--pm-muted); margin-top: 3px; }

.security-note { display: flex; gap: 14px; padding: 16px; border-radius: 18px; background: #f8fafc; border: 1px dashed #cbd5e1; }
.security-icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px; display: grid; place-items: center; background: #dcfce7; color: #15803d; }
.security-note p { color: var(--pm-muted); font-size: 13px; }
.command-list { padding: 18px 20px 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.command-chip { border: 1px solid var(--pm-border); background: #f8fafc; color: #334155; padding: 10px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.command-chip:hover { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

.chat-panel { border-radius: 24px; overflow: hidden; min-height: 74vh; display: flex; flex-direction: column; }
.chat-header { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--pm-border); }
.ai-avatar { width: 50px; height: 50px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); font-size: 22px; }
.chat-box { flex: 1; min-height: 52vh; max-height: 62vh; overflow-y: auto; background: linear-gradient(180deg, #f8fafc, #fff); padding: 24px; }
.chat-footer { padding: 18px; border-top: 1px solid var(--pm-border); background: #fff; }
.empty-chat { height: 100%; min-height: 320px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--pm-muted); }
.empty-chat h4 { color: #0f172a; font-weight: 850; letter-spacing: -.03em; }
.empty-chat p { max-width: 520px; }
.empty-icon { width: 70px; height: 70px; border-radius: 24px; display: grid; place-items: center; margin: 0 auto 18px; color: #2563eb; background: #dbeafe; font-size: 30px; }
.chat-message { padding: 14px 16px; border-radius: 18px; margin-bottom: 14px; max-width: 92%; white-space: pre-wrap; box-shadow: 0 8px 22px rgba(15,23,42,.06); }
.chat-user { margin-left: auto; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; border-bottom-right-radius: 6px; }
.chat-ai { background: #fff; color: #1e293b; border: 1px solid var(--pm-border); border-bottom-left-radius: 6px; }
pre.code-preview { max-height: 360px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 14px; font-size: 12px; }

.mobile-sidebar { background: var(--pm-sidebar); color: #fff; }

@media (max-width: 991.98px) {
    .sidebar { display: none; }
    .topbar { padding: 14px 18px; height: auto; }
    .content-area { padding: 22px 18px 32px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { padding: 38px; }
    .login-card { padding: 38px; }
}
@media (max-width: 575.98px) {
    .auth-wrapper { padding: 14px; }
    .login-brand-panel, .login-card { padding: 28px; }
    .hero-panel { padding: 24px; }
    .topbar-title { font-size: 20px; }
}


.model-info-card {
    border: 1px solid rgba(17, 24, 39, .08);
    background: linear-gradient(135deg, rgba(13, 110, 253, .08), rgba(13, 202, 240, .06));
    border-radius: 18px;
    padding: 14px;
}
.model-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #0d6efd;
    color: #fff;
    flex: 0 0 auto;
}
.recommended-models {
    display: grid;
    gap: 8px;
}
.model-chip {
    border: 1px solid rgba(13, 110, 253, .15);
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    transition: .18s ease;
}
.model-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(13, 110, 253, .45);
    box-shadow: 0 8px 24px rgba(13, 110, 253, .12);
}
.model-chip span {
    font-weight: 700;
    color: #111827;
}
.model-chip small {
    color: #6b7280;
    white-space: nowrap;
}

.file-list-box {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}
.file-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
}
.file-list-row:last-child { border-bottom: 0; }
.file-list-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.file-list-name code {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}
.file-list-name small {
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
}
.proposal-card {
    border: 1px solid #dbeafe;
    background: #f8fbff;
    border-radius: 16px;
    padding: 14px;
}
@media (max-width: 768px) {
    .file-list-row { align-items: flex-start; flex-direction: column; }
    .file-list-name code { max-width: 260px; }
}

.smart-discovery {
    border: 1px solid rgba(37, 99, 235, .18);
    background: linear-gradient(180deg, rgba(37, 99, 235, .06), rgba(37, 99, 235, .02));
    border-radius: 16px;
    padding: 14px;
}
.search-result-mini {
    display: grid;
    gap: 6px;
}
.search-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .08);
    font-size: 12px;
}
.search-results-box .search-result-row {
    align-items: flex-start;
}
.search-excerpt {
    margin-top: 6px;
    max-width: 760px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border-left: 3px solid #2563eb;
    padding: 6px 8px;
    border-radius: 8px;
    white-space: pre-wrap;
}
