/* ================================================
   사내 IP 관리 시스템 - Style
   신우디엔시 리뷰평가 디자인 시스템 기반 + 모바일 최적화
   ================================================ */

:root {
  --primary:   #4F46E5;
  --primary-d: #3730A3;
  --primary-l: #EEF2FF;
  --success:   #059669;
  --warning:   #D97706;
  --danger:    #DC2626;
  --info:      #0891B2;
  --bg:        #F1F5F9;
  --card:      #FFFFFF;
  --border:    #E2E8F0;
  --text:      #1E293B;
  --text-2:    #64748B;
  --sidebar-w: 240px;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ==============================
   사이드바
   ============================== */
.sidebar {
  width: var(--sidebar-w);
  background: #1E1B4B;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff; flex-shrink: 0;
}
.logo-text .logo-title { display: block; font-size: 13px; font-weight: 700; color: #fff; }
.logo-text .logo-sub   { display: block; font-size: 11px; color: #A5B4FC; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 0; }
.nav-section-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.35);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: all .2s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: var(--primary); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar-backup-info {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.07);
  border-radius: 8px;
  padding: 7px 10px;
}
.sidebar-backup-info > i {
  font-size: 13px;
  color: #A5B4FC;
  flex-shrink: 0;
}
.backup-text {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.backup-label {
  font-size: 9px; font-weight: 600;
  color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .05em;
}
.backup-time {
  font-size: 11px; font-weight: 500;
  color: #A5B4FC;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.s-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.s-user-info { min-width: 0; }
.s-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-user-role { font-size: 11px; color: #A5B4FC; }

/* ==============================
   메인 콘텐츠
   ============================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ==============================
   탑바
   ============================== */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sidebar-toggle {
  font-size: 18px; color: var(--text-2);
  padding: 6px; border-radius: 6px;
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}
.sidebar-toggle:hover { background: var(--bg); }
.breadcrumb {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text);
  min-width: 0;
}
.breadcrumb i { color: var(--primary); font-size: 15px; flex-shrink: 0; }
.breadcrumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-badge {
  display: flex; align-items: center; gap: 5px;
  background: var(--primary-l); color: var(--primary);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.topbar-add-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary); color: #fff;
  border-radius: 8px; padding: 8px 16px;
  font-size: 13px; font-weight: 600;
  transition: background .2s, box-shadow .2s;
  white-space: nowrap; flex-shrink: 0;
}
.topbar-add-btn:hover {
  background: var(--primary-d);
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}

/* ==============================
   페이지 본문
   ============================== */
.page-body {
  flex: 1;
  padding: 24px;
}

/* ==============================
   통계 카드
   ============================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff; flex-shrink: 0;
}
.bg-blue   { background: linear-gradient(135deg, #4F46E5, #6366F1); }
.bg-green  { background: linear-gradient(135deg, #059669, #10B981); }
.bg-red    { background: linear-gradient(135deg, #DC2626, #F87171); }
.bg-orange { background: linear-gradient(135deg, #D97706, #FBBF24); }
.stat-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: 11px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--text); }

/* ==============================
   필터 바
   ============================== */
.filter-bar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.search-wrap {
  position: relative;
  flex: 1; min-width: 180px;
}
.search-wrap .fa-magnifying-glass {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-2); font-size: 13px; pointer-events: none;
}
.search-input {
  width: 100%; height: 38px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0 34px;
  font-size: 13px; color: var(--text);
  outline: none;
  transition: border-color .2s;
  background: #fff;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.search-clear {
  position: absolute; right: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-2); font-size: 13px;
  padding: 3px; border-radius: 4px;
  display: none;
  transition: color .2s;
}
.search-clear:hover { color: var(--text); }
.search-clear.visible { display: flex; align-items: center; }

.filter-select {
  height: 38px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px; color: var(--text);
  background: #fff;
  outline: none; cursor: pointer;
  transition: border-color .2s;
  min-width: 120px;
}
.filter-select:focus { border-color: var(--primary); }

