/* ================================================================
   index.css — AI 법률상담 (Enterprise Light)
   ================================================================ */

/* ── App Shell ───────────────────────────────── */
body {
    background: #f0f2f7;
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 860px;
    margin: 0 auto;
    position: relative;
    background: #ffffff;
    border-left: 1px solid #e8ebf2;
    border-right: 1px solid #e8ebf2;
}


/* ── Header ──────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    flex-shrink: 0;
    background: #ffffff;
    border-bottom: 1px solid #eceef5;
    position: relative;
    z-index: 10;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(79,95,229,.15), transparent);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #4f5fe5 0%, #7c6cf0 100%);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(79, 95, 229, .3), inset 0 1px 0 rgba(255,255,255,.2);
}

.header-brand-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1d2e;
    letter-spacing: -0.03em;
}

.header-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4f5fe5;
    background: linear-gradient(135deg, #eef0ff, #e8e5ff);
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.header-divider {
    width: 1px;
    height: 20px;
    background: #e4e7f1;
    margin: 0 6px;
}

.header-action {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #9298ae;
    font-size: 14px;
    transition: all .2s cubic-bezier(.4,0,.2,1);
}

.header-action:hover {
    background: #f4f5fa;
    color: #4f5fe5;
}

.header-action--primary {
    background: #f4f5fa;
    color: #5a6178;
}

.header-action--primary:hover {
    background: #eef0ff;
    color: #4f5fe5;
}


/* ── Chat Area ───────────────────────────────── */
.chat {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px;
    scroll-behavior: smooth;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(79,95,229,.02) 0%, transparent 70%),
        #fafbfe;
}


/* ── Empty State ─────────────────────────────── */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 24px;
    animation: fadeUp .6s cubic-bezier(.4,0,.2,1);
}

.chat-empty.hidden { display: none; }

/* ── Drop Zone ───────────────────────────────── */
.drop-zone {
    width: 100%;
    max-width: 480px;
    padding: 48px 32px;
    border: 2px dashed #d0d5e4;
    border-radius: 20px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(79,95,229,.03) 0%, transparent 70%),
        #fafbfe;
    cursor: pointer;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drop-zone:hover {
    border-color: #4f5fe5;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(79,95,229,.06) 0%, transparent 70%),
        #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(79,95,229,.08);
}

.drop-zone--over {
    border-color: #4f5fe5;
    border-style: solid;
    background: #f0f1ff;
    transform: scale(1.01);
    box-shadow: 0 8px 32px rgba(79,95,229,.12);
}

.drop-zone-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    font-size: 24px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(79,95,229,.25);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.drop-zone:hover .drop-zone-icon {
    transform: translateY(-4px);
}

.drop-zone--over .drop-zone-icon {
    animation: iconBounce .5s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    40%      { transform: translateY(-8px); }
    60%      { transform: translateY(-4px); }
}

.drop-zone-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1d2e;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.drop-zone-desc {
    font-size: 14px;
    color: #8a90a5;
    line-height: 1.7;
    margin-bottom: 20px;
}

.drop-zone-formats {
    display: flex;
    gap: 8px;
}

.format-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #4f5fe5;
    background: #eef0ff;
    padding: 4px 10px;
    border-radius: 6px;
}

.drop-zone-or {
    margin-top: 24px;
    font-size: 13px;
    color: #b0b5c5;
    position: relative;
    width: 100%;
    max-width: 480px;
    text-align: center;
}

.drop-zone-or::before,
.drop-zone-or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 120px);
    height: 1px;
    background: #e4e7f1;
}

.drop-zone-or::before { left: 0; }
.drop-zone-or::after  { right: 0; }


/* ── Messages ────────────────────────────────── */
.messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 24px 0 36px;
}

