/* ===== VARIABLES ===== */
:root {
  --primary: #E53935;
  --primary-dark: #C62828;
  --primary-light: #FFEBEE;
  --amazon: #FF9900;
  --amazon-light: #FFF3E0;
  --amazon-dark: #E65C00;
  --frima: #D81B60;
  --frima-light: #FCE4EC;
  --frima-dark: #A00037;
  --success: #388E3C;
  --success-light: #E8F5E9;
  --warning: #F57C00;
  --warning-light: #FFF3E0;
  --danger: #C62828;
  --gray: #9E9E9E;
  --gray-light: #F5F5F5;
  --gray-border: #E0E0E0;
  --text: #212121;
  --text2: #757575;
  --white: #FFFFFF;
  --header-h: 52px;
  --tab-h: 62px;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: #F0F0F0;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ===== APP LAYOUT ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.12);
}

/* ===== HEADER ===== */
#header {
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  padding-bottom: 0;
  padding-left: 8px;
  padding-right: 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
#header h1 {
  grid-column: 2;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  padding: 0 4px 12px;
}
#back-btn { grid-column: 1; justify-self: start; padding-bottom: 8px; }
#action-btn { grid-column: 3; justify-self: end; padding-bottom: 8px; }

.header-btn {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}
.header-btn.back-circle {
  background: var(--gray-light);
  border-radius: 18px;
  padding: 0 14px 0 10px;
  gap: 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  height: 36px;
  min-width: unset;
}
.header-btn.pill-btn {
  background: var(--primary);
  color: white;
  border-radius: 18px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  height: 36px;
  min-width: unset;
}
.header-btn.pill-btn-outline {
  background: var(--gray-light);
  color: var(--primary);
  border-radius: 18px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  height: 36px;
  min-width: unset;
}
.header-btn:active { opacity: 0.65; }
.hidden { display: none !important; }

/* ===== MAIN ===== */
#main {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--gray-light);
}

/* ===== TAB BAR ===== */
#tab-bar {
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--gray-border);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--gray);
  font-size: 11px;
  padding: 6px 0;
  min-height: 44px;
}
.tab-btn svg { width: 24px; height: 24px; fill: currentColor; }
.tab-btn.active { color: var(--primary); }
.tab-btn:active { opacity: 0.65; }

/* ===== PRODUCT GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: #CCCCCC;
}
.product-grid-item {
  position: relative;
  background: var(--white);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
}
.product-grid-item:active { opacity: 0.82; }
.product-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-grid-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: #F9F9F9;
}
/* stock badge top-left */
.grid-stock {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(56,142,60,0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.grid-stock.warn  { background: rgba(245,124,0,0.92); }
.grid-stock.danger { background: rgba(198,40,40,0.92); }
/* name bar at bottom */
.grid-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.62);
  color: white;
  font-size: 10px;
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
/* color+size chip top-right */
.grid-colorsize {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.52);
  color: white;
  border-radius: 8px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 600;
  max-width: 54%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== GRID ACTION BAR ===== */
.grid-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
  gap: 8px;
}
.grid-count { font-size: 13px; color: var(--text2); }
.add-btn {
  background: var(--primary);
  color: white;
  border-radius: 18px;
  padding: 0 16px;
  height: 34px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.add-btn:active { opacity: 0.78; }

/* ===== SECTION HEADER ===== */
.section-hd {
  background: var(--gray-light);
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
}

/* ===== DETAIL ROWS ===== */
.detail-group {
  background: var(--white);
  margin-bottom: 10px;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-border);
  font-size: 15px;
  min-height: 52px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text2); flex-shrink: 0; font-size: 14px; }
.detail-value { font-weight: 500; color: var(--text); text-align: right; }
.detail-value.amazon { color: var(--amazon-dark); font-weight: 700; }
.detail-value.frima  { color: var(--frima-dark);  font-weight: 700; }
.detail-value.success { color: var(--success); font-weight: 700; }
.detail-value.warning { color: var(--warning); font-weight: 700; }
.detail-value.danger  { color: var(--danger);  font-weight: 700; }

/* ===== PHOTO AREA ===== */
.photo-area {
  width: 100%;
  aspect-ratio: 1;
  background: #F0F0F0;
  position: relative;
  overflow: hidden;
}
.photo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: #F0F0F0;
}

/* ===== INVENTORY STEPPER ===== */
.inv-section {
  background: var(--white);
  margin-bottom: 10px;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
}
.inv-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-border);
  gap: 12px;
  min-height: 60px;
}
.inv-row:last-child { border-bottom: none; }
.inv-channel-label {
  font-size: 13px;
  font-weight: 700;
  width: 72px;
  flex-shrink: 0;
}
.inv-channel-label.amazon { color: var(--amazon-dark); }
.inv-channel-label.frima  { color: var(--frima-dark); }
.inv-channel-label.total  { color: var(--text2); }
.inv-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.step-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gray-border);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.step-btn:active { background: var(--gray-light); }
.step-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  min-width: 48px;
}
.step-val.warn   { color: var(--warning); }
.step-val.danger { color: var(--danger); }
.inv-total-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text2);
}

