/* 그린 견적시스템 - 웹 UI 스타일 */
:root {
  --green: #5fa244;
  --green-deep: #3f7a2e;
  --green-soft: #eef6e8;
  --ink: #15181a;
  --ink-soft: #3a3d3f;
  --ink-mute: #767a7c;
  --border: #e2e4e0;
  --bg: #f7f8f5;
  --white: #ffffff;
  --red: #d94040;
  --red-soft: #fef2f2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

/* === NAVBAR === */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--green-deep);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover { color: var(--green-deep); }
.nav-logout { color: var(--ink-mute); }
.nav-user { font-size: 13px; color: var(--ink-mute); }

/* === LAYOUT === */
.main-content { padding: 32px 24px; }

.container {
  max-width: 960px;
  margin: 0 auto;
}

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

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.page-desc {
  font-size: 14px;
  color: var(--ink-mute);
  margin-bottom: 20px;
}

/* === FORMS === */
.form-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 16px;
}

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

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-group input,
.form-group select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.form-hint {
  font-size: 12px;
  color: var(--ink-mute);
}

.required { color: var(--red); }

.email-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.email-row input { flex: 1; }

.btn-remove-email {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
  align-self: center;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--green-deep);
  color: var(--white);
}
.btn-primary:hover { background: #2e6820; }

.btn-outline {
  background: var(--white);
  color: var(--ink-soft);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--green); color: var(--green-deep); }

.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 8px; font-size: 12px; }

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

.preview-actions { padding-top: 24px; border-top: 1px solid var(--border); }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #fecaca;
}

.alert-success {
  background: var(--green-soft);
  color: var(--green-deep);
  border: 1px solid #bbf7d0;
}

/* === LOGIN === */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-container { width: 100%; max-width: 400px; padding: 24px; }

.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 32px;
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--green-deep);
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--ink-mute);
  text-align: center;
  margin-bottom: 32px;
}

.login-form .form-group { margin-bottom: 16px; }
.login-form .btn { margin-top: 8px; }

/* === TABLE === */
.quote-table-wrap { overflow-x: auto; }

.quote-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.quote-table th,
.quote-table td {
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.quote-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 12px;
}

.quote-table .mono { font-family: monospace; font-size: 12px; }
.quote-table .text-right { text-align: right; }
.quote-table .actions { white-space: nowrap; }
.quote-table .actions .btn { margin-right: 4px; }

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--green-soft); color: var(--green-deep); }
.badge-error { background: var(--red-soft); color: var(--red); }
.badge-pending { background: #f5f5f5; color: var(--ink-mute); }

/* === PREVIEW === */
.preview-summary,
.preview-section,
.preview-internal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.preview-internal {
  border-color: #fde68a;
  background: #fffbeb;
}

.preview-section h3,
.preview-internal h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-label { font-size: 12px; color: var(--ink-mute); }
.summary-value { font-size: 15px; font-weight: 600; }

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

.preview-table th,
.preview-table td {
  padding: 8px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.preview-table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-mute);
  font-size: 12px;
}

.preview-table .text-right { text-align: right; }
.preview-table .total-row td { font-weight: 700; }
.preview-table .total-row.final td { color: var(--green-deep); }

/* === DETAIL === */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.detail-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.detail-section h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-deep);
  margin-bottom: 12px;
}

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.detail-list dt { font-size: 13px; color: var(--ink-mute); }
.detail-list dd { font-size: 14px; font-weight: 500; }
.amount-highlight { color: var(--green-deep); font-weight: 700; }

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

/* === SEARCH === */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

/* === PAGINATION === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.page-info { font-size: 14px; color: var(--ink-mute); }

/* === EMPTY === */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ink-mute);
}

.empty-state p { margin-bottom: 16px; }

/* === SETTINGS === */
.settings-form .form-section { margin-bottom: 20px; }

/* === DELETE BUTTON & ALERT === */
.btn-danger {
  background: #d04545;
  color: #fff;
  border: 1px solid #b83838;
}
.btn-danger:hover { background: #b83838; }

.inline-form {
  display: inline-block;
  margin: 0;
  padding: 0;
}

.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 14px;
}
.alert-info {
  background: #eef6e8;
  border: 1px solid #c8dfb8;
  color: #3f7a2e;
}

/* === LIVE QUOTE STICKY BAR === */
.live-quote-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 2px solid var(--green-deep, #3f7a2e);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 1000;
  padding: 12px 24px;
}
.live-quote-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.live-quote-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.live-quote-label {
  font-size: 11px;
  color: #767a7c;
  letter-spacing: 0.02em;
}
.live-quote-value {
  font-size: 17px;
  font-weight: 700;
  color: #15181a;
  font-variant-numeric: tabular-nums;
}
.live-quote-main {
  font-size: 24px;
  color: #3f7a2e;
}
.live-quote-status {
  margin-left: auto;
  font-size: 12px;
  color: #767a7c;
}

/* 폼 하단 여백 확보 (sticky bar에 가리지 않도록) */
.quote-form {
  padding-bottom: 100px;
}

/* === SUBMIT OVERLAY === */
.submit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 26, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.submit-overlay.active { display: flex; }

.submit-overlay-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 44px;
  min-width: 340px;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  text-align: center;
}

.submit-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #eef6e8;
  border-top-color: #3f7a2e;
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.submit-overlay-title {
  font-size: 17px;
  font-weight: 700;
  color: #15181a;
  margin-bottom: 18px;
}

.submit-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  text-align: left;
}
.submit-steps .step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 14px;
  color: #b0b3b5;
  transition: color 0.3s;
}
.submit-steps .step.active {
  color: #3f7a2e;
  font-weight: 600;
}
.submit-steps .step.done {
  color: #5fa244;
}
.submit-steps .step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e5e8ec;
  flex-shrink: 0;
  transition: background 0.3s;
}
.submit-steps .step.active .step-dot {
  background: #3f7a2e;
  box-shadow: 0 0 0 4px rgba(63, 122, 46, 0.18);
}
.submit-steps .step.done .step-dot {
  background: #5fa244;
}
.submit-steps .step.done .step-dot::after {
  content: '\2713';
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: block;
  text-align: center;
  line-height: 10px;
  margin-top: -1px;
}

.submit-hint {
  font-size: 12px;
  color: #767a7c;
}
