/* ─── Tax Center ─────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty / connect state */
.tax-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 24px 40px;
  text-align: center;
}

.tax-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.tax-empty-icon .material-symbols-outlined {
  font-size: 28px;
  color: var(--tsec);
}

.tax-empty-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 380px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.tax-empty-sub {
  color: var(--tsec);
  font-size: 14px;
  max-width: 340px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.tax-connect-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.tax-connect-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 44px;
  border: 1px solid var(--border-s);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.tax-connect-btn:hover:not(:disabled) {
  background: var(--primary-pale);
}

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

.tax-soon {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tsec);
  background: var(--grey-pill);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Connected header */
.tax-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tax-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tax-account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.tax-account-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-strong);
  flex-shrink: 0;
}

.tax-sync-info {
  font-size: 12px;
  color: var(--tsec);
}

.tax-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabs */
.tax-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tax-tab {
  padding: 12px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tax-tab:hover {
  color: var(--text);
}

.tax-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Invoice list */
.tax-list {
  flex: 1;
  overflow-y: auto;
}

.tax-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--tsec);
  text-align: center;
}

.tax-list-empty .material-symbols-outlined {
  font-size: 32px;
  opacity: 0.4;
}

.tax-list-empty p {
  font-size: 13px;
  line-height: 1.5;
}

.tax-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

#view-taxcenter .tax-row:hover {
  background: var(--primary-pale);
}

.tax-row-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tax-row-info {
  flex: 1;
  min-width: 0;
}

.tax-row-from {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tax-row-subject {
  font-size: 12px;
  color: var(--tsec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.tax-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.tax-attach-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--tsec);
  background: var(--grey-pill);
  padding: 2px 8px;
  border-radius: 4px;
}

.tax-row-date {
  font-size: 12px;
  color: var(--tsec);
  white-space: nowrap;
}

.tax-row-actions {
  display: flex;
  gap: 2px;
}

/* PDF Preview Modal */
.tax-preview-card {
  background: var(--white);
  border-radius: var(--r-lg);
  width: min(860px, 92vw);
  height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: relative;
}

.tax-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tax-preview-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
}

.tax-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pdf-bars-loader {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 28px;
}

