@import url('/public/assets/css/account.css?v=20260725-1');

:root {
    --blue: #2764ed;
    --blue-dark: #1747b8;
    --blue-soft: #eef4ff;
    --purple-soft: #f4efff;
    --purple-border: #d9c8ff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dce4f0;
    --surface: #ffffff;
    --background: #f6f8fc;
    --shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--background); }
button, input, select { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 4px 24px; border-bottom: 1px solid var(--border); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--blue); font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1.1rem; }
.brand span { margin-top: 2px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
nav { display: grid; gap: 7px; margin-top: 24px; }
.nav-item { padding: 12px 14px; border-radius: 10px; color: #475569; text-decoration: none; font-weight: 600; }
.nav-item:hover, .nav-item.active { color: var(--blue-dark); background: var(--blue-soft); }
.nav-item[aria-disabled="true"] { cursor: default; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; color: var(--muted); font-size: .8rem; }
.content { padding: 34px 4vw 60px; }
.hero { width: min(760px, 100%); margin: 0 auto; text-align: center; }
.badge { display: inline-flex; padding: 7px 13px; border-radius: 999px; color: var(--blue-dark); background: var(--blue-soft); font-size: .82rem; font-weight: 700; }
h1 { margin: 16px 0 8px; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.hero > p { margin: 0; color: var(--muted); font-size: 1rem; }
.search-box { display: flex; gap: 10px; margin-top: 26px; padding: 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 13px 15px; background: transparent; }
.search-box button { border: 0; padding: 12px 24px; border-radius: 11px; color: #fff; background: var(--blue); font-weight: 800; cursor: pointer; }
.search-box button:hover { background: var(--blue-dark); }
.status { min-height: 24px; margin-top: 11px !important; font-size: .82rem !important; color: var(--muted) !important; }
.error-message { color: #b91c1c !important; }
.feature-grid { width: min(900px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 46px auto 0; }
.feature-card { padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 22px rgba(15, 23, 42, .04); text-align: center; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 12px; color: var(--blue-dark); background: var(--blue-soft); font-size: 1.25rem; font-weight: 900; }
.feature-card h2 { margin: 0 0 9px; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.results-section { width: min(760px, 100%); margin: 30px auto 0; }
.results-list { display: grid; gap: 20px; }
.result-card { background: var(--surface); border: 1px solid var(--border); border-radius: 17px; box-shadow: var(--shadow); }
.result-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.result-card.result-card-integrated { display: flex !important; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; }
.result-card-integrated .result-summary { width: 100%; display: grid; grid-template-columns: minmax(185px, .95fr) minmax(0, 2.15fr) minmax(125px, .72fr); gap: 18px; align-items: stretch; padding: 24px; background: #fff; }
.result-card-integrated .result-summary > div { min-width: 0; padding: 16px; border-radius: 13px; background: #f8fafc; }
.result-card-integrated .result-code { background: #f8fbff; overflow: hidden; }
.result-code strong { display: block; max-width: 100%; color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: clamp(1.3rem, 2.25vw, 1.72rem); letter-spacing: .025em; line-height: 1.2; white-space: nowrap; }
.result-code small { display: block; margin-top: 7px; color: #475569; font-weight: 700; }
.result-description p { margin: 0; line-height: 1.55; font-size: .98rem; }
.tipi-parent { margin: -3px -3px 14px; padding: 11px 12px; border: 1px solid #d7e4f7; border-radius: 10px; background: #eef5ff; }
.tipi-parent span { margin-bottom: 4px; color: #2859ad; }
.tipi-parent p { color: #17345f; font-weight: 700; }
.result-rate { text-align: right; display: flex; flex-direction: column; justify-content: center; }
.result-rate strong { font-size: 1.25rem; }

.pis-cofins-panel { width: 100%; padding: 20px 24px 24px; border-top: 1px solid #d7e6d9; background: #f3faf4; }
.pis-cofins-title { color: #27733b !important; margin-bottom: 12px !important; }
.pis-cofins-grid { display: grid; grid-template-columns: 1fr .72fr 1.7fr; gap: 10px; }
.pis-cofins-grid > div { min-width: 0; padding: 12px 13px; border: 1px solid #d7e6d9; border-radius: 11px; background: rgba(255,255,255,.9); }
.pis-cofins-grid strong { display: block; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.4; }
.pis-cofins-grid > div:nth-child(2) strong { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 1.05rem; }

.legal-rule-panel { width: 100%; padding: 20px 24px 24px; border-top: 1px solid #cbdcff; background: #edf4ff; }
.legal-rule-heading { display: flex; justify-content: flex-start; gap: 16px; align-items: center; margin-bottom: 14px; }
.legal-rule-heading > div { min-width: 0; }
.legal-rule-heading strong { display: block; color: #173f96; font-size: 1.08rem; line-height: 1.35; }
.legal-label { color: #2259c7 !important; }
.review-badge { display: none !important; }
.review-approved, .review-active { background: #dcfce7; color: #166534 !important; }
.review-rejected { background: #fee2e2; color: #991b1b !important; }
.legal-rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.legal-rule-grid > div { min-width: 0; padding: 12px 13px; border: 1px solid #d5e2ff; border-radius: 11px; background: rgba(255, 255, 255, .86); }
.legal-rule-grid span { margin-bottom: 5px; }
.legal-rule-grid strong { display: block; overflow-wrap: anywhere; font-size: .9rem; line-height: 1.35; }
.legal-rule-grid > div:nth-child(-n+2) strong { color: #173f96; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 1.02rem; }
.classification-card small { display: block; margin-top: 7px; color: #4b6388; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .78rem; font-weight: 650; line-height: 1.35; }
.legal-description { margin: 12px 0 0; padding: 13px 14px; border: 1px solid #d5e2ff; border-radius: 11px; background: #fff; color: #24436f; line-height: 1.5; }
.legal-more { display: block; margin-top: 9px; color: var(--muted); }
.legal-rule-empty { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 18px 24px; border-top: 1px solid var(--border); background: #f8fafc; }
.legal-rule-empty strong { color: #475569; }
.legal-rule-empty span { margin: 0; color: var(--muted); font-size: .86rem; text-transform: none; letter-spacing: 0; }
.integral-classification { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.integral-classification span { padding: 8px 11px; border: 1px solid #dbe4f2; border-radius: 9px; background: #fff; }
.integral-classification strong { color: #173f96; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.integral-classification small { display: block; margin-top: 4px; color: #64748b; font-size: .78rem; line-height: 1.35; }
.empty-state { padding: 44px 24px; text-align: center; background: var(--surface); border: 1px dashed #bdc9d9; border-radius: 16px; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p, .results-limit { color: var(--muted); }
.results-limit { margin: 18px 0 0; text-align: center; font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.history-content { padding-top: 28px; }
.history-page { width: min(1120px, 100%); margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin-top: 13px; font-size: clamp(2rem, 4vw, 2.8rem); }
.page-heading p { margin: 0; color: var(--muted); }
.primary-link, .secondary-link, .danger-link { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; padding: 11px 16px; text-decoration: none; font-weight: 750; cursor: pointer; }
.primary-link { color: #fff; background: var(--blue); }
.primary-link:hover { background: var(--blue-dark); }
.secondary-link { color: #475569; background: #eef2f7; }
.danger-link { padding: 9px 12px; color: #b42318; background: #fff1f0; }
.small-link { padding: 9px 12px; font-size: .84rem; }
.notice { margin-bottom: 18px; padding: 12px 15px; border-radius: 11px; font-weight: 650; }
.success-notice { color: #166534; border: 1px solid #bbebc8; background: #effbf2; }
.error-notice { color: #991b1b; border: 1px solid #fecaca; background: #fff1f2; }
.history-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.history-summary article { padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 7px 20px rgba(15,23,42,.04); }
.history-summary span, .history-summary small { display: block; color: var(--muted); }
.history-summary span { font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.history-summary strong { display: block; margin: 7px 0 3px; font-size: 1.8rem; }
.history-summary small { font-size: .8rem; }
.history-filters { display: grid; grid-template-columns: minmax(230px, 1.6fr) minmax(150px, .7fr) minmax(150px, .7fr) auto auto; gap: 12px; align-items: end; margin: 22px 0; padding: 18px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.history-filters label { display: block; margin-bottom: 7px; color: #475569; font-size: .78rem; font-weight: 750; }
.history-filters input, .history-filters select { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #ccd7e5; border-radius: 9px; color: var(--text); background: #fff; outline: 0; }
.history-filters input:focus, .history-filters select:focus { border-color: #7aa2f7; box-shadow: 0 0 0 3px rgba(39,100,237,.1); }
.history-filters button { min-height: 43px; padding: 10px 18px; border: 0; border-radius: 9px; color: #fff; background: var(--blue); font-weight: 800; cursor: pointer; }
.history-section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin: 26px 0 13px; }
.history-section-heading h2, .history-section-heading p { margin: 0; }
.history-section-heading p, .history-section-heading small { color: var(--muted); }
.history-section-heading p { margin-top: 5px; font-size: .88rem; }
.history-section-heading small { max-width: 360px; text-align: right; line-height: 1.4; }
.history-list { display: grid; gap: 14px; }
.history-card { overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 22px rgba(15,23,42,.045); }
.history-card-main { display: grid; grid-template-columns: minmax(220px, 1.5fr) minmax(220px, 1fr) auto; gap: 18px; align-items: center; padding: 18px; }
.history-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.mode-badge, .status-badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.mode-badge { color: #315b9f; background: #edf4ff; }
.status-success { color: #166534; background: #dcfce7; }
.status-empty { color: #854d0e; background: #fef3c7; }
.status-error { color: #991b1b; background: #fee2e2; }
.history-query-block h3 { margin: 9px 0 4px; font-size: 1.08rem; overflow-wrap: anywhere; }
.history-query-block p { margin: 0; color: var(--muted); font-size: .8rem; }
.history-card-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.history-card-metrics > div { min-width: 0; padding: 10px 12px; border-radius: 10px; background: #f8fafc; }
.history-card-metrics span, .history-result-row span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.history-card-metrics strong { display: block; overflow-wrap: anywhere; font-size: .9rem; }
.history-actions { display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.history-actions form { margin: 0; }
.history-actions .danger-link { width: 100%; }
.history-details { border-top: 1px solid var(--border); background: #fbfcfe; }
.history-details summary { padding: 12px 18px; color: #315b9f; font-size: .84rem; font-weight: 750; cursor: pointer; }
.history-result-list { display: grid; gap: 8px; padding: 0 18px 18px; }
.history-result-row { display: grid; grid-template-columns: minmax(120px,.7fr) minmax(220px,2fr) minmax(140px,1fr) minmax(160px,1.2fr) minmax(110px,.7fr); gap: 10px; padding: 12px; border: 1px solid #e1e8f2; border-radius: 10px; background: #fff; }
.history-result-row > div { min-width: 0; }
.history-result-row strong { display: block; overflow-wrap: anywhere; font-size: .82rem; line-height: 1.35; }
.history-result-ncm strong { color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .95rem; }
.history-error-detail { padding: 12px 18px; border-top: 1px solid #fecaca; color: #991b1b; background: #fff7f7; font-size: .84rem; }
.history-empty .primary-link { margin-top: 8px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; }
.pagination a { padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--blue-dark); background: #fff; text-decoration: none; font-weight: 700; }
.pagination span { color: var(--muted); font-size: .86rem; }

@media (max-width: 1100px) {
    .history-card-main { grid-template-columns: 1fr 1fr; }
    .history-actions { grid-column: 1 / -1; flex-direction: row; }
    .history-actions form { width: auto; }
    .history-actions .danger-link { width: auto; }
    .history-result-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .history-result-description { grid-column: span 2; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; padding: 14px; }
    nav { display: flex; overflow-x: auto; margin-top: 14px; }
    .nav-item { white-space: nowrap; }
    .sidebar-footer { display: none; }
    .history-filters { grid-template-columns: 1fr 1fr; }
    .filter-search { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .content { padding: 26px 14px 42px; }
    .feature-grid { grid-template-columns: 1fr; }
    .result-card-integrated .result-summary { grid-template-columns: 1fr; padding: 16px; }
    .result-code strong { font-size: 1.55rem; white-space: normal; }
    .result-rate { text-align: left; }
    .pis-cofins-grid { grid-template-columns: 1fr; }
    .legal-rule-grid { grid-template-columns: 1fr 1fr; }
    .page-heading, .history-section-heading { align-items: flex-start; flex-direction: column; }
    .history-section-heading small { text-align: left; }
    .history-summary { grid-template-columns: 1fr 1fr; }
    .history-card-main { grid-template-columns: 1fr; }
    .history-actions { grid-column: auto; }
}

@media (max-width: 520px) {
    .search-box { flex-direction: column; }
    .search-box button { width: 100%; }
    .legal-rule-heading { flex-direction: column; align-items: flex-start; }
    .legal-rule-grid { grid-template-columns: 1fr; }
    .pis-cofins-panel, .legal-rule-panel, .legal-rule-empty { padding-left: 16px; padding-right: 16px; }
    .history-summary, .history-filters, .history-card-metrics, .history-result-row { grid-template-columns: 1fr; }
    .filter-search, .history-result-description { grid-column: auto; }
    .history-actions { flex-direction: column; }
    .history-actions form, .history-actions .danger-link, .history-actions .primary-link { width: 100%; }
}
