/* Deadline Calculator — styled with the shared FormsPal landing design system
   ("Document AI generation landing" project): light theme, flat green #0e8a5f,
   white cards on #f7f9fb, hairline #e3e8ee borders, system font.
   Host pages can re-theme via the custom properties below. */
:root {
  --dc-primary: #0e8a5f;
  --dc-primary-dark: #0b6e4c;
  --dc-primary-light: #e6f4ee;
  --dc-on-primary: #ffffff;
  --dc-ink: #1c2530;
  --dc-ink-soft: #51606f;
  --dc-line: #e3e8ee;
  --dc-bg: #f7f9fb;
  --dc-white: #ffffff;
  --dc-danger: #d64545;
  --dc-radius: 12px;
  --dc-shadow: 0 4px 20px rgba(16, 38, 30, 0.08);
  --dc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* ---------- dark theme ----------
   Same translation as the FormsPal AI widget: greens brightened one step for
   contrast on dark surfaces; --dc-primary-dark becomes the light text/hover
   accent; --dc-white keeps its token name but is the card surface. */
:root[data-dc-theme="dark"] {
  --dc-primary: #16a571;
  --dc-primary-dark: #34c188;
  --dc-primary-light: #143323;
  --dc-ink: #f2f5f7;
  --dc-ink-soft: #aab5bf;
  --dc-line: #2a3036;
  --dc-bg: #15181b;
  --dc-white: #1e2329;
  --dc-danger: #f87171;
  --dc-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* Standalone page only — when proxied/embedded the host page styles its own body. */
body { background: var(--dc-bg); margin: 0; padding: 16px; }

.dc-app {
  font-family: var(--dc-font);
  color: var(--dc-ink);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.dc-app *, .dc-app *::before, .dc-app *::after { box-sizing: border-box; }

.dc-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.dc-themetoggle {
  margin-left: auto; width: 42px; height: 42px; border-radius: 50%;
  background: var(--dc-white); border: 1.5px solid var(--dc-line);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
  transition: border-color .12s;
}
.dc-themetoggle:hover { border-color: var(--dc-primary); }
.dc-themetoggle svg { width: 18px; height: 18px; }
.dc-themetoggle .dc-sun { display: none; stroke: #f5a623; }
.dc-themetoggle .dc-moon { display: block; stroke: var(--dc-primary); }
:root[data-dc-theme="dark"] .dc-themetoggle .dc-sun { display: block; }
:root[data-dc-theme="dark"] .dc-themetoggle .dc-moon { display: none; }
.dc-tab {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--dc-ink);
  background: var(--dc-white); border: 1.5px solid var(--dc-line);
  border-radius: 999px; padding: 11px 18px; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dc-tab:hover { border-color: var(--dc-primary); }
.dc-tab.active {
  border-color: var(--dc-primary);
  background: var(--dc-primary-light);
  color: var(--dc-primary-dark);
}

.dc-panel {
  background: var(--dc-white);
  border: 1px solid var(--dc-line);
  border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow);
  padding: 26px;
}

.dc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dc-grid .dc-wide { grid-column: 1 / -1; }
@media (max-width: 480px) { .dc-grid { grid-template-columns: 1fr; } .dc-panel { padding: 20px; } }

.dc-field label { display: block; font-size: 13px; font-weight: 600; letter-spacing: .2px; color: var(--dc-ink-soft); margin-bottom: 6px; }
.dc-field input, .dc-field select {
  font: inherit; font-size: 16px; width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--dc-line); border-radius: 10px;
  background: var(--dc-white); color: var(--dc-ink);
  outline: none; transition: border-color .12s;
}
.dc-field input:focus, .dc-field select:focus { border-color: var(--dc-primary); }

.dc-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 16px; font-weight: 700;
  background: var(--dc-primary); color: var(--dc-on-primary);
  border: none; border-radius: 10px;
  width: 100%; padding: 14px 24px; cursor: pointer; margin-top: 18px;
  transition: background .15s ease, transform .1s ease;
}
.dc-submit:hover { background: var(--dc-primary-dark); }
.dc-submit:active { transform: scale(.98); }
.dc-submit:disabled { opacity: .5; cursor: not-allowed; }

.dc-result {
  margin-top: 20px; padding: 22px;
  background: var(--dc-bg);
  border: 1px solid var(--dc-line); border-radius: var(--dc-radius);
}
.dc-result-date { font-size: 30px; font-weight: 800; letter-spacing: -.4px; margin: 0 0 8px; color: var(--dc-primary); }
:root[data-dc-theme="dark"] .dc-result-date { color: var(--dc-primary-dark); }
.dc-result-trace { font-size: 15px; color: var(--dc-ink-soft); margin: 0 0 8px; }
.dc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.dc-actions button {
  font: inherit; font-size: 14px; font-weight: 600;
  background: var(--dc-white); color: var(--dc-ink);
  border: 1.5px solid var(--dc-line); border-radius: 10px;
  padding: 9px 14px; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.dc-actions button:hover {
  border-color: var(--dc-primary);
  background: var(--dc-primary-light);
  color: var(--dc-primary-dark);
}

.dc-cite { font-size: 13px; color: var(--dc-ink-soft); margin: 10px 0 0; }
.dc-sources { font-size: 13px; color: var(--dc-ink-soft); margin: 10px 0 0; line-height: 1.5; }
.dc-sources a { color: var(--dc-primary-dark); text-decoration: underline; text-underline-offset: 2px; }
:root[data-dc-theme="dark"] .dc-sources a { color: var(--dc-primary-dark); }
.dc-sources a:hover { text-decoration-thickness: 2px; }
.dc-verified { color: var(--dc-ink-soft); white-space: nowrap; }

/* ---------- calendar popover (custom date picker) — premium ---------- */
.dc-pickerhost { position: relative; }
.dc-cal {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 30;
  width: min(336px, calc(100vw - 40px));
  background: var(--dc-white);
  border: 1px solid var(--dc-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(16, 38, 30, .06), 0 20px 48px -12px rgba(16, 38, 30, .28);
  padding: 16px 16px 12px;
  transform-origin: top left;
  animation: dc-cal-in .15s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes dc-cal-in {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
:root[data-dc-theme="dark"] .dc-cal {
  background: #262e36; border-color: #3a4550;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 24px 56px -12px rgba(0, 0, 0, .7);
}

.dc-cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.dc-cal-title {
  font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; margin-right: auto;
  padding-left: 4px; color: var(--dc-ink); font-variant-numeric: tabular-nums;
}
.dc-cal-nav {
  width: 34px; height: 34px; flex: none;
  font: inherit; font-size: 18px; line-height: 1; color: var(--dc-ink-soft);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .08s ease;
}
.dc-cal-nav:hover { background: var(--dc-primary-light); color: var(--dc-primary-dark); }
.dc-cal-nav:active { transform: scale(.92); }

.dc-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dc-cal-wd {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--dc-ink-soft); opacity: .75; text-align: center; padding: 2px 0 8px;
}
.dc-cal-day {
  position: relative; aspect-ratio: 1; width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--dc-ink); background: none; border: none; border-radius: 50%; cursor: pointer;
  transition: background .12s ease, color .12s ease, box-shadow .15s ease, transform .08s ease;
}
.dc-cal-day:hover { background: var(--dc-primary-light); color: var(--dc-primary-dark); }
.dc-cal-day:active { transform: scale(.9); }
.dc-cal-day.out { color: var(--dc-ink-soft); opacity: .4; font-weight: 400; }
.dc-cal-day.today { color: var(--dc-primary-dark); font-weight: 700; }
.dc-cal-day.today::after {
  content: ""; position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--dc-primary);
}
.dc-cal-day.sel {
  background: var(--dc-primary); color: var(--dc-on-primary); font-weight: 700;
  box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--dc-primary) 55%, transparent);
}
.dc-cal-day.sel:hover { background: var(--dc-primary-dark); color: var(--dc-on-primary); }
.dc-cal-day.sel.today::after { background: var(--dc-on-primary); }

