/* 救急医療情報システム連携 患者台帳システム - スタイルシート */
:root {
    --primary: #2C4A6E;
    --primary-light: #3D6B99;
    --primary-dark: #1B2D44;
    --primary-muted: #5A7A94;
    --primary-bg: #EDF1F5;
    --accent: #8B4555;
    --success: #4A7A5C;
    --warning: #8A7340;
    --info: #3D6B99;
    --bg: #f8f9fa;
    --bg-white: #ffffff;
    --text: #2c3e50;
    --text-light: #636e72;
    --border: #dee2e6;
    --border-light: #e9ecef;
    --sidebar-width: 240px;
    --header-height: 56px;
    --footer-height: 40px;
    --triage-red: #B5454A;
    --triage-yellow: #C4A83A;
    --triage-green: #3D8A56;
    --triage-black: #2A3440;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

/* ===== Layout ===== */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
    height: var(--header-height);
    background: var(--primary-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.app-header h1 { font-size: 16px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user { font-size: 13px; opacity: 0.9; }
.header-version { font-size: 11px; background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 10px; }

.app-body {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--header-height);
    bottom: var(--footer-height);
    overflow-y: auto;
    padding: 12px 0;
}
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sidebar-item:hover { background: var(--border-light); }
.sidebar-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; border-left: 3px solid var(--primary); }
.sidebar-item .icon { margin-right: 10px; font-size: 16px; width: 22px; text-align: center; color: var(--primary-muted); }
.sidebar-sub { padding-left: 32px; }
.sidebar-sub .sidebar-item { padding: 7px 20px; font-size: 13px; }
.sidebar-label { font-size: 11px; color: var(--text-light); padding: 16px 20px 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    max-width: calc(100vw - var(--sidebar-width));
}

.app-footer {
    height: var(--footer-height);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-light);
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    width: 431px;
    max-width: 90vw;
}
.login-card h2 { text-align: center; color: #000; margin-bottom: 8px; font-size: 36px; font-weight: 700; }
.login-card .subtitle { text-align: center; color: #000; margin-bottom: 32px; font-size: 32px; font-weight: 400; }
.login-forgot-link { color: var(--info); font-size: 13px; cursor: pointer; }
.login-forgot-link:hover { text-decoration: underline; }

/* ===== Patient Info Bar ===== */
.patient-bar {
    background: var(--primary-bg);
    border: 1px solid var(--primary-muted);
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}
.patient-bar .label { font-weight: 600; color: var(--primary); }
.patient-bar .sep { color: var(--text-light); }

/* ===== Cards & Panels ===== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--primary-muted);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text); }

.stat-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-light);
    padding: 20px;
    text-align: center;
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--text); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }


input[type="text"], input[type="password"], input[type="date"], input[type="time"],
input[type="number"], input[type="email"], input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 2px rgba(41,128,185,0.15); }
input:read-only { background: var(--bg); color: var(--text-light); }
textarea { min-height: 80px; resize: vertical; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger:hover { background: var(--accent); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #3a6a4c; }
.btn-warning { background: transparent; color: var(--warning); border: 1px solid var(--warning); }
.btn-warning:hover { background: var(--warning); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-light); font-size: 13px; }
th { background: var(--primary-bg); font-weight: 600; color: var(--text); position: sticky; top: 0; cursor: pointer; white-space: nowrap; }
th:hover { background: var(--border-light); }
tr:hover td { background: #fafbfc; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--primary-bg); }

/* ===== Tabs ===== */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); background: white; border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button:hover { background: var(--bg); }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--text-light); }

