/* ==========================================================================
   SuratSiap.com — Apple-Grade Premium UI + Left Sidebar + 1-Page A4 Print
   ========================================================================== */

:root {
  --bg: #f5f5f7;                 /* Apple signature light canvas */
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --text: #1d1d1f;               /* Apple primary ink */
  --text-muted: #6e6e73;         /* Apple secondary ink */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);
  --primary: #0f766e;            /* Refined Deep Emerald */
  --primary-hover: #115e59;
  --primary-soft: #ecfdf5;
  --accent-blue: #0071e3;        /* Apple Blue */
  --navy: #1d1d1f;
  --whatsapp: #16a34a;
  --whatsapp-hover: #15803d;
  --sidebar-w: 272px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.045);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.12);
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --font-letter: "Times New Roman", Georgia, Cambria, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reserve space for fixed left sidebar on desktop */
body.has-sidebar {
  padding-left: var(--sidebar-w);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ==========================================================================
   LEFT SIDEBAR (Desktop Fixed + Mobile Slide-Out Drawer)
   ========================================================================== */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-right: 1px solid var(--border);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-close {
  display: none;
  background: #f1f5f9;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.2rem;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 24px;
}

.sidebar-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #86868b;
  padding: 12px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.14s ease, color 0.14s ease;
  text-decoration: none;
}

.sidebar-link:hover {
  background: rgba(0, 0, 0, 0.045);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.24);
}

.sidebar-link .sb-ico {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link .sb-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}

.sidebar-link.active .sb-ico {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sidebar-footer a {
  color: var(--text-muted);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 85;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.open {
  display: block;
  opacity: 1;
}

/* Mobile Floating Top Header (Frosted Glass) */
.site-header {
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.menu-toggle-btn {
  display: none;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-xs);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 8px;
  flex-shrink: 0;
}

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

.nav-links a {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 8px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
}

/* Hide redundant top nav links on desktop when left sidebar is active */
body.has-sidebar .site-header {
  display: none;
}

@media (max-width: 1024px) {
  body.has-sidebar {
    padding-left: 0;
  }

  body.has-sidebar .site-header {
    display: block;
  }

  .menu-toggle-btn {
    display: inline-flex;
  }

  .site-header .nav-links {
    display: none;
  }

  .app-sidebar {
    transform: translateX(-105%);
    width: 286px;
    max-width: 84vw;
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }
}

/* ==========================================================================
   APPLE-GRADE HERO & AMBIENT MOTION
   ========================================================================== */
.apple-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.apple-hero::before,
.apple-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
}

.apple-hero::before {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.22), transparent 70%);
  top: -120px;
  right: 8%;
  animation: auroraDrift 11s ease-in-out infinite alternate;
}

.apple-hero::after {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.18), transparent 70%);
  bottom: -140px;
  left: 6%;
  animation: auroraDrift 14s ease-in-out infinite alternate-reverse;
}

.apple-hero > .container {
  position: relative;
  z-index: 1;
}

@keyframes auroraDrift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(34px, -24px) scale(1.1); }
}

@keyframes floatPaper {
  0%, 100% { transform: translateY(0px) rotate(-0.4deg); }
  50% { transform: translateY(-9px) rotate(0.4deg); }
}

@keyframes drawSignature {
  0% { stroke-dashoffset: 360; }
  45% { stroke-dashoffset: 0; }
  85% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 360; }
}

.sample-showcase {
  position: relative;
  animation: floatPaper 6.5s ease-in-out infinite;
}

