/* ─── Variables ─────────────────────────────────────── */
:root {
  --bg:          #f1f5f9;
  --panel:       #ffffff;
  --card:        #f8fafc;
  --line:        #e2e8f0;
  --line-deep:   #c8d3de;
  --ink:         #0f172a;
  --sub:         #64748b;
  --muted:       #94a3b8;
  --accent:      #2563eb;
  --accent-deep: #1d4ed8;
  --light:       #eff6ff;
  --green:       #059669;
  --green-bg:    #ecfdf5;
  --orange:      #d97706;
  --orange-bg:   #fffbeb;
  --violet:      #7c3aed;
  --violet-bg:   #f5f3ff;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --sand:        #b45309;

  --sh-xs: 0 1px 2px rgb(0 0 0/.06);
  --sh-sm: 0 1px 3px rgb(0 0 0/.09), 0 1px 2px rgb(0 0 0/.06);
  --sh-md: 0 4px 8px -1px rgb(0 0 0/.08), 0 2px 4px -2px rgb(0 0 0/.06);
  --sh-lg: 0 10px 22px -3px rgb(0 0 0/.09), 0 4px 8px -4px rgb(0 0 0/.05);

  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 20px;
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  font-family: "Malgun Gothic", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

/* ─── App Shell ──────────────────────────────────────── */
.app-shell {
  max-width: 1720px;
  margin: 0 auto;
  padding: 14px 16px 52px;
}

/* ─── Header ─────────────────────────────────────────── */
.app-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  position: sticky;
  top: 14px;
  z-index: 60;
}

.brand-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px 12px;
  background: linear-gradient(95deg, #ffffff 70%, #f0f6ff 100%);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 3px;
}

.brand-area h1 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.028em;
  color: var(--ink);
  margin-bottom: 2px;
}

.sub-copy { font-size: 12px; color: var(--sub); line-height: 1.4; }

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}

.lang-btn {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sub);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(5,150,105,.18);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(5,150,105,.18); }
  50%       { box-shadow: 0 0 0 7px rgba(5,150,105,.06); }
}

