/* ===== Calculadora RSC-TAE — UFG Theme ===== */

/* --- CSS Reset & Variables --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

:root {
  /* Layout Base */
  --window-bg: #F8F9FA;
  --view-bg: #ffffff;
  --headerbar-bg: #ffffff;
  --card-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text: rgba(0, 0, 0, 0.85);
  --text-secondary: rgba(0, 0, 0, 0.55);
  --bg: var(--window-bg);

  /* SINT-IFESGO Accents */
  --primary: #0c71c3; /* Primary Blue */
  --primary-light: #2086d8;
  --primary-dark: #063963; /* Dark Institutional Blue */
  --primary-50: rgba(12, 113, 195, 0.1);
  --primary-100: rgba(12, 113, 195, 0.2);
  
  --accent-color: #0c71c3;
  --accent-bg: #0c71c3;
  --accent-fg: #ffffff;
  --success: #009E49; /* SINT Green */
  --warning: #F37021; /* SINT Orange */
  --destructive: #E30613; /* SINT Red */

  /* Shapes */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.06);

  /* Generic Transitions & Font */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: .2s cubic-bezier(.25, .46, .45, .94);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --window-bg: #101214;
  --view-bg: #181a1c;
  --headerbar-bg: #181a1c;
  --card-bg: #181a1c;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --bg: var(--window-bg);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- Base --- */
/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(150, 150, 150, 0.5);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary);
}

/* --- App Layout & Sidebar --- */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 280px;
  background-color: var(--primary-dark);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 80%;
}

.sidebar .logo-img {
  height: 48px;
  width: auto;
}

.btn-icon {
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 1.25rem;
  padding: 0.4rem;
  cursor: pointer;
  transition: background var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--border);
}

.sidebar-close {
  display: none;
  color: rgba(255, 255, 255, 0.8);
  position: absolute;
  right: 1rem;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 1rem;
  transition: all var(--transition);
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.sidebar-link i {
  font-size: 1.5rem;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
  border-left: 4px solid var(--warning); /* SINT Orange highlight */
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* --- Main Content Wrapper --- */
.main-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* important for flexbox text truncation */
}

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.window-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.hamburger {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.hamburger:hover {
  background: var(--border);
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }

  .mobile-topbar {
    display: flex;
  }
}

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Main --- */
main {
  flex: 1;
  padding: 2rem 0;
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-header .icon {
  width: 36px;
  height: 36px;
  background: rgba(12, 113, 195, 0.1);
  color: var(--accent-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* --- Action Bar --- */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
  justify-content: flex-end;
}

/* --- Buttons (Adwaita/GTK4) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: rgba(128, 128, 128, 0.1);
  color: var(--text);
  transition: background var(--transition);
  font-family: var(--font);
  white-space: nowrap;
}

.btn:hover {
  background: rgba(128, 128, 128, 0.2);
}

.btn:active {
  background: rgba(128, 128, 128, 0.3);
}

.suggested-action {
  background: var(--accent-bg);
  color: var(--accent-fg);
}

.suggested-action:hover {
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), var(--accent-bg);
  color: var(--accent-fg);
}

.destructive-action {
  background: var(--destructive);
  color: #fff;
}

.destructive-action:hover {
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), var(--destructive);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)), var(--success);
  color: #fff;
}

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

.btn-outline:hover {
  background: var(--border);
}

/* --- Level Selector --- */
.level-selector {
  margin-bottom: 1.5rem;
}

.level-selector label {
  display: block;
  font-weight: 600;
  margin-bottom: .5rem;
  font-size: .9rem;
  color: var(--text-secondary);
}

.level-selector select {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: .9375rem;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.level-selector select option {
  background: var(--card-bg);
  color: var(--text);
}

.level-selector select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 75, 141, .15);
}

/* --- Summary Cards --- */
.summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow);
}

.summary-card .label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .5rem;
}

.summary-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent-color);
}

.summary-card.gold .value {
  color: var(--accent);
}

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

.summary-card.warning .value {
  color: var(--warning);
}

/* Pending items list inside summary card */
.summary-card .pending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.summary-card .pending-list li {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--warning);
  line-height: 1.3;
  padding: 0.2rem 0.4rem;
  background: rgba(var(--warning-rgb, 243, 112, 33), 0.1);
  border-radius: 4px;
  text-align: left;
}

/* --- Filter Tabs --- */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-bottom: 1rem;
}

.filter-tab {
  padding: .4rem .875rem;
  border-radius: 20px;
  font-size: .8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--window-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.filter-tab:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--border);
}

.filter-tab.active {
  background: var(--text);
  color: var(--window-bg);
  border-color: var(--text);
}

/* --- Search --- */
.search-box {
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: .75rem 1rem .75rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: var(--font);
  background: var(--window-bg);
  color: var(--text);
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .75rem center;
}