.pdf-bars-loader span {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: var(--tsec, #aaa);
  animation: bars-bounce 1s ease-in-out infinite;
}

.pdf-bars-loader span:nth-child(1) { animation-delay: 0s;    height: 40%; }
.pdf-bars-loader span:nth-child(2) { animation-delay: 0.1s;  height: 70%; }
.pdf-bars-loader span:nth-child(3) { animation-delay: 0.2s;  height: 100%; }
.pdf-bars-loader span:nth-child(4) { animation-delay: 0.3s;  height: 70%; }
.pdf-bars-loader span:nth-child(5) { animation-delay: 0.4s;  height: 40%; }

@keyframes bars-bounce {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.tax-preview-iframe {
  flex: 1;
  border: none;
  width: 100%;
}

/* Scanning spinner */
.tax-scan-btn-spinning .material-symbols-outlined {
  animation: spin 1s linear infinite;
  display: inline-block;
}

/* ── Shell & Navigation ──────────────────────────────────── */
.tc-shell {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.tc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tc-topbar-left { display: flex; align-items: center; gap: 14px; }
.tc-topbar-right { display: flex; align-items: center; gap: 8px; }

.tc-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tc-tab {
  padding: 12px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tc-tab:hover { color: var(--text); }
.tc-tab.active { color: var(--text); border-bottom-color: var(--text); }

.tc-body {
  flex: 1;
}

/* ── Alert Banner ────────────────────────────────────────── */
.tc-alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  flex-shrink: 0;
}
.tc-alert-urgent { background: var(--danger-bg); color: var(--danger); }
.tc-alert-warning { background: #fff8e6; color: #92400e; }
.tc-alert-info    { background: var(--primary-pale); color: var(--text); }
.tc-alert-icon    { font-size: 16px !important; flex-shrink: 0; }
.tc-alert-msg     { flex: 1; }
.tc-alert-action  { background: none; border: 1px solid currentColor; border-radius: 6px; padding: 2px 10px; font-size: 12px; font-weight: 500; cursor: pointer; color: inherit; font-family: inherit; }
.tc-alert-dismiss { background: none; border: none; cursor: pointer; color: inherit; padding: 2px; line-height: 1; display: flex; }

/* ── Inbox Alerts ────────────────────────────────────────── */
.tc-inbox-alerts { border-bottom: 1px solid var(--border); }
.tc-alert-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 24px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.tc-alert-row:last-child { border-bottom: none; }
.tc-alert-row.tc-alert-warning { background: #fffbf0; }
.tc-alert-row.tc-alert-info    { background: var(--bg); }
.tc-alert-link { background:none; border:none; cursor:pointer; font-size:12px; font-weight:600; color:var(--primary); text-decoration:underline; font-family:inherit; }
.tc-alert-x    { background:none; border:none; cursor:pointer; color:var(--tsec); display:flex; padding:0; margin-left:auto; }

/* ── Inbox ───────────────────────────────────────────────── */
.tc-inbox { display: flex; flex-direction: column; }

.tc-inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tc-inbox-filters { display: flex; gap: 4px; }
.tc-inbox-actions { display: flex; align-items: center; gap: 6px; }

.tc-inbox-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle, var(--bg2));
  flex-shrink: 0;
}
.tc-inbox-total-count { font-size: 12px; color: var(--tsec); }
.tc-inbox-total-val { font-size: 13px; font-weight: 600; color: var(--tpri); }
.tc-inbox-total-missing { font-weight: 400; color: var(--tsec); }

.tc-filter-btn {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.12s, color 0.12s;
}
.tc-filter-btn:hover { background: var(--bg); color: var(--text); }
.tc-filter-btn.active { background: var(--text); color: var(--white); border-color: var(--text); }
.tc-filter-btn.active .tc-count { background: rgba(255,255,255,0.2); color: var(--white); }

.tc-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--grey-pill);
  color: var(--tsec);
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}

.tc-upload-btn { cursor: pointer; }

.tc-invoice-list { }

/* ── Invoice Rows ────────────────────────────────────────── */
/* col: checkbox | info | amount | type | date | actions */
.tc-row-header,
.tc-row {
  display: grid;
  grid-template-columns: 36px 1fr 140px 90px 110px 68px;
  align-items: center;
  column-gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.tc-row-header {
  padding-top: 10px; padding-bottom: 10px;
  background: var(--bg);
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border);
}
.tc-row-header span {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--tsec);
}
.tc-row-header span:last-child { text-align: right; }
.tc-row {
  padding-top: 14px; padding-bottom: 14px;
  transition: background 0.1s;
}
.tc-row:hover { background: var(--primary-pale); }
.tc-row.selected { background: var(--bg); }
.tc-row.tc-row-dup { opacity: 0.65; }

.tc-checkbox {
  width: 15px; height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--text);
}
.tc-row-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tc-row-info { min-width: 0; padding-right: 24px; }
.tc-row-from {
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.tc-row-subject {
  font-size: 12px; color: var(--tsec);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 3px;
}
.tc-row-amount {
  font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-right: 24px;
}
.tc-row-type   { padding-right: 24px; }
.tc-row-date   { font-size: 13px; color: var(--tsec); white-space: nowrap; padding-right: 24px; }
.tc-row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* ── Jurisdiction pill ───────────────────────────────────── */
.tc-juris-pill {
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  padding: 2px 6px; border-radius: 4px; border: none;
  cursor: pointer; line-height: 1.5; flex-shrink: 0;
  min-width: 54px; text-align: center;
  transition: opacity 0.15s;
}
.tc-juris-pill:hover { opacity: 0.75; }
.tc-juris-local       { background: #fef3c7; color: #b45309; }
.tc-juris-foreign     { background: #dbeafe; color: #1d4ed8; }

.tc-cat-badge {
  font-size: 11px;
  background: var(--grey-pill);
  color: var(--tsec);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}
.tc-dup-badge {
  font-size: 10px;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}


/* ── Package Builder ─────────────────────────────────────── */
.tc-packages { display: flex; flex-direction: column; }

.tc-tax-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.tc-tax-profile-left { display: flex; align-items: center; gap: 10px; }
.tc-country-flag img { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; }
.tc-tax-profile-country { font-size: 13.5px; font-weight: 600; }
.tc-tax-profile-meta    { font-size: 12px; color: var(--tsec); margin-top: 1px; }
.tc-settings-link {
  display: flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 500; color: var(--tsec);
  background: none; border: none; cursor: pointer; font-family: inherit;
  padding: 6px 10px; border-radius: var(--r-md);
  transition: background 0.12s, color 0.12s;
}
.tc-settings-link:hover { background: var(--primary-pale); color: var(--text); }

.tc-period-selector {
  display: flex;
  gap: 6px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.tc-period-btn {
  position: relative;
  padding: 7px 16px;
  border: 1px solid var(--border-s);
  border-radius: 999px;
  background: var(--white);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--tsec);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  display: flex; align-items: center; gap: 6px;
}
.tc-period-btn:hover { border-color: var(--text); color: var(--text); }
.tc-period-btn.current { border-color: var(--primary); color: var(--primary); }
.tc-period-btn.active  { background: var(--text); color: var(--white); border-color: var(--text); }
.tc-period-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-strong);
}
.tc-period-btn.active .tc-period-dot { background: rgba(255,255,255,0.6); }

.tc-package-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 80px 24px; color: var(--tsec); text-align: center;
}
.tc-package-empty .material-symbols-outlined { font-size: 36px; opacity: 0.35; }
.tc-package-empty p { font-size: 13px; }

