/* ============================================================
   Minecraft Material Tracker – Global Styles
   Minecraft-inspired dark theme
   ============================================================ */

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

:root {
  --bg-base:       #1a1a1a;
  --bg-surface:    #242424;
  --bg-card:       #2d2d2d;
  --bg-hover:      #363636;
  --border:        #404040;
  --border-light:  #505050;

  --green:    #4caf50;
  --green-dk: #388e3c;
  --green-bg: rgba(76,175,80,.12);
  --red:      #f44336;
  --red-dk:   #c62828;
  --red-bg:   rgba(244,67,54,.12);
  --yellow:   #ffb300;
  --yellow-bg:rgba(255,179,0,.12);
  --blue:     #42a5f5;
  --blue-bg:  rgba(66,165,245,.12);
  --purple:   #ab47bc;
  --orange:   #ff7043;

  --text-primary:   #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted:     #666;

  --mc-green:  #5d9e48;
  --mc-brown:  #7b5c3e;
  --mc-stone:  #888;
  --mc-dirt:   #a07050;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow: 0 2px 8px rgba(0,0,0,.5);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.6);

  --font: 'Noto Sans JP', sans-serif;
  --font-mono: 'Courier New', monospace;
}

html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ============================================================
   HEADER
   ============================================================ */
#app-header {
  position: sticky; top: 0; z-index: 100;
  background: #111;
  border-bottom: 2px solid var(--mc-green);
  box-shadow: 0 2px 12px rgba(0,0,0,.7);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.logo-icon { font-size: 1.4rem; }
.logo-text {
  font-size: 1.1rem; font-weight: 700;
  color: var(--mc-green);
  letter-spacing: .5px;
}
.logo-sub {
  font-size: .7rem; color: var(--text-muted);
  margin-top: 2px;
}

.header-nav {
  display: flex; gap: 4px; flex: 1; overflow-x: auto;
}
.nav-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: .85rem; font-family: var(--font);
  white-space: nowrap;
  transition: all .2s;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active {
  background: var(--mc-green);
  color: #fff; font-weight: 600;
}

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.current-project-badge {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 3px 10px; border-radius: 20px;
  font-size: .78rem; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================================================
   MAIN / VIEWS
   ============================================================ */
#app-main {
  max-width: 1400px; margin: 0 auto;
  padding: 24px 20px;
}
.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.view-title {
  font-size: 1.3rem; font-weight: 700;
  color: var(--text-primary);
}
.view-title i { margin-right: 8px; color: var(--mc-green); }

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--mc-green); color: #fff;
  border: none; padding: 8px 16px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font); font-size: .85rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--green-dk); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  background: var(--bg-card); color: var(--text-secondary);
  border: 1px solid var(--border); padding: 8px 16px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font); font-size: .85rem;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s;
}
.btn-secondary:hover { border-color: var(--border-light); color: var(--text-primary); background: var(--bg-hover); }

.btn-danger {
  background: var(--red-dk); color: #fff;
  border: none; padding: 6px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font); font-size: .82rem;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .2s;
}
.btn-danger:hover { background: var(--red); }

