/* ==========================================================================
   NanoKhata Tools
   Shared styling for the free, on-device utility pages.
   ========================================================================== */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Helvetica Neue", Arial, sans-serif;
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --subtle: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --hairline: #eef2f6;
  --primary: #368098;
  --primary-dark: #2b677a;
  --primary-soft: #eaf2f5;
  --primary-border: #a9c8d2;
  --danger: #b42318;
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--hairline);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.brand img {
  height: 28px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text-primary);
}

.site-nav .nav-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-xs);
  color: #ffffff;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.site-nav .nav-start:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
}

/* Page head ------------------------------------------------------------- */

.tool-main {
  /* Only vertical padding: keep .wrap's side gutters. */
  padding-top: 28px;
  padding-bottom: 12px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.breadcrumb a:hover {
  color: var(--primary-dark);
}

.page-head {
  max-width: 760px;
  padding: 20px 0 24px;
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.page-head h1 {
  font-size: clamp(1.9rem, 3.8vw, 2.5rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
}

.lede {
  margin-top: 12px;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.lede-ne {
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.73rem;
  font-weight: 600;
}

/* Tool card ------------------------------------------------------------- */

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

@media (min-width: 720px) {
  .tool-card {
    padding: 22px;
  }
}

/* Mode picker ----------------------------------------------------------- */

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.mode {
  appearance: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  text-align: left;
  font-family: inherit;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mode:hover {
  border-color: var(--primary-border);
  background: var(--subtle);
}

.mode[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mode-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-icon svg {
  width: 22px;
  height: 22px;
}

.mode[aria-selected="true"] .mode-icon {
  background: var(--primary);
  color: #ffffff;
}

.mode-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mode-copy strong {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.mode[aria-selected="true"] .mode-copy strong {
  color: var(--primary-dark);
}

.mode-copy small {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.panel {
  scroll-margin-top: 84px;
}

/* Dropzone -------------------------------------------------------------- */

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
  padding: 34px 18px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dz-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  color: var(--primary);
  display: block;
}

.dz-title {
  font-size: 1rem;
  font-weight: 600;
}

.dz-sub {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

/* Buttons --------------------------------------------------------------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
}

.btn-lg {
  min-height: 46px;
  padding: 0 24px;
  font-size: 0.95rem;
}

/* Page grid ------------------------------------------------------------- */

.pages-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.pages-head p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.muted {
  color: var(--text-muted);
  font-weight: 400;
}

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

.pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: #ffffff;
  overflow: hidden;
}

.thumb-canvas {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: contain;
  background: #f8fafc;
}

.thumb-num {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.thumb-actions {
  display: flex;
  border-top: 1px solid var(--hairline);
}

.mini-btn {
  appearance: none;
  flex: 1;
  border: 0;
  background: none;
  padding: 7px 4px;
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
}

.mini-btn:hover {
  background: var(--primary-soft);
}

.mini-btn + .mini-btn {
  border-left: 1px solid var(--hairline);
}

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

.mini-btn-danger:hover {
  background: #fef3f2;
}

/* Settings -------------------------------------------------------------- */

.settings {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.field select {
  appearance: none;
  min-height: 38px;
  min-width: 190px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface)
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.hint {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 380px;
}

.pdf-info {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-word;
}

/* Tool hub -------------------------------------------------------------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.tool-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-link:hover {
  border-color: var(--primary-border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.tool-link-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.tool-link-icon svg {
  width: 23px;
  height: 23px;
}

.tool-link h2 {
  font-size: 1.02rem;
  line-height: 1.35;
}

.tool-link p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.tool-link-go {
  margin-top: auto;
  padding-top: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.tool-link.is-soon {
  border-style: dashed;
  background: var(--subtle);
  box-shadow: none;
  transform: none;
}

.tool-link.is-soon .tool-link-icon {
  background: var(--surface);
  color: var(--text-faint);
}

/* Result previews ------------------------------------------------------- */

.result {
  margin-top: 20px;
  padding: 16px;
  scroll-margin-top: 84px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-copy {
  min-width: 0;
  flex: 1 1 220px;
}

.result-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.result-title {
  margin-top: 2px;
  font-size: 1rem;
  line-height: 1.35;
  word-break: break-word;
}

.result-meta {
  margin-top: 2px;
  font-size: 0.79rem;
  color: var(--text-muted);
}

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

.pdf-frame {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff;
}

.pdf-frame iframe {
  display: block;
  width: 100%;
  height: min(72vh, 640px);
  min-height: 320px;
  border: 0;
  background: #ffffff;
}

.frame-note {
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--text-faint);
}

.frame-note-narrow {
  display: none;
}

.strip-label {
  margin-top: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.page-strip {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-bottom: 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.page-strip:empty {
  display: none;
}

.page-thumb {
  flex: 0 0 auto;
  width: 88px;
  margin: 0;
  scroll-snap-align: start;
}

.page-thumb img {
  width: 88px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.page-thumb figcaption {
  margin-top: 4px;
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-muted);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.image-item {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.image-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 220px;
  min-height: 120px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #f1f5f9;
}

.image-preview img {
  max-height: 220px;
  width: auto;
  object-fit: contain;
}

.image-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.image-name {
  font-weight: 600;
  color: var(--text-secondary);
  word-break: break-all;
}

.image-download {
  justify-self: start;
  width: 100%;
}

/* Status & progress ----------------------------------------------------- */

.tool-status {
  min-height: 1.4em;
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.tool-status.is-ok {
  color: var(--primary-dark);
  font-weight: 500;
}

.tool-status.is-error {
  color: var(--danger);
  font-weight: 500;
}

.tool-status.is-warn {
  color: #92400e;
  font-weight: 500;
}

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

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.2s ease;
}

.progress-text {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Editor overlay -------------------------------------------------------- */

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.74);
}

.editor {
  display: flex;
  flex-direction: column;
  width: min(940px, 100%);
  max-height: calc(100vh - 24px);
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.editor-count {
  font-size: 0.85rem;
  font-weight: 600;
}

.editor-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--subtle);
  color: var(--text-primary);
}

.editor-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #eef2f6;
  overflow: auto;
}

.editor-stage canvas {
  display: block;
  touch-action: none;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  cursor: crosshair;
}

.editor-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--hairline);
}

.chip {
  appearance: none;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--primary-border);
}

.chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.editor-hint {
  flex: 1 1 140px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.editor-tools .btn-primary {
  margin-left: auto;
}

/* Article content ------------------------------------------------------- */

.content {
  max-width: 760px;
  padding: 34px 0 60px;
}

.content h2 {
  margin-top: 34px;
  font-size: 1.32rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.content h2:first-child {
  margin-top: 0;
}

.content h3 {
  margin-top: 20px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.content p,
.content li {
  font-size: 0.97rem;
  line-height: 1.78;
  color: var(--text-secondary);
}

.content p {
  margin-top: 10px;
}

.content ol,
.content ul {
  margin-top: 10px;
  padding-left: 1.25em;
  display: grid;
  gap: 7px;
}

.content a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.content a:hover {
  color: var(--primary);
}

.content strong {
  color: var(--text-primary);
}

.tip-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}

.tip-box p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.faq {
  margin-top: 16px;
}

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

.faq details:last-of-type {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-primary);
  list-style-position: outside;
}

.faq summary::marker {
  color: var(--primary);
}

.faq details p {
  margin-top: 8px;
  font-size: 0.93rem;
}

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 36px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.cta-band p {
  margin: 0;
  max-width: 440px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.cta-band strong {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
}

/* Footer ---------------------------------------------------------------- */

.site-footer {
  margin-top: 20px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

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

@media (max-width: 640px) {
  .wrap {
    padding: 0 16px;
  }

  .site-nav {
    gap: 14px;
  }

  .site-nav a:not(.nav-start) {
    display: none;
  }

  .tool-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .modes {
    grid-template-columns: 1fr;
  }

  .mode {
    padding: 12px;
  }

  .result {
    padding: 12px;
  }

  .pdf-frame,
  .frame-note-wide {
    display: none;
  }

  .frame-note-narrow {
    display: block;
  }

  .page-strip {
    gap: 12px;
    padding-bottom: 8px;
  }

  .page-thumb {
    width: min(58vw, 220px);
  }

  .page-thumb img {
    width: 100%;
  }

  .pdf-frame iframe {
    height: 60vh;
    min-height: 240px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  }

  .dropzone {
    padding: 26px 14px;
  }

  .field select {
    min-width: 100%;
  }

  .field {
    flex: 1 1 140px;
  }

  .pages {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  }

  .thumb-canvas {
    height: 96px;
  }

  .editor-tools .btn-primary {
    margin-left: 0;
    width: 100%;
  }

  .editor-hint {
    display: none;
  }
}

/* ==========================================================================
   Salary tax calculator
   ========================================================================== */
.st-card { padding: 22px; }
.st-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 900px) {
  .st-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; }
  .st-results { position: sticky; top: 84px; align-self: start; }
}
.st-inputs { display: flex; flex-direction: column; gap: 14px; }
.st-h {
  font-size: 0.95rem;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}
.st-h:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.st-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) {
  .st-row-3 { grid-template-columns: 1fr; }
}
.st-inputs .field select { min-width: 0; width: 100%; }
.st-inputs .field input {
  min-height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.st-inputs .field input:focus,
.st-inputs .field select:focus {
  outline: 2px solid var(--primary-border);
  outline-offset: 1px;
  border-color: var(--primary);
}
.st-field .hint { font-weight: 400; max-width: none; }
.st-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.st-check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); }

.st-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.st-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
}
.st-stat-main {
  grid-column: 1 / -1;
  background: var(--primary-soft);
  border-color: var(--primary-border);
}
.st-stat-label { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); }
.st-stat strong { font-size: 1.2rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.st-stat-main strong { font-size: 1.7rem; color: var(--primary-dark); }
.st-stat-sub { font-size: 0.76rem; color: var(--text-muted); }

.st-table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.st-table caption {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-bottom: 6px;
}
.st-table th,
.st-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
  text-align: right;
  vertical-align: top;
}
.st-table th { text-align: left; font-weight: 500; color: var(--text-secondary); padding-right: 10px; }
.st-table thead th { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
.st-table thead th:not(:first-child) { text-align: right; }
.st-table .is-total th,
.st-table .is-total td { font-weight: 800; color: var(--text-primary); }
.st-table tr.is-empty th,
.st-table tr.is-empty td { color: var(--text-faint); }
.st-table tfoot th,
.st-table tfoot td { font-weight: 600; border-bottom: 0; }
.st-slab-table td:nth-child(3) { white-space: nowrap; }
.st-note { margin-top: 14px; }
.content .st-static { max-width: 640px; margin: 8px 0 18px; font-size: 0.92rem; }
.content .st-static td { text-align: left; }
/* The scanner's mobile `.field { flex: 1 1 140px }` would become a 140px
   height inside this vertical stack. */
.st-inputs .field { flex: 0 0 auto; }
.st-table td { white-space: nowrap; padding-left: 8px; }
@media (max-width: 520px) {
  .st-slab-table { font-size: 0.78rem; }
}

/* ==========================================================================
   Photo resizer & crop
   ========================================================================== */
.ir-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 900px) {
  .ir-workspace { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 32px; }
  .ir-left { position: sticky; top: 84px; align-self: start; }
}
.ir-stage-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: #1e293b;
}
.ir-stage {
  display: block;
  max-width: 100%;
  touch-action: none;
  cursor: crosshair;
}
.ir-crop-info { margin-top: 8px; font-size: 0.78rem; }
.ir-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.ir-right { display: flex; flex-direction: column; gap: 10px; }
.ir-h {
  font-size: 0.95rem;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}
.ir-h:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.ir-group-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.ir-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ir-chips .chip { display: inline-flex; align-items: center; gap: 6px; }
.ir-chips .chip small { font-size: 0.68rem; font-weight: 500; color: var(--text-faint); }
.ir-chips .chip[aria-pressed="true"] small { color: var(--primary-dark); }
.ir-note {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.ir-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ir-sliders .field { flex: 0 0 auto; }
.ir-sliders output { font-weight: 700; color: var(--text-primary); margin-left: 4px; }
.ir-sliders input[type="range"] { width: 100%; accent-color: var(--primary); }
#ir-fx-reset { align-self: flex-start; }

.ir-size { display: flex; align-items: flex-end; gap: 10px; }
.ir-size .field { flex: 1 1 0; min-width: 0; }
.ir-size .field input,
.ir-size .field select {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background-color: var(--surface);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ir-size .field input:disabled { background: var(--subtle); color: var(--text-muted); }
.ir-x { padding-bottom: 9px; color: var(--text-muted); }

.ir-result {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
  transition: opacity 0.15s ease;
}
.ir-result.is-busy { opacity: 0.55; }
.ir-preview {
  width: 120px;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background:
    repeating-conic-gradient(#e2e8f0 0% 25%, #ffffff 0% 50%) 50% / 14px 14px;
  flex-shrink: 0;
}
.ir-result-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ir-warn {
  font-size: 0.78rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 5px 8px;
}
.ir-result-copy .btn { align-self: flex-start; }
.ir-table td { white-space: normal; }

@media (max-width: 520px) {
  .ir-sliders { grid-template-columns: 1fr; }
  .ir-preview { width: 96px; }
}

/* ==========================================================================
   Quotation maker
   ========================================================================== */
.qm-card { padding: 22px; }
.qm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 980px) {
  .qm-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); gap: 32px; }
  .qm-side { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; }
}
.qm-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.qm-section {
  border: 0;
  border-top: 1px solid var(--hairline);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.qm-section:first-child { border-top: 0; padding-top: 0; }
.qm-section legend {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  float: left;
  width: 100%;
}
.qm-section legend + * { clear: both; }
.qm-saved {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  padding: 1px 8px;
}
.qm-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 0;
}
.qm-field input,
.qm-field select,
.qm-in,
.qm-textarea,
.qm-inline select {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
}
.qm-textarea { padding: 10px 11px; line-height: 1.5; resize: vertical; min-height: 96px; }
.qm-field input:focus, .qm-in:focus, .qm-textarea:focus, .qm-inline select:focus {
  outline: 2px solid var(--primary-border);
  outline-offset: 1px;
  border-color: var(--primary);
}
.qm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qm-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) {
  .qm-row, .qm-row-3 { grid-template-columns: 1fr; }
}

.qm-logo-row { display: flex; align-items: center; gap: 14px; }
.qm-logo-preview {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--subtle);
  padding: 4px;
}
.qm-logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qm-logo-actions .hint { flex-basis: 100%; }
.qm-accents { display: flex; gap: 8px; flex-wrap: wrap; }
.qm-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
}
.qm-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text-primary); }