/* ── Package Cards ───────────────────────────────────────── */
.tc-pkg-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--white);
  overflow: hidden;
}

.tc-pkg-card-label {
  padding: 14px 20px 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tsec);
}

.tc-pkg-card-body {
  padding: 10px 20px 14px;
}

.tc-pkg-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.tc-pkg-sum-label {
  color: var(--tsec);
  font-size: 13px;
}

.tc-pkg-sum-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0 4px;
}

.tc-pkg-sum-row-total {
  font-weight: 600;
}

.tc-pkg-toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--tsec);
  padding: 8px 0 0;
  transition: color 0.12s;
}
.tc-pkg-toggle-btn:hover { color: var(--text); }

.tc-pkg-detail { display: none; border-top: 1px solid var(--border); }
.tc-pkg-detail.open { display: block; }

.tc-pkg-detail-group {
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tc-pkg-detail-group:last-child { border-bottom: none; }

.tc-pkg-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.tc-pkg-detail-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--tsec);
}

.tc-pkg-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--tsec);
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}

.tc-pkg-detail-row-total {
  color: var(--text);
  font-weight: 500;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 6px;
}

/* ── Package export prompt (blank state) ─────────────────── */
.tc-pkg-export-prompt {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 72px 24px; color: var(--tsec); text-align: center;
}
.tc-pkg-export-prompt .material-symbols-outlined { font-size: 40px; opacity: 0.3; }
.tc-pkg-export-prompt p { margin: 0; font-size: 14px; font-weight: 500; }
.tc-pkg-export-hint { font-size: 12px !important; font-weight: 400 !important; line-height: 1.6; }

/* ── Package View (redesigned) ───────────────────────────── */
.tc-package-view {
  display: flex;
  flex-direction: column;
  padding: 20px 24px 32px;
  gap: 0;
}

.tc-package-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.tc-package-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }

/* ── Section rows (Expenses / Income) ───────────────────── */
.tc-pkg-section-row {
  margin: 0 -24px;
  padding: 16px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.tc-pkg-section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--tsec); margin-bottom: 10px;
}

/* ── Panels inside each section ─────────────────────────── */
.tc-pkg-panels { display: flex; gap: 10px; }
.tc-pkg-panel {
  flex: 1; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  background: var(--white);
}
.tc-pkg-panel-results { background: var(--bg); }
.tc-pkg-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px 7px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tc-pkg-panel-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tc-pkg-panel-title-foreign { color: #1d4ed8 !important; }
.tc-pkg-panel-count { font-size: 11px; color: var(--tsec); }
.tc-pkg-panel-body  { padding: 0; background: var(--white); }
.tc-pkg-panel-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 13px; font-size: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.tc-pkg-panel-row:last-child { border-bottom: none; }
.tc-pkg-panel-row-total { font-weight: 600; background: var(--bg); }

/* ── Analytics stat card ─────────────────────────────────── */
.tc-pkg-analytics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0;
}
.tc-pkg-stat {
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  min-width: 0; /* prevent grid blowout */
  overflow: hidden;
}
.tc-pkg-stat-green  { background: #f0fdf4; border-color: #bbf7d0; }
.tc-pkg-stat-green .tc-pkg-stat-label { color: var(--green-strong); }
.tc-pkg-stat-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tsec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-pkg-stat-val    { font-size: 24px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-pkg-stat-sub    { font-size: 10.5px; color: var(--tsec); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Analytics wrap + breakdown ─────────────────────────── */
.tc-pkg-analytics-wrap { margin: 20px 0 4px; }

.tc-pkg-breakdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--tsec);
  padding: 8px 4px;
  transition: color 0.12s;
}
.tc-pkg-breakdown-btn:hover { color: var(--text); }

.tc-pkg-breakdown {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 24px;
}
.tc-pkg-breakdown > * { overflow: hidden; }
.tc-pkg-breakdown.open { grid-template-rows: 1fr; }

.tc-pkg-bd-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tc-pkg-bd-section {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--white);
}

