/* ==========================================================================
   바로문서 (BaroDoc) — Main Stylesheet
   Clean, trustworthy Korean SaaS UI + Responsive Workbench + Print Safe
   ========================================================================== */

:root {
  --brand-navy: #1b365d;
  --brand-navy-dark: #102442;
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-blue-soft: #eff6ff;
  --seal-red: #c81e1e;
  --seal-red-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;

  --bg-page: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-workbench: #e6ebf2;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;

  --border: #e5e7eb;
  --border-strong: #cbd5e1;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  --font-ui: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --font-serif: 'Noto Serif KR', 'Gowun Batang', 'Batang', Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-narrow {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 19px;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-logo img {
  width: 30px;
  height: 30px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--seal-red);
  background: var(--seal-red-soft);
  border: 1px solid #fecaca;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 2px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-link {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--brand-navy);
}

.nav-link.active {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}

.nav-link.nav-stamp {
  color: var(--seal-red);
  background: var(--seal-red-soft);
  margin-left: 4px;
}

.nav-link.nav-stamp:hover,
.nav-link.nav-stamp.active {
  background: #fee2e2;
  color: #991b1b;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}

.mobile-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 12px 20px 18px;
}

.mobile-drawer.open {
  display: block;
}

.mobile-drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mobile-drawer-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.mobile-drawer-link.active {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}

.mobile-drawer-link.stamp-link {
  grid-column: 1 / -1;
  background: var(--seal-red-soft);
  border-color: #fecaca;
  color: var(--seal-red);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-blue-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-navy {
  background: var(--brand-navy);
  color: #ffffff;
}

.btn-navy:hover:not(:disabled) {
  background: var(--brand-navy-dark);
}

.btn-seal {
  background: var(--seal-red);
  color: #ffffff;
}

.btn-seal:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

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

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Hero & Home Sections
   ========================================================================== */

.home-hero {
  background: linear-gradient(135deg, #1b365d 0%, #0f172a 100%);
  color: #ffffff;
  padding: 52px 0 46px;
}

.home-hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  align-items: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 16px;
}

.home-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.6vw, 40px);
  line-height: 1.28;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.home-hero h1 .accent {
  color: #93c5fd;
}

.home-hero p.hero-desc {
  margin: 0 0 24px;
  font-size: 16px;
  color: #cbd5e1;
  max-width: 600px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.hero-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: #cbd5e1;
}

.hero-trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hero-preview-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.hero-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.hero-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.hero-step strong {
  display: block;
  font-size: 14px;
  color: #ffffff;
  margin-bottom: 2px;
}

.hero-step p {
  margin: 0;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

.section {
  padding: 44px 0;
}

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}

.section-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-blue);
}

.tool-card.featured-stamp {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 100%);
}

.tool-card.featured-stamp:hover {
  border-color: var(--seal-red);
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
}

.tool-card.featured-stamp .tool-icon {
  background: var(--seal-red-soft);
  color: var(--seal-red);
}

.tool-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tool-card.featured-stamp .tool-tag {
  background: var(--seal-red-soft);
  color: var(--seal-red);
  border-color: #fecaca;
}

.tool-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.tool-card p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
  flex: 1;
}

