:root {
  --bg: #f1f3f8;
  --card-bg: #ffffff;
  --item-bg: #f6f7fb;
  --input-bg: #eceef4;
  --text-main: #18191f;
  --text-sub: #70737d;
  --accent: #007aff;
  --success: #34c759;
  --danger: #ff3b30;
  --flow-color: #5e3bee;
}

body.dark-mode {
  --bg: #111216;
  --card-bg: #22242b;
  --item-bg: #2c2f38;
  --input-bg: #353844;
  --text-main: #f2f3f7;
  --text-sub: #a0a4b0;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  height: 100dvh;
  overflow: hidden;
}

.app-container {
  max-width: 760px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

.header-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: var(--input-bg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.primary-btn, .success-btn, .secondary-btn, .flow-btn {
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.primary-btn { background: var(--accent); }
.success-btn { background: var(--success); }
.secondary-btn { background: #8a8d96; }
.flow-btn { background: var(--flow-color); }

.add-receipt-btn {
  width: 100%;
  font-size: 16px;
}

.status-bar {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  padding: 0 4px;
}

.list-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.6;
}

.receipt-item {
  background: var(--item-bg);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.badge {
  background: #767a85;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.item-title {
  font-size: 14px;
  font-weight: 700;
}

.item-sub {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.act-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bottom-bar {
  display: flex;
  gap: 10px;
  height: 52px;
}

.danger-icon-btn {
  width: 56px;
  height: 52px;
  border: none;
  border-radius: 12px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.export-main-btn {
  flex: 1;
  font-size: 16px;
}

/* 모달 창 (키보드 가림 방지를 위해 max-height 및 내부 스크롤 지원) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px 0;
}

.modal-header-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.small-dark-btn {
  background: #555863;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.toggle-row, .form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}

.form-row label {
  flex: 0.42;
  font-size: 13.5px;
  font-weight: 600;
}

.req-label {
  color: #f04438;
}

.form-row input {
  flex: 0.58;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

/* 삼성 One UI 스타일 좌우 슬라이드 토글 스위치 */
.oneui-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.oneui-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.oneui-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #8c8f99;
  transition: 0.22s;
  border-radius: 28px;
}

.oneui-switch .slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.22s;
  border-radius: 50%;
}

.oneui-switch input:checked + .slider {
  background-color: var(--accent);
}

.oneui-switch input:checked + .slider:before {
  transform: translateX(22px);
}

.modal-hint {
  font-size: 11.5px;
  color: var(--text-sub);
  text-align: center;
  margin: 4px 0 0 0;
}

.dev-credit {
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
  margin: 0;
}

.modal-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-btn-row button {
  flex: 1;
}

.full-btn {
  width: 100%;
}

.quick-btn-row {
  display: flex;
  gap: 8px;
}

.quick-chip {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
}

.preview-img-box {
  max-height: 60dvh;
  overflow: auto;
  text-align: center;
}

.preview-img-box img {
  max-width: 100%;
  border-radius: 10px;
}

.share-file-desc {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  white-space: pre-line;
  margin: 4px 0 8px 0;
}

.loading-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 2000;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.25);
  border-top-color: #3898ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
.item-actions {
  display: flex;
  gap: 5px;
}
.act-ico-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.export-row-card {
  background: var(--input-bg);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.export-file-label {
  font-size: 13.5px;
  font-weight: 600;
  word-break: break-all;
  flex: 1;
}
.export-icon-btns {
  display: flex;
  gap: 6px;
}
.ico-action-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.dl-ico { background: #007aff; }
.share-ico { background: #34c759; }

.top-add-row {
  display: flex;
  gap: 10px;
}
.top-half-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14.5px;
  padding: 13px 10px;
}
.cam-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}
.cam-thumb-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
}
.cam-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 59, 48, 0.9);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* 인앱 연속 촬영 카메라 전체화면 스타일 */
.live-cam-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 3000;
  display: flex;
  flex-direction: column;
}
.live-cam-header {
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.65);
}
.live-cam-close {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 14px;
}
.live-cam-body {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
#liveVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
.cam-flash.active {
  opacity: 0.75;
}
.live-cam-strip {
  height: 76px;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  overflow-x: auto;
}
.strip-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.strip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.strip-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 59, 48, 0.95);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
.live-cam-footer {
  height: 96px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.shutter-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.1s;
}
.shutter-btn:active .shutter-inner {
  transform: scale(0.88);
  background: #d0d4dc;
}
.cam-done-btn {
  width: 90px;
  height: 44px;
  border-radius: 10px;
  border: none;
  background: #34c759;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
