:root {
  --t10x-primary: #116b45;
  --t10x-primary-dark: #0a4d32;
  --t10x-accent: #d8f3e7;
  --t10x-danger: #a32222;
  --t10x-border: #d8e2dc;
  --t10x-muted: #58675f;
  --t10x-surface: #ffffff;
  --t10x-shadow: 0 16px 42px rgba(15, 50, 35, 0.1);
}

.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; }
.tool-hero { padding: clamp(2.4rem, 6vw, 5rem) 0 2.5rem; background: linear-gradient(135deg, #edf8f2 0%, #f8fbf9 58%, #e6f3ed 100%); border-block: 1px solid var(--t10x-border); }
.tool-hero__inner { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.7fr); gap: 2rem; align-items: center; }
.tool-hero h1 { max-width: 850px; margin: 0.35rem 0 1rem; font-size: clamp(2rem, 5vw, 3.8rem); line-height: 1.06; }
.tool-hero__lead { max-width: 760px; margin: 0; font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--t10x-muted); }
.tool-privacy { padding: 1.35rem; background: rgba(255, 255, 255, 0.86); border: 1px solid var(--t10x-border); border-radius: 18px; box-shadow: var(--t10x-shadow); }
.tool-privacy p { margin: 0.4rem 0 0; color: var(--t10x-muted); }
.tempo-app { padding-block: clamp(2rem, 5vw, 4rem); }
.tool-feedback { min-height: 1.5rem; margin: 0 0 1rem; color: var(--t10x-primary-dark); font-weight: 700; }
.tool-feedback.is-error, .tool-alert { color: var(--t10x-danger); }
.tool-grid { display: grid; grid-template-columns: minmax(290px, 0.85fr) minmax(0, 1.4fr); gap: 1.4rem; align-items: start; }
.tool-panel, .activities-panel, .data-panel, .active-timer, .report-panel { background: var(--t10x-surface); border: 1px solid var(--t10x-border); border-radius: 20px; box-shadow: var(--t10x-shadow); }
.tool-panel, .activities-panel { padding: clamp(1rem, 3vw, 1.7rem); }
.tool-panel h2, .activities-panel h2, .data-panel h2, .active-timer h2 { margin-top: 0; }
#activity-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.38rem; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label { color: #233c30; font-weight: 700; font-size: 0.92rem; }
.field small { color: var(--t10x-muted); }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 0.72rem 0.78rem; color: #183327; background: #fff; border: 1px solid #aebdb5; border-radius: 10px; font: inherit; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .tool-button:focus-visible, .file-button:focus-within { outline: 3px solid rgba(17, 107, 69, 0.28); outline-offset: 2px; border-color: var(--t10x-primary); }
.form-actions, .data-actions, .timer-actions, .activity-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.tool-button { min-height: 42px; padding: 0.65rem 0.9rem; color: #173a2b; background: #edf4f0; border: 1px solid #aac0b4; border-radius: 10px; font: inherit; font-weight: 750; line-height: 1.2; cursor: pointer; }
.tool-button:hover { background: #dfece5; }
.tool-button--primary { color: #fff; background: var(--t10x-primary); border-color: var(--t10x-primary); }
.tool-button--primary:hover { background: var(--t10x-primary-dark); }
.tool-button--quiet { background: #fff; }
.tool-button--danger { color: #8b1d1d; background: #fff5f5; border-color: #dfb4b4; }
.section-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.section-heading h2 { margin-bottom: 0; }
.count-badge { padding: 0.38rem 0.65rem; color: var(--t10x-primary-dark); background: var(--t10x-accent); border-radius: 999px; font-size: 0.86rem; font-weight: 750; white-space: nowrap; }
.activity-filters { display: grid; grid-template-columns: repeat(3, minmax(135px, 1fr)); gap: 0.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--t10x-border); }
.field--search { grid-column: span 2; }
.filter-actions { display: flex; align-items: end; }
.activity-list { display: grid; gap: 0.85rem; margin-top: 1rem; }
.empty-state { padding: 1rem; color: var(--t10x-muted); background: #f6f9f7; border-radius: 12px; text-align: center; }
.activity-card { padding: 1rem; border: 1px solid var(--t10x-border); border-radius: 14px; background: #fff; }
.activity-card__top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.activity-card h3 { margin: 0; font-size: 1.12rem; overflow-wrap: anywhere; }
.activity-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; }
.badge, .active-label { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.77rem; font-weight: 800; text-transform: capitalize; }
.badge { color: #244235; background: #edf4f0; }
.priority-alta { color: #814b00; background: #fff0cd; }
.priority-urgente { color: #8b1d1d; background: #ffe0e0; }
.priority-baixa { color: #26527a; background: #e4f1fd; }
.active-label { color: var(--t10x-primary-dark); background: var(--t10x-accent); }
.activity-description, .activity-notes { margin: 0.75rem 0; color: var(--t10x-muted); overflow-wrap: anywhere; }
.activity-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 0.55rem; margin: 0.9rem 0; }
.activity-details div { padding: 0.55rem; background: #f6f9f7; border-radius: 8px; }
.activity-details dt { color: var(--t10x-muted); font-size: 0.75rem; }
.activity-details dd { margin: 0.18rem 0 0; font-weight: 750; font-size: 0.88rem; }
.activity-details .metric-is-over { background: #fff6e2; }
.activity-details .metric-is-over dd { color: #8b4d00; }
.activity-details .metric-is-under { background: #edf6fd; }
.activity-details .metric-is-under dd { color: #26527a; }
.activity-details .metric-is-on-target { background: #eaf7f0; }
.activity-details .metric-is-on-target dd { color: var(--t10x-primary-dark); }
.active-timer { position: sticky; top: 82px; z-index: 30; display: grid; grid-template-columns: minmax(190px, .8fr) minmax(310px, 1.4fr) auto; gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; padding: 1.15rem 1.35rem; border-color: #80b89b; background: linear-gradient(110deg, #f3fbf6, #fff); }
.active-timer[hidden] { display: none; }
.active-timer h2 { margin-bottom: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.timer-live { display: grid; grid-template-columns: auto minmax(180px, 1fr); gap: 1rem; align-items: center; }
.timer-value { min-width: 9ch; color: var(--t10x-primary-dark); font: 800 clamp(1.55rem, 4vw, 2.35rem)/1 monospace; letter-spacing: 0.05em; }
.timer-progress-wrap { display: grid; gap: .45rem; }
.timer-progress-copy { display: flex; justify-content: space-between; gap: 1rem; color: var(--t10x-muted); font-size: .78rem; }
.timer-progress-copy strong { color: #244235; }
.timer-progress { width: 100%; height: 12px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--t10x-primary); }
.timer-progress::-webkit-progress-bar { background: #dfe9e3; border-radius: 999px; }
.timer-progress::-webkit-progress-value { background: var(--t10x-primary); border-radius: 999px; transition: width .35s linear; }
.timer-progress.is-warning { accent-color: #c27a00; }
.timer-progress.is-warning::-webkit-progress-value { background: #c27a00; }
.timer-progress.is-over { accent-color: var(--t10x-danger); }
.timer-progress.is-over::-webkit-progress-value { background: var(--t10x-danger); }
.data-panel { display: flex; justify-content: space-between; gap: 1.25rem; align-items: center; margin-top: 1.4rem; padding: 1.15rem 1.35rem; }
.data-panel h2 { margin-bottom: 0.35rem; font-size: 1.15rem; }
.data-panel p { max-width: 650px; margin: 0; color: var(--t10x-muted); }
.report-panel { margin-top: 1.4rem; padding: clamp(1rem, 3vw, 1.7rem); }
.report-heading { max-width: none; align-items: center; }
.report-heading p { margin: 0.35rem 0 0; color: var(--t10x-muted); }
.report-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; justify-content: flex-end; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin: 1.2rem 0 1.5rem; }
.report-summary article { padding: 1rem; background: #f3f8f5; border: 1px solid #dce8e1; border-radius: 12px; }
.report-summary span { display: block; color: var(--t10x-muted); font-size: 0.78rem; font-weight: 700; }
.report-summary strong { display: block; margin-top: 0.35rem; color: var(--t10x-primary-dark); font-size: clamp(1.15rem, 2.3vw, 1.55rem); }
.report-summary strong.is-over { color: #9a5400; }
.report-tabs { display: flex; gap: .35rem; margin-bottom: 1rem; padding: .3rem; background: #edf4f0; border-radius: 12px; }
.report-tab { padding: .65rem 1rem; color: #355044; background: transparent; border: 0; border-radius: 9px; font: inherit; font-weight: 750; cursor: pointer; }
.report-tab[aria-selected="true"] { color: #fff; background: var(--t10x-primary); }
.report-panel [hidden] { display: none !important; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-card { min-width: 0; padding: 1rem; border: 1px solid var(--t10x-border); border-radius: 14px; background: #fff; }
.chart-card--wide { grid-column: 1 / -1; }
.chart-card h3, .report-table-section h3 { margin: 0; font-size: 1.05rem; }
.chart-card p, .report-table-section > p { margin: .35rem 0 0; color: var(--t10x-muted); font-size: .88rem; }
.chart-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .8rem; color: var(--t10x-muted); font-size: .78rem; }
.chart-legend span { display: inline-flex; gap: .35rem; align-items: center; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend-planned { background: #b6c8bf; }
.legend-tracked { background: var(--t10x-primary); }
.daily-chart { display: flex; align-items: end; gap: clamp(.35rem, 1.5vw, 1rem); min-height: 220px; margin-top: 1rem; padding: 1rem .4rem 0; border-bottom: 1px solid #bdcbc3; }
.daily-chart__group { display: grid; grid-template-rows: 170px auto; flex: 1; min-width: 28px; gap: .45rem; text-align: center; }
.daily-chart__bars { display: flex; align-items: end; justify-content: center; gap: 3px; height: 170px; }
.daily-chart__bar { width: min(18px, 42%); border-radius: 4px 4px 0 0; }
.daily-chart__bar.is-planned { background: #b6c8bf; }
.daily-chart__bar.is-tracked { background: var(--t10x-primary); }
.daily-chart__label { color: var(--t10x-muted); font-size: .7rem; white-space: nowrap; }
.category-chart { display: grid; gap: 1rem; margin-top: 1rem; }
.category-bar { display: grid; gap: .5rem; padding-bottom: 1rem; border-bottom: 1px solid #e1e9e4; }
.category-bar:last-child { padding-bottom: 0; border-bottom: 0; }
.category-bar__label { display: flex; justify-content: space-between; gap: .8rem; align-items: center; font-size: .82rem; }
.category-bar__label > span { min-width: 0; color: #203c2f; font-weight: 800; overflow-wrap: anywhere; }
.category-bar__variance { flex: 0 0 auto; padding: .2rem .45rem; color: #355044; background: #edf4f0; border-radius: 999px; font-size: .7rem; }
.category-bar__variance.is-over { color: #8b4d00; background: #fff0cd; }
.category-bar__variance.is-under { color: #26527a; background: #e4f1fd; }
.category-bar__series { display: grid; grid-template-columns: 66px minmax(70px, 1fr) minmax(48px, auto); gap: .55rem; align-items: center; }
.category-bar__series-label { color: var(--t10x-muted); font-size: .7rem; }
.category-bar__track { height: 12px; overflow: hidden; background: #edf2ef; border-radius: 999px; }
.category-bar__fill { display: block; height: 100%; border-radius: inherit; }
.category-bar__fill.is-planned { background: #aebfb6; }
.category-bar__fill.is-tracked { background: linear-gradient(90deg, var(--t10x-primary), #39a775); }
.category-bar__value { color: #203c2f; font-size: .72rem; text-align: right; white-space: nowrap; }
.activity-time-chart { display: grid; gap: 1rem; max-height: 560px; margin-top: 1rem; padding-right: .25rem; overflow-y: auto; }
.activity-time-group { overflow: hidden; border: 1px solid #dce6e0; border-radius: 12px; background: #fbfdfc; }
.activity-time-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .7rem .85rem; background: #edf4f0; }
.activity-time-heading h4 { margin: 0; color: #203c2f; font-size: .88rem; overflow-wrap: anywhere; }
.activity-time-heading span { flex: 0 0 auto; color: var(--t10x-muted); font-size: .72rem; }
.activity-time-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(180px, 1.2fr) minmax(52px, auto); gap: .7rem; align-items: center; padding: .75rem .85rem; border-top: 1px solid #e5ece8; }
.activity-time-title { min-width: 0; color: #203c2f; font-size: .8rem; overflow-wrap: anywhere; }
.activity-time-track { height: 12px; overflow: hidden; background: #edf2ef; border-radius: 999px; }
.activity-time-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--t10x-primary), #39a775); }
.activity-time-value { color: #203c2f; font-size: .72rem; text-align: right; white-space: nowrap; }
.status-chart { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; align-items: center; margin-top: 1rem; }
.status-donut { display: grid; place-items: center; width: 140px; aspect-ratio: 1; border-radius: 50%; }
.status-donut::before { content: ""; grid-area: 1 / 1; width: 72%; aspect-ratio: 1; background: #fff; border-radius: 50%; }
.status-donut span { z-index: 1; grid-area: 1 / 1; color: var(--t10x-muted); font-size: .78rem; font-weight: 800; }
.status-legend { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; color: #355044; font-size: .82rem; }
.status-legend li { display: flex; gap: .45rem; align-items: center; }
.status-swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart-empty { padding: 1rem; text-align: center; }
.report-table-section { margin-top: 1rem; }
.report-table-section > .table-scroll { margin-top: .65rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--t10x-border); border-radius: 12px; }
.report-table-section table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.report-table-section th, .report-table-section td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--t10x-border); text-align: left; white-space: nowrap; }
.report-table-section th { color: #29473a; background: #edf4f0; }
.report-table-section tbody tr:last-child td { border-bottom: 0; }
.report-table-section td:nth-child(2) { max-width: 320px; white-space: normal; }
.file-button { display: inline-flex; align-items: center; }
.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tool-content-layout { padding-top: 1rem; padding-bottom: 4rem; }

@media (max-width: 1024px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-hero__inner { grid-template-columns: 1fr; }
  .tool-privacy { max-width: 650px; }
  .active-timer { position: static; grid-template-columns: 1fr auto; }
  .timer-live { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 768px) {
  .activity-filters { grid-template-columns: 1fr 1fr; }
  .field--search { grid-column: 1 / -1; }
  .report-summary { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .chart-card--wide { grid-column: auto; }
  .activity-details { grid-template-columns: repeat(2, 1fr); }
  .active-timer { grid-template-columns: 1fr auto; }
  .active-timer .timer-actions { grid-column: 1 / -1; }
  .data-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
  #activity-form, .activity-filters { grid-template-columns: 1fr; }
  .field--search, .field--wide { grid-column: auto; }
  .activity-card__top, .section-heading { flex-direction: column; }
  .activity-badges { justify-content: flex-start; }
  .activity-details { grid-template-columns: 1fr; }
  .active-timer { grid-template-columns: 1fr; }
  .active-timer .timer-actions { grid-column: auto; }
  .timer-live { grid-column: auto; grid-template-columns: 1fr; }
  .timer-progress-copy, .chart-heading { flex-direction: column; gap: .25rem; }
  .status-chart { grid-template-columns: 1fr; justify-items: center; }
  .status-legend { width: 100%; }
  .report-tabs { overflow-x: auto; }
  .tool-button, .file-button { width: 100%; justify-content: center; }
  .report-summary { grid-template-columns: 1fr; }
  .report-actions, .filter-actions { width: 100%; }
  .activity-time-row { grid-template-columns: 1fr minmax(100px, 1fr) auto; }
}

@media (min-width: 980px) and (max-width: 1180px) {
  .portal-nav a { padding-inline: 0.55rem; font-size: 0.82rem; }
}

@media print {
  .portal-header, .breadcrumb, .tool-hero, .tool-grid, .active-timer, .data-panel, .tool-content-layout,
  .tool-feedback, .activity-filters, .activity-list, .report-actions, .portal-footer { display: none !important; }
  body { color: #111; background: #fff; }
  .tempo-app { padding: 0; }
  .report-panel { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .report-summary { grid-template-columns: repeat(5, 1fr); }
  .table-scroll { overflow: visible; }
  .report-table-section table { font-size: 9pt; }
  .report-table-section th, .report-table-section td { white-space: normal; }
  @page { margin: 1.2cm; }
}