.sig-anim-path {
  stroke-dasharray: 360;
  stroke-dashoffset: 360;
  animation: drawSignature 5.5s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

/* Smooth Apple Scroll-Reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .apple-hero::before, .apple-hero::after, .sample-showcase, .sig-anim-path {
    animation: none !important;
  }
  .sig-anim-path { stroke-dashoffset: 0 !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

.apple-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 18px;
}

.apple-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

@media (max-width: 900px) {
  .apple-hero {
    padding: 30px 0 28px;
  }
  .apple-hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.apple-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--text);
}

.apple-hero h1 .grad-text {
  background: linear-gradient(90deg, #0f766e 0%, #0071e3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.apple-hero p {
  margin: 0 0 24px;
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.6;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.btn-apple-primary {
  background: #1d1d1f;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(29, 29, 31, 0.16);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-apple-primary:hover {
  background: #000000;
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-apple-secondary {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-apple-secondary:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Visual Sample Letter Mockup in Hero */
.sample-showcase {
  position: relative;
}

.sample-paper {
  background: #ffffff;
  color: #111827;
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.04);
  font-family: var(--font-letter);
  font-size: 11.5px;
  line-height: 1.48;
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.sample-paper-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 11px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.sample-paper hr {
  border: 0;
  border-top: 1px solid #1d1d1f;
  margin: 7px 0 9px;
}

.sample-paper-title {
  font-weight: 700;
  text-decoration: underline;
  margin: 8px 0 6px;
  font-size: 11.5px;
}

.sample-sig-svg {
  width: 118px;
  height: 36px;
  display: block;
  margin: 4px 0 2px;
}

.sample-badge-float {
  position: absolute;
  bottom: -14px;
  right: 16px;
  background: #1d1d1f;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

/* ==========================================================================
   GALERI CONTOH SURAT SIAP (Apple Showcase Cards on Dashboard)
   ========================================================================== */
.section {
  padding: 44px 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-title {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.section-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Horizontal Apple-Style Snap Carousel for Sample Letters */
.carousel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease, transform 0.15s ease;
}

.carousel-btn:hover {
  background: #1d1d1f;
  color: #ffffff;
  border-color: #1d1d1f;
  transform: scale(1.04);
}

.gallery-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 6px 4px 18px;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.mini-letter-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.2s ease;
}

@media (max-width: 520px) {
  .mini-letter-card {
    flex: 0 0 84vw;
  }
  .carousel-controls {
    display: none;
  }
}

.mini-letter-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.1);
  border-color: rgba(15, 118, 110, 0.32);
  text-decoration: none;
}

/* Realistic Full A4 Paper Sheet Preview */
.a4-mini-stage {
  background: linear-gradient(145deg, #eceef2 0%, #e2e5eb 100%);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: center;
}

.mini-paper {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  width: 100%;
  min-height: 360px;
  padding: 16px 15px;
  font-family: var(--font-letter);
  font-size: 8.2px;
  line-height: 1.44;
  color: #111827;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mini-letter-card:hover .mini-paper {
  transform: scale(1.025);
}

.mp-sender {
  font-size: 7.2px;
  line-height: 1.3;
  margin-bottom: 5px;
}

.mp-hr {
  border: 0;
  border-top: 1px solid #111827;
  margin: 4px 0 6px;
}

.mp-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 7px;
}

.mp-date {
  font-weight: 700;
  font-size: 6.8px;
  white-space: nowrap;
}

.mp-subj {
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: underline;
  margin: 4px 0 5px;
  font-size: 7.4px;
}

.mp-body p {
  margin: 0 0 4.5px;
  text-align: justify;
}

.mp-sign {
  margin-top: auto;
  padding-top: 6px;
}

.mp-sig-svg {
  width: 58px;
  height: 18px;
  display: block;
  margin: 2px 0;
}

.mini-letter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-letter-meta h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.mini-letter-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.mini-letter-pill {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-blue);
  background: #eff6ff;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Search Bar on Dashboard */
.search-bar-wrap {
  position: relative;
  max-width: 440px;
  width: 100%;
  margin-bottom: 18px;
}

.search-bar-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar-input {
  width: 100%;
  padding: 11px 16px 11px 42px !important;
  border-radius: 999px !important;
  border: 1px solid var(--border-strong) !important;
  background: var(--surface) !important;
  font-size: 0.92rem !important;
  box-shadow: var(--shadow-xs);
}

.search-bar-input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14) !important;
}

/* Filter Tabs */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.filter-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 0.15s ease;
}