.tc-pkg-bd-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tsec);
  padding: 12px 16px 4px;
}

.tc-pkg-bd-rows { padding: 0; }

.tc-pkg-bd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  font-size: 13px;
  color: var(--tsec);
  font-variant-numeric: tabular-nums;
}

.tc-pkg-bd-row-anchor {
  color: var(--text);
  font-weight: 600;
}

.tc-pkg-bd-row-total {
  color: var(--text);
  font-weight: 600;
}

.tc-pkg-bd-row-info {
  font-size: 12px;
  opacity: 0.75;
}


.tc-pkg-bd-takehome-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--r-lg);
  padding: 14px 16px;
  color: var(--green-strong);
}
.tc-pkg-bd-takehome-pill-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tc-pkg-bd-takehome-pill-val {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tc-pkg-bd-divider {
  border-top: 1px solid var(--border);
  margin: 4px 16px;
}

.tc-pkg-bd-sub {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
}

.tc-pkg-bd-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--tsec);
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}

/* ── Legacy summary bar (kept for _renderSummaryPanel) ───── */
.tc-pkg-summary-bar { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.tc-pkg-sum-col { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-right: 1px solid var(--border); }
.tc-pkg-sum-col:last-child { border-right: none; }
.tc-pkg-sum-col-highlight { background: var(--bg); }
.tc-pkg-sum-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tsec); }
.tc-pkg-sum-sub   { font-size: 11px; color: var(--tsec); opacity: 0.7; margin-top: 1px; }
.tc-pkg-sum-val   { font-size: 15px; font-weight: 700; margin-top: 2px; }
/* ── ZIP area ────────────────────────────────────────────── */
.tc-zip-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0 0;
  margin-top: 16px;
  flex-wrap: wrap;
}

.tc-zip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--text);
  color: var(--white);
  border: none;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.tc-zip-btn:hover:not(:disabled) { opacity: 0.85; }
.tc-zip-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tc-zip-ready {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tc-zip-ready.hidden { display: none; }

/* ── Assign-to-package button on rows ────────────────────── */
.tc-pkg-assign-btn { color: var(--tsec); }
.tc-pkg-assign-btn:hover { color: var(--text); }

/* ── Keep legacy colour helpers (used in summary bar) ───── */
.tc-sum-val  { font-weight: 500; }
.tc-sum-bold { font-weight: 700; }
.tc-sum-warn { color: var(--danger); }
.tc-sum-green{ color: var(--green-strong); font-weight: 700; }

.tc-bracket-breakdown {
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 8px 10px;
  margin: 4px 0;
}
.tc-bracket-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--tsec);
  padding: 2px 0;
}

.tc-summary-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── History ─────────────────────────────────────────────── */
.tc-history-list { padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; }
.tc-history-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.tc-history-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.tc-history-title { font-size: 14px; font-weight: 600; }
.tc-history-meta  { font-size: 12px; color: var(--tsec); margin-top: 2px; }
.tc-history-stats {
  display: flex; gap: 0;
}
.tc-hist-stat {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  font-size: 12px;
}
.tc-hist-stat:last-child { border-right: none; }
.tc-hist-stat span  { color: var(--tsec); margin-bottom: 3px; }
.tc-hist-stat strong{ font-size: 13px; font-weight: 600; }

/* ── Send Modal ──────────────────────────────────────────── */
/* ── Send Modal — compose ────────────────────────────────── */
.tc-send-card {
  background: var(--white);
  border-radius: var(--r-lg);
  width: min(680px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.tc-send-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 12px 16px;
  flex-shrink: 0;
  gap: 10px;
  user-select: none;
}
.tc-gm-header-title { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); }
.tc-gm-header-btns  { display: flex; align-items: center; gap: 2px; }
.tc-gm-hbtn {
  background: none; border: none; cursor: pointer;
  color: var(--tsec); padding: 4px 6px; border-radius: var(--r-md);
  display: flex; align-items: center; transition: background 0.1s, color 0.1s;
}
.tc-gm-hbtn:hover { background: var(--border); color: var(--text); }
.tc-gm-hbtn .material-symbols-outlined { font-size: 17px; }
.tc-send-body { overflow: hidden; padding: 0; flex: 1; display: flex; flex-direction: column; }

