:root {
  --tf-bg: #eef1f6;
  --tf-surface: #ffffff;
  --tf-surface-2: #f8f9fc;
  --tf-border: #e2e8f0;
  --tf-border-focus: #c41e3a;
  --tf-text: #0f172a;
  --tf-text-muted: #64748b;
  --tf-brand: #c41e3a;
  --tf-brand-dark: #9b1530;
  --tf-dark: #111827;
  --tf-radius: 12px;
  --tf-radius-sm: 8px;
  --tf-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --tf-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --tf-font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

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

.tf-orcamento-body {
  margin: 0;
  background: var(--tf-bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(196, 30, 58, 0.08), transparent);
  color: var(--tf-text);
  font-family: var(--tf-font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.tf-orc-app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* —— Toasts —— */
.tf-orc-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.tf-orc-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--tf-surface);
  border-radius: var(--tf-radius-sm);
  box-shadow: var(--tf-shadow-lg);
  border-left: 4px solid #64748b;
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
}

.tf-orc-toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.tf-orc-toast--success {
  border-left-color: #16a34a;
}

.tf-orc-toast--error {
  border-left-color: var(--tf-brand);
}

.tf-orc-toast--info {
  border-left-color: #2563eb;
}

.tf-orc-toast__text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--tf-text);
}

.tf-orc-toast__close {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--tf-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 4px;
}

.tf-orc-toast__close:hover {
  color: var(--tf-text);
}

/* —— Header —— */
.tf-orc-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -20px 28px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tf-border);
}

.tf-orc-header--sticky {
  position: sticky;
  top: 0;
  z-index: 100;
}

.tf-orc-header__brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tf-orc-header__brand img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.tf-orc-header__brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tf-orc-header__brand span {
  display: block;
  font-size: 0.8rem;
  color: var(--tf-text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.tf-orc-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tf-orc-badge {
  display: inline-block;
  padding: 8px 14px;
  background: var(--tf-dark);
  color: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 4px;
}

/* —— Layout —— */
.tf-orc-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .tf-orc-grid {
    grid-template-columns: 1fr;
  }
}

.tf-orc-card {
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 22px 24px;
  box-shadow: var(--tf-shadow);
  margin-bottom: 20px;
}

.tf-orc-card h2 {
  margin: 0 0 18px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tf-text-muted);
}

/* —— Forms —— */
.tf-orc-field {
  margin-bottom: 16px;
}

.tf-orc-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--tf-text);
}

.tf-orc-field input,
.tf-orc-field select,
.tf-orc-field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  background: var(--tf-surface);
  color: var(--tf-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tf-orc-field input:focus,
.tf-orc-field select:focus,
.tf-orc-field textarea:focus {
  outline: none;
  border-color: var(--tf-border-focus);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.tf-orc-field textarea {
  min-height: 88px;
  resize: vertical;
}

.tf-orc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.tf-orc-search-wrap {
  position: relative;
}

.tf-orc-suggestions {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--tf-shadow-lg);
  display: none;
}

.tf-orc-suggestions.is-open {
  display: block;
}

.tf-orc-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  border-bottom: 1px solid var(--tf-surface-2);
  color: var(--tf-text);
}

.tf-orc-suggestion:hover {
  background: var(--tf-surface-2);
}

.tf-orc-suggestion small {
  display: block;
  color: var(--tf-text-muted);
  margin-top: 3px;
  font-size: 0.8rem;
}

/* —— Table —— */
.tf-orc-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.tf-orc-items-table th {
  padding: 10px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tf-text-muted);
  border-bottom: 2px solid var(--tf-border);
  text-align: left;
}

.tf-orc-items-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--tf-surface-2);
  vertical-align: middle;
}

.tf-orc-items-table input {
  padding: 8px 10px;
  border: 1px solid var(--tf-border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.tf-orc-items-table .tf-orc-num {
  width: 72px;
}

.tf-orc-items-table .tf-orc-price {
  width: 96px;
}

.tf-orc-remove {
  background: none;
  border: none;
  color: var(--tf-brand);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.tf-orc-remove:hover {
  background: #fde8ea;
}

/* —— Totals —— */
.tf-orc-totals {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--tf-border);
}

.tf-orc-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.92rem;
  color: var(--tf-text-muted);
}

.tf-orc-total-line span:last-child {
  color: var(--tf-text);
  font-variant-numeric: tabular-nums;
}

.tf-orc-total-line--highlight {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--tf-brand) !important;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--tf-border);
}

