/* ═══════════════════════════════════════════════════════
   ANOVA DESIGN SYSTEM — components.css v1.0.1
   USO: @import 'design-system/tokens.css';
        @import 'design-system/components.css';
   ═══════════════════════════════════════════════════════ */

/* ═══ BUTTONS ═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--r-md);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; border: 2px solid transparent;
  transition: all .2s var(--ease); line-height: 1; text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-inv); border-color: var(--accent); }
.btn-primary:hover { opacity: .85; }
.btn-outline { background: transparent; color: var(--text-1); border-color: var(--text-1); }
.btn-outline:hover { background: var(--text-1); color: var(--bg); }
.btn-ghost { background: none; color: var(--text-2); border: none; padding: 8px 16px; }
.btn-ghost:hover { color: var(--text-1); }
.btn-sm { padding: 7px 14px; font-size: 11px; }
.btn-lg { padding: 14px 32px; font-size: 14px; }

/* ═══ CARDS ═════════════════════════════════════════════ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: var(--s5);
  transition: border-color .2s var(--ease);
}
.card:hover { border-color: var(--text-1); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: var(--s1); }
.card-desc { font-size: 14px; color: var(--text-2); line-height: 1.5; }

/* ═══ METRIC CARDS ══════════════════════════════════════ */
.metric-card {
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: var(--s5); transition: border-color .2s;
}
.metric-card:hover { border-color: var(--text-1); }
.metric-label {
  font-family: var(--mono); font-size: var(--text-micro);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: var(--s2);
}
.metric-value {
  font-size: var(--text-xl); font-weight: 700;
  line-height: 1; letter-spacing: -.02em;
}
.metric-value sub {
  font-size: 14px; font-weight: 500;
  color: var(--text-2); vertical-align: baseline;
}

/* ═══ INPUTS ════════════════════════════════════════════ */
.input {
  width: 100%; padding: 10px var(--s4);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: 14px;
  color: var(--text-1); font-family: var(--font);
  outline: none; transition: border-color .2s;
}
.input:focus { border-color: var(--text-1); }
.input::placeholder { color: var(--text-3); }
.input:disabled { opacity: .5; cursor: not-allowed; }

.select {
  width: 100%; padding: 10px var(--s4); padding-right: 36px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: 14px;
  color: var(--text-1); font-family: var(--font);
  appearance: none; -webkit-appearance: none; outline: none;
  cursor: pointer; transition: border-color .2s;
}
.select:focus { border-color: var(--text-1); }

.textarea {
  width: 100%; padding: 12px var(--s4);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); font-size: 14px;
  color: var(--text-1); font-family: var(--font);
  outline: none; resize: vertical; min-height: 100px;
  transition: border-color .2s; line-height: 1.6;
}
.textarea:focus { border-color: var(--text-1); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: var(--text-xs); font-weight: 600;
  color: var(--text-2); text-transform: uppercase;
  letter-spacing: .06em; font-family: var(--mono);
}
.field-hint { font-size: var(--text-micro); color: var(--text-3); font-family: var(--mono); }
.field-error { font-size: var(--text-micro); color: var(--charcoal); font-weight: 600; font-family: var(--mono); }
.field-error::before { content: '⚠ '; }

/* ═══ CHECKBOX / RADIO / TOGGLE ═════════════════════════ */
.check-box, .radio-box {
  width: 18px; height: 18px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; cursor: pointer; background: var(--bg); flex-shrink: 0;
}
.check-box { border-radius: var(--r-sm); }
.radio-box { border-radius: 50%; }
.check-box.checked { background: var(--onyx); border-color: var(--onyx); }
.check-box.checked::after { content: '✓'; color: var(--white); font-size: 11px; font-weight: 700; }
.radio-box.checked { border-color: var(--onyx); }
.radio-box.checked::after { content: ''; width: 8px; height: 8px; background: var(--onyx); border-radius: 50%; }

.toggle {
  width: 40px; height: 22px; border-radius: 11px;
  background: var(--border); position: relative;
  cursor: pointer; transition: background .2s; flex-shrink: 0;
}
.toggle.on { background: var(--onyx); }
.toggle-knob {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--white); transition: transform .2s var(--ease-spring);
}
.toggle.on .toggle-knob { transform: translateX(18px); }