/* Field rows */
.tc-gm-field {
  display: flex; align-items: center;
  padding: 4px 18px; border-bottom: 1px solid var(--border);
  min-height: 42px; gap: 8px;
}
.tc-gm-label     { font-size: 13px; color: var(--tsec); width: 44px; flex-shrink: 0; }
.tc-gm-input     { flex: 1; border: none; outline: none; font-size: 13.5px; color: var(--text); background: transparent; font-family: inherit; padding: 0; min-width: 0; }
.tc-gm-subject   { font-weight: 500; }
.tc-gm-from-addr { flex: 1; font-size: 13.5px; color: var(--tsec); }
.tc-gm-cc-btns   { display: flex; gap: 8px; flex-shrink: 0; }
.tc-gm-cc-toggle {
  font-size: 12.5px; color: var(--tsec); background: none; border: none;
  cursor: pointer; padding: 0; font-family: inherit;
}
.tc-gm-cc-toggle:hover { color: var(--text); text-decoration: underline; }

/* Body area */
.tc-gm-body-wrap { flex: 1; display: flex; flex-direction: column; padding: 10px 18px 8px; overflow-y: auto; min-height: 0; }
.tc-gm-body      { flex: 1; min-height: 320px; width: 100%; border: none; outline: none; resize: none; font-size: 13.5px; color: var(--text); font-family: inherit; line-height: 1.6; box-sizing: border-box; background: transparent; }
/* Emoji picker */
.tc-emoji-picker { display:flex;flex-wrap:wrap;width:210px;background:var(--bg);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.18);padding:8px;gap:2px; }
.tc-emoji-opt    { width:34px;height:34px;display:flex;align-items:center;justify-content:center;font-size:19px;cursor:pointer;border-radius:6px;user-select:none; }
.tc-emoji-opt:hover { background:var(--hover); }

