:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --accent: #06b6d4;
  --ink: #111827;
  --ink-soft: #4b5563;
  --border: #e5e7eb;
  --bg: #ffffff;
  --bg-soft: #f9fafb;
  --success: #059669;
  --success-bg: #ecfdf5;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(17,24,39,.08), 0 1px 2px rgba(17,24,39,.04);
  --shadow-lg: 0 10px 25px rgba(17,24,39,.08), 0 4px 10px rgba(17,24,39,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 1em; color: var(--ink-soft); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius); font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { background: var(--bg-soft); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--error); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Header --- */
.site-header { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; font-size: 20px; color: var(--ink); }
.logo span { color: var(--brand); }
.main-nav { display: flex; align-items: center; gap: 22px; }
.nav-link { background: none; border: none; font: inherit; color: var(--ink); cursor: pointer; font-weight: 500; font-size: 14.5px; }
.nav-dropdown { position: relative; }
.nav-dropdown:hover .dropdown-panel { display: flex; }
.dropdown-panel {
  display: none; position: absolute; top: 100%; left: -40px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 20px; gap: 28px; width: 620px; z-index: 60;
}
.dropdown-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #9ca3af; margin-bottom: 10px; }
.dropdown-col a { display: block; padding: 6px 0; color: var(--ink); font-size: 14px; }
.mobile-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }

/* --- Flash --- */
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; font-size: 14px; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.flash-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }

/* --- Hero / landing --- */
.hero { padding: 64px 0 40px; text-align: center; background: linear-gradient(180deg, var(--brand-light), #fff); }
.hero h1 { font-size: 42px; max-width: 780px; margin: 0 auto .4em; }
.hero p.lead { font-size: 18px; max-width: 620px; margin: 0 auto 28px; }
.hero-badges { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 24px; font-size: 13.5px; color: var(--ink-soft); }
.hero-badges span { display: inline-flex; align-items: center; gap: 6px; }

/* --- Tool grid --- */
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tool-card {
  display: block; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; transition: box-shadow .15s, transform .15s;
}
.tool-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.tool-card .icon { font-size: 26px; display: block; margin-bottom: 10px; }
.tool-card h3 { font-size: 15.5px; margin: 0 0 4px; color: var(--ink); }
.tool-card p { font-size: 13px; margin: 0; color: var(--ink-soft); }
.tool-card .badge { display: inline-block; margin-top: 8px; font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.badge-free { background: var(--success-bg); color: var(--success); }
.badge-api { background: var(--warn-bg); color: var(--warn); }
.badge-hybrid { background: var(--brand-light); color: var(--brand); }
.badge-limited { background: #f3f4f6; color: #6b7280; }

.cat-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.cat-tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer; background: #fff; }
.cat-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --- Tool page (upload widget) --- */
.tool-page-head { text-align: center; padding: 44px 0 8px; }
.tool-page-head .icon { font-size: 40px; }
.tool-mode-note { max-width: 640px; margin: 12px auto 0; padding: 10px 16px; border-radius: var(--radius); font-size: 13.5px; }
.mode-api-note { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.mode-limited-note { background: #f3f4f6; color: #4b5563; border: 1px solid var(--border); }

.upload-card { max-width: 620px; margin: 30px auto; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.dropzone {
  border: 2px dashed #c7d2fe; border-radius: var(--radius); padding: 44px 20px; text-align: center;
  cursor: pointer; background: var(--brand-light); transition: border-color .15s;
}
.dropzone.dragover { border-color: var(--brand); }
.dropzone .dz-icon { font-size: 34px; display: block; margin-bottom: 10px; }
.dropzone input[type=file] { display: none; }
.file-list { margin-top: 16px; }
.file-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.file-row .file-remove { color: var(--error); cursor: pointer; font-weight: 700; }
.form-row { margin: 16px 0; }
.form-row label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.form-row input[type=text], .form-row input[type=number], .form-row input[type=password], .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.form-inline { display: flex; gap: 12px; }
.form-inline .form-row { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.progress-wrap { margin-top: 16px; height: 8px; background: var(--bg-soft); border-radius: 8px; overflow: hidden; display: none; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.result-box { margin-top: 20px; padding: 16px; border-radius: var(--radius); background: var(--success-bg); border: 1px solid #a7f3d0; display: none; text-align: center; }

/* --- Cards / Dashboard --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff; }
.stat-card .stat-label { font-size: 12.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 22px; margin-bottom: 20px; }
.card h2, .card h3 { margin-top: 0; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:hover { background: var(--bg-soft); }

.dash-shell { display: grid; grid-template-columns: 220px 1fr; gap: 30px; padding: 30px 0; }
.dash-sidebar a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; margin-bottom: 2px; }
.dash-sidebar a.active, .dash-sidebar a:hover { background: var(--brand-light); color: var(--brand); text-decoration: none; }
.dash-sidebar h4 { font-size: 11px; text-transform: uppercase; color: #9ca3af; margin: 18px 0 6px; }

/* --- Auth --- */
.auth-shell { max-width: 400px; margin: 60px auto; padding: 0 20px; }
.auth-card { border: 1px solid var(--border); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; }

/* --- Pricing --- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.price-card { border: 1px solid var(--border); border-radius: 14px; padding: 26px; text-align: center; background: #fff; }
.price-card.featured { border-color: var(--brand); box-shadow: var(--shadow-lg); position: relative; }
.price-card .price-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; padding: 3px 12px; border-radius: 20px; }
.price-card .amount { font-size: 34px; font-weight: 800; margin: 10px 0 4px; }
.price-card .amount span { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0; text-align: left; font-size: 13.5px; }
.price-card ul li { padding: 6px 0; color: var(--ink-soft); }
.price-card ul li::before { content: "✓ "; color: var(--success); font-weight: 700; }

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 60px; padding-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; padding-bottom: 30px; }
.footer-inner h4 { font-size: 13px; margin-bottom: 10px; }
.footer-inner a { display: block; color: var(--ink-soft); font-size: 13.5px; padding: 4px 0; }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 20px; font-size: 12.5px; color: #9ca3af; text-align: center; }

/* --- Utilities --- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.muted { color: var(--ink-soft); font-size: 13.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.badge-plan { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--brand-light); color: var(--brand); }

/* --- Editor (Edit PDF tool) --- */
.editor-shell { display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding: 20px 0; }
.editor-tools button { display: block; width: 100%; text-align: left; margin-bottom: 8px; }
.editor-canvas-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); overflow: auto; text-align: center; padding: 20px; }
#pdf-canvas-stack { position: relative; display: inline-block; }
#pdf-canvas-stack canvas { display: block; }
#overlay-canvas { position: absolute; top: 0; left: 0; cursor: crosshair; }

@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .dash-shell { grid-template-columns: 1fr; }
  .editor-shell { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .main-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--border); flex-direction: column; padding: 16px 20px; gap: 14px; }
  .main-nav.open { display: flex; }
  .mobile-toggle { display: block; }
  .dropdown-panel { position: static; display: flex; flex-direction: column; width: auto; box-shadow: none; border: none; padding: 10px 0 0; }
  .hero h1 { font-size: 30px; }
}