.tool-card-features {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.tool-card-cta {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-card.featured-stamp .tool-card-cta {
  color: var(--seal-red);
}

.features-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.feature-box h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  color: var(--brand-navy);
}

.feature-box p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Tool Page Header & Breadcrumbs
   ========================================================================== */

.page-hero {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 0 18px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.breadcrumb a:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

.page-hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}

.page-hero p.page-subtitle {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-secondary);
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #a7f3d0;
  padding: 5px 11px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* ==========================================================================
   Form Workbench (Split View)
   ========================================================================== */

.workbench-section {
  padding: 20px 0 36px;
}

.mobile-tabs {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--bg-surface);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.mobile-tab-btn {
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.mobile-tab-btn.active {
  background: var(--brand-navy);
  color: #ffffff;
}

.workbench-grid {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.editor-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.editor-toolbar-left,
.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.editor-body {
  padding: 16px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.form-group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
  background: #ffffff;
}

.form-group-card:last-child {
  margin-bottom: 0;
}

.form-group-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--brand-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.field {
  margin-bottom: 10px;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.field input[type='text'],
.field input[type='number'],
.field input[type='date'],
.field input[type='email'],
.field input[type='tel'],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

.field-help {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.field-converted {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-blue-soft);
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
  color: var(--brand-navy);
  line-height: 1.5;
}

.field-alert {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.field-alert.warn {
  background: var(--warn-soft);
  border: 1px solid #fcd34d;
  color: #92400e;
}

.field-alert.danger {
  background: var(--seal-red-soft);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.field-alert.ok {
  background: var(--success-soft);
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip-btn {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.editor-sticky-footer {
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Dynamic line items table in editor (견적서 / 거래명세서) */
.line-item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
  background: var(--bg-subtle);
}

.line-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.line-item-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.line-item-nums {
  display: grid;
  grid-template-columns: 0.7fr 1.1fr 1fr;
  gap: 6px;
}

.line-item-card input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-size: 13px;
  background: #ffffff;
}

.summary-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--brand-navy);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}

.summary-line.total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 800;
  font-size: 14.5px;
}

/* Stamp Widget inside Form Sidebar */
.stamp-widget {
  border: 1px solid #fecaca;
  background: #fffbfb;
  border-radius: var(--radius-md);
  padding: 13px;
  margin-bottom: 14px;
}

.stamp-widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stamp-widget-head strong {
  font-size: 14px;
  color: var(--seal-red);
  display: flex;
  align-items: center;
  gap: 5px;
}

.stamp-slot-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.stamp-slot-tab {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.stamp-slot-tab.active {
  border-color: var(--seal-red);
  background: var(--seal-red-soft);
  color: var(--seal-red);
}

.saved-stamps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.saved-stamp-item {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.saved-stamp-item:hover {
  border-color: var(--seal-red);
}

.saved-stamp-item.selected {
  border-color: var(--seal-red);
  background: var(--seal-red-soft);
  box-shadow: 0 0 0 2px rgba(200, 30, 30, 0.15);
}

.saved-stamp-item img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.saved-stamp-item span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-stamp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px auto;
  gap: 6px;
  margin-top: 8px;
}

.quick-stamp-row input,
.quick-stamp-row select {
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #ffffff;
}

.stamp-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #fecaca;
  font-size: 12.5px;
}

/* Preview Panel (Right Side) */
.preview-panel {
  background: var(--bg-workbench);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.preview-toolbar-info {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.font-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.font-toggle button {
  padding: 5px 10px;
  border: none;
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.font-toggle button.active {
  background: var(--brand-navy);
  color: #ffffff;
}

.preview-stage {
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  min-height: 600px;
}

.a4-scale-container {
  transform-origin: top center;
  transition: transform 0.12s ease;
}

/* ==========================================================================
   Stamp Maker Dedicated Page (/stamp/)
   ========================================================================== */

.stamp-maker-grid {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.stamp-preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.checker-stage {
  width: 100%;
  min-height: 310px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin-bottom: 18px;
}

#stampCanvas {
  width: 240px;
  height: 240px;
  max-width: 100%;
}

.stamp-paper-demo {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stamp-paper-demo-doc {
  font-family: var(--font-serif);
  font-size: 15px;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stamp-paper-demo-seal {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
}

.stamp-paper-demo-seal .in-mark {
  color: #6b7280;
  font-size: 13px;
}

.stamp-paper-demo-seal img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stamp-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.stamp-jump-box {
  background: var(--brand-blue-soft);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 14px;
}

.stamp-jump-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--brand-navy);
}

.stamp-jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stamp-jump-links a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #bfdbfe;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand-navy);
}

.stamp-jump-links a:hover {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}

.color-swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.color-swatch.active {
  border-color: #111827;
  transform: scale(1.08);
}

.shape-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.shape-btn {
  padding: 9px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.shape-btn.active {
  border-color: var(--seal-red);
  background: var(--seal-red-soft);
  color: var(--seal-red);
}

.saved-tray-card {
  margin-top: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.saved-tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.tray-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
}

.tray-item img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.tray-item-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

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

/* ==========================================================================
   Editorial Content (AdSense Value & SEO Guides / FAQs)
   ========================================================================== */

.editorial-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 46px 0 56px;
}

.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
}

.guide-article h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-navy);
  letter-spacing: -0.02em;
}

.guide-article h3 {
  margin: 28px 0 10px;
  font-size: 17.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.guide-article p {
  margin: 0 0 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.guide-article ul,
.guide-article ol {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.guide-article li {
  margin-bottom: 6px;
}

.guide-callout {
  background: var(--brand-blue-soft);
  border-left: 4px solid var(--brand-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 15px 18px;
  margin: 18px 0;
}

.guide-callout.warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}

.guide-callout strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-navy);
}

.guide-callout.warn strong {
  color: #92400e;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
  font-size: 14px;
}

.guide-table th,
.guide-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.guide-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--brand-navy);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  overflow: hidden;
}

.faq-item summary {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-blue);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-answer {
  padding: 0 16px 15px;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.75;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  background: #ffffff;
}

.editorial-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 80px;
}

.aside-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--bg-subtle);
}