/* ===== PERIOD TABS ===== */
.period-tabs {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tab {
  flex: 1;
  min-width: 64px;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  white-space: nowrap;
  text-align: center;
  border-bottom: 2px solid transparent;
}
.period-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== STATS CARDS ===== */
.stats-row {
  display: flex;
  gap: 2px;
  background: #CCCCCC;
  margin-bottom: 10px;
}
.stat-card {
  flex: 1;
  background: var(--white);
  padding: 14px 10px;
  text-align: center;
}
.stat-label {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 4px;
}
.stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.stat-val.amazon { color: var(--amazon-dark); }
.stat-val.frima  { color: var(--frima-dark); }
.stat-val.total  { color: var(--text); }
.stat-unit { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ===== FORECAST SECTION ===== */
.forecast-box {
  background: var(--white);
  margin-bottom: 10px;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
  padding: 14px 16px;
}
.forecast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 10px;
}
.forecast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.forecast-item {
  background: var(--gray-light);
  border-radius: 10px;
  padding: 10px 12px;
}
.forecast-item-label {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 4px;
}
.forecast-item-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.forecast-item-val.good    { color: var(--success); }
.forecast-item-val.warn    { color: var(--warning); }
.forecast-item-val.danger  { color: var(--danger); }
.forecast-item-val.amazon  { color: var(--amazon-dark); }
.forecast-item-val.frima   { color: var(--frima-dark); }
.forecast-alert {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.forecast-alert.green  { background: var(--success-light); color: var(--success); }
.forecast-alert.orange { background: var(--warning-light); color: var(--warning); }
.forecast-alert.red    { background: var(--primary-light); color: var(--danger); }

/* ===== MONTHLY TABLE ===== */
.monthly-table-wrap {
  background: var(--white);
  margin-bottom: 10px;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
  overflow-x: auto;
}
.monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.monthly-table th {
  padding: 10px 12px;
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  border-bottom: 1px solid var(--gray-border);
  white-space: nowrap;
}
.monthly-table th:first-child { text-align: left; }
.monthly-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--gray-border);
  white-space: nowrap;
}
.monthly-table td:first-child { text-align: left; font-weight: 600; }
.monthly-table tr:last-child td { border-bottom: none; }
.monthly-table .col-amazon { color: var(--amazon-dark); font-weight: 700; }
.monthly-table .col-frima  { color: var(--frima-dark);  font-weight: 700; }
.monthly-table .col-total  { font-weight: 700; }

/* ===== HISTORY LIST ===== */
.history-list {
  background: var(--white);
  margin-bottom: 10px;
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
}
.history-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-border);
  gap: 10px;
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }
.history-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.history-dot.plus  { background: var(--success); }
.history-dot.minus { background: var(--danger); }
.history-body { flex: 1; min-width: 0; }
.history-main { font-weight: 600; margin-bottom: 2px; }
.history-sub  { font-size: 11px; color: var(--text2); }
.badge-amazon { display: inline-block; background: var(--amazon); color: #000; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.badge-frima  { display: inline-block; background: var(--frima); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }

/* ===== FORM (sheet) ===== */
.form-section {
  background: var(--white);
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
  margin-bottom: 16px;
}
.form-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--gray-border);
  min-height: 52px;
  gap: 12px;
}
.form-row:last-child { border-bottom: none; }
.form-label {
  font-size: 14px;
  color: var(--text);
  width: 88px;
  flex-shrink: 0;
  font-weight: 500;
}
.form-label.req::after { content: ' *'; color: var(--danger); }
.form-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  padding: 0;
  text-align: right;
}
.form-input::placeholder { color: #BDBDBD; font-size: 14px; }
.form-input[type="number"] { text-align: right; }
.form-textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  padding: 12px 0;
  resize: none;
  text-align: right;
  min-height: 80px;
}
select.form-input { text-align: right; }

/* Photo upload row */
.photo-upload-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-border);
  gap: 12px;
  cursor: pointer;
}
.photo-upload-row:active { background: var(--gray-light); }
.photo-upload-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-border);
  background: var(--gray-light);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.photo-upload-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-hint { flex: 1; font-size: 14px; color: var(--text2); }