/* ═══ UPLOAD ════════════════════════════════════════════ */
.upload-zone {
  border: 1.5px dashed var(--border); border-radius: var(--r-xl);
  padding: var(--s7) var(--s5); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--s3);
  cursor: pointer; transition: border-color .2s, background .2s; text-align: center;
}
.upload-zone:hover { border-color: var(--text-1); background: var(--bg-alt); }

/* ═══ TABLES ════════════════════════════════════════════ */
.tbl-wrap {
  border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden;
}
.tbl-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border);
}
.tbl-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: var(--s2); }
.tbl-count {
  font-family: var(--mono); font-size: var(--text-micro);
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 8px; color: var(--text-3);
}
.tbl-search {
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 13px; width: 200px; outline: none; transition: border-color .15s;
  background: var(--bg-alt); color: var(--text-1); font-family: var(--font);
}
.tbl-search:focus { border-color: var(--text-1); background: var(--bg); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-family: var(--mono); font-size: var(--text-micro); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
  text-align: left; padding: 10px var(--s5); background: var(--bg-alt);
  border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
  transition: color .15s; white-space: nowrap;
}
.tbl th:hover { color: var(--text-1); }
.tbl th.align-r { text-align: right; }
.tbl td { padding: 14px var(--s5); border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl tbody tr:hover { background: var(--bg-alt); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.selected { background: var(--bg-alt); }
.tbl tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--onyx); }

/* Table cell types */
.cell-id { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.cell-client { display: flex; align-items: center; gap: var(--s3); }
.cell-client-name { font-weight: 600; font-size: 14px; }
.cell-client-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.cell-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--onyx); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.cell-avatar-light { background: var(--bg-alt); color: var(--text-2); border: 1px solid var(--border); }
.cell-meta { font-size: 13px; color: var(--text-2); }
.cell-value { font-family: var(--mono); font-size: 14px; font-weight: 600; text-align: right; }
.cell-date { font-family: var(--mono); font-size: 12px; color: var(--text-3); white-space: nowrap; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-action {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid transparent; display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all .12s; background: none;
}
.cell-action:hover { border-color: var(--border); background: var(--bg-alt); }
.cell-action svg { width: 15px; height: 15px; stroke: var(--text-3); fill: none; stroke-width: 1.5; }
.cell-action:hover svg { stroke: var(--text-1); }

/* ═══ STATUS BADGES ═════════════════════════════════════ */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 99px;
  font-size: var(--text-xs); font-weight: 600;
  font-family: var(--mono); letter-spacing: .02em;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-active { background: var(--onyx); color: var(--white); }
.status-active .status-dot { background: var(--white); }
.status-pending { background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-2); }
.status-pending .status-dot { background: var(--text-3); }
.status-progress { background: var(--bg); border: 1px solid var(--charcoal); color: var(--charcoal); }
.status-progress .status-dot { background: var(--charcoal); }
.status-error { background: var(--bg); border: 1px solid var(--grey); color: var(--grey); }
.status-error .status-dot { background: var(--grey); }
.status-none { background: var(--bg); border: 1px solid var(--silver); color: var(--silver); }
.status-none .status-dot { border: 1.5px solid var(--silver); background: transparent; }

/* ═══ PAGINATION ════════════════════════════════════════ */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: var(--s4) 0; }
.page-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: 12px; font-family: var(--mono); cursor: pointer;
  background: var(--bg); color: var(--text-2); transition: all .15s;
}
.page-btn:hover { border-color: var(--text-1); color: var(--text-1); }
.page-btn.active { background: var(--onyx); color: var(--white); border-color: var(--onyx); }
.page-nav { padding: 6px 14px; width: auto; font-weight: 600; }

/* ═══ ALERTS ════════════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s4) var(--s5); border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.alert svg { width: 18px; height: 18px; stroke: var(--text-2); fill: none; stroke-width: 1.5; flex-shrink: 0; }
.alert-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.alert-desc { font-size: 13px; color: var(--text-2); }
.alert-action {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-1); cursor: pointer;
  margin-top: var(--s2); font-family: var(--mono);
}
.alert-info { background: var(--bg-alt); }
.alert-warn { border-color: var(--grey); }
.alert-critical { border-color: var(--onyx); border-width: 2px; }

/* ═══ PROGRESS / STEPS ══════════════════════════════════ */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--onyx); border-radius: 2px; transition: width .6s var(--ease-out); }