.aside-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--brand-navy);
}

.aside-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.aside-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.aside-links a:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.aside-stamp-cta {
  background: var(--seal-red-soft);
  border-color: #fecaca;
}

.aside-stamp-cta h3 {
  color: var(--seal-red);
}

.aside-stamp-cta p {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* Legal / Static Content Pages */
.static-page {
  padding: 40px 0 64px;
}

.static-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--shadow-sm);
}

.static-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-navy);
}

.static-meta {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.static-card h2 {
  margin: 28px 0 10px;
  font-size: 19px;
  font-weight: 800;
  color: var(--brand-navy);
}

.static-card p,
.static-card li {
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ==========================================================================
   AdSense Slot Container (Hidden when empty to keep pre-approval UI clean)
   ========================================================================== */

.ad-slot {
  margin: 20px auto;
  text-align: center;
}

.ad-slot:empty {
  display: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 40px 0 32px;
  font-size: 13.5px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
}

.footer-brand {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.footer-desc {
  margin: 0 0 10px;
  color: #94a3b8;
  line-height: 1.65;
}

.footer-col h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}

.footer-links.single-col {
  grid-template-columns: 1fr;
}

.footer-links a {
  color: #94a3b8;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: #64748b;
  font-size: 12.5px;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #111827;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1120px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .workbench-grid,
  .stamp-maker-grid {
    grid-template-columns: 380px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .main-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .home-hero-inner {
    grid-template-columns: 1fr;
  }
  .features-3col {
    grid-template-columns: 1fr;
  }
  .mobile-tabs {
    display: grid;
  }
  .workbench-grid,
  .stamp-maker-grid {
    grid-template-columns: 1fr;
  }
  .workbench-grid[data-mobile-tab='edit'] .preview-panel {
    display: none;
  }
  .workbench-grid[data-mobile-tab='preview'] .editor-panel {
    display: none;
  }
  .editor-body {
    max-height: none;
  }
  .editorial-grid {
    grid-template-columns: 1fr;
  }
  .editorial-aside {
    position: static;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .stamp-action-bar {
    grid-template-columns: 1fr;
  }
  .quick-stamp-row {
    grid-template-columns: 1fr auto;
  }
  .quick-stamp-row input {
    grid-column: 1 / -1;
  }
  .static-card {
    padding: 24px 20px;
  }
}

/* ==========================================================================
   Print Styles (A4 Crisp Vector Output)
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    width: 210mm;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .site-header,
  .mobile-drawer,
  .page-hero,
  .mobile-tabs,
  .editor-panel,
  .preview-toolbar,
  .editorial-section,
  .site-footer,
  .toast-container,
  .ad-slot,
  .no-print {
    display: none !important;
  }

  .workbench-section,
  .container,
  .workbench-grid,
  .preview-panel,
  .preview-stage {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: #ffffff !important;
    box-shadow: none !important;
    overflow: visible !important;
    min-height: auto !important;
  }

  .a4-scale-container {
    transform: none !important;
    width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
  }
}
