/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.1), 0 8px 32px rgba(0,0,0,.06);
  --radius: 12px;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.header-title .logo {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.header-nav button {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}

.header-nav button:hover {
  background: var(--bg);
  color: var(--text);
}

.header-nav button.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.header-nav .header-logout {
  margin-left: 8px;
  color: #ef4444;
  border-left: 1px solid var(--border, #e5e7eb);
  border-radius: 0;
  padding-left: 16px;
}

.header-nav .header-logout:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* ===== Main Layout ===== */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.main-content-wide {
  max-width: 1400px;
}

/* ===== Home Page ===== */
.home-welcome {
  margin-bottom: 32px;
}

.home-welcome h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.home-welcome p {
  color: var(--text-secondary);
  font-size: 15px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.menu-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.menu-card .card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.menu-card .card-icon.product { background: #dbeafe; color: #2563eb; }
.menu-card .card-icon.client  { background: #dcfce7; color: #16a34a; }
.menu-card .card-icon.company { background: #fef3c7; color: #d97706; }
.menu-card .card-icon.sales   { background: #ede9fe; color: #7c3aed; }
.menu-card .card-icon.stats   { background: #e0f2fe; color: #0284c7; }

.menu-card .card-body h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.menu-card .card-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.menu-card .card-arrow {
  margin-left: auto;
  align-self: center;
  color: var(--text-secondary);
  font-size: 18px;
  transition: transform .2s;
}

.menu-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--primary);
}

/* ===== Sub Page ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
}

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

.sort-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  outline: none;
}

.sort-select:focus {
  border-color: var(--primary);
}

.list-search-input {
  width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.list-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-success {
  background: #16a34a;
  color: white;
}

.btn-success:hover {
  background: #15803d;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ===== Table ===== */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-scroll-container {
  max-height: 75vh;
  overflow-y: auto;
}

.list-scroll-container .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.product-list-table th,
.product-list-table td,
.client-list-table th,
.client-list-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8fafc;
}

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

/* ===== Sales Register: Monthly Accordion ===== */
.sales-accordion-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: hidden;
}

.sales-accordion-group {
  border-bottom: 1px solid var(--border);
}

.sales-accordion-group:last-child {
  border-bottom: none;
}

.sales-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f8fafc;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

.sales-accordion-header:hover {
  background: #eef2f7;
}

.sales-accordion-group.is-expanded .sales-accordion-header {
  background: #e0e7ff;
}

.sales-accordion-arrow {
  font-size: 11px;
  color: var(--text-secondary);
}

.sales-accordion-body {
  padding: 12px 16px 16px;
}

.sales-accordion-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.sales-accordion-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sales-accordion-summary-item span {
  font-size: 12px;
  color: var(--text-secondary);
}

.sales-accordion-summary-item strong {
  font-size: 16px;
  color: var(--text);
}

.sales-accordion-date-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sales-accordion-date-table td {
  padding: 10px 14px;
}

.ip-search-date.is-selected {
  color: #dc2626;
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: .5;
}

.empty-state p {
  font-size: 15px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn .15s;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* ===== Company Info ===== */
.company-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

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

.company-form .form-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Backup / Restore ===== */
.backup-restore-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 20px;
}

.backup-restore-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.backup-restore-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.5;
}

.backup-restore-actions {
  display: flex;
  gap: 8px;
}

.backup-import-progress {
  margin-top: 16px;
}

.backup-import-progress-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}

.backup-import-progress-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width .2s;
}

.backup-import-progress-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.backup-migrate-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.backup-migrate-desc {
  margin-top: 8px;
  margin-bottom: 0;
}

/* ===== Product Image Upload ===== */
.product-img-upload {
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-img-preview {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color .15s;
}

.product-img-preview:hover {
  border-color: var(--primary);
}

.product-img-preview.has-image {
  border-style: solid;
  border-color: var(--border);
}

.product-img-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-img-preview .placeholder-icon {
  font-size: 28px;
  color: #cbd5e1;
  margin-bottom: 2px;
}

.product-img-preview .placeholder-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.product-img-actions {
  display: flex;
  gap: 8px;
}

.product-list-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-list-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-list-thumb span {
  font-size: 18px;
}

/* ===== Logo Upload ===== */
.logo-upload-area {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color .15s;
}

.logo-preview:hover {
  border-color: var(--primary);
}

.logo-preview.has-image {
  border-style: solid;
  border-color: var(--border);
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-preview .placeholder-icon {
  font-size: 32px;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.logo-preview .placeholder-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.logo-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-actions p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.logo-actions .logo-btns {
  display: flex;
  gap: 8px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s;
  z-index: 300;
}

/* ===== Ledger ===== */
.text-right { text-align: right; }

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.summary-value {
  font-size: 18px;
  font-weight: 700;
}

/* Receivable Bar */
.receivable-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
}

.receivable-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.receivable-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.receivable-value {
  font-size: 16px;
  font-weight: 700;
}

.receivable-highlight {
  margin-left: auto;
  padding: 8px 18px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 8px;
}

.ledger-actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.ledger-type-btn {
  font-weight: 700;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s;
}

.ledger-type-btn:hover {
  opacity: .8;
}

.ledger-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ledger-table th,
.ledger-table td {
  font-size: 13px;
  padding: 12px 10px;
}

.ledger-table th.text-right,
.ledger-table td.text-right {
  text-align: right;
  min-width: 80px;
  white-space: nowrap;
}

.group-date,
.group-type {
  vertical-align: middle;
  border-bottom: 2px solid var(--border);
}

.group-subtotal td {
  background: #f1f5f9;
  border-bottom: 2px solid var(--border);
}

.group-date-cell {
  vertical-align: middle;
  text-align: center;
  border-bottom: 2px solid var(--border);
  min-width: 100px;
}

.group-date-text {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.group-actions-icons {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}

.icon-btn:hover {
  background: var(--bg);
  border-color: var(--primary);
}

.icon-btn-danger:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

.icon-btn-print:hover {
  background: #dbeafe;
  border-color: #2563eb;
}

/* Group Edit Modal */
.group-edit-entries {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 55vh;
  overflow-y: auto;
}

.group-edit-row {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.group-edit-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.group-edit-row .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.group-edit-row .calc-fields {
  margin-top: 8px;
  margin-bottom: 8px;
}

.calc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: -4px;
  margin-bottom: 16px;
}

.calc-fields .form-group {
  margin-bottom: 0;
}

.calc-fields input[readonly] {
  background: #e2e8f0;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 640px) {
  .ledger-summary { grid-template-columns: repeat(2, 1fr); }
  .ledger-actions-bar { flex-wrap: wrap; }
  .calc-fields { grid-template-columns: 1fr; }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .menu-grid { grid-template-columns: 1fr; }
  .company-form .form-row { grid-template-columns: 1fr; }
  .header { padding: 0 16px; }
  .main-content { padding: 20px 16px; }
}

/* ===== Sales Register ===== */
.sales-register-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.sr-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

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

.sr-items-header h3 {
  font-size: 16px;
  font-weight: 700;
}

/* '+ 행 추가' 버튼: 하단 액션바(취소/저장)와 같은 줄에 위치하되,
   가로 위치는 JS(positionSrAddRowButton)가 sr-table의 '매출단가' 컬럼과 맞춰
   left 좌표를 동적으로 계산해 인라인 style로 지정한다. */
.sr-actions {
  position: relative;
}

.sr-add-row-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

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

.sr-table th,
.sr-table td {
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
}

.sr-table th:nth-child(1),
.sr-table td:nth-child(1) {
  width: 30%;
}

.sr-table th:nth-child(2),
.sr-table td:nth-child(2),
.sr-table th:nth-child(3),
.sr-table td:nth-child(3),
.sr-table th:nth-child(4),
.sr-table td:nth-child(4),
.sr-table th:nth-child(5),
.sr-table td:nth-child(5),
.sr-table th:nth-child(6),
.sr-table td:nth-child(6) {
  width: 12%;
}

.sr-table th:nth-child(7),
.sr-table td:nth-child(7) {
  width: 10%;
}

.sr-table select,
.sr-table input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.sr-table select {
  text-align: left;
}

.sr-table input[readonly] {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 700;
}

.sr-summary {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sr-summary-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sr-summary-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sr-summary-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.sr-existing {
  margin-bottom: 24px;
}

.sr-existing h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.sr-history-table th,
.sr-history-table td {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
  text-align: center;
}

.sr-history-table .sr-client-cell {
  text-align: left;
}

.sr-history-table .sr-product-cell {
  text-align: left;
}

.sr-search-buy-price {
  width: 96px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: right;
  font-size: 13px;
}

.sr-new-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.sr-client-cell {
  background: #f8fafc;
  vertical-align: middle;
  font-weight: 600;
}

.sr-day-summary {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.sr-day-summary strong {
  color: var(--primary);
  font-size: 16px;
}

/* ===== Import Products ===== */
.import-products-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.import-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.import-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: all .2s ease;
}

.import-mode-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.import-mode-icon {
  font-size: 28px;
}

.import-mode-card strong {
  font-size: 20px;
  color: var(--text);
}

.import-mode-card span:last-child {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ip-search-table {
  max-width: 420px;
}

.ip-search-table th,
.ip-search-table td {
  text-align: center;
}

.ip-search-date {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
}

.ip-search-detail {
  margin-top: 24px;
}

.receivable-stat-table tfoot {
  background: #f8fafc;
  color: var(--primary);
}

.receivable-stat-table tfoot td {
  border-top: 2px solid var(--border);
}

.statistics-filter {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.statistics-filter .form-group {
  margin-bottom: 0;
}

.radio-group {
  display: flex;
  gap: 14px;
  padding: 10px 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 0;
}

.radio-option input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.tax-attach-bar {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.row-purchase-highlight td {
  background: #fff59d;
}

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

.ip-items-header h3 {
  font-size: 16px;
  font-weight: 700;
}

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

.ip-table th,
.ip-table td {
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
}

.ip-table th:nth-child(1),
.ip-table td:nth-child(1) { width: 6%; }

.ip-table th:nth-child(2),
.ip-table td:nth-child(2) { width: 11%; }

.ip-table th:nth-child(3),
.ip-table td:nth-child(3) { width: 18%; }

.ip-table th:nth-child(4),
.ip-table td:nth-child(4) { width: 7%; }

.ip-table th:nth-child(5),
.ip-table td:nth-child(5) { width: 7%; }

.ip-table th:nth-child(6),
.ip-table td:nth-child(6) { width: 8%; }

.ip-table th:nth-child(7),
.ip-table td:nth-child(7) { width: 9%; }

.ip-table th:nth-child(8),
.ip-table td:nth-child(8) { width: 7%; }

.ip-table th:nth-child(9),
.ip-table td:nth-child(9) { width: 8%; }

.ip-table th:nth-child(10),
.ip-table td:nth-child(10) { width: 7%; }

.ip-table th:nth-child(11),
.ip-table td:nth-child(11) { width: 12%; }

.ip-table select,
.ip-table input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}

.ip-table select {
  text-align: left;
}

.ip-table input[readonly] {
  background: #f1f5f9;
  color: var(--primary);
  font-weight: 700;
}

.ip-table .table-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
  white-space: nowrap;
}

.ip-table .table-actions .btn-sm {
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.import-products-form .table-container {
  overflow-x: auto;
}

.ip-saved-section {
  margin-top: 32px;
}

.ip-saved-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.ip-saved-summary {
  display: flex;
  gap: 24px;
  justify-content: flex-end;
  margin-top: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.ip-saved-summary strong {
  color: var(--text);
  margin-right: 4px;
}

.ip-saved-summary span:last-child strong {
  color: var(--primary);
}

.ip-saved-summary span:last-child {
  color: var(--primary);
  font-weight: 700;
}

.ip-saved-table tfoot .ip-saved-total-row {
  background: #f1f5f9;
  font-weight: 700;
}

.ip-saved-table tfoot .ip-saved-total-row td {
  border-top: 2px solid var(--border);
  color: var(--text);
}

.ip-saved-table tfoot .ip-saved-total-row td:nth-child(5),
.ip-saved-table tfoot .ip-saved-total-row td:nth-child(8),
.ip-saved-table tfoot .ip-saved-total-row td:nth-child(9) {
  color: var(--primary);
}

.ip-exchange-rate {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.ip-exchange-rate label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ip-exchange-rate input {
  width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  text-align: right;
}

.ip-second-page-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.ip-second-page-section {
  margin-top: 28px;
}

.ip-second-page-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.ip-page-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-secondary);
}

.ip-page-date strong,
.ip-page-company {
  color: var(--text);
  font-weight: 700;
}

.ip-doc-number {
  width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  letter-spacing: 1px;
}

.ip-third-extra-code {
  width: 190px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  letter-spacing: 1px;
}

.ip-origin-note {
  color: var(--text);
  font-weight: 700;
}

.ip-second-page-table td:nth-child(3) {
  min-width: 220px;
  text-align: left;
  white-space: normal;
}

.ip-second-page-table {
  table-layout: fixed;
  min-width: 980px;
}

.ip-second-page-table th,
.ip-second-page-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.ip-second-page-table th:nth-child(1),
.ip-second-page-table td:nth-child(1) { width: 90px; }

.ip-second-page-table th:nth-child(2),
.ip-second-page-table td:nth-child(2) { width: 90px; }

.ip-second-page-table th:nth-child(3),
.ip-second-page-table td:nth-child(3) {
  width: 240px;
  text-align: left;
}

.ip-second-page-table th:nth-child(4),
.ip-second-page-table td:nth-child(4),
.ip-second-page-table th:nth-child(5),
.ip-second-page-table td:nth-child(5),
.ip-second-page-table th:nth-child(6),
.ip-second-page-table td:nth-child(6),
.ip-second-page-table th:nth-child(7),
.ip-second-page-table td:nth-child(7),
.ip-second-page-table th:nth-child(8),
.ip-second-page-table td:nth-child(8),
.ip-second-page-table th:nth-child(9),
.ip-second-page-table td:nth-child(9) {
  width: 95px;
  text-align: center;
}

.ip-second-page-costs {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ip-second-page-costs .form-group {
  margin-bottom: 0;
}

.ip-third-page-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.ip-third-page-section {
  margin-top: 28px;
}

.ip-third-page-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.ip-third-page-table {
  table-layout: fixed;
  min-width: 980px;
}

.ip-third-page-table th,
.ip-third-page-table td {
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.ip-third-page-table th:first-child,
.ip-third-page-table td:first-child {
  width: 220px;
  text-align: left;
}

.ip-third-page-table th:nth-child(7),
.ip-third-page-table td:nth-child(7),
.ip-third-page-table th:last-child,
.ip-third-page-table td:last-child {
  color: var(--primary);
  font-weight: 700;
}

.ip-third-page-total-row {
  background: #f1f5f9;
}

.ip-third-page-total-row td {
  border-top: 2px solid var(--border);
}

.ip-reference-amount {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

.ip-reference-amount span {
  color: var(--text-secondary);
  font-weight: 700;
}

.ip-reference-amount strong {
  color: var(--primary);
  font-size: 18px;
}

.ip-apply-date {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ip-apply-date label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ip-apply-date input {
  width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.ip-complete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.import-pdf-options {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.import-pdf-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.import-pdf-options input {
  width: 18px;
  height: 18px;
}

.ip-saved-table th,
.ip-saved-table td {
  padding: 8px 10px;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.ip-saved-table th {
  font-weight: 600;
  background: #f8fafc;
}

.card-icon.import { background: #fef3c7; }

/* ===== Login Page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}

.login-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.login-box h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.login-form .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-form .form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.login-form .form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-error {
  color: #dc2626;
  font-size: 13px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 10px;
}

.login-submit {
  width: 100%;
  padding: 11px;
  font-size: 15px;
  margin-top: 4px;
}

/* ===== Sale Price Hint Tooltip ===== */
.price-hint-tooltip {
  position: fixed;
  z-index: 250; /* .modal-overlay(200)보다 위, .toast(300)보다 아래 */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 10px 14px;
  min-width: 220px;
  max-width: 320px;
  font-size: 12px;
}

.price-hint-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}

.price-hint-section + .price-hint-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.price-hint-title {
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.price-hint-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

.price-hint-date { color: var(--text-secondary); }
.price-hint-client { color: var(--text-secondary); flex: 1; text-align: left; }
.price-hint-price { font-weight: 700; color: var(--primary); }

.price-hint-empty {
  color: var(--text-secondary);
  padding: 2px 0;
}

/* ===== Product History Popup (상품관리 - 최근 매출/매입 내역) ===== */
.product-history-trigger {
  cursor: pointer;
}

.product-row:hover .product-history-trigger {
  color: var(--primary);
}

.product-history-modal {
  max-width: 640px;
}

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

.modal-header-row h3 {
  margin-bottom: 0;
}

.product-history-modal-title {
  font-size: 17px;
}

.product-history-close {
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
}

.product-history-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-history-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.product-history-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.product-history-header-row,
.product-history-row {
  display: grid;
  grid-template-columns: 100px 1fr 110px 70px;
  gap: 8px;
  align-items: center;
}

.product-history-header-row {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
}

.product-history-header-row span:nth-child(3),
.product-history-header-row span:nth-child(4) {
  text-align: right;
}

.product-history-list {
  max-height: 210px;
  overflow-y: auto;
}

.product-history-row {
  padding: 8px 4px;
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}

.product-history-row:last-child {
  border-bottom: none;
}

.product-history-date { color: var(--text-secondary); }
.product-history-client { color: var(--text); }
.product-history-price { font-weight: 700; color: var(--primary); text-align: right; }
.product-history-qty { color: var(--text); text-align: right; }

.product-history-empty,
.product-history-loading,
.product-history-end {
  text-align: center;
  padding: 14px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Searchable Product Combobox ===== */
.product-combobox {
  position: relative;
}

.product-combobox-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  font-family: inherit;
}

.product-combobox-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.product-combobox-list {
  position: fixed;
  z-index: 260; /* .price-hint-tooltip(250)보다 위, .toast(300)보다 아래 */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 220px; /* JS(positionList)가 뷰포트 남은 공간에 맞춰 인라인 style로 덮어씀 */
  overflow-y: auto;
}

.product-combobox-item {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-combobox-item:hover,
.product-combobox-item.active {
  background: #eff6ff;
  color: var(--primary);
}

.product-combobox-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-combobox-code {
  color: var(--text-secondary);
  font-size: 12px;
}

.product-combobox-stock {
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.product-combobox-empty {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Mobile Work UI 2026-08-02 ===== */
.mobile-bottom-nav { display: none; }

@media (max-width: 760px) {
  :root { --mobile-nav-height: 68px; }

  html { -webkit-text-size-adjust: 100%; }
  body {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .header {
    height: 56px;
    padding: 0 14px;
    box-shadow: 0 1px 8px rgba(15,23,42,.06);
  }
  .header-title { font-size: 17px; gap: 8px; }
  .header-title .logo { width: 32px; height: 32px; }
  .header-nav button:not(.header-logout) { display: none; }
  .header-nav .header-logout {
    margin: 0;
    border-left: 0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .main-content {
    width: 100%;
    padding: 18px 12px 28px;
  }

  .page-header {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header h2 { font-size: 21px; line-height: 1.3; }
  .header-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .header-actions .btn { flex: 1 1 auto; }

  .home-welcome { margin-bottom: 18px; padding: 0 2px; }
  .home-welcome h2 { font-size: 23px; }
  .home-welcome p { font-size: 14px; }
  .menu-grid { gap: 10px; }
  .menu-card {
    min-height: 88px;
    padding: 16px;
    align-items: center;
    gap: 14px;
    border-radius: 14px;
  }
  .menu-card:hover { transform: none; }
  .menu-card .card-icon { width: 46px; height: 46px; font-size: 21px; }
  .menu-card .card-body h3 { font-size: 16px; margin-bottom: 3px; }
  .menu-card .card-body p {
    font-size: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  button, .btn, input, select, textarea { font-size: 16px; }
  .btn {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    touch-action: manipulation;
  }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea,
  .product-combobox-input {
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 10px;
  }
  textarea { min-height: 88px; }
  .form-group { margin-bottom: 14px; }
  .form-row, .sr-top-row, .group-edit-row .form-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .card, .sales-register-form, .company-form,
  .product-history-section, .ledger-summary-card {
    border-radius: 14px;
  }
  .sales-register-form, .company-form { padding: 16px 12px; }

  .table-container, .list-scroll-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .data-table, .sr-table { min-width: 720px; }
  .data-table th, .data-table td, .sr-table th, .sr-table td {
    white-space: nowrap;
    padding: 10px 9px;
  }
  .data-table thead th, .sr-table thead th { position: sticky; top: 0; z-index: 2; }

  .ledger-summary { gap: 8px; }
  .ledger-summary-card { padding: 12px 10px; }
  .ledger-summary-card .value { font-size: 17px; }
  .ledger-actions-bar { gap: 8px; }
  .ledger-actions-bar .btn { flex: 1 1 calc(50% - 8px); }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: none !important;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
    animation: mobileSheetUp .18s ease-out;
  }
  .modal-header-row {
    position: sticky;
    top: -18px;
    z-index: 5;
    background: var(--surface);
    padding: 14px 0 10px;
    margin-bottom: 10px;
  }
  .modal-actions {
    position: sticky;
    bottom: calc(-18px - env(safe-area-inset-bottom));
    z-index: 5;
    background: var(--surface);
    margin: 16px -14px 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
  }
  .modal-actions .btn { flex: 1; }

  /* 모바일에서는 표가 가로 스크롤되어 '매출단가' 컬럼의 화면 좌표가 스크롤 위치에 따라
     달라지므로, absolute 정렬 대신 액션바 맨 앞에 자연스럽게 배치한다(취소 버튼 왼쪽 유지). */
  .sr-add-row-btn {
    position: static;
    transform: none;
    flex: 1;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-nav-height) + 12px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .product-combobox-list { max-height: 42vh; }
  .product-combobox-item { min-height: 46px; padding: 11px 12px; }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 180;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    padding: 5px 6px env(safe-area-inset-bottom);
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(15,23,42,.08);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    min-width: 0;
    padding: 5px 2px;
    border-radius: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
    touch-action: manipulation;
  }
  .mobile-nav-item.active { color: var(--primary); background: #eff6ff; }
  .mobile-nav-icon { font-size: 22px; line-height: 1; font-weight: 700; }
  .mobile-nav-label { font-size: 11px; line-height: 1.2; font-weight: 700; white-space: nowrap; }

  .login-page { padding: 18px 12px; }
  .login-box { width: 100%; padding: 28px 20px; border-radius: 16px; }

  @keyframes mobileSheetUp {
    from { opacity: .5; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ===== AI Employee ===== */
.ai-menu-card { border-color: #bfdbfe; background: linear-gradient(145deg, #ffffff, #eff6ff); }
.ai-menu-card .menu-icon { font-size: 18px; font-weight: 800; letter-spacing: -1px; color: #fff; background: linear-gradient(135deg, #2563eb, #7c3aed); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; }
.ai-employee-page { max-width: 960px; margin: 0 auto; }
.ai-page-header { align-items: center; }
.ai-page-header p { margin: 5px 0 0; color: var(--text-secondary); }
.ai-status-badge { display: inline-flex; padding: 7px 11px; border-radius: 999px; background: #ecfdf5; color: #047857; font-size: 12px; font-weight: 700; white-space: nowrap; }
.ai-suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.ai-suggestions button { border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px; padding: 8px 12px; cursor: pointer; font-family: inherit; }
.ai-suggestions button:hover { border-color: var(--primary); color: var(--primary); }
.ai-chat { height: min(56vh, 520px); min-height: 340px; overflow-y: auto; background: #f8fafc; border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.ai-message { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 15px; }
.ai-message.user { flex-direction: row-reverse; }
.ai-avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: #1d4ed8; color: #fff; font-size: 12px; font-weight: 800; }
.ai-message.user .ai-avatar { background: #475569; }
.ai-bubble { max-width: min(78%, 680px); padding: 11px 13px; border-radius: 6px 16px 16px 16px; background: #fff; border: 1px solid #e2e8f0; line-height: 1.65; white-space: normal; }
.ai-message.user .ai-bubble { background: #2563eb; color: #fff; border-color: #2563eb; border-radius: 16px 6px 16px 16px; }
.ai-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 12px; align-items: stretch; }
.ai-input-row textarea { resize: none; min-height: 52px; }
.ai-voice-btn { min-width: 54px; }
.ai-privacy-note { margin: 8px 2px 0; color: var(--text-secondary); font-size: 12px; }
@media (max-width: 768px) {
  .ai-page-header { align-items: flex-start; gap: 10px; }
  .ai-chat { height: calc(100dvh - 360px); min-height: 300px; padding: 12px; }
  .ai-bubble { max-width: 86%; }
  .ai-input-row { grid-template-columns: minmax(0, 1fr) 48px; }
  .ai-input-row .btn-primary { grid-column: 1 / -1; }
}

.ai-approval-card{margin:12px 44px;padding:16px;border:2px solid #f59e0b;border-radius:14px;background:#fffbeb}.ai-approval-card pre{white-space:pre-wrap;font-family:inherit;line-height:1.6;margin:10px 0}.ai-approval-card>div{display:flex;justify-content:flex-end;gap:8px}
