/* Business Plus — premium mobile-first business tools */
:root {
  --graphite: #23262F;
  --lime: #B6FF2E;
  --porcelain: #F8F7F4;
  --navy: #14213D;
  --lime-soft: #E9FFC7;
  --navy-soft: #E7ECF5;
  --muted: #5F6673;
  --line: #D8DCE3;
  --danger: #A4262C;
  --shadow: 0 12px 34px rgba(20, 33, 61, 0.11);
  --radius: 20px;
  --tap: 46px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--graphite);
  background:
    radial-gradient(circle at 6% -4%, rgba(182, 255, 46, 0.20), transparent 30rem),
    radial-gradient(circle at 100% 6%, rgba(20, 33, 61, 0.10), transparent 28rem),
    var(--porcelain);
  font-family: "Inter", "Segoe UI", "Noto Sans Devanagari", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { touch-action: manipulation; cursor: pointer; }

[hidden] { display: none !important; }

.app-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 14px calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -14px;
  padding: 12px 14px;
  background: rgba(248, 247, 244, 0.93);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(20, 33, 61, 0.10);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand__mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 13px;
  box-shadow: 0 6px 16px rgba(20, 33, 61, 0.24);
}

.brand__text { min-width: 0; }

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--navy);
}

.brand p {
  margin: 2px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.pill, .icon-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.05);
}

.pill--voice { display: inline-flex; align-items: center; gap: 6px; }
.pill--voice span[aria-hidden] { font-size: 1rem; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill.is-offline { background: var(--lime-soft); color: #3D5A00; }

.guidance {
  position: relative;
  margin: 14px 0 0;
  padding: 14px 48px 14px 44px;
  border: 1px solid rgba(182, 255, 46, 0.75);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--lime-soft), #fff 72%);
  box-shadow: var(--shadow);
}

.guidance__icon { position: absolute; left: 15px; top: 13px; font-size: 1.2rem; }
.guidance p { margin: 0; font-size: 0.86rem; line-height: 1.55; }

.icon-btn {
  position: absolute;
  right: 9px;
  top: 9px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
}

.tool-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 14px 0 18px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.tool-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 68px;
  padding: 7px 4px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tool-tab > span[aria-hidden] { font-size: 1.18rem; line-height: 1; }

.tool-tab.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 16px rgba(20, 33, 61, 0.28);
}

.tool-tab:active { transform: scale(0.98); }

.main-content { padding: 0 2px; }

.tool-panel { animation: rise 220ms ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 4px 2px 12px;
  border-bottom: 2px solid var(--lime);
  background: url('assets/flourish.svg') no-repeat right 8px / 92px auto;
}

.panel-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--navy);
}

.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 0.78rem; max-width: 54ch; }

.panel-badge {
  flex: 0 0 auto;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--lime);
  border-radius: 999px;
  padding: 3px 9px;
}

.card {
  margin: 0 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 14px;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--navy);
}

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

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field label { font-size: 0.74rem; font-weight: 800; color: var(--navy); letter-spacing: 0.01em; }

.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--porcelain);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(182, 255, 46, 0.55);
}

.input-row { display: flex; align-items: stretch; gap: 6px; }
.input-row input { flex: 1 1 auto; min-width: 0; }

.mic {
  flex: 0 0 var(--tap);
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--lime-soft);
  font-size: 1.1rem;
}

.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.legacy-note {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.svg-stage {
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--porcelain);
  min-height: 240px;
  padding: 10px;
  overflow: hidden;
  margin: 10px 0;
}

.svg-stage svg { display: block; width: 100%; height: auto; }

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.btn:active { transform: scale(0.98); }

.btn--primary { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(20, 33, 61, 0.24); }
.btn--outline { border-color: var(--navy); color: var(--navy); background: #fff; }
.btn--ghost { border-color: var(--line); color: var(--graphite); background: #fff; }
.btn--small { min-height: 38px; padding: 0 13px; font-size: 0.74rem; }

.result-card {
  margin: 0 0 14px;
  padding: 17px;
  border: 1px solid rgba(182, 255, 46, 0.85);
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fff, var(--porcelain));
  box-shadow: var(--shadow);
}

.result-card h3 {
  margin: 0 0 12px;
  font-family: Georgia, serif;
  color: var(--navy);
  font-size: 1.1rem;
}

.result-rows { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0 0 12px; }

.result-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(20, 33, 61, 0.05);
}

.result-rows dt { color: var(--muted); font-size: 0.78rem; }
.result-rows dd { margin: 0; font-size: 0.84rem; font-weight: 800; text-align: right; }

.result-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.result-table th, .result-table td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.result-table th { background: var(--navy); color: #fff; white-space: nowrap; }
.result-table tr:last-child td { border-bottom: 0; }

.records-section { margin-top: 18px; }
.records-section h3 { margin: 0 0 10px; font-family: Georgia, serif; color: var(--navy); font-size: 1.02rem; }

.record-list { display: grid; grid-template-columns: 1fr; gap: 10px; }

.record-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 14px;
  background: #fff;
}