.filter-tab:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-tab.active {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #ffffff;
}

/* Bento Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 18px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(15, 118, 110, 0.35);
  text-decoration: none;
}

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

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f5f5f7;
  color: #1d1d1f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.tool-icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.tool-card:hover .tool-icon {
  background: var(--primary);
  color: #ffffff;
}

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.tool-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--text-muted);
}

.tool-tag.hot {
  background: #ecfdf5;
  color: #0f766e;
}

.tool-tag.new {
  background: #eff6ff;
  color: #0071e3;
}

.tool-card h3 {
  margin: 0 0 7px;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.tool-card p {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
}

.tool-cta {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-blue);
}

/* Feature Highlight Band */
.feature-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 34px;
}

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

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

.feature-box h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.feature-box p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   TOOL PAGE HEADER & WORKSPACE
   ========================================================================== */
.page-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 26px 0;
}

.breadcrumb {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  max-width: 720px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 410px) 1fr;
  gap: 24px;
  align-items: start;
  padding: 26px 0 40px;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  margin: 0 0 16px;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

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

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

label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 0.94rem;
  color: var(--text);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  resize: vertical;
  min-height: 76px;
}

.helper-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Action Buttons */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.89rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
  font-family: var(--font-ui);
}

.btn-primary {
  background: #1d1d1f;
  color: #ffffff;
}

.btn-primary:hover {
  background: #000000;
}

.btn-word {
  background: #0071e3;
  color: #ffffff;
}

.btn-word:hover {
  background: #005bb5;
}

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

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

.btn-outline {
  background: #ffffff;
  border-color: #d2d2d7;
  color: var(--text);
}

.btn-outline:hover {
  background: #f5f5f7;
}

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

/* Digital Signature Pad */
.sig-pad-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed #d2d2d7;
}

.sig-pad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sig-canvas {
  width: 100%;
  height: 115px;
  background: #f5f5f7;
  border: 1.5px dashed #a1a1a6;
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.sig-canvas:hover {
  border-color: var(--primary);
  background: #ffffff;
}

/* A4 Letter Paper Preview */
.preview-shell {
  background: #e8e8ed;
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
}

.a4-sheet {
  background: #ffffff;
  color: #111827;
  width: 100%;
  max-width: 794px;
  min-height: 920px;
  margin: 0 auto;
  padding: 46px 52px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  font-family: var(--font-letter);
  font-size: 15px;
  line-height: 1.58;
}

.letter-sender {
  white-space: pre-line;
  margin-bottom: 12px;
}

.letter-divider {
  border: 0;
  border-top: 1.5px solid #111827;
  margin: 12px 0 16px;
}

.letter-recipient-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.letter-recipient {
  white-space: pre-line;
}

.letter-date {
  white-space: nowrap;
  font-weight: 600;
  text-transform: uppercase;
}

.letter-salutation {
  margin-bottom: 12px;
}

.letter-subject {
  font-weight: 700;
  text-transform: uppercase;
  text-decoration: underline;
  margin: 0 0 14px;
}

.letter-body p {
  margin: 0 0 12px;
  text-align: justify;
}

.letter-details-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px 18px;
}

.letter-details-table td {
  padding: 3px 6px;
  vertical-align: top;
}

.letter-details-table td:first-child {
  width: 34%;
  font-weight: 600;
}

.letter-signoff {
  margin-top: 24px;
}

.signature-space {
  min-height: 54px;
  display: flex;
  align-items: flex-end;
}

.signature-img {
  max-height: 58px;
  max-width: 210px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* Invoice / Receipt specific inside A4 */
.a4-sheet.invoice-sheet {
  font-family: var(--font-ui);
  font-size: 14px;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1d1d1f;
  padding-bottom: 16px;
  margin-bottom: 20px;
  gap: 16px;
}

.inv-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 0;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.inv-table th {
  background: #1d1d1f;
  color: #ffffff;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.inv-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e5ea;
}

.inv-table th.num,
.inv-table td.num {
  text-align: right;
}

.inv-totals {
  margin-left: auto;
  width: 280px;
  max-width: 100%;
}

.inv-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.95rem;
}