.search-box input:focus {
  border-color: var(--accent-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(12, 113, 195, .15);
}

/* --- GNOME Boxed Lists --- */
.item-list {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.item-row {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 0;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 40px 1fr 100px 80px 140px;
  grid-template-rows: auto auto;
  gap: .5rem 1rem;
  align-items: center;
  transition: background var(--transition);
}

.item-row:nth-child(even) {
  background-color: rgba(128, 128, 128, 0.02);
}

.item-row:last-child {
  border-bottom: none;
}

/* Print Button Container (Global) */
.print-btn-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.item-attach {
  grid-column: 1 / -1;
}

.item-row:hover {
  background: rgba(128, 128, 128, 0.03);
}

/* GNOME Status "Farol" adaptation - left border inside the boxed list */
.item-row.status-ok {
  border-left: 4px solid var(--success);
}

.item-row.status-warning {
  border-left: 4px solid var(--warning);
}

.item-row.status-danger {
  border-left: 4px solid var(--destructive);
}

.item-number {
  width: 36px;
  height: 36px;
  background: rgba(12, 113, 195, 0.1);
  color: var(--accent-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
}

.item-info {
  min-width: 0;
}

.item-name {
  font-weight: 600;
  font-size: .875rem;
  margin-bottom: .25rem;
  color: var(--text);
}

.item-desc {
  font-size: .75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.item-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 12px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: .25rem;
}

/* --- Document Expander --- */
.doc-expander {
    margin-top: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.doc-expander summary {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--accent);
    user-select: none;
    transition: background 0.2s ease;
}

.doc-expander summary:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .doc-expander summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.doc-expander .doc-content {
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    white-space: pre-wrap;
    line-height: 1.4;
}

.item-badge.requisito-I {
  background: #dbeafe;
  color: #1e40af;
}

.item-badge.requisito-II {
  background: #fce7f3;
  color: #9d174d;
}

.item-badge.requisito-III {
  background: #fef3c7;
  color: #92400e;
}

.item-badge.requisito-IV {
  background: #d1fae5;
  color: #065f46;
}

.item-badge.requisito-V {
  background: #ede9fe;
  color: #5b21b6;
}

.item-badge.requisito-VI {
  background: #fee2e2;
  color: #991b1b;
}

[data-theme="dark"] .item-badge.requisito-I {
  background: #1e3a5f;
  color: #93c5fd;
}

[data-theme="dark"] .item-badge.requisito-II {
  background: #4a1942;
  color: #f9a8d4;
}

[data-theme="dark"] .item-badge.requisito-III {
  background: #4a3600;
  color: #fcd34d;
}

[data-theme="dark"] .item-badge.requisito-IV {
  background: #063f2e;
  color: #6ee7b7;
}

[data-theme="dark"] .item-badge.requisito-V {
  background: #3b1f7a;
  color: #c4b5fd;
}

[data-theme="dark"] .item-badge.requisito-VI {
  background: #5c1a1a;
  color: #fca5a5;
}

.item-unit {
  font-size: .75rem;
  color: var(--text-secondary);
  text-align: center;
}

.item-points {
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
  font-size: .9rem;
}

[data-theme="dark"] .item-points {
  color: var(--accent);
}

/* --- Quantity Control --- */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-bg);
}

.qty-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(128, 128, 128, 0.05);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 700;
  transition: all var(--transition);
  font-family: var(--font);
}

.qty-btn:hover {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text);
}

.qty-input {
  width: 44px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text);
}

.qty-input:focus {
  outline: none;
  background: var(--primary-50);
}

/* Hide spinners */
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input[type=number] {
  -moz-appearance: textfield;
}