.dc-cal-foot {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--dc-line);
}
.dc-cal-foot button {
  font: inherit; font-size: 13.5px; font-weight: 700; color: var(--dc-ink-soft);
  background: none; border: none; border-radius: 8px;
  padding: 7px 12px; cursor: pointer; transition: background .12s ease, color .12s ease;
}
.dc-cal-foot button:hover { background: var(--dc-primary-light); color: var(--dc-primary-dark); }
.dc-cal-foot button[data-act="today"] { color: var(--dc-primary-dark); }

.dc-disclaimer {
  font-size: 13px; color: var(--dc-ink-soft);
  margin-top: 18px; padding: 0 4px;
}

@media print {
  .dc-tabs, .dc-actions, .dc-submit { display: none !important; }
  .dc-panel, .dc-result { border: none; box-shadow: none; background: none; padding: 0; }
}

/* ---------- pre-ship: visible keyboard focus for all interactive tool elements ---------- */
.dc-tab:focus-visible, .dc-submit:focus-visible, .dc-actions button:focus-visible,
.dc-themetoggle:focus-visible, .dc-cal-day:focus-visible, .dc-cal-nav:focus-visible,
.dc-cal-foot button:focus-visible, .dc-sources a:focus-visible {
  outline: 3px solid var(--dc-primary); outline-offset: 2px;
}
.dc-field input:focus-visible, .dc-field select:focus-visible {
  outline: 2px solid var(--dc-primary); outline-offset: 1px;
}

/* ============================================================
   Elite refinements — layered on the base system above.
   ============================================================ */