/* Formatting bar — floating pill inside body */
.tc-gm-fmt-bar {
  display: flex; align-items: center;
  padding: 4px 10px; gap: 2px;
  margin: 8px 0 4px;
  background: var(--bg);
  border-radius: 20px;
  flex-shrink: 0;
  width: fit-content;
}
.tc-gm-fmt-btn { background: none; border: none; cursor: pointer; color: var(--tsec); padding: 4px; border-radius: 4px; display: flex; align-items: center; transition: background 0.1s; }
.tc-gm-fmt-btn:hover { background: var(--border); color: var(--text); }
.tc-gm-fmt-btn .material-symbols-outlined { font-size: 17px; }
.tc-gm-fmt-sep  { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

/* Bottom toolbar */
.tc-gm-toolbar { display: flex; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); gap: 6px; flex-shrink: 0; }
.tc-gm-tool { background: none; border: none; cursor: pointer; color: var(--tsec); padding: 5px; border-radius: 50%; display: flex; align-items: center; transition: background 0.1s; }
.tc-gm-tool:hover { background: var(--bg); color: var(--text); }
.tc-gm-tool .material-symbols-outlined { font-size: 18px; }
.tc-gm-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.tc-gm-attachment {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: var(--bg);
  border-radius: 12px; font-size: 12px; color: var(--tsec);
  border: 1px solid var(--border);
}
.tc-gm-attachment .material-symbols-outlined { font-size: 13px; color: var(--tsec); }
.tc-gm-att-size { color: var(--tsec); opacity: 0.7; }
/* Send + Schedule: fully rounded + wide padding (scoped, doesn't affect other btn-sm) */
.tc-gm-toolbar .btn-primary,
.tc-gm-toolbar .btn-ghost { border-radius: 20px !important; padding: 7px 32px !important; }
/* Dark-filled action buttons (import / export) */
.btn-dark { background: #1a1a1a; color: #fff; border: 1px solid #1a1a1a; border-radius: var(--r-md); padding: 7px 14px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-weight: 500; transition: background 0.15s; min-width: 210px; }
.btn-dark:hover { background: #333; border-color: #333; }

/* Discard — same size as other tc-gm-tool icons, red on hover */
.tc-gm-discard { margin-left: auto; }
.tc-gm-discard:hover { color: #dc2626 !important; background: #fee2e2 !important; }
/* Extra attachment chips */
.tc-attach-chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Sent confirmation banner */
.tc-sent-banner { background: #e6f4ea; border-bottom: 1px solid #34a853; flex-shrink: 0; animation: overlay-in 0.2s ease; }
.tc-sent-banner.tc-sent-fading { animation: tc-sent-fade 0.6s ease forwards; }
@keyframes tc-sent-fade { from { opacity: 1; transform: translateY(0); max-height: 60px; } to { opacity: 0; transform: translateY(-6px); max-height: 0; padding: 0; border: none; } }
.tc-sent-banner-inner { display: flex; align-items: center; gap: 10px; padding: 10px 20px; }
.tc-sent-banner-text { flex: 1; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }

/* ── Settings: Tax Intelligence ──────────────────────────── */
.tc-brackets-list { display: flex; flex-direction: column; gap: 4px; }
.tc-bracket-item  {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.tc-bracket-item:last-child { border-bottom: none; }
.tc-bracket-rate { font-weight: 600; }

.tc-alert-prefs { display: flex; flex-direction: column; gap: 8px; }
.tc-alert-toggle {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; cursor: pointer;
}
.tc-alert-toggle input { accent-color: var(--text); width: 14px; height: 14px; cursor: pointer; }

/* ── Custom date picker popup ────────────────────────────── */
.tc-date-picker-popup {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  z-index: 9999;
  font-family: inherit;
  animation: tc-dr-in 0.16s cubic-bezier(0.2, 0, 0.2, 1);
}
@keyframes tc-dr-in {
  from { opacity: 0; transform: translate(-50%,-50%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}

/* ── New dual-calendar range picker ── */
.tc-dr-popup { width: 528px; padding: 20px; }

.tc-dr-inputs {
  display: flex; align-items: flex-end; gap: 10px;
  margin-bottom: 18px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tc-dr-field { flex: 1; }
.tc-dr-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--tsec); margin-bottom: 5px;
}
.tc-dr-input {
  width: 100%; box-sizing: border-box;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); color: var(--text);
  outline: none; font-variant-numeric: tabular-nums;
  transition: border-color 0.12s, background 0.12s;
}
.tc-dr-input:focus { border-color: var(--text); background: var(--white); }
.tc-dr-arrow { font-size: 15px; color: var(--tsec); padding-bottom: 9px; flex-shrink: 0; }

.tc-dr-cals { display: flex; gap: 0; }
.tc-dr-cal  { flex: 1; }
.tc-dr-divider { width: 1px; background: var(--border); margin: 0 18px; flex-shrink: 0; }

.tc-dr-month-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.tc-dr-nav {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  border-radius: 7px; color: var(--tsec); padding: 0;
  transition: background 0.1s, color 0.1s;
}
.tc-dr-nav:hover { background: var(--bg); color: var(--text); }
.tc-dr-nav .material-symbols-outlined { font-size: 16px; }
.tc-dr-month-name { font-size: 12.5px; font-weight: 600; color: var(--text); }

.tc-dr-daynames {
  display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 3px;
}
.tc-dr-daynames span {
  text-align: center; font-size: 10px; font-weight: 600;
  color: var(--tsec); padding: 3px 0; letter-spacing: 0.03em;
}

.tc-dr-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.tc-dr-day {
  position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: inherit;
}
.tc-dr-day::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
}
.tc-dr-day span {
  position: relative; z-index: 1;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; font-size: 12px; color: var(--text);
  transition: background 0.1s;
}
.tc-dr-day:hover:not(.tc-dr-other):not(.tc-dr-from):not(.tc-dr-to) span {
  background: var(--bg);
}
.tc-dr-other { pointer-events: none; }
.tc-dr-other span { color: color-mix(in srgb, var(--border) 100%, transparent); }

.tc-dr-today span { font-weight: 700; }
.tc-dr-today:not(.tc-dr-from):not(.tc-dr-to)::after {
  content: ''; position: absolute; bottom: 2px;
  left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--text); z-index: 2;
}

/* Range fill */
.tc-dr-mid::before    { background: #f0f0f0; }
.tc-dr-from::before   { background: linear-gradient(to right, transparent 50%, #f0f0f0 50%); }
.tc-dr-to::before     { background: linear-gradient(to left,  transparent 50%, #f0f0f0 50%); }
.tc-dr-from.tc-dr-to::before { background: none; }

/* Selected endpoints */
.tc-dr-from span, .tc-dr-to span {
  background: var(--text) !important;
  color: #fff !important;
  font-weight: 600;
}

.tc-dr-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ── Bulk bar (top of inbox) ─────────────────────────────── */
.tc-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--white);
  border-bottom: 0px solid var(--border);
  font-size: 13px;
  color: var(--text);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    max-height 0.22s ease,
    opacity    0.18s ease,
    padding    0.22s ease,
    border-width 0.22s ease,
    transform  0.18s ease;
}
.tc-bulk-bar.is-visible {
  max-height: 52px;
  padding: 8px 16px;
  border-bottom-width: 1px;
  opacity: 1;
  transform: translateY(0);
}
.tc-bulk-bar span { flex: 1; font-weight: 500; }

/* ── ZIP area — send variant ─────────────────────────────── */
.tc-zip-btn-send { background: var(--primary); color: #fff; border-color: var(--primary); }
.tc-zip-save { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; }

/* ── History — grouped layout ────────────────────────────── */
.tc-history-grouped { padding: 16px 24px; display: flex; flex-direction: column; gap: 0; }

.tc-hist-year-group {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 12px;
}

.tc-hist-year-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-family: inherit;
  gap: 10px;
  text-align: left;
}
.tc-hist-year-header:hover { background: var(--hover); }

.tc-hist-year-label { font-size: 14px; font-weight: 700; color: var(--text); }
.tc-hist-year-count { font-size: 12px; color: var(--tsec); }
.tc-hist-year-icon  { font-size: 18px; color: var(--tsec); margin-left: auto; }

.tc-hist-year-body { display: none; }
.tc-hist-year-body.open { display: block; }

/* ── History entry ───────────────────────────────────────── */
.tc-hist-entry {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tc-hist-entry-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tc-hist-period-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 64px;
  flex-shrink: 0;
}

.tc-hist-financials {
  display: flex;
  gap: 0;
  flex: 1;
  flex-wrap: wrap;
}

.tc-hist-fin-stat {
  display: flex;
  flex-direction: column;
  padding: 0 12px;
  border-right: 1px solid var(--border);
  font-size: 11px;
  gap: 2px;
}
.tc-hist-fin-stat:first-child { padding-left: 0; }
.tc-hist-fin-stat:last-child  { border-right: none; }
.tc-hist-fin-stat span   { color: var(--tsec); }
.tc-hist-fin-stat strong { font-size: 13px; font-weight: 600; }


.tc-hist-redownload {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  color: var(--tsec);
  transition: color 0.15s, border-color 0.15s;
}
.tc-hist-redownload:hover { color: var(--text); border-color: var(--text); }
.tc-hist-delete:hover { color: var(--danger); border-color: var(--danger); }

/* ── Event timeline ──────────────────────────────────────── */
.tc-hist-events { display: flex; flex-wrap: wrap; gap: 8px; }

.tc-hist-event {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--tsec);
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 3px 8px;
}
.tc-hist-event-sent { color: var(--primary); background: var(--primary-pale); }
.tc-hist-event-dl   { color: var(--text);    background: var(--hover); }
.tc-hist-event-cp   { color: var(--tsec); }

/* ── Invoice expand ──────────────────────────────────────── */
.tc-hist-inv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--tsec);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.tc-hist-inv-toggle:hover { color: var(--text); }

.tc-hist-inv-list { display: none; margin-top: 4px; }
.tc-hist-inv-list.open { display: block; }

.tc-hist-inv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.tc-hist-inv-row:last-child { border-bottom: none; }

.tc-hist-inv-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tsec);
  width: 52px;
  flex-shrink: 0;
}
.tc-hist-inv-name   { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-hist-inv-amount { font-weight: 600; color: var(--text); flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .tc-pkg-analytics        { grid-template-columns: 1fr 1fr; }
  .tc-pkg-summary-bar      { flex-wrap: wrap; }
  .tc-pkg-sum-col          { min-width: 50%; border-bottom: 1px solid var(--border); }
  .tc-history-stats        { flex-wrap: wrap; }
  .tc-hist-stat            { min-width: 50%; }
  .tc-hist-financials   { gap: 6px; }
  .tc-hist-fin-stat     { border-right: none; padding: 0; min-width: calc(50% - 3px); }
  .tc-hist-period-label { min-width: auto; }
}