.qm-items-head,
.qm-item {
  display: grid;
  grid-template-columns: minmax(0, 2.6fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 30px;
  gap: 6px;
  align-items: center;
}
.qm-items-head span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}
.qm-items-head span:nth-child(5) { text-align: right; }
.qm-items { display: flex; flex-direction: column; gap: 6px; }
.qm-in { padding: 0 8px; min-height: 38px; font-size: 0.88rem; }
.qm-num { text-align: right; }
.qm-amount {
  text-align: right;
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qm-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  font-size: 1.2rem;
  cursor: pointer;
}
.qm-remove:hover { background: #fef2f2; color: var(--danger); }
#qm-add-item { align-self: flex-start; }
@media (max-width: 560px) {
  .qm-items-head { display: none; }
  .qm-item {
    grid-template-columns: 1fr 1fr 1fr 30px;
    padding: 8px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
  }
  .qm-item .qm-desc { grid-column: 1 / 4; }
  .qm-item .qm-amount { grid-column: 1 / 4; text-align: left; }
  .qm-item .qm-remove { grid-column: 4; grid-row: 1; }
}

.qm-charges { align-items: end; }
.qm-inline { display: flex; gap: 6px; }
.qm-inline input { flex: 1 1 auto; }
.qm-inline select { width: 70px; flex: 0 0 70px; padding: 0 8px; }
.qm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.qm-check input { width: 18px; height: 18px; accent-color: var(--primary); }

.qm-summary {
  margin: 4px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--subtle);
  font-variant-numeric: tabular-nums;
}
.qm-summary div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 0.88rem; }
.qm-summary dt { color: var(--text-muted); }
.qm-summary dd { margin: 0; font-weight: 600; }
.qm-summary .is-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.qm-summary .is-total dt, .qm-summary .is-total dd { color: var(--text-primary); font-weight: 800; font-size: 1rem; }