/* Layered, premium depth + a soft focus-ring token. */
:root {
  --dc-shadow: 0 1px 2px rgba(16, 38, 30, .05), 0 8px 28px -10px rgba(16, 38, 30, .14);
  --dc-ring: 0 0 0 3px color-mix(in srgb, var(--dc-primary) 20%, transparent);
  --dc-line-strong: color-mix(in srgb, var(--dc-line) 65%, var(--dc-ink) 14%);
}
:root[data-dc-theme="dark"] {
  --dc-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -12px rgba(0, 0, 0, .6);
  --dc-ring: 0 0 0 3px color-mix(in srgb, var(--dc-primary) 32%, transparent);
}

/* Crisp, aligned numerals wherever numbers/dates appear. */
.dc-app { font-feature-settings: "ss01"; -moz-osx-font-smoothing: grayscale; }
.dc-result-date, .dc-result-trace, .dc-cite, .dc-sources, .dc-verified,
.dc-cal-day, .dc-cal-title, .dc-field input { font-variant-numeric: tabular-nums; }

/* Selects: replace the inconsistent native chevron with a clean themed caret. */
.dc-field select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.75 6 6.25 11 1.75' stroke='%2351606f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
:root[data-dc-theme="dark"] .dc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.75 6 6.25 11 1.75' stroke='%23aab5bf' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Inputs: crisper resting border + a soft focus glow (keeps the a11y outline too). */
.dc-field input, .dc-field select { border-color: var(--dc-line-strong); transition: border-color .15s ease, box-shadow .15s ease; }
.dc-field input:focus, .dc-field select:focus { box-shadow: var(--dc-ring); }

/* The result — the moment that matters: a gently elevated, accented answer card. */
.dc-result {
  background: linear-gradient(180deg, color-mix(in srgb, var(--dc-primary) 6%, var(--dc-white)), var(--dc-white));
  border: 1px solid color-mix(in srgb, var(--dc-primary) 22%, var(--dc-line));
  box-shadow: var(--dc-shadow);
  animation: dc-rise .3s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes dc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Insulate the embedded tool from a host page's broad element rules. The landing
   page's `.lp p { font-size:16px; color; line-height }` (specificity 0,1,1) otherwise
   leaks in and beats the tool's own `.dc-result-date` (0,1,0) — shrinking the result
   number and graying it in light mode. Re-assert the tool's typography under .dc-app. */
.dc-app .dc-result-date { font-size: 32px; letter-spacing: -.6px; line-height: 1.15; color: var(--dc-primary); }
:root[data-dc-theme="dark"] .dc-app .dc-result-date { color: var(--dc-primary-dark); }
.dc-app .dc-result-trace { font-size: 15px; color: var(--dc-ink-soft); line-height: 1.5; }
.dc-app .dc-cite, .dc-app .dc-sources { font-size: 13px; color: var(--dc-ink-soft); }
.dc-app .dc-disclaimer { font-size: 13px; color: var(--dc-ink-soft); }

/* Insulate the panel from the host page's generic section padding. The tool's
   `.dc-panel` is a <section>, and the landing page's `.lp section { padding:40px 0 }`
   (specificity 0,1,1) otherwise beats `.dc-panel` (0,1,0) — zeroing the side padding
   and over-padding top/bottom, which made the form look edge-to-edge and sparse. */
.dc-app .dc-panel { padding: 26px; }
@media (max-width: 480px) { .dc-app .dc-panel { padding: 20px; } }

/* Primary button: subtle tinted lift; secondary actions get a hover shadow. */
.dc-submit {
  box-shadow: 0 1px 2px rgba(16, 38, 30, .12), 0 10px 22px -10px color-mix(in srgb, var(--dc-primary) 60%, transparent);
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.dc-submit:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(16, 38, 30, .14), 0 14px 28px -10px color-mix(in srgb, var(--dc-primary) 70%, transparent); }
.dc-submit:active { transform: translateY(0) scale(.99); }
.dc-actions button:hover { box-shadow: var(--dc-shadow); }
.dc-tab.active { box-shadow: 0 1px 2px rgba(16, 38, 30, .06); }

/* Accent-tinted text selection. */
::selection { background: color-mix(in srgb, var(--dc-primary) 26%, transparent); }

/* Comfortable touch targets on touch devices. */
@media (pointer: coarse) {
  .dc-actions button, .dc-cal-foot button, .dc-cal-day { min-height: 44px; }
}

/* Respect reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .dc-result, .dc-cal { animation: none; }
  .dc-submit:hover, .lp-card:hover { transform: none; }
  .dc-cal-day:active, .dc-cal-nav:active { transform: none; }
}

/* Cross-tool nav: the sibling tool is a real link styled as a tab; the current page
   is a non-interactive <span> indicator. */
a.dc-tab { text-decoration: none; }
.dc-tab.active { cursor: default; }