.msg {
    display: flex;
    gap: 14px;
    padding: 18px 0;
    animation: fadeUp .3s cubic-bezier(.4,0,.2,1);
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-role {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.msg-content {
    font-size: 14.5px;
    line-height: 1.85;
    color: #2e3347;
    word-break: break-word;
}

.msg-content p { margin-bottom: 10px; }
.msg-content p:last-child { margin-bottom: 0; }

/* 사용자 */
.msg--user .msg-avatar {
    background: #f4f5fa;
    color: #5a6178;
    border: 1px solid #e8ebf2;
}
.msg--user .msg-role { color: #7a7f94; }

/* AI */
.msg--ai .msg-avatar {
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    box-shadow: 0 3px 10px rgba(79,95,229,.2);
}
.msg--ai .msg-role { color: #4f5fe5; }
.msg--ai .msg-content { color: #2a2e3f; }

/* 로딩 dots */
.msg-loading {
    display: inline-flex;
    gap: 5px;
    padding: 6px 0;
}

.msg-loading span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4f5fe5;
    animation: dotPulse 1.2s ease-in-out infinite;
}

.msg-loading span:nth-child(2) { animation-delay: .2s; }
.msg-loading span:nth-child(3) { animation-delay: .4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: .25; transform: scale(.7); }
    40%           { opacity: 1;   transform: scale(1);   }
}

.msg-time {
    font-size: 11px;
    color: #b8bdd0;
    margin-top: 6px;
}


/* ── Composer ────────────────────────────────── */
.composer {
    flex-shrink: 0;
    padding: 16px 24px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid #eceef5;
}

.composer-inner {
    max-width: 780px;
    margin: 0 auto;
}

.composer-box {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f7f8fc;
    border: 1.5px solid #e4e7f1;
    border-radius: 18px;
    padding: 8px 8px 8px 20px;
    transition: all .25s cubic-bezier(.4,0,.2,1);
}

.composer-box:focus-within {
    border-color: #4f5fe5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79,95,229,.07), 0 4px 16px rgba(79,95,229,.06);
}

.composer-box textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #1a1d2e;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    resize: none;
    max-height: 160px;
    padding: 8px 0;
    font-family: inherit;
}

.composer-box textarea::placeholder {
    color: #b0b5c5;
}

.composer-send {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 12px rgba(79,95,229,.3), inset 0 1px 0 rgba(255,255,255,.15);
}

.composer-send:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(79,95,229,.35);
}

.composer-send:active {
    transform: scale(.97);
}

.composer-send:disabled {
    background: #e8ebf2;
    color: #b8bdd0;
    cursor: default;
    box-shadow: none;
    transform: none;
}


/* ── Progress Bar ────────────────────────────── */
.progress-bar {
    flex-shrink: 0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: #ffffff;
    border-bottom: 1px solid #eceef5;
}
.progress-bar.hidden { display: none; }

.progress-track {
    flex: 1;
    height: 6px;
    background: #eef0f6;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f5fe5, #7c6cf0);
    border-radius: 3px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,.3) 50%,
        transparent 100%
    );
    animation: progressShimmer 1.8s infinite;
}

@keyframes progressShimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 13px;
    font-weight: 700;
    color: #4f5fe5;
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.progress-label {
    font-size: 12px;
    color: #8a90a5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}


/* ── Question Card ──────────────────────────── */
.question-card {
    border-left: 3px solid #4f5fe5;
    background: linear-gradient(135deg, #f8f9ff 0%, #f4f3ff 100%);
    border-radius: 0 12px 12px 0;
    padding: 16px 18px;
    margin-left: -3px;
}

.q-badge {
    display: inline-block;
    background: linear-gradient(135deg, #eef0ff, #e8e5ff);
    color: #4f5fe5;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.q-text {
    font-size: 15px;
    font-weight: 500;
    color: #2a2e3f;
    line-height: 1.7;
}


/* ── Analysis Panel ─────────────────────────── */
.analysis-panel {
    padding: 28px 0 40px;
    animation: fadeUp .4s cubic-bezier(.4,0,.2,1);
}
.analysis-panel.hidden { display: none; }

.analysis-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.analysis-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    font-size: 19px;
    box-shadow: 0 4px 14px rgba(79,95,229,.25), inset 0 1px 0 rgba(255,255,255,.15);
}

.analysis-header-text {
    flex: 1;
}

.analysis-header h2 {
    font-size: 19px;
    font-weight: 800;
    color: #1a1d2e;
    letter-spacing: -0.02em;
}

.analysis-sub {
    font-size: 13px;
    color: #8a90a5;
    margin-top: 2px;
    display: block;
}

.analysis-back {
    background: #ffffff;
    border: 1px solid #e4e7f1;
    color: #5a6178;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.analysis-back:hover {
    background: #f8f8ff;
    color: #4f5fe5;
    border-color: #c7ccf9;
    box-shadow: 0 3px 10px rgba(79,95,229,.08);
}


/* ── Tabs ────────────────────────────────────── */
.analysis-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 24px;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid #eef0f6;
    padding-bottom: 0;
}

.analysis-tabs::-webkit-scrollbar { height: 0; }

.analysis-tabs .tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: #9298ae;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    flex-shrink: 0;
    position: relative;
}