.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; font-family: var(--mono); font-size: 12px;
  font-weight: 700; color: var(--text-3); flex-shrink: 0; transition: all .2s;
}
.step.done .step-num { background: var(--onyx); color: var(--white); border-color: var(--onyx); }
.step.current .step-num { border-color: var(--onyx); color: var(--onyx); }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 var(--s2); }
.step.done .step-line { background: var(--onyx); }

/* ═══ AVATARS ═══════════════════════════════════════════ */
.avatar {
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-family: var(--mono); font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-md { width: 36px; height: 36px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 14px; }
.avatar-dark { background: var(--onyx); color: var(--white); }
.avatar-light { background: var(--bg-alt); color: var(--text-2); border: 1px solid var(--border); }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid var(--white); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ═══ PRODUCT CARD ══════════════════════════════════════ */
.product-card {
  border: 1px solid var(--border); border-radius: var(--r-xl);
  overflow: hidden; transition: border-color .2s;
}
.product-card:hover { border-color: var(--text-1); }
.product-img {
  height: 180px; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border);
}
.product-body { padding: var(--s5); }
.product-tag {
  font-family: var(--mono); font-size: var(--text-micro);
  color: var(--text-3); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: var(--s2);
}
.product-name { font-size: 17px; font-weight: 700; margin-bottom: var(--s1); }
.product-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: var(--s4); }
.product-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--s3); border-top: 1px solid var(--border);
}
.product-price { font-size: 20px; font-weight: 700; }
.product-price sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ═══ MODAL ═════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.04); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-box {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: var(--s6); max-width: 420px; width: 100%;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; border: 1px solid var(--border);
  border-radius: var(--r-sm); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: border-color .15s; background: none;
}
.modal-close:hover { border-color: var(--text-1); }
.modal-body { font-size: 14px; color: var(--text-2); line-height: 1.6; margin-bottom: var(--s5); }
.modal-actions { display: flex; gap: var(--s3); justify-content: flex-end; }

/* ═══ TABS ══════════════════════════════════════════════ */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab-item {
  padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-3); border-bottom: 2px solid transparent; transition: all .15s;
  background: none; border-top: none; border-left: none; border-right: none; font-family: var(--font);
}
.tab-item:hover { color: var(--text-1); }
.tab-item.active { color: var(--text-1); border-bottom-color: var(--onyx); font-weight: 600; }
.tab-count {
  font-family: var(--mono); font-size: 10px;
  background: var(--onyx); color: var(--white);
  border-radius: 99px; padding: 1px 6px; margin-left: 6px;
}

/* ═══ BREADCRUMBS ═══════════════════════════════════════ */
.breadcrumb { display: flex; align-items: center; gap: var(--s2); }
.breadcrumb-item {
  font-family: var(--mono); font-size: var(--text-micro);
  color: var(--text-3); text-decoration: none; transition: color .15s;
}
.breadcrumb-item:hover { color: var(--text-1); }
.breadcrumb-current { color: var(--text-1); font-weight: 600; }
.breadcrumb-sep { color: var(--border); font-size: 10px; }

/* ═══ TOOLTIP ═══════════════════════════════════════════ */
.tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--onyx); color: var(--white); font-family: var(--mono);
  font-size: var(--text-xs); padding: 6px 12px; border-radius: var(--r-md);
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s;
}
.tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--onyx);
}
.tooltip-trigger:hover .tooltip { opacity: 1; }

/* ═══ EMPTY STATE ═══════════════════════════════════════ */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: var(--s9) var(--s5); text-align: center;
}
.empty-title { font-size: 17px; font-weight: 700; margin-bottom: var(--s2); }
.empty-desc { font-size: 14px; color: var(--text-3); max-width: 360px; margin-bottom: var(--s5); }

/* ═══ LOGO SQUIRCLE ═════════════════════════════════════ */
.logo-squircle {
  background: var(--onyx); border-radius: var(--r-squircle);
  display: flex; align-items: center; justify-content: center;
}
.logo-squircle span {
  font-family: var(--font); font-weight: 700; color: var(--white);
  text-align: center;
}
/* Scale: 24px→p1px, 28px→p2px/5px, 32px→p3px/6px, 36px→p4px/8px, 64px→p8px/10px, 80px→p10px/12px */
/* Always: margin-right: -(letter-spacing) to center text */