.tf-orc-total-line--highlight span {
  color: var(--tf-brand) !important;
}

/* —— Actions bar —— */
.tf-orc-actions-bar {
  margin-top: 8px;
  padding: 20px 24px;
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  box-shadow: var(--tf-shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}

.tf-orc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tf-orc-actions--send {
  padding-left: 24px;
  border-left: 1px solid var(--tf-border);
}

.tf-orc-actions-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tf-text-muted);
  margin-right: 4px;
}

@media (max-width: 768px) {
  .tf-orc-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .tf-orc-actions--send {
    padding-left: 0;
    border-left: none;
    padding-top: 16px;
    border-top: 1px solid var(--tf-border);
  }
}

/* —— Buttons —— */
.tf-orc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--tf-radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  white-space: nowrap;
}

.tf-orc-btn:hover {
  transform: translateY(-1px);
}

.tf-orc-btn:active {
  transform: translateY(0);
}

.tf-orc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tf-orc-btn--primary {
  background: linear-gradient(180deg, #d42242 0%, var(--tf-brand) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.35);
}

.tf-orc-btn--dark {
  background: var(--tf-dark);
  color: #fff;
}

.tf-orc-btn--outline {
  background: var(--tf-surface);
  color: var(--tf-text);
  border: 1px solid var(--tf-border);
}

.tf-orc-btn--ghost {
  background: var(--tf-surface-2);
  color: var(--tf-text);
  border: 1px solid var(--tf-border);
}

.tf-orc-btn--wa {
  background: #25d366;
  color: #fff;
}

.tf-orc-btn--telegram {
  background: #229ed9;
  color: #fff;
}

.tf-orc-btn--email {
  background: #4f46e5;
  color: #fff;
}

.tf-orc-btn--danger {
  background: var(--tf-brand);
  color: #fff;
}

.tf-orc-btn--secondary {
  background: var(--tf-surface);
  color: var(--tf-text);
  border: 1px solid var(--tf-border);
}

/* —— History —— */
.tf-orc-history-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-surface-2);
}

.tf-orc-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-bottom: 1px solid var(--tf-border);
}

.tf-orc-history-item:last-child {
  border-bottom: none;
}

.tf-orc-history-item__main {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--tf-text);
  border-radius: 6px;
}

.tf-orc-history-item__main:hover {
  background: var(--tf-surface);
}

.tf-orc-history-delete {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--tf-radius-sm);
  background: transparent;
  color: var(--tf-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tf-orc-history-delete:hover {
  background: #fde8ea;
  color: var(--tf-brand);
}

/* —— Modal —— */
.tf-orc-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tf-orc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.tf-orc-modal__box {
  position: relative;
  max-width: 420px;
  width: 100%;
  background: var(--tf-surface);
  border-radius: var(--tf-radius);
  padding: 28px;
  box-shadow: var(--tf-shadow-lg);
}

.tf-orc-modal__box h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.tf-orc-modal__box p {
  margin: 0 0 22px;
  color: var(--tf-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.tf-orc-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* —— Login —— */
.tf-orc-login {
  max-width: 420px;
  margin: 12vh auto;
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius);
  padding: 36px;
  box-shadow: var(--tf-shadow-lg);
}

.tf-orc-login h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.tf-orc-login p {
  margin: 0 0 24px;
  color: var(--tf-text-muted);
}

.tf-orc-login__submit {
  width: 100%;
  margin-top: 8px;
}

.tf-orc-msg {
  padding: 12px 14px;
  border-radius: var(--tf-radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.tf-orc-msg--error {
  background: #fde8ea;
  color: var(--tf-brand-dark);
}

.tf-orc-hint {
  font-size: 0.82rem;
  color: var(--tf-text-muted);
  margin: 0;
}

.tf-orc-hidden {
  display: none !important;
}

.tf-orc-frete-custom {
  margin-top: 0;
}
