:root {
  --bg-page: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-subtle: #F6F3F6;
  --brand: #7C5A7C;
  --brand-dark: #634463;
  --brand-soft: #F4EEF4;
  --text-main: #1F1A21;
  --text-sub: #59515C;
  --text-muted: #8E8691;
  --border: #E8E1E9;
  --shadow-card: 0 4px 18px rgba(34, 21, 38, 0.05);
  --shadow-sheet: 0 18px 48px rgba(28, 16, 32, 0.16);

  --st-unassigned: #D94854;
  --st-unassigned-bg: #FDF1F2;
  --st-waiting: #D67A1A;
  --st-waiting-bg: #FEF6EB;
  --st-scheduled: #7C5A7C;
  --st-scheduled-bg: #F4EEF4;
  --st-completed: #248258;
  --st-completed-bg: #EDF8F2;
  --st-cancelled: #6E737D;
  --st-cancelled-bg: #F1F2F4;

  --radius-card: 18px;
  --radius-pill: 999px;
  --font-serif: 'Gowun Batang', Georgia, serif;
  --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* ===== 로그인 / 미등록 화면 ===== */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top center, #F5EFF5 0%, #FAFAFA 60%);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 40px 28px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.brand-badge {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--brand);
  color: #FFFFFF;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 20px rgba(124, 90, 124, 0.25);
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 30px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.btn-google {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.btn-google:active {
  transform: scale(0.98);
}

.btn-google:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.email-pill {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
}

/* ===== 상단 헤더 ===== */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 250, 250, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.top-bar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-title-sm {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--brand);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.role-badge {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.role-badge.is-tech {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.user-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #248258;
  box-shadow: 0 0 0 3px rgba(36, 130, 88, 0.16);
}

.sync-dot.is-offline {
  background: #D94854;
  box-shadow: 0 0 0 3px rgba(217, 72, 84, 0.16);
}

/* ===== 공통 버튼 ===== */
.btn-primary-sm,
.btn-outline-sm,
.btn-ghost-sm {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.btn-primary-sm {
  background: var(--brand);
  color: #FFFFFF;
}

.btn-primary-sm:active {
  transform: scale(0.97);
}

.btn-outline-sm {
  background: #FFFFFF;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn-ghost-sm {
  background: var(--bg-subtle);
  color: var(--text-sub);
}

.btn-primary-lg {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.btn-primary-lg:active {
  transform: scale(0.98);
  background: var(--brand-dark);
}

.btn-secondary {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 600;
}

.full-width {
  width: 100%;
}

/* ===== 필터 탭 & 정렬 툴바 ===== */
.toolbar-wrap {
  position: sticky;
  top: 61px;
  z-index: 25;
  background: rgba(250, 250, 250, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.toolbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  flex: 1 1 auto;
}

.status-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tab-btn .tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.tab-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

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

.search-box {
  position: relative;
}

.search-input {
  width: 150px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #FFFFFF;
  font-size: 13px;
  outline: none;
}

.search-input:focus {
  border-color: var(--brand);
}

.sort-toggle {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.sort-toggle.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

/* ===== KDS 카드 그리드 ===== */
.board-main {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

.orders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .orders-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* ===== 바나프레소 KDS 스타일 카드 ===== */
.kds-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.kds-card:active {
  transform: scale(0.988);
}

.kds-card.is-delayed {
  border-color: #E8A65D;
}

.kds-card.is-overdue {
  border-color: #E06B74;
}

.kds-card.is-closed {
  opacity: 0.78;
}

.kds-card-head {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.kds-card-head.st-unassigned { background: var(--st-unassigned-bg); }
.kds-card-head.st-waiting { background: var(--st-waiting-bg); }
.kds-card-head.st-scheduled { background: var(--st-scheduled-bg); }
.kds-card-head.st-completed { background: var(--st-completed-bg); }
.kds-card-head.st-cancelled { background: var(--st-cancelled-bg); }

.kds-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
}

.status-unassigned { background: var(--st-unassigned); }
.status-waiting { background: var(--st-waiting); }
.status-scheduled { background: var(--st-scheduled); }
.status-completed { background: var(--st-completed); }
.status-cancelled { background: var(--st-cancelled); }

.tech-pill {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kds-elapsed {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kds-elapsed.is-warn {
  color: #C46308;
}

.kds-elapsed.is-danger {
  color: #C92A37;
}

.kds-card-body {
  padding: 15px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
}

.kds-customer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.kds-customer-name {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 21px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.kds-visit-badge {
  padding: 4px 10px;
  border-radius: 9px;
  background: var(--brand);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 연락처 & 주소 원터치 칩 */
.kds-contact-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kds-action-chip {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.kds-action-chip:active {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.kds-tel {
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.kds-addr-text {
  flex: 1;
  min-width: 0;
  word-break: keep-all;
  line-height: 1.35;
}

.chip-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--brand);
}

.chip-copy-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: #FFFFFF;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* 품목 / 금액 박스 */
.kds-item-box {
  padding: 11px 12px;
  border-radius: 12px;
  background: #FAF8FA;
  border: 1px solid #EFEAEF;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kds-product {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  word-break: keep-all;
}

.kds-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kds-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

.kds-payment {
  padding: 2px 8px;
  border-radius: 6px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.kds-memo {
  padding: 9px 12px;
  border-radius: 10px;
  background: #FFFDF7;
  border: 1px solid #F3E5C8;
  font-size: 13px;
  font-weight: 500;
  color: #5C4620;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ===== 빈 상태 ===== */
.empty-state {
  padding: 64px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-label {
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

/* ===== 모달 / 바텀시트 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(24, 15, 27, 0.46);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: 24px;
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-main);
}

.btn-close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-summary {
  padding: 12px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-sub);
}

.action-summary strong {
  color: var(--text-main);
  font-size: 14px;
}

.modal-body {
  padding: 18px 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 기사 선택 그리드 */
.sheet-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  margin: 0 0 8px 0;
}

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

.tech-pick-btn {
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  transition: all 0.12s ease;
}

.tech-pick-btn:active,
.tech-pick-btn.is-selected {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

/* 날짜 & 시간 빠른 선택 */
.schedule-panel {
  padding: 14px;
  border-radius: 16px;
  background: #FAF8FA;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-pill {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.quick-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

.datetime-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.datetime-inputs input {
  height: 42px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  font-weight: 600;
}

.action-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-status-complete {
  min-height: 54px;
  border-radius: 14px;
  background: var(--st-completed);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
}

.btn-status-cancel {
  min-height: 54px;
  border-radius: 14px;
  background: var(--st-cancelled-bg);
  color: var(--st-cancelled);
  border: 1px solid #D8DCE3;
  font-size: 16px;
  font-weight: 700;
}

.btn-status-waiting {
  min-height: 46px;
  border-radius: 12px;
  background: var(--st-waiting-bg);
  color: var(--st-waiting);
  font-size: 14px;
  font-weight: 700;
}

.btn-status-unassign {
  min-height: 46px;
  border-radius: 12px;
  background: var(--st-unassigned-bg);
  color: var(--st-unassigned);
  font-size: 14px;
  font-weight: 700;
}

.btn-delete-order {
  min-height: 42px;
  border-radius: 12px;
  background: transparent;
  color: #C92A37;
  font-size: 13px;
  font-weight: 600;
}

/* ===== 폼 입력 ===== */
.form-stack {
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
}

/* ===== 기사 관리 모달 ===== */
.user-add-form {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 560px) {
  .user-add-form {
    grid-template-columns: 1fr 1fr;
  }
  .user-add-form input[type="email"] {
    grid-column: 1 / -1;
  }
}

.user-add-form input,
.user-add-form select {
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  min-width: 0;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-row {
  padding: 11px 14px;
  border-radius: 12px;
  background: #FAF8FA;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-row-name {
  font-weight: 700;
  font-size: 14px;
}

.user-row-email {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-tag {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.user-role-tag.is-admin {
  background: var(--brand);
  color: #FFFFFF;
}

.btn-user-del {
  padding: 6px 10px;
  border-radius: 8px;
  background: #FDF1F2;
  color: #C92A37;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ===== 토스트 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(31, 26, 33, 0.92);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

@media (max-width: 480px) {
  .top-bar-inner {
    padding: 10px 12px;
  }
  .toolbar-inner {
    padding: 10px 12px;
  }
  .search-input {
    width: 118px;
  }
  .board-main {
    padding: 12px;
  }
}