/* --- Footer --- */
.footer {
  background: var(--card-bg);
  color: var(--text-secondary);
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

[data-theme="dark"] .footer {
  background: var(--card-bg);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer a {
  color: var(--accent-light);
}

.footer a:hover {
  color: var(--accent);
}

/* --- Page Hero --- */
.hero {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
  color: #fff;
  padding: 3rem 0;
  margin: -2rem 0 2rem;
  text-align: center;
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: .5rem;
}

.hero p {
  font-size: 1rem;
  opacity: .85;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Info Section --- */
.info-section {
  margin-bottom: 2rem;
}

.info-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.info-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.25rem 0 .5rem;
}

.info-section p {
  color: var(--text-secondary);
  margin-bottom: .75rem;
  line-height: 1.7;
}

.info-section ul,
.info-section ol {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.info-section li {
  margin-bottom: .5rem;
}

/* --- Highlight Box --- */
.highlight-box {
  background: var(--primary-50);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: .875rem;
  color: var(--text);
}

.highlight-box strong {
  color: var(--primary);
}

.highlight-box.gold {
  background: var(--accent-light);
  border-color: var(--accent);
}

.highlight-box.gold strong {
  color: var(--accent-dark);
}

/* --- Level Table --- */
.level-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .875rem;
}

.level-table th {
  background: var(--primary);
  color: #fff;
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
}

.level-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.level-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.level-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.level-table tr:hover {
  background: var(--primary-50);
}

.level-table tr:last-child td:first-child {
  border-radius: 0 0 0 var(--radius-sm);
}

.level-table tr:last-child td:last-child {
  border-radius: 0 0 var(--radius-sm) 0;
}

/* --- Steps (How To) --- */
.step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-number {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
}

.step-content h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

.step-content p {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* --- Charts Area --- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.chart-container {
  position: relative;
  height: 280px;
}

/* --- Progress bars --- */
.progress-bar-wrapper {
  margin-bottom: 1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: .375rem;
  font-size: .8125rem;
}

.progress-label .name {
  font-weight: 600;
}

.progress-label .numbers {
  color: var(--text-secondary);
}

.progress-track {
  height: 10px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width .6s ease;
}

.progress-fill.complete {
  background: linear-gradient(90deg, var(--success), #22c55e);
}

.progress-fill.over {
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary-dark);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .emoji {
  font-size: 2.5rem;
  margin-bottom: .75rem;
}

.empty-state p {
  font-size: .9rem;
}

/* --- Badge count --- */
.item-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 10px;
  font-size: .65rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: .35rem;
}

/* --- Attachment UI (Drop Zone Architecture) --- */
.attach-area {
  padding-top: .5rem;
  border-top: 1px dashed var(--border);
}

/* Toggle button */
.attach-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  border: 1px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  background: var(--primary-50);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
}

.attach-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-style: solid;
}

.attach-chevron {
  display: inline-block;
  transition: transform .2s ease;
  font-size: .65rem;
}

.attach-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 9px;
  font-size: .65rem;
  font-weight: 700;
  padding: 0 4px;
}

.attach-toggle:hover .attach-count {
  background: #fff;
  color: var(--primary);
}

/* Drop zone — hidden by default */
.drop-zone {
  display: none;
  margin-top: .5rem;
}

.drop-zone.open {
  display: block;
}

.drop-zone-inner {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  transition: all .2s ease;
  background: var(--window-bg);
}

.drop-zone-inner.dragging {
  border-color: var(--primary);
  background: var(--primary-50);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.drop-zone.processing .drop-zone-inner {
  opacity: .5;
  pointer-events: none;
}

.drop-zone-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: .25rem;
  color: var(--text-muted);
  font-size: .8rem;
}

.drop-zone-icon {
  font-size: 1.2rem;
}

/* Native file input — VISIBLE, styled */
.drop-zone-input {
  display: block;
  margin: .5rem auto;
  font-size: .8rem;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
}

.drop-zone-input::file-selector-button {
  padding: .4rem 1rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  margin-right: .5rem;
}

.drop-zone-input::file-selector-button:hover {
  background: var(--primary-dark, #1a56a8);
}

.drop-zone-hint {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* File list */
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: .75rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}

.attach-file {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--window-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .25rem .5rem;
  font-size: .7rem;
  max-width: 220px;
}

.attach-icon {
  flex-shrink: 0;
}

.attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.attach-size {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.attach-remove {
  background: none;
  border: none;
  color: var(--danger, #e74c3c);
  cursor: pointer;
  padding: 0 .15rem;
  font-size: .8rem;
  line-height: 1;
  opacity: .7;
  transition: opacity var(--transition);
  font-family: var(--font);
}

.attach-remove:hover {
  opacity: 1;
}

/* --- Scroll-to-top --- */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition);
  z-index: 90;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .headerbar {
    grid-template-columns: auto 1fr auto;
  }

  .window-title {
    font-size: 0.9rem;
  }

  .nav {
    display: none;
    position: absolute;
    top: 52px;
    right: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    flex-direction: column;
    padding: 0.5rem;
    min-width: 200px;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    justify-content: flex-start;
    padding: 0.6rem 1rem;
    width: 100%;
  }

  .hamburger {
    display: flex;
  }

  .item-row {
    grid-template-columns: 1fr;
    gap: .5rem;
  }

  .item-row>* {
    text-align: left !important;
  }

  .item-number {
    width: auto;
    height: auto;
    padding: .25rem .5rem;
    display: inline-flex;
  }

  .summary-row {
    grid-template-columns: 1fr 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 1.35rem;
  }

  .action-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn .4s ease forwards;
}

.item-row {
  animation: fadeIn .3s ease forwards;
}

/* --- Loading Overlay (Gerar PDF) --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

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

.loading-text {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}