/* ===== Search Bar ===== */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.search-bar .form-group { margin-bottom: 0; min-width: 150px; }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-danger { background: #F0E4E7; color: var(--accent); }
.badge-success { background: #E4EFE8; color: var(--success); }
.badge-warning { background: #F0ECE2; color: var(--warning); }
.badge-dark { background: var(--border-light); color: var(--text); }
.badge-triage-red { background: var(--triage-red); color: white; }
.badge-triage-yellow { background: var(--triage-yellow); color: #333; }
.badge-triage-green { background: var(--triage-green); color: white; }
.badge-triage-black { background: var(--triage-black); color: white; }

/* ===== Alerts ===== */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-info { background: var(--primary-bg); border: 1px solid var(--primary-muted); color: var(--primary); }
.alert-success { background: #eafaf1; border: 1px solid #a9dfbf; color: #1e7e34; }
.alert-warning { background: #fef9e7; border: 1px solid #f9e79f; color: #856404; }
.alert-danger { background: #fdedec; border: 1px solid #f5b7b1; color: #721c24; }

/* ===== Misc ===== */
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; color: var(--text); }
.section-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.text-muted { color: var(--text-light); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none; }
.tab-panel { display: none; }
.tab-panel-active { display: block; }

/* ===== Integration Page ===== */
.integration-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    padding: 24px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.integration-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.integration-card h3 { font-size: 16px; margin-bottom: 8px; }
.integration-card p { font-size: 13px; color: var(--text-light); }
.integration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* ===== Loading ===== */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-light); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ===== OCR Panel ===== */
.patient-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.patient-bar-row .patient-bar { flex: 1; margin-bottom: 0; }
.btn-icon {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; font-size: 13px; font-weight: 500;
    border: none; border-radius: 6px; cursor: pointer;
    background: var(--info); color: white; white-space: nowrap;
    transition: background 0.15s;
}
.btn-icon:hover { background: #2980b9; }

.ocr-panel { border: 1px solid var(--info); border-left: 4px solid var(--info); }
.ocr-preview-area { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ocr-preview-img { max-width: 240px; max-height: 180px; border-radius: 4px; border: 1px solid var(--border); object-fit: contain; }
.ocr-result-summary { font-size: 13px; color: var(--text); line-height: 1.8; }
.ocr-result-summary .ocr-section-label { font-weight: 600; margin-right: 4px; }

/* ===== Progress Bars ===== */
.progress-bar-container {
    width: 100%; height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; border-radius: 4px; transition: width 0.3s ease;
}
.progress-complete { background: var(--success); }
.progress-half { background: var(--primary); }
.progress-low { background: var(--warning); }

/* ===== Tree View ===== */
.tree-view { padding-left: 16px; border-left: 2px solid var(--border-light); }
.tree-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 8px; font-size: 13px; border-bottom: 1px solid var(--border-light);
}
.tree-item:last-child { border-bottom: none; }
.tree-label { color: var(--text); }
.tree-value { font-weight: 600; color: var(--primary); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.modal {
    background: white; border-radius: 8px; padding: 24px; width: 560px; max-width: 90vw;
    max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-light); }

/* ===== Q&A Chat UI ===== */
.qa-layout { display: flex; gap: 16px; height: calc(100vh - var(--header-height) - var(--footer-height) - 100px); }
.qa-sidebar {
    width: 240px; min-width: 200px; background: white; border: 1px solid var(--border-light);
    border-radius: 8px; padding: 12px; overflow-y: auto;
}
.qa-conv-item {
    padding: 8px 12px; font-size: 13px; cursor: pointer; border-radius: 4px;
    margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background 0.15s;
}
.qa-conv-item:hover { background: var(--border-light); }
.qa-conv-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }

.qa-main {
    flex: 1; display: flex; flex-direction: column; background: white;
    border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden;
}
.qa-messages {
    flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.qa-message { display: flex; }
.qa-message.user { justify-content: flex-end; }
.qa-message.assistant { justify-content: flex-start; }
.qa-bubble {
    max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6;
}
.qa-message.user .qa-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.qa-message.assistant .qa-bubble { background: var(--primary-bg); color: var(--text); border-bottom-left-radius: 4px; }

.qa-sql {
    background: var(--primary-dark); color: #e0e0e0; padding: 8px 12px; border-radius: 4px;
    font-family: monospace; font-size: 12px; margin-top: 8px; overflow-x: auto; white-space: pre-wrap;
}

.qa-input {
    display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-light);
}
.qa-input input { flex: 1; }

/* ===== LLM Status Bar ===== */
.llm-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 16px;
    margin-bottom: 12px;
    font-size: 13px;
}
.llm-status-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.llm-status-right {
    display: flex;
    align-items: center;
}
.llm-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.llm-status-dot.not-loaded { background: var(--border); }
.llm-status-dot.loading { background: var(--warning); animation: pulse 1.5s ease-in-out infinite; }
.llm-status-dot.ready { background: var(--success); }
.llm-status-dot.generating { background: var(--info); animation: pulse 1s ease-in-out infinite; }
.llm-status-dot.error { background: var(--accent); }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.llm-progress-bar {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.llm-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.llm-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}
.llm-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}
.qa-streaming {
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}
.btn-abort {
    white-space: nowrap;
}

/* ===== Feedback Form ===== */
.feedback-status-open { color: var(--primary); }
.feedback-status-resolved { color: var(--success); }
.feedback-status-closed { color: var(--text-light); }

/* ===== Accessibility ===== */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; top: -100%; left: 16px; z-index: 1000;
    padding: 8px 16px; background: var(--primary); color: white;
    border-radius: 0 0 4px 4px; text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: 0; }

.btn:focus-visible, .tab:focus-visible, .sidebar-item:focus-visible,
.clickable-row:focus-visible, .pagination button:focus-visible,
.integration-card:focus-visible, .qa-conv-item:focus-visible,
.modal-close:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(41,128,185,0.25);
}

.field-error { color: var(--accent); font-size: 12px; margin-top: 4px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(139,69,85,0.15);
}

/* ===== JTAS Badges ===== */
.jtas-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    min-width: 70px;
    text-align: center;
    background: var(--border-light);
    color: var(--text);
}
.jtas-1 { background: #1565C0; color: white; }
.jtas-2 { background: #C62828; color: white; }
.jtas-3 { background: #F9A825; color: #333; }
.jtas-4 { background: #2E7D32; color: white; }
.jtas-5 { background: #757575; color: white; }

/* ===== Inline Editing Cells ===== */
.status-cell {
    position: relative;
}
.status-cell select {
    width: auto;
    min-width: 70px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s;
}
.status-cell select:hover {
    border-color: var(--border);
}
.status-cell select:focus {
    border-color: var(--primary-light);
    background: white;
    box-shadow: 0 0 0 2px rgba(41,128,185,0.15);
}

.inline-memo-input {
    width: 100% !important;
    min-width: 120px;
    padding: 4px 8px !important;
    font-size: 12px !important;
    border: 1px solid transparent !important;
    border-radius: 4px;
    background: transparent;
    transition: border-color 0.15s;
}
.inline-memo-input:hover {
    border-color: var(--border) !important;
}
.inline-memo-input:focus {
    border-color: var(--primary-light) !important;
    background: white;
    box-shadow: 0 0 0 2px rgba(41,128,185,0.15) !important;
}

/* ===== Elapsed Time ===== */
.elapsed-warning {
    color: #E65100;
    font-weight: 600;
}
.elapsed-danger {
    color: #B71C1C;
    font-weight: 700;
    animation: pulse-danger 2s ease-in-out infinite;
}
@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .spinner { animation: none; border-top-color: var(--primary); }
}

/* ===== Tablet (≤1024px) ===== */
@media (max-width: 1024px) {
    :root { --sidebar-width: 56px; }
    .sidebar-item span:not(.icon) { display: none; }
    .sidebar-item .icon { margin-right: 0; }
    .sidebar-item { justify-content: center; padding: 10px; }
    .sidebar-item.active { border-left: 3px solid var(--primary); }
    .sidebar-label { display: none; }
    .sidebar-sub { padding-left: 0; }
    .sidebar-sub .sidebar-item { padding: 7px 10px; }
    .form-row { grid-template-columns: 1fr; }
}

/* ===== Mobile (≤768px) ===== */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; max-width: 100vw; padding: 16px; }
    .btn, .tab, .sidebar-item, .clickable-row td,
    .pagination button, .integration-card, .qa-conv-item { min-height: 44px; }
    .search-bar { flex-direction: column; }
    .search-bar .form-group { min-width: 100%; }
    .qa-layout { flex-direction: column; height: auto; }
    .qa-sidebar { width: 100%; min-width: auto; max-height: 200px; }
    .modal { width: 95vw; max-height: 90vh; }
    .login-card { padding: 24px; }
    .page-title { font-size: 18px; }
}