/* ─── Tab Bar ────────────────────────────────────────── */
.tabbar {
  display: flex;
  padding: 0 12px;
  background: var(--card);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 17px 11px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn:hover     { color: var(--ink); }
.tab-btn.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Main Layout ────────────────────────────────────── */
.main {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.page-head {
  padding: 2px 2px 0;
}
.page-head h2 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.2;
  margin-bottom: 3px;
}

/* ─── Views ──────────────────────────────────────────── */
.view          { display: none; gap: 16px; }
.view.is-active { display: grid; }

/* ─── Panels ─────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 20px;
}

.soft-panel {
  background: linear-gradient(160deg, #ffffff 0%, #f6f9ff 100%);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.022em;
}

/* ─── Grids ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.narrow-top { align-items: start; }

.inline, .cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.cta-row { margin-top: 6px; }

/* ─── Stat Cards ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  border-radius: var(--r);
  padding: 18px 20px;
  color: #fff;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-md);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -16px;
  right: -16px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  pointer-events: none;
}

.stat-card span   { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .88; }
.stat-card strong { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }

.blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.orange { background: linear-gradient(135deg, #f97316, #c2560d); }
.green  { background: linear-gradient(135deg, #10b981, #047857); }
.violet { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.red    { background: linear-gradient(135deg, #f87171, #b91c1c); }
.sand   { background: linear-gradient(135deg, #fbbf24, #92400e); }

/* ─── Type Cards ─────────────────────────────────────── */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.exp-warning-banner {
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 14px;
}

.type-card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.type-card:hover { border-color: #bac5d6; box-shadow: var(--sh-sm); }
.type-card h4    { font-size: 15px; font-weight: 800; margin-bottom: 12px; letter-spacing: -.01em; }

.type-stats          { display: flex; gap: 22px; }
.type-stats strong   { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.type-stats span     { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--sub); }

/* ─── Equipment Status ───────────────────────────────── */
.equipment-panel {
  padding-bottom: 16px;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.equipment-card {
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 13px 12px;
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: var(--r-sm);
  background: var(--card);
}

.equipment-card[data-status="stopped"] {
  border-left-color: var(--red);
  background: var(--red-bg);
}

.equipment-card[data-status="maintenance"] {
  border-left-color: var(--orange);
  background: var(--orange-bg);
}

.equipment-card[data-offline="true"] {
  opacity: .78;
}

.equipment-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.equipment-status-select {
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 800;
  background: var(--panel);
}

.equipment-mold {
  gap: 4px;
  font-size: 11px;
}

.equipment-mold > span {
  color: var(--sub);
}

.equipment-mold-input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.equipment-updated {
  min-height: 16px;
  font-size: 10.5px;
  color: var(--sub);
  white-space: nowrap;
}

/* ─── Mini Stats ─────────────────────────────────────── */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stats article {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  transition: border-color .15s, box-shadow .15s;
}
.mini-stats article:hover { border-color: #bac5d6; box-shadow: var(--sh-xs); }
.mini-stats span   { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sub); margin-bottom: 7px; }
.mini-stats strong { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }

.panel-subhead {
  margin: 16px 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.slot-table-wrap {
  margin-top: 12px;
}

.slot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 10px;
}

.slot-tab {
  min-height: 36px;
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}

.slot-tab:hover {
  border-color: #70ad47;
  background: #f4faef;
}

.slot-tab.is-active {
  background: #70ad47;
  border-color: #70ad47;
  color: #0b1f05;
  box-shadow: 0 2px 6px rgb(112 173 71 / .24);
}

.slot-table th {
  background: #70ad47;
  color: #0b1f05;
  text-align: center;
  vertical-align: middle;
  padding: 8px 10px;
}

.slot-table td {
  text-align: center;
  white-space: nowrap;
  padding: 8px 10px;
}

.slot-table tfoot td {
  position: sticky;
  bottom: 0;
  background: #eef7e9;
  border-top: 1.5px solid #70ad47;
  font-weight: 800;
  color: var(--ink);
}

.slot-table[data-mode="raw"],
.slot-table[data-mode="bond"] {
  max-width: 980px;
}

.slot-table {
  table-layout: fixed;
}

.slot-table th:nth-child(1),
.slot-table td:nth-child(1) {
  width: 54px;
}

.slot-table th:nth-child(2),
.slot-table td:nth-child(2),
.slot-table th:nth-child(6),
.slot-table td:nth-child(6) {
  width: 150px;
}

.slot-table th:nth-child(3),
.slot-table td:nth-child(3),
.slot-table th:nth-child(7),
.slot-table td:nth-child(7) {
  width: 140px;
}

.slot-table th:nth-child(4),
.slot-table td:nth-child(4),
.slot-table th:nth-child(8),
.slot-table td:nth-child(8) {
  width: 86px;
}

.slot-table th:nth-child(5),
.slot-table td:nth-child(5),
.slot-table th:nth-child(9),
.slot-table td:nth-child(9) {
  width: 104px;
}

/* ─── Buttons ────────────────────────────────────────── */
.primary, .ghost, .danger {
  border-radius: var(--r-xs);
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all .15s;
  line-height: 1.4;
}

.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 1px 3px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.14);
}
.primary:hover  { background: var(--accent-deep); box-shadow: 0 4px 10px rgba(37,99,235,.35); }
.primary:active { transform: translateY(1px); box-shadow: none; }

.ghost {
  background: var(--panel);
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.ghost:hover  { background: var(--card); border-color: var(--line-deep); }
.ghost:active { transform: translateY(1px); }

.danger {
  background: var(--red);
  color: #fff;
  border: none;
  box-shadow: 0 1px 3px rgba(220,38,38,.3);
}
.danger:hover  { background: #b91c1c; }
.danger:active { transform: translateY(1px); }

.orange-btn { background: linear-gradient(135deg, #f97316, #c2560d); box-shadow: 0 1px 3px rgba(194,86,13,.3); }
.orange-btn:hover { background: linear-gradient(135deg, #ea6c0a, #a84500); box-shadow: 0 4px 10px rgba(194,86,13,.35); }

.violet-btn { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 1px 3px rgba(109,40,217,.3); }
.violet-btn:hover { background: linear-gradient(135deg, #7c4ff0, #5b21b6); box-shadow: 0 4px 10px rgba(109,40,217,.35); }

.small { padding: 7px 12px; font-size: 12px; }

/* ─── Form Grid ──────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ─── Labels & Inputs ────────────────────────────────── */
label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

label > span { color: var(--sub); letter-spacing: .01em; }

.check > span { color: var(--ink); }

input, select, textarea {
  width: 100%;
  background: var(--panel);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  padding: 9px 11px;
  font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

#inboundQty {
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  -webkit-user-select: text;
  user-select: text;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fafcff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input[readonly] {
  background: var(--card);
  color: var(--sub);
  cursor: default;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.75;
  font-size: 13px;
}

.block { margin-bottom: 14px; }

.mini-field { min-width: 180px; }

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 22px;
}
.check input { width: auto; }

.auto-save-check {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 8px 10px;
  margin: -4px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--card);
}

/* ─── Filters  (가로 레이아웃) ───────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.filters > input,
.filters > select {
  flex: 1 1 120px;
  width: auto;
  max-width: 220px;
  font-size: 13px;
  padding: 8px 10px;
}

.filters > input[type="date"] {
  flex: 0 1 158px;
  min-width: 145px;
  max-width: 175px;
}

.filters > button { flex: 0 0 auto; }

/* ─── Table Wrap ─────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: auto;
  background: var(--panel);
}
.compact { max-height: 450px; }

table { width: 100%; border-collapse: collapse; }

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  color: var(--sub);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1.5px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr               { transition: background .1s; }
tbody tr:hover         { background: #f5f8ff; }
tbody tr.is-selected   { background: var(--light); }

/* ─── Detail Box ─────────────────────────────────────── */
.detail-box   { display: grid; gap: 12px; align-content: start; }
.detail-box h4 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0;
}
.meta-grid > div  { padding: 10px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.meta-grid dt     { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--sub); margin-bottom: 4px; }
.meta-grid dd     { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }

/* ─── Misc ───────────────────────────────────────────── */
.helper {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 14px;
  line-height: 1.65;
}

.btn-edit-row {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 5px;
  white-space: nowrap;
  color: var(--accent);
  border-color: rgba(37,99,235,.25);
  background: var(--light);
}
.btn-edit-row:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.backup-box     { display: grid; gap: 12px; }
.backup-summary {
  padding: 11px 14px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--sub);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ─── Result Box ─────────────────────────────────────── */
.result-box {
  margin: 0;
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: var(--r-xs);
  background: #0d1117;
  color: #c9d1d9;
  padding: 16px 18px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.85;
  font-family: "Consolas", "D2Coding", "Malgun Gothic", monospace;
  border: 1.5px solid #21262d;
  transition: border-color .2s;
}

.result-box[data-status="ok"]    { border-color: rgba(5,150,105,.5); }
.result-box[data-status="warn"]  { border-color: rgba(217,119,6,.5); }
.result-box[data-status="error"] { border-color: rgba(220,38,38,.55); }

/* ─── Op Split (입고 / 출고 / 재입고) ───────────────── */
.op-split {
  display: grid;
  grid-template-columns: minmax(300px, 460px) 1fr;
  gap: 16px;
  align-items: start;
}

.op-log {
  display: flex;
  flex-direction: column;
}

.op-result {
  min-height: 540px;
  flex: 1;
}

/* ─── Lots Head ──────────────────────────────────────── */
.lots-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.lots-head > span:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  letter-spacing: .01em;
}

.lot-count {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: var(--light);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: .02em;
}

/* ─── Global Log (입고/출고/재입고 탭에서 숨김) ─────── */
.main:has([data-view-panel="inbound"].is-active)  .global-log,
.main:has([data-view-panel="outbound"].is-active) .global-log,
.main:has([data-view-panel="return"].is-active)   .global-log {
  display: none;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1280px) {
  .stat-grid  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .equipment-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cols-4     { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2     { grid-template-columns: 1fr; }
  .op-split   { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell  { padding: 8px 10px 36px; }
  .brand-area { flex-direction: column; align-items: flex-start; }
  .tab-btn    { padding: 11px 12px 10px; font-size: 12.5px; }
  .stat-grid, .type-grid, .mini-stats,
  .equipment-grid,
  .cols-2, .cols-3, .cols-4, .meta-grid { grid-template-columns: 1fr; }
  .stat-card strong { font-size: 28px; }
  .filters > input, .filters > select { max-width: none; }
}

@media (max-width: 640px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-size: 15px;
    background: #eef3f8;
  }

  .app-shell {
    width: 100%;
    padding: 0 0 28px;
  }

  .app-header {
    top: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 2px 10px rgb(15 23 42 / .08);
  }

  .brand-area {
    gap: 10px;
    padding: 10px 12px;
    background: var(--panel);
  }

  .eyebrow,
  .brand-area .sub-copy {
    display: none;
  }

  .brand-area h1 {
    font-size: 17px;
    line-height: 1.25;
    margin: 0;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .language-switch {
    grid-column: 1 / -1;
    justify-content: center;
    border-radius: var(--r-xs);
  }

  .lang-btn {
    flex: 1;
    min-height: 38px;
  }

  .status-pill {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: var(--r-xs);
  }

  .tabbar {
    gap: 6px;
    padding: 8px 10px 10px;
    scroll-padding-left: 10px;
  }

  .tab-btn {
    min-width: 78px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-xs);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--sh-xs);
  }

  .tab-btn.is-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
  }

  .main {
    gap: 10px;
    margin-top: 10px;
    padding: 0 10px;
  }

  .page-head {
    display: none;
  }

  .view.is-active {
    gap: 10px;
  }

  .panel {
    padding: 14px;
    border-radius: var(--r-sm);
    box-shadow: var(--sh-xs);
  }

  .panel-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .panel-head h3 {
    font-size: 15px;
  }

  .inline,
  .cta-row,
  .filters {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filters {
    padding: 10px;
    margin-bottom: 12px;
    border-radius: var(--r-sm);
  }

  .filters > input,
  .filters > select,
  .filters > input[type="date"],
  .filters > button,
  .mini-field,
  .header-actions .ghost,
  .inline > *,
  .cta-row > * {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .primary,
  .ghost,
  .danger,
  .small {
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    padding: 10px 11px;
    font-size: 16px;
  }

  textarea {
    min-height: 240px;
    line-height: 1.65;
  }

  .op-split {
    gap: 10px;
  }

  .op-result {
    min-height: 220px;
    max-height: 320px;
  }

  .result-box {
    padding: 12px;
    font-size: 12px;
    line-height: 1.7;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .equipment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .equipment-card {
    min-height: 136px;
  }

  .stat-card {
    min-height: 92px;
    padding: 14px;
    border-radius: var(--r-sm);
  }

  .stat-card strong {
    font-size: 25px;
  }

  .type-card,
  .mini-stats article,
  .meta-grid > div {
    border-radius: var(--r-sm);
    padding: 12px;
  }

  .type-stats {
    justify-content: space-between;
    gap: 12px;
  }

  .table-wrap {
    border-radius: var(--r-sm);
    max-width: calc(100vw - 20px);
    -webkit-overflow-scrolling: touch;
  }

  .compact {
    max-height: 360px;
  }

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .btn-edit-row {
    min-height: 34px;
    padding: 6px 10px;
  }

  .backup-box .inline {
    grid-template-columns: 1fr;
  }

  .slot-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .slot-tab {
    width: 100%;
    min-height: 42px;
  }
}

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

  .header-actions {
    grid-template-columns: 1fr;
  }
}