/* Sheet buttons */
.sheet-btn-row {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  background: var(--white);
  border-top: 1px solid var(--gray-border);
  position: sticky;
  bottom: 0;
}
.btn-primary {
  flex: 1;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
}
.btn-primary:active { opacity: 0.78; }
.btn-gray {
  height: 48px;
  padding: 0 20px;
  background: var(--gray-light);
  color: var(--text2);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.btn-gray:active { opacity: 0.78; }
.btn-danger {
  height: 48px;
  padding: 0 20px;
  background: var(--primary-light);
  color: var(--danger);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.btn-danger:active { opacity: 0.78; }

/* ===== CSV PAGE ===== */
.csv-tab-bar {
  display: flex;
  background: var(--white);
  border-bottom: 1px solid var(--gray-border);
}
.csv-tab {
  flex: 1;
  padding: 12px 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  text-align: center;
  border-bottom: 2px solid transparent;
}
.csv-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.upload-zone {
  margin: 16px;
  border: 2px dashed var(--gray-border);
  border-radius: 14px;
  background: var(--white);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
}
.upload-zone:active { background: var(--gray-light); }
.upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.upload-icon { font-size: 40px; margin-bottom: 8px; }
.upload-text { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text2); }
.upload-filename { font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 8px; }

.import-result {
  margin: 0 16px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.import-result.ok     { background: #E8F5E9; color: var(--success); }
.import-result.error  { background: var(--primary-light); color: var(--danger); }
.import-result.info   { background: #E3F2FD; color: #1565C0; }

.import-btn-wrap {
  padding: 0 16px 16px;
  display: flex;
  gap: 8px;
}
.import-btn {
  flex: 1;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}
.import-btn:active { opacity: 0.78; }
.clear-btn {
  height: 48px;
  padding: 0 16px;
  background: var(--gray-light);
  color: var(--text2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.history-section {
  background: var(--white);
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
  margin-top: 8px;
}
.history-row {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-border);
  gap: 10px;
}
.history-row:last-child { border-bottom: none; }
.history-info { flex: 1; min-width: 0; }
.history-filename { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.history-stats { font-size: 12px; }
.history-del-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  align-self: center;
}
.history-del-btn:active { opacity: 0.7; }

.ch-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 4px;
}
.ch-amazon { background: var(--amazon); color: #000; }
.ch-frima  { background: var(--frima); color: #fff; }

.unmatched-box {
  background: #FFF8E1;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--warning);
}
.unmatched-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.unmatched-item:last-child { border-bottom: none; }
.add-master-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--warning);
  color: var(--warning);
  background: none;
  white-space: nowrap;
}

/* ===== SETTINGS PAGE ===== */
.settings-section {
  background: var(--white);
  border-top: 1px solid var(--gray-border);
  border-bottom: 1px solid var(--gray-border);
  margin-bottom: 10px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--gray-border);
  min-height: 52px;
  font-size: 15px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: var(--gray-light); }
.settings-row-label { color: var(--text); }
.settings-row-val   { color: var(--text2); font-size: 14px; }
.settings-arrow { color: var(--gray); font-size: 18px; margin-left: 6px; }
.settings-btn-row {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-action-btn {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  background: var(--gray-light);
  color: var(--text);
}
.settings-action-btn.danger { background: var(--primary-light); color: var(--danger); }
.settings-action-btn:active { opacity: 0.78; }

/* ===== SHEET (bottom modal) ===== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--gray-light);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-border);
  margin: 10px auto 4px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  padding: 4px 16px 14px;
  color: var(--text);
}

/* Confirm box (not bottom sheet, centered) */
.confirm-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 14px;
  width: 280px;
  overflow: hidden;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(33,33,33,0.92);
  color: white;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  white-space: normal;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: rgba(56,142,60,0.95); }
.toast.error   { background: rgba(198,40,40,0.95); }
.toast.warning { background: rgba(245,124,0,0.95); }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 10px;
}
.empty-icon { font-size: 52px; }
.empty-title { font-size: 17px; font-weight: 700; color: var(--text); }
.empty-desc  { font-size: 14px; color: var(--text2); line-height: 1.6; }
.empty-btn {
  margin-top: 8px;
  background: var(--primary);
  color: white;
  border-radius: 24px;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 700;
}
.empty-btn:active { opacity: 0.78; }

/* ===== CSV PREVIEW TABLE ===== */
.csv-preview {
  margin: 0 16px 16px;
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--gray-border);
}
.csv-preview table { width: 100%; border-collapse: collapse; font-size: 12px; }
.csv-preview th { background: var(--gray-light); padding: 8px 10px; text-align: left; font-weight: 600; color: var(--text2); border-bottom: 1px solid var(--gray-border); white-space: nowrap; }
.csv-preview td { padding: 7px 10px; border-bottom: 1px solid var(--gray-border); color: var(--text); }
.csv-preview tr:last-child td { border-bottom: none; }