.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px 6px; border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ============================================================
   PROJECTS GRID
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.project-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--mc-green);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.project-card:hover {
  border-color: var(--mc-green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.project-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.project-card-name {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
  flex: 1; margin-right: 8px;
}
.project-card-menu {
  position: relative;
}
.project-card-desc {
  font-size: .82rem; color: var(--text-secondary); margin-bottom: 12px;
  min-height: 1.2em;
}
.project-card-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.meta-chip {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: .75rem;
  padding: 2px 8px; border-radius: 20px;
}
.meta-chip i { margin-right: 3px; }

.project-progress-bar-outer {
  height: 6px; background: var(--bg-surface);
  border-radius: 3px; overflow: hidden; margin-bottom: 6px;
}
.project-progress-bar-inner {
  height: 100%; background: var(--mc-green);
  border-radius: 3px; transition: width .5s;
}
.project-progress-label {
  font-size: .75rem; color: var(--text-secondary);
  display: flex; justify-content: space-between;
}
.project-card-footer {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: .75rem; color: var(--text-muted);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-sub { font-size: .85rem; color: var(--text-muted); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border-light); }
.stat-icon { font-size: 1.8rem; flex-shrink: 0; }
.stat-label { font-size: .75rem; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.stat-total  { border-left: 3px solid var(--blue); }
.stat-owned  { border-left: 3px solid var(--green); }
.stat-missing{ border-left: 3px solid var(--red); }
.stat-done   { border-left: 3px solid var(--yellow); }
.stat-progress{ border-left: 3px solid var(--purple); }

.progress-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px 20px;
  margin-bottom: 24px;
}
.progress-label-row {
  display: flex; justify-content: space-between;
  font-size: .85rem; color: var(--text-secondary);
  margin-bottom: 10px; font-weight: 600;
}
.progress-bar-outer {
  height: 12px; background: var(--bg-surface);
  border-radius: 6px; overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--mc-green), #7ec850);
  border-radius: 6px; transition: width .6s ease;
}

.dashboard-bottom {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 800px) { .dashboard-bottom { grid-template-columns: 1fr; } }

.top-missing-section, .layer-overview-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px;
}

.section-heading {
  font-size: .95rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 14px;
}
.section-heading i { color: var(--mc-green); margin-right: 6px; }

.ranking-list { list-style: none; }
.ranking-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.ranking-list li:last-child { border-bottom: none; }
.rank-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
  color: var(--text-muted);
}
.rank-num.gold   { background: #b8860b; color: #fff; border-color: var(--yellow); }
.rank-num.silver { background: #666; color: #fff; border-color: #888; }
.rank-num.bronze { background: var(--mc-brown); color: #fff; border-color: #a07050; }
.rank-name { flex: 1; color: var(--text-primary); }
.rank-value { color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Layer progress in dashboard */
.layer-progress-item {
  margin-bottom: 12px;
}
.layer-progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 5px; font-size: .82rem;
}
.layer-progress-label { color: var(--text-secondary); }
.layer-progress-pct { color: var(--text-primary); font-weight: 600; }
.layer-prog-bar-outer {
  height: 7px; background: var(--bg-surface);
  border-radius: 4px; overflow: hidden;
}
.layer-prog-bar-inner {
  height: 100%; background: var(--blue);
  border-radius: 4px; transition: width .4s;
}
.layer-prog-bar-inner.done { background: var(--mc-green); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 16px; align-items: center;
}
.search-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-input {
  width: 100%; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-primary);
  padding: 8px 12px 8px 32px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .85rem;
  transition: border-color .2s;
}
.search-input:focus { outline: none; border-color: var(--mc-green); }

.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-select {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); padding: 7px 10px;
  border-radius: var(--radius-sm); font-family: var(--font); font-size: .82rem;
  cursor: pointer; transition: border-color .2s;
}
.filter-select:focus { outline: none; border-color: var(--mc-green); }

.count-badge {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-secondary); padding: 4px 12px; border-radius: 20px;
  font-size: .78rem;
}