.analysis-tabs .tab i {
    font-size: 13px;
}

.analysis-tabs .tab:hover {
    color: #5a6178;
}

.analysis-tabs .tab.active {
    color: #4f5fe5;
    border-bottom-color: #4f5fe5;
    font-weight: 700;
}

.analysis-tabs .tab.active i {
    color: #4f5fe5;
}


/* ── Tab Panes ───────────────────────────────── */
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .25s cubic-bezier(.4,0,.2,1); }

.pane-body {
    font-size: 15px;
    line-height: 1.95;
    color: #2e3347;
    word-break: break-word;
    letter-spacing: -0.01em;
}
.pane-body p { margin-bottom: 16px; }
.pane-body p:last-child { margin-bottom: 0; }

/* ── Annotation (주석) ───────────────────────── */
.annotation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    padding: 14px 18px;
    background: #f8f8ff;
    border: 1px solid #e8e5ff;
    border-left: 3px solid #4f5fe5;
    border-radius: 2px 12px 12px 2px;
    color: #4a4083;
    font-size: 13.5px;
    line-height: 1.8;
    position: relative;
}
.annotation::before {
    content: '주석';
    position: absolute;
    top: -9px;
    left: 12px;
    font-size: 10px;
    font-weight: 700;
    color: #4f5fe5;
    background: #f8f8ff;
    padding: 0 6px;
    letter-spacing: 0.05em;
}
.annotation-icon {
    color: #7c6cf0;
    font-size: 13px;
    margin-top: 3px;
    flex-shrink: 0;
}


/* ── Timeline ────────────────────────────────── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.tl-item {
    display: flex;
    gap: 20px;
}

.tl-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 20px;
    padding-top: 20px;
}

.tl-dot {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(79,95,229,.25);
    z-index: 1;
}

.tl-dot-ring {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(79,95,229,.12);
    animation: ringFade 2.5s ease-in-out infinite;
}

.tl-item:first-child .tl-dot-ring {
    border-color: rgba(79,95,229,.3);
    animation: ringPulse 2s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.5); opacity: 0; }
}

@keyframes ringFade {
    0%, 100% { opacity: .5; }
    50%      { opacity: 1; }
}

.tl-item--last .tl-dot {
    background: linear-gradient(145deg, #8a90a5, #b8bdd0);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.tl-line {
    width: 2px;
    flex: 1;
    background: #e0e3ef;
    border-radius: 1px;
    min-height: 36px;
    position: relative;
    overflow: visible;
}

/* 라인 상단 그라디언트 */
.tl-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, rgba(79,95,229,.35), transparent);
    border-radius: 1px;
}

/* 라인 끝 화살표 */
.tl-line::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #d0d5f0;
}

.tl-card {
    flex: 1;
    background: #fafbfe;
    border: 1px solid #eef0f6;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 24px;
    transition: all .2s cubic-bezier(.4,0,.2,1);
    position: relative;
}

/* 카드 좌측 연결 꼬리 */
.tl-card::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 20px;
    width: 10px;
    height: 2px;
    background: #e0e3ef;
}

.tl-card:hover {
    border-color: #d0d5f0;
    background: #f6f7ff;
    box-shadow: 0 4px 16px rgba(79,95,229,.06);
}

.tl-card:hover::before {
    background: rgba(79,95,229,.25);
}

.tl-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #4f5fe5;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #eef0ff, #e8e5ff);
    padding: 3px 10px;
    border-radius: 6px;
}

.tl-date i {
    font-size: 11px;
    opacity: .7;
}

.tl-content {
    font-size: 14.5px;
    color: #2e3347;
    line-height: 1.8;
}