.inv-totals-row.grand {
  border-top: 2px solid #1d1d1f;
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 64px 92px 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.btn-remove {
  background: #fee2e2;
  color: #b91c1c;
  border: 0;
  border-radius: 8px;
  height: 36px;
  cursor: pointer;
  font-weight: 700;
}

/* SEO Content & FAQ */
.seo-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-xs);
}

.seo-content h2 {
  margin-top: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.seo-content h3 {
  font-size: 1.06rem;
  color: var(--text);
  margin: 22px 0 8px;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

/* Related Tools */
.related-section {
  margin-bottom: 40px;
}

.related-section h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #1d1d1f;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
}

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

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 28px 0;
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ==========================================================================
   MOBILE RESPONSIVE POLISH
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .section {
    padding: 28px 0;
  }

  .page-head {
    padding: 18px 0;
  }

  .workspace {
    padding: 18px 0 28px;
    gap: 18px;
  }

  .panel {
    padding: 16px;
  }

  input[type="text"],
  input[type="date"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px;
    padding: 10px 12px;
  }

  .action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .action-bar .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
    padding: 12px 16px;
  }

  .action-bar .btn {
    font-size: 0.84rem;
    padding: 10px 10px;
  }

  .preview-shell {
    padding: 10px;
  }

  .a4-sheet {
    padding: 20px 16px;
    min-height: auto;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .letter-recipient-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .letter-details-table {
    margin-left: 0;
  }

  .letter-details-table td:first-child {
    width: 42%;
  }

  .inv-header {
    flex-direction: column;
    gap: 10px;
  }

  .inv-header > div:last-child {
    text-align: left !important;
  }

  .inv-table th,
  .inv-table td {
    padding: 7px 6px;
    font-size: 0.78rem;
  }

  .inv-totals {
    width: 100%;
  }

  .item-row {
    grid-template-columns: 1fr 1fr 36px;
    gap: 6px;
    padding: 10px;
    background: #f5f5f7;
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .item-row input:first-child {
    grid-column: 1 / -1;
  }

  .seo-content {
    padding: 20px 16px;
    margin-bottom: 24px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ==========================================================================
   PRINT / PDF EXPORT — Hides all UI chrome + sidebar, fits cleanly on 1 A4
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 13mm 16mm;
  }

  html, body, body.has-sidebar {
    background: #fff !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-left: 0 !important;
  }

  .app-sidebar,
  .sidebar-backdrop,
  .site-header,
  .page-head,
  .form-panel,
  .action-bar,
  .seo-content,
  .related-section,
  .site-footer,
  .toast,
  .no-print {
    display: none !important;
  }

  .container,
  .workspace,
  .preview-column,
  .preview-shell {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    font-size: 10.5pt !important;
    line-height: 1.42 !important;
  }

  .letter-sender { margin-bottom: 8px !important; }
  .letter-divider { margin: 8px 0 10px !important; }
  .letter-recipient-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    margin-bottom: 14px !important;
  }
  .letter-salutation { margin-bottom: 8px !important; }
  .letter-subject { margin-bottom: 10px !important; }
  .letter-body p { margin-bottom: 8px !important; }
  .letter-details-table { margin: 6px 0 10px 14px !important; }
  .letter-details-table td { padding: 2px 6px !important; }
  .letter-signoff {
    margin-top: 16px !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .signature-space { min-height: 40px !important; height: auto !important; }
  .signature-img { max-height: 48px !important; }

  .a4-sheet.invoice-sheet { font-size: 10pt !important; line-height: 1.38 !important; }
  .inv-header { flex-direction: row !important; padding-bottom: 10px !important; margin-bottom: 14px !important; }
  .inv-header > div:last-child { text-align: right !important; }
  .inv-table { margin: 12px 0 !important; }
  .inv-table th, .inv-table td { padding: 7px 9px !important; font-size: 9.5pt !important; }
  .inv-totals { width: 260px !important; }
}
