/* Shared styles for the Phase 2 browser tools. Scoped to .tt-new. */

.tt-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.tt-panel-head h2,
.tt-panel-head h3 {
  margin-bottom: 0.15rem;
}

.tt-form-section {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--tt-border);
}

.tt-form-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.tt-form-section-title {
  margin-bottom: 0.65rem;
  color: var(--tt-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tt-form-actions {
  align-items: center;
}

.tt-reset-button {
  margin-left: auto;
}

.tt-line-items {
  display: grid;
  gap: 0.8rem;
}

.tt-line-item {
  padding: 0.85rem;
  border: 1px solid var(--tt-border);
  border-radius: 13px;
  background: var(--tt-surface-2);
}

.tt-line-item-grid {
  display: grid;
  gap: 0.7rem;
}

.tt-line-item .tt-field {
  margin-bottom: 0;
}

.tt-line-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.tt-line-total {
  color: var(--tt-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.tt-line-total span {
  color: var(--tt-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.tt-remove-item {
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--tt-danger) !important;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.tt-remove-item:hover {
  text-decoration: underline;
}

.tt-result-panel {
  background: linear-gradient(180deg, #ffffff 0%, #f1f6fd 100%);
}

.tt-result-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.tt-result-card {
  min-width: 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  background: var(--tt-surface);
}

.tt-result-card--primary {
  border-color: rgba(23, 92, 211, 0.35);
  background: var(--tt-primary);
  color: #fff;
}

.tt-result-card--success {
  border-color: #b7e4cd;
  background: var(--tt-success-soft);
}

.tt-result-card--warning {
  border-color: #f0d49a;
  background: var(--tt-warning-soft);
}

.tt-result-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.3rem;
  color: var(--tt-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tt-result-card--primary .tt-result-label {
  color: #dbe8ff;
}

.tt-result-value {
  margin: 0;
  color: var(--tt-ink);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.tt-result-card--primary .tt-result-value {
  color: #fff;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.tt-result-card--success .tt-result-value {
  color: var(--tt-success);
}

.tt-result-note {
  margin: 0.35rem 0 0;
  color: var(--tt-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.tt-result-card--primary .tt-result-note {
  color: #dbe8ff;
}

.tt-result-empty {
  padding: 1.2rem;
  border: 1px dashed var(--tt-border-strong);
  border-radius: 12px;
  background: var(--tt-surface);
  color: var(--tt-muted);
  font-size: 0.9rem;
  text-align: center;
}

.tt-summary-list {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.tt-summary-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.48rem 0;
  border-bottom: 1px solid var(--tt-border);
  color: var(--tt-body);
  font-size: 0.88rem;
}

.tt-summary-list li:last-child {
  border-bottom: 0;
}

.tt-summary-list .tt-summary-value {
  color: var(--tt-ink);
  font-weight: 700;
  text-align: right;
}

.tt-summary-list .tt-summary-total {
  color: var(--tt-ink);
  font-size: 1rem;
  font-weight: 700;
}

.tt-result-callout {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #f0d49a;
  border-radius: 11px;
  background: var(--tt-warning-soft);
  color: #695000;
  font-size: 0.82rem;
  line-height: 1.55;
}

.tt-result-callout .bi {
  margin-right: 0.35rem;
}

.tt-form-note {
  margin: 0 0 1rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--tt-primary);
  border-radius: 0 8px 8px 0;
  background: var(--tt-primary-soft);
  color: var(--tt-primary-strong);
  font-size: 0.82rem;
  line-height: 1.5;
}

.tt-error-summary {
  margin-bottom: 1rem;
}

.tt-inline-grid {
  display: grid;
  gap: 0 1rem;
}

/* Invoice */
.tt-invoice-paper {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2.5rem);
  border: 1px solid var(--tt-border);
  border-radius: 14px;
  background: #fff;
  color: #142033;
  box-shadow: var(--tt-shadow);
}

.tt-invoice-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid #142033;
}

.tt-invoice-kicker {
  margin: 0 0 0.3rem;
  color: var(--tt-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tt-invoice-business {
  margin: 0 0 0.35rem;
  color: #142033;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.tt-invoice-contact {
  margin: 0;
  color: #53637a;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-line;
}

.tt-invoice-meta {
  display: grid;
  gap: 0.35rem;
  min-width: 190px;
  text-align: right;
}

.tt-invoice-meta div {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.82rem;
}

.tt-invoice-meta dt,
.tt-invoice-meta span {
  color: #53637a;
}

.tt-invoice-meta dd,
.tt-invoice-meta strong {
  margin: 0;
  color: #142033;
  font-weight: 700;
}

.tt-invoice-parties {
  display: grid;
  gap: 1rem;
  margin: 1.2rem 0;
}

.tt-invoice-parties h3 {
  margin: 0 0 0.25rem;
  color: #53637a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tt-invoice-parties p {
  margin: 0;
  color: #142033;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-line;
}

.tt-invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tt-invoice-table th {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #c9d3e0;
  color: #53637a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.tt-invoice-table th:not(:first-child),
.tt-invoice-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.tt-invoice-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #e4eaf1;
  vertical-align: top;
}

.tt-invoice-table .tt-invoice-empty {
  padding: 1.2rem 0.5rem;
  color: #7a8798;
  font-size: 0.82rem;
  text-align: center;
}

.tt-invoice-totals {
  display: grid;
  gap: 0.35rem;
  max-width: 330px;
  margin: 1rem 0 0 auto;
}

.tt-invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  color: #53637a;
  font-size: 0.84rem;
}

.tt-invoice-totals strong {
  color: #142033;
}

.tt-invoice-totals .tt-invoice-grand {
  margin-top: 0.2rem;
  padding-top: 0.55rem;
  border-top: 2px solid #142033;
  color: #142033;
  font-size: 1rem;
  font-weight: 700;
}

.tt-invoice-grand strong {
  font-size: 1.2rem;
}

.tt-invoice-notes {
  margin-top: 1.3rem;
  padding-top: 1rem;
  border-top: 1px solid #e4eaf1;
}

.tt-invoice-notes h3 {
  margin: 0 0 0.2rem;
  color: #53637a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tt-invoice-notes p {
  margin: 0 0 0.75rem;
  color: #26344a;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-line;
}

.tt-invoice-notes p:last-child {
  margin-bottom: 0;
}

.tt-invoice-thanks {
  margin: 1.2rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid #e4eaf1;
  color: #53637a;
  font-size: 0.8rem;
  text-align: center;
}

/* Proposal */
.tt-proposal-paper {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2.6rem);
  border: 1px solid var(--tt-border);
  border-radius: 14px;
  background: #fff;
  color: #1b2738;
  box-shadow: var(--tt-shadow);
}

.tt-proposal-paper h2,
.tt-proposal-paper h3 {
  color: #142033;
}

.tt-proposal-kicker {
  margin: 0 0 0.3rem;
  color: var(--tt-primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tt-proposal-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  line-height: 1.2;
}

.tt-proposal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  margin: 0 0 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 2px solid #142033;
  color: #53637a;
  font-size: 0.8rem;
}

.tt-proposal-section {
  margin-top: 1.15rem;
}

.tt-proposal-section h3 {
  margin: 0 0 0.35rem;
  color: #142033;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tt-proposal-section p,
.tt-proposal-section ul {
  margin: 0;
  color: #2a374b;
  font-size: 0.9rem;
  line-height: 1.65;
}

.tt-proposal-section ul {
  padding-left: 1.15rem;
}

.tt-proposal-section li {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.tt-proposal-amount {
  margin: 0 0 0.35rem;
  color: #142033;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}

.tt-proposal-editable {
  border-radius: 6px;
  outline: 1px dashed transparent;
  transition: background-color 0.15s ease, outline-color 0.15s ease;
}

.tt-proposal-editable:hover,
.tt-proposal-editable:focus {
  outline-color: #b9c9dc;
  background: #f7faff;
}

.tt-proposal-editable:focus {
  outline: 2px solid var(--tt-primary);
  outline-offset: 3px;
}

.tt-proposal-signoff {
  display: grid;
  gap: 1rem;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e8f0;
}

.tt-proposal-signoff div {
  padding-top: 1.4rem;
  border-top: 1px solid #142033;
  color: #53637a;
  font-size: 0.78rem;
}

.tt-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.tt-preview-shell {
  max-height: 780px;
  overflow: auto;
  padding: 0.25rem;
  border-radius: 14px;
  background: var(--tt-surface-2);
}

.tt-preview-shell .tt-invoice-paper,
.tt-preview-shell .tt-proposal-paper {
  box-shadow: none;
}

.tt-edit-hint {
  margin: 0.65rem 0 0;
  color: var(--tt-muted);
  font-size: 0.78rem;
}

.tt-example-values {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tt-example-values li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--tt-border);
  color: var(--tt-body);
  font-size: 0.85rem;
}

.tt-example-values li:last-child {
  border-bottom: 0;
}

.tt-example-values strong {
  color: var(--tt-ink);
}

.tt-print-note {
  margin-top: 0.8rem;
  color: var(--tt-muted);
  font-size: 0.78rem;
}

@media (min-width: 560px) {
  .tt-line-item-grid {
    grid-template-columns: minmax(0, 1fr) 90px 130px;
  }

  .tt-result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tt-invoice-parties {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tt-proposal-signoff {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tt-inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 820px) {
  .tt-tool-layout.tt-tool-layout--wide {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }

  .tt-result-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tt-result-card--span-2 {
    grid-column: span 2;
  }

  .tt-result-card--hero {
    grid-column: 1 / -1;
  }

  .tt-invoice-meta {
    min-width: 230px;
  }
}

@media (max-width: 819px) {
  .tt-preview-shell {
    max-height: none;
    overflow: visible;
  }
}

@media print {
  body.tt-print-page {
    background: #fff !important;
    padding-top: 0 !important;
    color: #000 !important;
  }

  body.tt-print-page #pre-load-animation,
  body.tt-print-page #main-header,
  body.tt-print-page #myBtn,
  body.tt-print-page .footer-section,
  body.tt-print-page .tt-skip-link,
  body.tt-print-page noscript,
  body.tt-print-page .tt-main > :not(.tt-print-section) {
    display: none !important;
  }

  body.tt-print-page .tt-main {
    display: block !important;
    overflow: visible !important;
  }

  body.tt-print-page .tt-print-section {
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.tt-print-page .tt-print-section .tt-container {
    max-width: none !important;
    padding: 0 !important;
  }

  body.tt-print-page .tt-print-section .tt-tool-layout {
    display: block !important;
    gap: 0 !important;
  }

  body.tt-print-page .tt-print-section .tt-tool-layout > * {
    display: none !important;
  }

  body.tt-print-page .tt-print-section .tt-tool-layout > .tt-print-target {
    display: block !important;
  }

  body.tt-print-page .tt-print-hide,
  body.tt-print-page .tt-preview-toolbar,
  body.tt-print-page .tt-edit-hint,
  body.tt-print-page .tt-print-note {
    display: none !important;
  }

  body.tt-print-page .tt-output-panel {
    position: static !important;
    top: auto !important;
  }

  body.tt-print-page .tt-print-target,
  body.tt-print-page .tt-preview-shell {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
  }

  body.tt-print-page .tt-invoice-paper,
  body.tt-print-page .tt-proposal-paper {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  body.tt-print-page .tt-invoice-table tr,
  body.tt-print-page .tt-proposal-section {
    break-inside: avoid;
  }

  body.tt-print-page a {
    color: inherit !important;
    text-decoration: none !important;
  }

  @page {
    margin: 14mm;
  }
}