/* ── Info Grid ───────────────────────────────── */
.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.info-row {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: #fafbfe;
    border-radius: 12px;
    border: 1px solid #eef0f6;
    transition: border-color .15s;
}
.info-row:hover {
    border-color: #d8dbed;
}
.info-label {
    font-size: 12px;
    font-weight: 700;
    color: #4f5fe5;
    min-width: 88px;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
.info-value {
    font-size: 14.5px;
    color: #2a2e3f;
    line-height: 1.65;
}


/* ── Evidence ────────────────────────────────── */
.evidence-section {
    margin-bottom: 24px;
}
.evidence-section:last-child {
    margin-bottom: 0;
}

.evidence-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 10px 16px;
    border-radius: 10px;
}

.evidence-section-header i {
    font-size: 15px;
}

.evidence-section--secured {
    color: #0ea47a;
    background: rgba(14,164,122,.06);
    border: 1px solid rgba(14,164,122,.12);
}

.evidence-section--required {
    color: #d97706;
    background: rgba(217,119,6,.06);
    border: 1px solid rgba(217,119,6,.12);
}

.evidence-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,.7);
}

.evidence-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.evidence-list li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fafbfe;
    border-radius: 12px;
    border: 1px solid #eef0f6;
    font-size: 14.5px;
    color: #2e3347;
    line-height: 1.75;
    transition: all .2s;
}
.evidence-list li:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.evidence-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* 확보된 증거 */
.evidence-item--secured {
    border-left: 3px solid #0ea47a;
}
.evidence-item--secured .evidence-num {
    background: rgba(14,164,122,.1);
    color: #0ea47a;
}
.evidence-item--secured:hover {
    border-color: #0ea47a;
}

/* 추가 필요 증거 */
.evidence-item--required {
    border-left: 3px solid #d97706;
    background: #fffcf7;
}
.evidence-item--required .evidence-num {
    background: rgba(217,119,6,.1);
    color: #d97706;
}
.evidence-item--required:hover {
    border-color: #d97706;
}


/* ── Strategy ────────────────────────────────── */
.strategy-block {
    margin-bottom: 28px;
}
.strategy-block:last-child { margin-bottom: 0; }

.strategy-title {
    font-size: 15px;
    font-weight: 700;
    color: #2a2e3f;
    margin-bottom: 12px;
    padding-left: 14px;
    border-left: 3px solid #4f5fe5;
    line-height: 1;
    padding-top: 2px;
    padding-bottom: 2px;
}
.strategy-items {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.strategy-items li {
    padding: 14px 20px;
    background: #fafbfe;
    border-radius: 12px;
    border: 1px solid #eef0f6;
    font-size: 14.5px;
    color: #2e3347;
    line-height: 1.8;
    transition: all .2s;
}
.strategy-items li:hover {
    border-color: #c7ccf9;
    box-shadow: 0 2px 8px rgba(79,95,229,.05);
}


/* ── Case Cards (판례) ───────────────────────── */
.cases-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-card {
    background: #ffffff;
    border: 1px solid #e8ebf2;
    border-radius: 16px;
    padding: 20px 22px;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 3px rgba(0,0,0,.02);
}
.case-card:hover {
    border-color: #c7ccf9;
    box-shadow: 0 8px 28px rgba(79,95,229,.08);
    transform: translateY(-2px);
}

.case-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.case-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: linear-gradient(135deg, #eef0ff, #e8e5ff);
    color: #4f5fe5;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.case-head-text {
    flex: 1;
    min-width: 0;
}

.case-title {
    font-size: 15.5px;
    font-weight: 700;
    color: #1a1d2e;
    line-height: 1.45;
}

.case-score {
    position: relative;
    width: 58px;
    height: 30px;
    background: #f4f5fa;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.score-bar {
    position: absolute;
    inset: 0;
    background: var(--score-color, #4f5fe5);
    opacity: .1;
    border-radius: 8px;
}
.score-num {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 13px;
    font-weight: 800;
    color: var(--score-color, #4f5fe5);
    font-variant-numeric: tabular-nums;
}

/* 사건 메타정보 (사건번호·법원·선고일) */
.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.case-meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    line-height: 1;
}

.case-meta-tag i {
    font-size: 10px;
    opacity: .7;
}

.case-meta--court {
    background: #f0faf6;
    color: #0ea47a;
}

.case-meta--date {
    background: #fef9ee;
    color: #d97706;
}

.case-point {
    font-size: 14.5px;
    color: #4a5068;
    line-height: 1.85;
    padding-top: 4px;
}

/* 실무 조언 */
.case-advice {
    margin-top: 22px;
    padding: 20px 22px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f6f4ff 100%);
    border: 1px solid #e8e5ff;
    border-radius: 14px;
}

.advice-title {
    font-size: 14px;
    font-weight: 700;
    color: #2a2e3f;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.advice-title i {
    color: #e5a100;
    font-size: 14px;
}

.case-advice ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.case-advice li {
    font-size: 13.5px;
    color: #2e3347;
    line-height: 1.75;
    padding-left: 18px;
    position: relative;
}
.case-advice li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f5fe5, #7c6cf0);
}

