:root {
  --navy: #142446;
  --navy-hover: #1d3463;
  --slate: #646c7b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --yellow: #f7cc45;
  --red: #d92f2e;
  --black: #000000;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 4px 20px rgba(20, 36, 70, 0.06);
}

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--navy);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-brand-bar {
  display: flex;
  height: 6px;
  width: 100%;
}
.top-brand-bar .bar-black {
  flex: 1 1 88%;
  background: var(--black);
}
.top-brand-bar .bar-yellow {
  flex: 0 0 6%;
  background: var(--yellow);
}
.top-brand-bar .bar-red {
  flex: 0 0 6%;
  background: var(--red);
}

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

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

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

.header-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.header-logo {
  height: 36px;
  width: auto;
  display: block;
}

.header-divider {
  width: 2px;
  height: 34px;
  background: #ced3db;
  border-radius: 2px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.015em;
}

.app-header p {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--slate);
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 24px;
  padding-top: 28px;
  padding-bottom: 40px;
  align-items: start;
}

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

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

.card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
}

.badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

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

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

.form-row.align-center {
  align-items: center;
  margin-top: 4px;
}

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

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

input[type="text"],
input[type="tel"],
input[type="email"],
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--navy);
  background: #ffffff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(20, 36, 70, 0.1);
}

.input-prefix-wrap {
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  background: #f1f5f9;
  border: 1.5px solid var(--border-strong);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--slate);
  white-space: nowrap;
}

.input-prefix.hidden-prefix {
  display: none;
}

.input-prefix-wrap input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-prefix.hidden-prefix + input {
  border-radius: var(--radius-sm);
}

.fixed-info-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 16px 0;
}

.fixed-info-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin-bottom: 8px;
}

.fixed-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fixed-item {
  display: flex;
  flex-direction: column;
}

.fixed-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate);
}

.fixed-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  word-break: break-word;
}

.advanced-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  background: #fcfdff;
}

.advanced-panel summary {
  cursor: pointer;
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced-panel summary::after {
  content: '▾';
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.advanced-panel[open] summary::after {
  transform: rotate(180deg);
}

.advanced-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--border);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--navy);
  margin: 0;
  cursor: pointer;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.custom-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  text-decoration: underline;
  cursor: pointer;
  display: inline;
  margin: 0;
}

.btn-link.danger {
  color: var(--red);
}

.form-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 14px;
}

.actions-bar {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  flex: 1;
  background: var(--navy);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(20, 36, 70, 0.22);
}

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

.btn-secondary {
  background: #f1f5f9;
  color: var(--navy);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  padding: 0 16px;
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--border-strong);
  font-weight: 600;
}

.btn-ghost:hover {
  background: #f8fafc;
}

.btn-sm {
  height: 36px;
  padding: 0 13px;
  font-size: 0.82rem;
}

.progress-wrap {
  margin-top: 14px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--red));
  border-radius: 999px;
  transition: width 0.12s ease;
}

/* Preview column */
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.email-mockup {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.email-topbar {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-dots {
  display: flex;
  gap: 6px;
}

.email-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.email-dots span:nth-child(1) { background: #f87171; }
.email-dots span:nth-child(2) { background: #fbbf24; }
.email-dots span:nth-child(3) { background: #4ade80; }

.email-subject {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--slate);
}

.email-body {
  padding: 20px;
  background: #ffffff;
}

.email-placeholder-text {
  margin: 0 0 18px;
  font-size: 0.86rem;
  color: #94a3b8;
}

.signature-stage {
  border: 1px dashed #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  overflow: hidden;
}

#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: #ffffff;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--slate);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--navy);
}

.meta-dimensions {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Result Card */
.result-card {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, var(--success-bg) 0%, #ffffff 70px);
}

.result-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.check-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--success);
  color: #ffffff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--slate);
}

.gif-preview-frame {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  overflow: hidden;
}

.gif-preview-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.result-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--slate);
}

/* Guide Card */
.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.guide-card h3 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.badge-office {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.guide-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: #334155;
}

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

.guide-list code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--slate);
}

.app-footer p {
  margin: 0;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .fixed-info-grid {
    grid-template-columns: 1fr;
  }
  .actions-bar {
    flex-direction: column;
  }
  .header-divider {
    display: none;
  }
}