.record-card h4 { margin: 0 0 3px; font-size: 0.9rem; }
.record-card p { margin: 0 0 9px; color: var(--muted); font-size: 0.76rem; }
.record-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.link-btn {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 0.71rem;
  font-weight: 800;
}

.link-btn--danger { background: #FCE8E8; color: var(--danger); }

.empty { margin: 0; padding: 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 0.82rem; }

#actions-status { display: block; margin: 0 0 10px; font-size: 0.76rem; font-weight: 700; color: var(--muted); }

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding: 16px 4px 8px;
  border-top: 1px solid var(--line);
}

.footer p { margin: 0; color: var(--muted); font-size: 0.74rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 80;
  width: min(92vw, 440px);
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--graphite);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 14px 34px rgba(20, 33, 61, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

#print-area { display: none; }

@media (min-width: 560px) {
  .tool-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 700px) {
  .app-shell { padding: 0 28px 40px; }
  .topbar { margin: 0 -28px; padding: 14px 28px; }
  .brand h1 { font-size: 1.5rem; }
  .brand p { font-size: 0.78rem; }
  .tool-nav { grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 10px; }
  .tool-tab { flex-direction: row; min-height: 60px; font-size: 0.82rem; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .field--wide, .form-actions { grid-column: 1 / -1; }
  .result-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-heading h2 { font-size: 2rem; }
  .panel-heading p { font-size: 0.88rem; }
  .guidance p { font-size: 0.94rem; }
}

@media (min-width: 1040px) {
  .tool-nav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .tool-tab { flex-direction: column; min-height: 76px; font-size: 0.72rem; }
  .record-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-content { padding: 0 8px; }
}

@media (hover: hover) {
  .btn:hover, .pill:hover, .tool-tab:hover, .link-btn:hover { box-shadow: 0 8px 18px rgba(20, 33, 61, 0.16); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tool-panel { animation: none; }
}

@media print {
  body { background: #fff !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .toast { display: none !important; }
}


/* ThinkingApps — shared dark theme layer. Applied only when data-theme="dark". */
html[data-theme="dark"] {
  color-scheme: dark;
  --porcelain: #10131B;
  --paper: #171B26;
  --line: #343B4D;
  --muted: #AAB2C5;
}

html[data-theme="dark"] body {
  background: #0E1118 !important;
  color: #EEF1F7 !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] p,
html[data-theme="dark"] span,
html[data-theme="dark"] label,
html[data-theme="dark"] dt,
html[data-theme="dark"] dd,
html[data-theme="dark"] strong {
  color: inherit;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .app-header,
html[data-theme="dark"] header {
  background: linear-gradient(135deg, #11172A, #1D2450) !important;
  color: #EEF1F7 !important;
  border-color: #343B4D !important;
}

html[data-theme="dark"] .tool-nav,
html[data-theme="dark"] .tool-panel,
html[data-theme="dark"] main,
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .section,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .record-card,
html[data-theme="dark"] .guidance,
html[data-theme="dark"] .footer,
html[data-theme="dark"] .app-footer,
html[data-theme="dark"] .records-section,
html[data-theme="dark"] .svg-stage,
html[data-theme="dark"] .draw-stage,
html[data-theme="dark"] .world-stage {
  background: #171B26 !important;
  color: #EEF1F7 !important;
  border-color: #343B4D !important;
  box-shadow: none !important;
}

html[data-theme="dark"] button,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #202635 !important;
  color: #EEF1F7 !important;
  border-color: #3C445A !important;
}

html[data-theme="dark"] button.primary,
html[data-theme="dark"] .btn--primary,
html[data-theme="dark"] .tool-tab.is-active {
  background: #6C4BD8 !important;
  color: #FFFFFF !important;
  border-color: #6C4BD8 !important;
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .panel-badge,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .record-actions,
html[data-theme="dark"] .form-actions {
  background: #202635 !important;
  color: #EEF1F7 !important;
  border-color: #3C445A !important;
}

html[data-theme="dark"] .empty,
html[data-theme="dark"] .meta {
  color: #AAB2C5 !important;
}

html[data-theme="dark"] a {
  color: #FFF275 !important;
}

html[data-theme="dark"] input[type="color"] {
  padding: 3px !important;
}

@media print {
  html[data-theme="dark"] body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
}

/* A-to-Z: local backup and restore controls */
.backup-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0; }
.backup-actions button { min-height: 44px; cursor: pointer; }
.backup-status { font-size: .82rem; opacity: .85; }

/* A-to-Z: honest limitation disclosure, shown in the active language. */
.a2z-disclosure { margin: .75rem 0; padding: .6rem .75rem; border-left: 3px solid #B6FF2E; background: rgba(20,33,61,.06); font-size: .82rem; line-height: 1.4; }
.a2z-disclosure [lang="hi"] { display: none; }
html[lang="hi"] .a2z-disclosure [lang="en"] { display: none; }
html[lang="hi"] .a2z-disclosure [lang="hi"] { display: inline; }
