/* ==========================================================================
   03-components.css — Calm Matte Buttons, Cards, Inputs, Badges & Modals
   ========================================================================== */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

@media (min-width: 640px) {
  .card {
    padding: 22px;
  }
}

.overview-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-right: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.overview-banner h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  color: var(--text-primary);
}
.overview-banner p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* Calm Matte Buttons (No glaring gradients or neon shadows) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-medium);
  color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--accent-border);
  color: var(--accent);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
}

.btn-quiet-danger {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-text);
}

.btn-sm {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}
.icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Inputs & Selects */
.input, .select {
  min-height: 41px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.search-input-wrap {
  position: relative;
  flex: 1 1 100%;
  min-width: 0;
}
@media (min-width: 680px) {
  .search-input-wrap {
    flex: 2 1 240px;
  }
}
.search-input-wrap svg {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap .input {
  width: 100%;
  padding-right: 36px;
}
.search-toolbar .select {
  flex: 1 1 135px;
  min-width: 0;
  max-width: 100%;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 680px) {
  .metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.metric-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.metric-tile .m-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.metric-tile .m-num {
  font-size: 23px;
  font-weight: 750;
  color: var(--text-primary);
  margin: 3px 0 2px;
  font-family: var(--font-en);
}
.metric-tile .m-note {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Subtle Scientific Badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.tag svg {
  width: 13px;
  height: 13px;
}
.tag-accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}
.tag-ok {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}
.tag-err {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-text);
}
.tag-pearl {
  background: var(--pearl-bg);
  border-color: var(--pearl-border);
  color: var(--pearl-text);
}

/* Lists & Progress */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.section-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
  color: var(--text-primary);
}

.clean-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.clean-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.clean-row:hover {
  border-color: var(--accent-border);
}

.track-bar {
  height: 6px;
  background: var(--bg-muted);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.track-bar > i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Tabs */
.chip-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.chip-tabs::-webkit-scrollbar {
  display: none;
}
.chip-tab {
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Upload Zone */
.upload-panel {
  border: 1.5px dashed var(--accent-border);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  text-align: center;
}
.upload-panel svg {
  width: 30px;
  height: 30px;
}
.upload-panel input[type="file"] {
  display: none;
}

/* Modals */
.app-dialog {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 0;
  width: min(880px, 95vw);
  max-height: 92vh;
  box-shadow: var(--shadow-float);
}
.app-dialog::backdrop {
  background: rgba(15, 23, 42, 0.72);
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 15px;
  border-bottom: 1px solid var(--border-light);
}
.dialog-canvas {
  background: #0c111b;
  max-height: 74vh;
  overflow: auto;
  padding: 10px;
  text-align: center;
}
.dialog-canvas img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.dialog-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 15px;
  border-top: 1px solid var(--border-light);
}
.drawer-scroll {
  max-height: 75vh;
  overflow-y: auto;
  padding: 14px;
}

.empty-notice {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 13.5px;
}

.toast-msg {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  background: #1e293b;
  color: #f8fafc;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  display: none;
  max-width: 90vw;
  text-align: center;
}
@media (min-width: 980px) {
  .toast-msg {
    bottom: 24px;
  }
}
