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

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

:root {
  /* GNOME Window Base (Libadwaita Light) */
  --window-bg: #fafafa;
  --view-bg: #ffffff;
  --headerbar-bg: #ebebeb;
  --card-bg: #ffffff;
  --border: rgba(0, 0, 0, 0.15);
  --border-hover: rgba(0, 0, 0, 0.25);
  --text: rgba(0, 0, 0, 0.85);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --bg: var(--window-bg);
  /* Fallback to fix Body */

  /* SINT-IFESGO Accents (Suggested & Destructive Actions) */
  --accent-color: #0c71c3;
  /* Primary Blue */
  --accent-bg: #0c71c3;
  --accent-fg: #ffffff;
  --success: #009E49;
  /* SINT Green */
  --warning: #F37021;
  /* SINT Orange */
  --destructive: #E30613;
  /* SINT Red */

  /* Legacy Restored (Avoid broken modules) */
  --primary: #0c71c3;
  --primary-light: #2086d8;
  --primary-dark: #085596;
  --primary-50: rgba(12, 113, 195, 0.1);
  --primary-100: rgba(12, 113, 195, 0.2);

  /* Adwaita Shapes */
  --radius-sm: 6px;
  /* inputs */
  --radius: 8px;
  /* buttons */
  --radius-lg: 12px;
  /* boxed lists / cards */

  /* Adwaita Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

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

/* --- Dark Mode (GNOME High-Contrast Dark) --- */
[data-theme="dark"] {
  --window-bg: #141414;
  /* Extremely Dark Grey */
  --view-bg: #1e1e1e;
  --headerbar-bg: #1a1a1a;
  --card-bg: #202020;
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.25);
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --bg: var(--window-bg);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* --- Base --- */
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);
}

/* --- HeaderBar (GTK4/Libadwaita) --- */
.headerbar {
  background: var(--headerbar-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding: 0 0.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 48px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.headerbar-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
}

.headerbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.headerbar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.window-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  text-decoration: none;
}

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

.logo-img {
  height: 28px;
  width: auto;
  border-radius: 4px;
}

/* HeaderBar Nav Buttons */
.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.btn-flat,
.btn-icon {
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon {
  padding: 0.4rem;
  font-size: 1.15rem;
}

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

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

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

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

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* --- 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: 1.5rem;
  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);
}

/* --- 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 var(--border);
  border-radius: 0;
  padding: 0.8rem 1rem;
  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:last-child {
  border-bottom: none;
}

.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;
}

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

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

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

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

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

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

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

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

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

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

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

[data-theme="dark"] .item-badge.inciso-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(--primary-dark);
  color: rgba(255, 255, 255, .7);
  padding: 2rem 0;
  margin-top: auto;
  font-size: .8125rem;
}

.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;
}