.result-count {
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; font-weight: 600;
  margin-left: auto;
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ==============================
   데스크톱 테이블
   ============================== */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.data-table {
  width: 100%; border-collapse: collapse;
}
.data-table thead { background: #F8FAFC; }
.data-table th {
  padding: 12px 16px;
  font-size: 11px; font-weight: 700;
  color: var(--text-2);
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  user-select: none;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--primary); }
.sort-icon { margin-left: 4px; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover td { background: #F8F7FF; }
.td-no { text-align: center; color: var(--text-2); font-size: 12px; }

/* IP 칩 */
.ip-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px; font-weight: 700;
  color: var(--primary);
  background: var(--primary-l);
  padding: 3px 10px; border-radius: 6px;
  border: 1px solid #C7D2FE;
}

/* 상태 뱃지 */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.status-badge.active  { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.status-badge.inactive{ background: #F1F5F9; color: #475569; border: 1px solid var(--border); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-badge.active .status-dot   { background: var(--success); }
.status-badge.inactive .status-dot { background: #94A3B8; }

/* 부서 칩 */
.dept-chip {
  display: inline-block;
  padding: 2px 9px; border-radius: 4px;
  font-size: 11px; font-weight: 700;
  background: #EDE9FE; color: #5B21B6;
}
.text-muted { color: #CBD5E1; font-style: italic; font-size: 12px; }

/* 로딩/빈 상태 */
.loading-cell { text-align: center; padding: 56px 20px; color: var(--text-2); font-size: 14px; }
.loading-cell i { color: var(--primary); margin-right: 8px; }
.empty-state-row td { text-align: center; padding: 0 !important; }
.empty-state-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--text-2); padding: 56px 20px;
}
.empty-state-inner i { font-size: 36px; opacity: .35; }
.empty-state-inner p { font-size: 14px; font-weight: 500; }

/* 관리 버튼 */
.action-btns { display: flex; gap: 6px; justify-content: center; }
.btn-icon {
  width: 30px; height: 30px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: all .2s;
}
.btn-icon.edit   { background: var(--primary-l); color: var(--primary); }
.btn-icon.delete { background: #FEF2F2; color: var(--danger); }
.btn-icon.edit:hover   { background: var(--primary); color: #fff; }
.btn-icon.delete:hover { background: var(--danger); color: #fff; }

/* ==============================
   모바일 카드형 목록
   ============================== */
.mobile-list { display: none; flex-direction: column; gap: 10px; padding: 12px; }

.ip-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .2s;
  position: relative;
}
.ip-card:active { box-shadow: var(--shadow-md); }

.ip-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ip-card-addr {
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 15px; font-weight: 800;
  color: var(--primary);
}
.ip-card-status { flex-shrink: 0; }

.ip-card-middle {
  display: flex; align-items: center; gap: 10px;
}
.ip-card-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  flex: 1;
}
.ip-card-name.empty { color: #CBD5E1; font-weight: 400; font-style: italic; }

.ip-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
}
.ip-card-desc {
  font-size: 12px; color: var(--text-2);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ip-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-card-edit {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-l); color: var(--primary);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; font-weight: 600;
  transition: all .2s;
}
.btn-card-edit:hover, .btn-card-edit:active { background: var(--primary); color: #fff; }
.btn-card-delete {
  display: inline-flex; align-items: center; gap: 5px;
  background: #FEF2F2; color: var(--danger);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; font-weight: 600;
  transition: all .2s;
}
.btn-card-delete:hover, .btn-card-delete:active { background: var(--danger); color: #fff; }

/* ==============================
   페이지네이션
   ============================== */
.pagination-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #F8FAFC;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 모바일 페이지네이션: 기본 숨김, JS inline style로 제어됨 */
#mobilePaginationWrap { display: none; }
.page-info { font-size: 12px; color: var(--text-2); font-weight: 500; }
.page-btns { display: flex; gap: 4px; }
.page-btn {
  min-width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-radius: 7px;
  background: #fff; color: var(--text-2);
  font-size: 12px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
  transition: all .2s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ==============================
   FAB 버튼 (모바일 전용)
   ============================== */
.fab-btn {
  display: none;
  position: fixed;
  bottom: 24px; right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(79,70,229,.45);
  z-index: 150;
  transition: transform .2s, box-shadow .2s;
  border: none; cursor: pointer;
}
.fab-btn:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(79,70,229,.4); }

/* ==============================
   공통 버튼
   ============================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  transition: all .2s; cursor: pointer; border: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-outline {
  background: #fff; color: var(--text);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger-outline {
  background: #FEF2F2; color: var(--danger);
  border: 2px solid #FCA5A5;
}
.btn-danger-outline:hover { background: #FEE2E2; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ==============================
   모달
   ============================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 300; padding: 0;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

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

.modal-box {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 100%;
  box-shadow: 0 -8px 40px rgba(0,0,0,.18);
  animation: slideUp .25s ease;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-box.modal-sm {
  max-width: 100%;
  border-radius: 20px 20px 0 0;
}

/* 모달 핸들 (모바일 시트 느낌) */
.modal-handle {
  width: 40px; height: 4px;
  background: #CBD5E1;
  border-radius: 2px;
  margin: 10px auto 0;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 15px; transition: .2s;
  background: var(--bg);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-footer {
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: stretch; gap: 8px;
}
.modal-footer .btn { flex: 1; justify-content: center; }

/* ==============================
   폼 스타일
   ============================== */
.form-row-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  margin-bottom: 6px; color: var(--text);
  text-transform: uppercase; letter-spacing: .04em;
}
.form-label i { color: var(--primary); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 13px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px; /* iOS에서 zoom 방지를 위해 15px 이상 */
  color: var(--text);
  outline: none; transition: border-color .2s;
  background: #fff;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l);
}
.form-input.error { border-color: var(--danger); }
.form-error {
  font-size: 11px; font-weight: 600;
  color: var(--danger); margin-top: 4px;
  display: none;
}

/* 토글 스위치 */
.toggle-row { display: flex; align-items: center; gap: 10px; height: 44px; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #CBD5E1; border-radius: 28px;
  transition: .3s; cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; left: 3px; bottom: 3px;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.toggle-label { font-size: 14px; color: var(--text-2); font-weight: 600; }

/* 삭제 확인 */
.delete-confirm { text-align: center; padding: 10px 0 4px; }
.delete-confirm .warn-icon { font-size: 48px; color: var(--warning); margin-bottom: 14px; }
.delete-confirm p { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.delete-confirm .sub { font-size: 13px; color: var(--text-2); font-weight: 400; }

/* ==============================
   토스트
   ============================== */
.toast-container {
  position: fixed; bottom: 86px; right: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  min-width: 220px; max-width: 300px;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease;
  pointer-events: auto;
}
@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.toast.success { background: #ECFDF5; color: #065F46; border-left: 4px solid #059669; }
.toast.error   { background: #FEF2F2; color: #991B1B; border-left: 4px solid #DC2626; }
.toast.warning { background: #FFFBEB; color: #92400E; border-left: 4px solid #D97706; }
.toast.info    { background: #EFF6FF; color: #1E40AF; border-left: 4px solid #3B82F6; }

/* 사이드바 오버레이 */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.show { display: block; }

/* ==============================
   반응형 - 태블릿 (1024px)
   ============================== */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==============================
   반응형 - 태블릿 (768px)
   ============================== */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
    z-index: 250;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .page-body { padding: 12px; }
  .topbar { padding: 0 14px; height: 52px; }

  /* 필터 바 조정 */
  .filter-bar { padding: 10px 12px; }
  .filter-select { min-width: 100px; }
}

/* ==============================
   반응형 - 모바일 (600px)
   ============================== */
@media (max-width: 600px) {
  /* ── KPI 카드: 2열 컴팩트 ── */
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  .stat-card {
    padding: 12px 10px;
    gap: 8px;
    flex-direction: row;
    align-items: center;
  }
  .stat-icon {
    width: 36px; height: 36px;
    font-size: 14px;
    border-radius: 9px;
    flex-shrink: 0;
  }
  .stat-info { gap: 1px; min-width: 0; }
  .stat-label { font-size: 10px; }
  .stat-value { font-size: 20px; line-height: 1.1; }

  /* ── 필터 바 모바일: 검색 위, 필터 아래 ── */
  .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 12px;
  }
  .search-wrap {
    min-width: unset;
    flex: 1 1 100%;
    order: -1;
  }
  .search-input { height: 38px; font-size: 14px; }
  .filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 13px;
    height: 36px;
  }
  .result-count { display: none; }

  /* 데스크톱 테이블 숨기고 카드뷰 표시 */
  .table-wrap { display: none; }
  .mobile-list { display: flex; }

  /* FAB 버튼 */
  .fab-btn { display: flex; }

  /* 탑바에서 추가버튼, 배지 숨기기 */
  .topbar-add-btn { display: none; }
  .topbar-badge { display: none; }

  /* 토스트 위치 - FAB 위쪽 */
  .toast-container { bottom: 90px; right: 12px; left: 12px; align-items: stretch; }
  .toast { max-width: 100%; }

  /* 모달 풀 바텀시트 */
  .modal-box,
  .modal-box.modal-sm {
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
  }
  .form-row-2 { grid-template-columns: 1fr; }
  .page-body { padding: 10px; }
}

/* ==============================
   반응형 - 소형 모바일 (380px)
   ============================== */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px 8px; gap: 7px; }
  .stat-icon { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 9px; }
  .filter-select { font-size: 12px; height: 34px; }
  html { font-size: 13px; }
}

/* ==============================
   iOS safe area 대응
   ============================== */
@supports (padding: env(safe-area-inset-bottom)) {
  .fab-btn {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .toast-container {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .modal-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* 터치 기기 tap highlight 제거 */
* { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