.qm-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.qm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qm-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: #e2e8f0;
}
.qm-page {
  width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}
.qm-page-count:empty { display: none; }
.qm-forget {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}
.qm-taxes { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.qm-tax {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 30px;
  gap: 6px;
  align-items: center;
}
.qm-rate { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-muted); }
.qm-tax-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.qm-tax-actions .ir-chips { display: contents; }
.qm-summary .qm-sum-taxes { display: block; padding: 0; }
.qm-summary .qm-sum-taxes:empty { display: none; }
.qm-date-hint { margin-top: -4px; }

/* Editable item headings + optional code column */
.qm-items .qm-code,
.qm-items-head .qm-code { display: none; }
.qm-items.has-code .qm-item,
.qm-items-head.has-code {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr) minmax(0, 0.75fr) minmax(0, 0.75fr) minmax(0, 1fr) minmax(0, 1.05fr) 30px;
}
.qm-items.has-code .qm-code,
.qm-items-head.has-code .qm-code { display: block; }
.qm-col {
  width: 100%;
  min-width: 0;
  padding: 3px 6px;
  border: 1px dashed transparent;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: text;
}
.qm-col:hover { border-color: var(--border); }
.qm-col:focus { outline: none; border-color: var(--primary); border-style: solid; background: var(--surface); color: var(--text-primary); }
.qm-col.qm-num { text-align: right; }
.qm-col-hint { margin-bottom: -4px; }
.qm-items-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.qm-check-sm { min-height: 0; font-size: 0.82rem; }
@media (max-width: 560px) {
  .qm-items-head, .qm-items-head.has-code { display: none; }
  .qm-col-hint { display: none; }
  .qm-items.has-code .qm-item { grid-template-columns: 1fr 1fr 1fr 30px; }
  .qm-items.has-code .qm-item .qm-code { grid-column: 1 / 4; }
}

/* Wider canvas for the editor-style tools */
.tool-wide .wrap { max-width: 1340px; }

/* Cookie consent banner */
.consent-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 12px 32px -10px rgba(15, 23, 42, 0.3);
}
.consent-text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.consent-text a { color: var(--primary-dark); text-decoration: underline; }
.consent-actions { display: flex; gap: 8px; margin-left: auto; }