/* ── 판례 분석률 + 예약 CTA ──────────────────── */
.case-cta {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
    border: 1px solid #e0e3fa;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.case-cta-stat {
    flex: 1;
}

.case-cta-rate {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    color: #2e3347;
    margin-bottom: 6px;
}

.case-cta-rate i {
    color: #4f5fe5;
    font-size: 15px;
}

.case-cta-rate strong {
    color: #4f5fe5;
    font-weight: 800;
}

.case-cta-desc {
    font-size: 13px;
    color: #8a90a5;
    line-height: 1.5;
}

.case-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(79,95,229,.3), inset 0 1px 0 rgba(255,255,255,.15);
    transition: all .2s cubic-bezier(.4,0,.2,1);
}

.case-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79,95,229,.35);
}

.case-cta-btn:active {
    transform: scale(.97);
}

@media (max-width: 640px) {
    .case-cta {
        flex-direction: column;
        text-align: center;
    }
    .case-cta-rate {
        justify-content: center;
    }
    .case-cta-btn {
        width: 100%;
        justify-content: center;
    }
}


/* ── Length Modal ────────────────────────────── */
.len-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s cubic-bezier(.4,0,.2,1);
}
.len-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.len-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26,29,46,.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.len-body {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #e8ebf2;
    border-radius: 20px;
    padding: 32px 28px;
    transform: translateY(16px) scale(.98);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 24px 64px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.04);
}
.len-modal.show .len-body {
    transform: translateY(0) scale(1);
}

.len-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 18px;
}
.len-title {
    font-size: 13px;
    color: #8a90a5;
}
.len-count {
    font-size: 24px;
    font-weight: 800;
    color: #4f5fe5;
    letter-spacing: -0.02em;
}

.len-middle {
    margin-bottom: 28px;
}
.len-info {
    font-size: 14.5px;
    line-height: 1.75;
    color: #4a5068;
}

.len-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.len-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #e8ebf2;
    background: #fafbfe;
    color: #2e3347;
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4,0,.2,1);
}
.len-btn:hover {
    background: #f0f1ff;
    color: #4f5fe5;
    border-color: #c7ccf9;
}
.len-btn--primary {
    background: linear-gradient(145deg, #4f5fe5, #7c6cf0);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(79,95,229,.3), inset 0 1px 0 rgba(255,255,255,.15);
    font-weight: 600;
}
.len-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79,95,229,.35);
}


/* ── Animations ──────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── Scrollbar ───────────────────────────────── */
.chat::-webkit-scrollbar { width: 5px; }
.chat::-webkit-scrollbar-track { background: transparent; }
.chat::-webkit-scrollbar-thumb { background: #d8dbed; border-radius: 3px; }
.chat::-webkit-scrollbar-thumb:hover { background: #b8bdd0; }


/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
    .app { max-width: 100%; border: none; }
    .chat { padding: 0 16px; }
    .composer { padding: 12px 16px; }
    .header { padding: 0 16px; }
    .chat-empty h1 { font-size: 22px; }
    .chat-empty p { font-size: 14px; }
    .chat-chips { gap: 8px; }
    .chip { font-size: 13px; padding: 9px 14px; }
    .progress-bar { padding: 10px 16px; }
    .progress-label { max-width: 150px; }
    .analysis-tabs .tab { padding: 10px 16px; font-size: 13px; }
    .info-row { flex-direction: column; gap: 4px; }
    .info-label { min-width: auto; }
    .chat-empty-visual { width: 72px; height: 72px; }
    .chat-empty-icon { width: 72px; height: 72px; font-size: 26px; border-radius: 20px; }
}
