/* Etsy 中控服务器 - 样式表 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 200px;
    background: #2d3436;
    color: #fff;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1100;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    padding: 0 20px 20px;
    border-bottom: 1px solid #636e72;
    margin-bottom: 10px;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: #b2bec3;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #636e72;
    color: #fff;
}

.nav-item.active {
    background: #0984e3;
    color: #fff;
}

/* 主内容区 */
.content {
    margin-left: 200px;
    flex: 1;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dfe6e9;
}

.topbar h1 {
    font-size: 22px;
}

.topbar-title-group,
.topbar-status-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: #fff;
    color: #2d3436;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.mqtt-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    background: #dfe6e9;
}

.page-body {
    padding: 20px 30px;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mobile-full-width {
    width: 100%;
}

.responsive-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.responsive-modal {
    width: min(960px, 96vw);
    max-width: 96vw;
    max-height: 90vh;
    overflow: auto;
}

body.sidebar-open {
    overflow: hidden;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #2d3436;
}

.stat-label {
    font-size: 14px;
    color: #636e72;
    margin-top: 5px;
}

.stat-online .stat-value { color: #00b894; }
.stat-offline .stat-value { color: #636e72; }
.stat-error .stat-value { color: #d63031; }

/* 节点卡片网格 */
.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.node-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #dfe6e9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.node-card.status-online { border-left-color: #00b894; }
.node-card.status-offline { border-left-color: #636e72; }
.node-card.status-error { border-left-color: #d63031; }

.node-id {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.node-status {
    font-size: 13px;
    color: #636e72;
}

.node-info {
    font-size: 12px;
    color: #b2bec3;
    margin-top: 3px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    --table-zebra-bg: #eef2f5;
    --table-hover-bg: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-top: 10px;
}

.data-table th {
    background: #f5f6fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #636e72;
    border-bottom: 2px solid #dfe6e9;
}

.data-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.data-table tbody > tr:nth-child(even):not(.error-row):not(.duplicate-row) > td:not(.empty-state):not(.loading) {
    background: var(--table-zebra-bg);
}

.data-table tbody > tr:hover > td:not(.empty-state):not(.loading) {
    background: var(--table-hover-bg);
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-online, .badge-completed { background: #e6fff5; color: #00b894; }
.badge-offline { background: #f0f0f0; color: #636e72; }
.badge-error, .badge-failed { background: #ffe6e6; color: #d63031; }
.badge-pending { background: #fff3e0; color: #e17055; }
.badge-running, .badge-processing { background: #e3f2fd; color: #0984e3; }
.badge-interrupted { background: #fff3cd; color: #856404; }

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn:hover { background: #f5f6fa; }

.btn-primary {
    background: #0984e3;
    color: #fff;
    border-color: #0984e3;
}

.btn-primary:hover { background: #0876cc; }

.btn-danger {
    background: #fff;
    color: #d63031;
    border-color: #d63031;
}

.btn-danger:hover { background: #d63031; color: #fff; }

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.toolbar select {
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 13px;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    min-width: 400px;
    max-width: 500px;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 14px;
}

.checkbox-group {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    padding: 10px;
}

.checkbox-label {
    display: block;
    padding: 5px 0;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin-right: 8px;
}

/* 提示 */
.csv-format-hint {
    background: #fff3e0;
    border: 1px solid #e17055;
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 13px;
    color: #e17055;
    margin-bottom: 20px;
}

.upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

#uploadStatus {
    font-size: 13px;
    color: #636e72;
}

/* 空状态 */
.empty-state, .loading {
    text-align: center;
    color: #b2bec3;
    padding: 30px;
}

/* 登录页 */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #2d3436;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 360px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2d3436;
}

.login-error {
    background: #ffe6e6;
    color: #d63031;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    margin-top: 10px;
}

/* 侧边栏登出 */
.nav-logout {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #636e72;
    color: #b2bec3 !important;
    font-size: 13px;
}

/* ========== 文件管理页面样式 ========== */

/* 筛选器区域 */
.filters-container {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select, .filter-input {
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 13px;
}

.filter-select {
    min-width: 120px;
}

.filter-input {
    min-width: 150px;
}

.filters-inline-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    background: #f8fafb;
}

.filters-inline-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0984e3;
}

.filters-inline-select label {
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.stats-summary {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dfe6e9;
}

.stat-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stat-item .stat-label {
    font-size: 13px;
    color: #636e72;
}

.stat-item .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #2d3436;
}

/* 文件网格布局 */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.file-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.file-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

.file-icon {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #f5f6fa;
}

.file-info {
    padding: 12px;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d3436;
}

.file-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #636e72;
    margin-bottom: 8px;
}

.business-id {
    font-size: 12px;
    color: #0984e3;
    margin-bottom: 8px;
    font-weight: 500;
}

.file-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: #e3f2fd;
    color: #0984e3;
    font-weight: 500;
}

.file-actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
}

.btn-secondary {
    background: #636e72;
    color: #fff;
    border-color: #636e72;
}

.btn-secondary:hover {
    background: #4a5356;
}

/* 分页样式 */
.pagination {
    margin-top: 20px;
}

.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.page-info {
    font-size: 14px;
    color: #636e72;
}

/* 图片预览模态框 */
#imageModal {
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

#imageModal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    padding: 0;
    background: transparent;
    border-radius: 0;
    min-width: auto;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

.modal-close:hover {
    color: #ddd;
}

.modal-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 6px;
    max-width: 80%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: 30px;
    padding: 20px;
    cursor: pointer;
    z-index: 1001;
    border-radius: 4px;
}

.modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-nav-prev {
    left: 20px;
}

.modal-nav-next {
    right: 20px;
}

.modal-download {
    position: absolute;
    top: 20px;
    left: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    z-index: 1001;
}

.modal-download:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ========== 批量操作工具栏 ========== */
.batch-toolbar {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    animation: slideDown 0.3s ease;
}

#pageSelectSummary {
    color: #636e72;
    font-weight: 500;
    font-size: 14px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.batch-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.batch-info input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0984e3;
}

.batch-info label {
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

#selectedCount {
    color: #0984e3;
    font-weight: 600;
    font-size: 14px;
}

.batch-actions {
    display: flex;
    gap: 10px;
}

/* 文件卡片复选框 */
.file-card {
    position: relative;
}

.file-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
    accent-color: #0984e3;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
}

.file-card.selected {
    border: 2px solid #0984e3;
    box-shadow: 0 4px 12px rgba(9, 132, 227, 0.3);
}

.file-card.selected .file-preview,
.file-card.selected .file-icon {
    opacity: 0.85;
}

/* ========== 日志查看页面样式 ========== */

/* 日志级别标签 */
.badge-DEBUG { background: #f0f0f0; color: #636e72; }
.badge-INFO { background: #e3f2fd; color: #0984e3; }
.badge-WARNING { background: #fff3e0; color: #e17055; }
.badge-ERROR { background: #ffe6e6; color: #d63031; }

/* 日志表格 */
.log-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.log-table th {
    background: #f5f6fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #636e72;
    border-bottom: 2px solid #dfe6e9;
    white-space: nowrap;
}

.log-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.log-table tr:hover {
    background: #f8f9fa;
}

.log-message {
    max-width: 500px;
    word-break: break-word;
}

.log-timestamp {
    white-space: nowrap;
    color: #636e72;
    font-size: 12px;
}

/* 自动刷新控制 */
.auto-refresh {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auto-refresh label {
    font-size: 13px;
    color: #636e72;
}

.auto-refresh select {
    padding: 6px 10px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 13px;
}

/* ========== 消息管理页面样式 ========== */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.messages-summary-grid {
    gap: 10px;
    margin-bottom: 0;
}

.messages-summary-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 8px 14px;
}

.messages-summary-card .stat-value {
    font-size: 26px;
    line-height: 1;
}

.messages-summary-card .stat-label {
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

.shop-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.shop-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.shop-info h3 {
    margin: 0;
    font-size: 18px;
    color: #2d3436;
}

.shop-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.shop-meta-row-primary {
    gap: 8px 14px;
}

.extract-time,
.unread-count,
.order-number,
.message-sender {
    font-size: 13px;
    color: #636e72;
}

.extract-time-today {
    color: #00b894;
    font-weight: 600;
}

.extract-time-stale {
    color: #2d3436;
    font-weight: 600;
}

.unread-count {
    color: #0984e3;
    font-weight: 600;
}

.toggle-btn,
.expand-btn {
    border: none;
    background: transparent;
    color: #636e72;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 6px;
}

.shop-content {
    padding: 16px 20px 20px;
}

.empty-message {
    padding: 20px;
    border-radius: 6px;
    background: #f8f9fa;
    color: #636e72;
    text-align: center;
}

.conversation-item {
    border: 1px solid #eef1f4;
    border-radius: 8px;
    overflow: hidden;
}

.conversation-item + .conversation-item {
    margin-top: 12px;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f8f9fa;
    cursor: pointer;
}

.customer-name {
    font-weight: 600;
    color: #2d3436;
}

.conversation-messages {
    padding: 14px;
    background: #fff;
}

.message {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 10px;
}

.message + .message {
    margin-top: 10px;
}

.message-customer {
    background: #f1f3f5;
    color: #2d3436;
}

.message-shop {
    margin-left: auto;
    background: #e3f2fd;
    color: #2d3436;
}

.message-text {
    margin-top: 4px;
    line-height: 1.5;
    word-break: break-word;
}

.hint {
    margin-top: 8px;
    font-size: 13px;
    color: #636e72;
}

/* ========== 日志查看页面补充样式 ========== */
.logs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filters-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 160px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #636e72;
}

.filter-group select,
.filter-group input {
    height: 38px;
    padding: 8px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

.time-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-range span {
    font-size: 13px;
    color: #636e72;
}

.logs-table-container {
    overflow-x: auto;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-info {
    font-size: 13px;
    color: #636e72;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-ellipsis {
    color: #636e72;
    font-size: 13px;
    padding: 0 4px;
}

.task-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #636e72;
}

.stat-value.error,
.badge-error,
.badge-ERROR {
    color: #d63031;
}

.stat-value.warning,
.badge-warning,
.badge-WARNING {
    color: #e17055;
}

.badge-debug,
.badge-DEBUG {
    background: #f0f0f0;
    color: #636e72;
}

.badge-info,
.badge-INFO {
    background: #e3f2fd;
    color: #0984e3;
}

.badge-warning,
.badge-WARNING {
    background: #fff3e0;
}

.badge-error,
.badge-ERROR {
    background: #ffe6e6;
}

@media (max-width: 900px) {
    body {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 1200;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content {
        margin-left: 0;
        min-height: auto;
    }

    .topbar {
        padding: 14px 16px;
        gap: 12px;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .topbar-title-group {
        width: 100%;
    }

    .topbar-status-group {
        width: 100%;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .page-body {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 20px;
    }

    .toolbar {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .toolbar > * {
        width: 100%;
    }

    .filters {
        align-items: stretch;
    }

    .filters-panel {
        padding: 16px;
        align-items: stretch;
    }

    .filters-panel,
    .filters,
    .responsive-form-grid {
        grid-template-columns: 1fr;
    }

    .filter-select,
    .filter-input,
    .filters-panel .filter-group,
    .toolbar select,
    .mobile-full-width {
        width: 100%;
        min-width: 0;
    }

    .pagination {
        align-items: stretch;
    }

    .responsive-modal,
    .modal-content {
        width: min(96vw, 96vw);
        max-width: 96vw;
        padding: 20px 16px;
    }

    .shop-header,
    .shop-info,
    .batch-toolbar,
    .stats-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .shop-header,
    .shop-info {
        gap: 10px;
    }

    .batch-info,
    .batch-actions,
    .file-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .login-card,
    .responsive-card {
        width: min(360px, 92vw);
        padding: 28px 20px;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