/* ============================================================
   MATERIALS TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
.materials-table {
  width: 100%; border-collapse: collapse;
  font-size: .84rem;
}
.materials-table thead tr {
  background: #111; border-bottom: 2px solid var(--border);
}
.materials-table th {
  padding: 10px 12px; text-align: left;
  color: var(--text-secondary); font-weight: 600;
  white-space: nowrap;
}
.materials-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.materials-table tbody tr:hover { background: var(--bg-hover); }
.materials-table tbody tr.row-done { opacity: .6; }
.materials-table tbody tr.row-done td:first-child::before {
  content: '✓ '; color: var(--green);
}
.materials-table td {
  padding: 10px 12px; vertical-align: middle;
}

.col-name  { min-width: 160px; }
.col-id    { min-width: 140px; color: var(--text-muted); font-size: .78rem; font-family: var(--font-mono); }
.col-layer { width: 70px; text-align: center; }
.col-type  { min-width: 90px; }
.col-required, .col-owned, .col-missing { width: 80px; text-align: right; font-variant-numeric: tabular-nums; }
.col-stack, .col-shulker { min-width: 100px; }
.col-progress { min-width: 110px; }
.col-actions { width: 90px; text-align: center; }

.material-name { font-weight: 600; color: var(--text-primary); }
.material-item-id { color: var(--text-muted); font-size: .77rem; font-family: var(--font-mono); }
.material-assignee { color: var(--blue); font-size: .75rem; }

.td-required { color: var(--text-primary); }
.td-owned    { color: var(--green); font-weight: 600; }
.td-missing  { color: var(--red);   font-weight: 600; }
.td-missing.zero { color: var(--green); }

.stack-text { color: var(--text-secondary); font-size: .82rem; }
.shulker-text { color: var(--purple); font-size: .82rem; }

.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress-mini-outer {
  flex: 1; height: 6px; background: var(--bg-surface);
  border-radius: 3px; overflow: hidden; min-width: 60px;
}
.progress-mini-inner {
  height: 100%; background: var(--mc-green);
  border-radius: 3px; transition: width .4s;
}
.progress-mini-inner.partial { background: var(--yellow); }
.progress-mini-inner.zero    { background: var(--red); }
.progress-pct-text { font-size: .75rem; color: var(--text-secondary); width: 36px; text-align: right; }

.type-chip {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: .75rem; font-weight: 600;
  background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Row action buttons */
.row-actions { display: flex; gap: 4px; justify-content: center; }

/* ============================================================
   LAYERS VIEW
   ============================================================ */
.layer-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 16px; overflow: hidden;
}
.layer-section-header {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.layer-section-header:hover { background: var(--bg-hover); }
.layer-badge {
  background: var(--mc-green); color: #fff;
  padding: 2px 10px; border-radius: 4px;
  font-size: .8rem; font-weight: 700;
}
.layer-title { flex: 1; font-weight: 600; }
.layer-stats { font-size: .8rem; color: var(--text-secondary); }
.layer-chevron { color: var(--text-muted); transition: transform .2s; }
.layer-section.collapsed .layer-chevron { transform: rotate(-90deg); }
.layer-section.collapsed .layer-section-body { display: none; }
.layer-section-body { padding: 0; }

.layer-progress-compact {
  padding: 10px 18px 0;
  display: flex; align-items: center; gap: 10px;
}
.layer-prog-wide-outer {
  flex: 1; height: 8px; background: var(--bg-base);
  border-radius: 4px; overflow: hidden;
}
.layer-prog-wide-inner {
  height: 100%; background: var(--mc-green); border-radius: 4px;
  transition: width .4s;
}
.layer-prog-label { font-size: .8rem; color: var(--text-secondary); min-width: 36px; text-align: right; }

.layer-done-badge {
  background: var(--green-bg); color: var(--green);
  border: 1px solid var(--green);
  padding: 2px 10px; border-radius: 4px; font-size: .75rem; font-weight: 700;
}

/* ============================================================
   STATS VIEW
   ============================================================ */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 800px) { .stats-grid { grid-template-columns: 1fr; } }

.stats-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px;
}
.type-breakdown { display: flex; flex-direction: column; gap: 8px; }
.type-row {
  display: flex; align-items: center; gap: 10px; font-size: .84rem;
}
.type-row-name { flex: 1; color: var(--text-primary); }
.type-row-bar-outer {
  width: 120px; height: 7px; background: var(--bg-surface);
  border-radius: 4px; overflow: hidden;
}
.type-row-bar-inner {
  height: 100%; background: var(--blue); border-radius: 4px;
}
.type-row-count { color: var(--text-secondary); font-size: .78rem; min-width: 40px; text-align: right; }

.completion-estimate { display: flex; flex-direction: column; gap: 12px; }
.estimate-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg-surface);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: .85rem;
}
.estimate-label { color: var(--text-secondary); }
.estimate-value { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
.modal-box-lg { max-width: 640px; }
@keyframes modal-in {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.modal-header {
  padding: 18px 20px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-header h2 i { margin-right: 8px; color: var(--mc-green); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem;
  padding: 4px 6px; border-radius: var(--radius-sm);
  transition: color .2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 20px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--border);
}

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: .82rem; color: var(--text-secondary); font-weight: 600; }
.form-input {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-primary); padding: 8px 12px;
  border-radius: var(--radius-sm); font-family: var(--font); font-size: .85rem;
  transition: border-color .2s;
}
.form-input:focus { outline: none; border-color: var(--mc-green); }
.required { color: var(--red); margin-left: 3px; }
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* File drop zone */
.file-drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 24px; text-align: center; cursor: pointer;
  color: var(--text-muted);
  transition: border-color .2s, background .2s;
}
.file-drop-zone:hover, .file-drop-zone.drag-over {
  border-color: var(--mc-green); background: var(--green-bg);
  color: var(--text-secondary);
}
.file-drop-zone i { font-size: 2rem; margin-bottom: 8px; display: block; color: var(--mc-green); }
.file-drop-zone p { font-size: .85rem; line-height: 1.6; }
.file-drop-zone small { color: var(--text-muted); }
.file-selected-name {
  display: block; margin-top: 8px; font-size: .8rem;
  color: var(--mc-green); font-weight: 600;
}

/* Info box */
.info-box {
  background: var(--blue-bg); border: 1px solid var(--blue);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .82rem; color: var(--blue); line-height: 1.5;
}
.info-box i { margin-right: 6px; }

/* Owned input controls */
.owned-input-row {
  display: flex; gap: 4px; align-items: center;
}
.owned-input { flex: 1; text-align: center; font-weight: 700; }
.qty-btn {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--red); padding: 7px 10px;
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 700;
  font-family: var(--font); font-size: .82rem;
  transition: background .2s;
}
.qty-btn:hover { background: var(--red-bg); }
.qty-btn.qty-btn-plus { color: var(--green); }
.qty-btn.qty-btn-plus:hover { background: var(--green-bg); }

/* Calc preview */
.calc-preview {
  background: var(--bg-surface); border-radius: var(--radius-md);
  padding: 12px 16px; grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (max-width: 520px) { .calc-preview { grid-template-columns: 1fr 1fr; } }
.calc-item { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.calc-label { font-size: .72rem; color: var(--text-muted); }
.calc-value { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.calc-value.red   { color: var(--red); }
.calc-value.green { color: var(--green); }

/* Diff modal */
.diff-section { margin-bottom: 16px; }
.diff-section h4 { font-size: .9rem; font-weight: 700; margin-bottom: 8px; }
.diff-added   h4 { color: var(--green); }
.diff-removed h4 { color: var(--red); }
.diff-updated h4 { color: var(--yellow); }
.diff-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.diff-list li {
  font-size: .82rem; padding: 5px 10px; border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
}
.diff-added   .diff-list li { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.diff-removed .diff-list li { background: var(--red-bg);   border-color: var(--red);   color: var(--red); }
.diff-updated .diff-list li { background: var(--yellow-bg);border-color: var(--yellow);color: var(--yellow); }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
#loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
}
.loading-spinner { text-align: center; color: var(--text-primary); }
.spinner {
  width: 48px; height: 48px; margin: 0 auto 16px;
  border: 4px solid var(--border);
  border-top-color: var(--mc-green);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOAST
   ============================================================ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 18px;
  font-size: .85rem; color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .3s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text-muted); }
.fw-bold     { font-weight: 700; }
.mono        { font-family: var(--font-mono); }

/* Responsive tweaks */
@media (max-width: 768px) {
  .header-inner { gap: 8px; }
  .logo-sub     { display: none; }
  #app-main     { padding: 16px 12px; }
  .materials-table { font-size: .78rem; }
  .dashboard-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .dashboard-cards { grid-template-columns: 1fr; }
  .nav-btn { padding: 5px 10px; font-size: .78rem; }
}
