/* ==========================================================================
   4Safe Dashboard — Components
   Buttons, cards, badges, forms, tables, modals, wizard, calendar, uikit.
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--radius-md);
  border: none; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--color-primary) 60%, transparent);
}
.btn-secondary { background: transparent; color: var(--color-primary); border: 1.5px solid var(--color-primary); }
.btn-ghost { background: var(--color-surface-alt); color: var(--text-primary); }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--color-border); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative;
  transition: color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.action-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary);
}

/* ---------- Cards ---------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow); }
.panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-title { font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Badges ---------- */
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 12px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-info { background: var(--color-primary-light); color: var(--color-accent); }
.badge-muted { background: var(--color-surface-alt); color: var(--text-muted); }
.badge-solid { background: var(--color-primary); color: #fff; }

/* ---------- Forms ---------- */
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 7px; display: block; }
.input, select.input, textarea.input {
  padding: 11px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface-alt);
  color: var(--text-primary); font-size: 13.5px; font-family: inherit; width: 100%; outline: none;
}
.input:focus { border-color: var(--color-primary); }
textarea.input { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.checkbox { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--color-border); background: var(--color-surface); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.checkbox.checked { border: none; background: var(--color-primary); }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--color-border); background: var(--color-surface); cursor: pointer; flex: none; }
.radio-dot.checked { border: 6px solid var(--color-primary); }
.toggle-track { width: 44px; height: 25px; border-radius: 20px; position: relative; cursor: pointer; background: var(--color-border); flex: none; transition: background .2s ease; }
.toggle-track.on { background: var(--color-primary); }
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: left .2s ease; box-shadow: 0 1px 3px #0004; }
.toggle-track.on .toggle-knob { left: 22px; }

/* ---------- Tables ---------- */
.table-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow); }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); }
.data-table th {
  padding: 12px 16px; text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table td { padding: 14px 16px; font-size: 13px; color: var(--text-primary); border-bottom: 1px solid var(--color-border); }
.data-table tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--font-mono); font-weight: 600; }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--color-border); flex-wrap: wrap; gap: 10px; }
.pager-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--color-border); background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); font-size: 16px; }
.pager-num { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--text-secondary); }
.pager-num.active { background: var(--color-primary); color: #fff; }

/* ---------- Chips / tabs / toggles ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 15px; border-radius: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer; border: 1px solid var(--color-border); background: transparent; color: var(--text-secondary); }
.chip.active { border: 1.5px solid var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.chip.solid.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.tab-group { display: flex; gap: 6px; background: var(--color-surface-alt); padding: 5px; border-radius: 12px; width: fit-content; }
.tab-btn { padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; background: transparent; color: var(--text-secondary); }
.tab-btn.active { background: var(--color-primary); color: #fff; }

.underline-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--color-border); }
.underline-tab { padding: 10px 4px; font-size: 13px; font-weight: 700; cursor: pointer; border: none; background: transparent; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.underline-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: #00000066; display: flex; align-items: center; justify-content: center; z-index: 300; backdrop-filter: blur(3px); }
.modal-card { background: var(--color-surface); border-radius: 18px; padding: 28px; width: 440px; max-width: calc(100vw - 40px); box-shadow: var(--shadow-lg); border: 1px solid var(--color-border); }

/* ---------- Toast ---------- */
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-radius: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow);
  animation: fs-toastIn .3s ease; min-width: 260px;
}
.toast-msg { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.kpi-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.kpi-icon-wrap { width: 30px; height: 30px; border-radius: 9px; background: var(--color-primary-light); display: flex; align-items: center; justify-content: center; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; margin-top: 10px; }
.kpi-trend-row { display: flex; align-items: center; gap: 5px; margin-top: 8px; }
.kpi-trend { font-size: 12px; font-weight: 700; }
.kpi-trend.up { color: var(--color-success); }
.kpi-trend.down { color: var(--color-danger); }
.kpi-trend-label { font-size: 11.5px; color: var(--text-muted); }

.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.activity-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }

.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.activity-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--color-border); }
.activity-row:last-child { border-bottom: none; }
.activity-icon-wrap { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }

.status-row { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.status-row:last-child { border-bottom: none; }
.status-track { height: 6px; border-radius: 3px; background: var(--color-border); overflow: hidden; }
.status-fill { height: 100%; border-radius: 3px; background: var(--color-primary); transition: width .4s ease; }

/* ---------- Wizard ---------- */
.wizard-steps { display: flex; align-items: center; margin-bottom: 28px; }
.wizard-step-wrap { display: flex; align-items: center; flex: 1; }
.wizard-step-wrap:last-child { flex: none; }
.wizard-step-circle-wrap { display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; flex: none; }
.wizard-step-circle {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--color-surface-alt); color: var(--text-muted); border: 1px solid var(--color-border);
}
.wizard-step-circle.done, .wizard-step-circle.current { background: var(--color-primary); color: #fff; border: none; }
.wizard-step-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.wizard-step-label.current { color: var(--text-primary); }
.wizard-step-line { flex: 1; height: 2px; background: var(--color-border); margin: 0 10px 20px; }
.wizard-step-line.done { background: var(--color-primary); }

.scan-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.scan-type-card {
  padding: 18px; border-radius: var(--radius-lg); cursor: pointer; width: 100%; text-align: left; font-family: inherit;
  border: 1px solid var(--color-border); background: var(--color-surface); transition: border-color .15s ease, background .15s ease;
}
.scan-type-card.selected { border: 2px solid var(--color-primary); background: var(--color-primary-light); }
.scan-type-icon-wrap { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--color-primary-light); display: flex; align-items: center; justify-content: center; }
.scan-type-card.selected .scan-type-icon-wrap { background: var(--color-primary); }
.scan-type-check { width: 22px; height: 22px; border-radius: 50%; background: var(--color-primary); display: flex; align-items: center; justify-content: center; }

.wizard-step2-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.timeslot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.timeslot-btn { padding: 10px 6px; border-radius: 9px; font-size: 13px; font-weight: 700; text-align: center; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--text-primary); cursor: pointer; }
.timeslot-btn.selected { border: 1.5px solid var(--color-primary); background: var(--color-primary); color: #fff; }
.timeslot-btn.disabled { background: var(--color-surface-alt); color: var(--text-muted); cursor: not-allowed; opacity: .55; text-decoration: line-through; }

.summary-row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.summary-row:last-of-type { border-bottom: none; }
.summary-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.summary-val { font-size: 13.5px; color: var(--text-primary); font-weight: 700; text-align: right; }
.summary-total { display: flex; justify-content: space-between; padding: 16px 18px; border-radius: 12px; background: var(--color-primary-light); color: var(--color-primary); font-weight: 800; font-size: 15px; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: 2.2fr 1fr; gap: 16px; align-items: start; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-weekday { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; padding: 4px 0; }
.cal-cell { min-height: 84px; padding: 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; display: flex; flex-direction: column; gap: 5px; }
.cal-cell.out-of-month { opacity: .35; cursor: default; }
.cal-cell.today { border-color: var(--color-primary); }
.cal-cell.selected { background: var(--color-primary-light); }
.cal-day-num { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.cal-cell.selected .cal-day-num { color: var(--color-primary); font-weight: 800; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-event-row { display: flex; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.cal-event-row:last-child { border: none; padding-bottom: 0; }
.cal-event-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 4px; }

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-card { padding: 26px; border-radius: 18px; display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow); }
.plan-card.highlight { background: linear-gradient(160deg, var(--color-primary-dark), var(--color-primary)); border: none; color: #fff; box-shadow: 0 20px 40px -12px color-mix(in srgb, var(--color-primary) 55%, transparent); }
.plan-name { font-size: 16px; font-weight: 800; }
.plan-desc { font-size: 13px; margin-top: 6px; line-height: 1.5; }
.plan-price { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.plan-unit { font-size: 13px; }
.plan-feature { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.plan-cta { padding: 11px 18px; border-radius: 10px; border: 1px solid var(--color-border); font-size: 13px; font-weight: 700; cursor: pointer; background: transparent; color: var(--text-primary); }
.plan-card.highlight .plan-cta { border: none; background: #fff; color: var(--color-primary); }

/* ---------- Domains / credit ---------- */
.domain-card { border: 1px solid var(--color-border); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.domain-record-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--color-surface-alt); border-radius: 10px; padding: 10px 14px; font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); overflow: hidden; }
.method-toggle-wrap { display: flex; gap: 4px; background: var(--color-surface-alt); padding: 4px; border-radius: 11px; width: fit-content; }

.wallet-hero { padding: 28px; border-radius: 18px; background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)); color: #fff; display: flex; flex-direction: column; gap: 6px; }
.amount-chip { padding: 13px 10px; border-radius: 10px; font-size: 14.5px; font-weight: 700; cursor: pointer; text-align: center; border: 1px solid var(--color-border); }
.amount-chip.active { border: 1.5px solid var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* ---------- Profile / team / roles ---------- */
.profile-avatar { width: 84px; height: 84px; border-radius: 50%; background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 28px; flex: none; }
.stat-card { text-align: center; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.avatar-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary-light); color: var(--color-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.roles-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.roles-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 4px; width: 220px; flex: none; }
.role-chip { padding: 11px 14px; border-radius: 10px; text-align: left; cursor: pointer; border: none; font-size: 13.5px; font-weight: 700; background: transparent; color: var(--text-secondary); }
.role-chip.active { background: var(--color-primary); color: #fff; }
.roles-matrix { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden; flex: 1; min-width: 0; }
.roles-matrix-head { padding: 18px 20px; border-bottom: 1px solid var(--color-border); font-size: 14.5px; font-weight: 800; color: var(--text-primary); }

/* ---------- Inbox ---------- */
.inbox-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.inbox-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden; width: 360px; flex: none; }
.inbox-search { display: flex; align-items: center; gap: 9px; background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 10px; padding: 9px 12px; margin: 14px; }
.inbox-search input { border: none; outline: none; background: transparent; color: var(--text-primary); font-size: 13.5px; flex: 1; min-width: 0; }
.email-row { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; border-bottom: 1px solid var(--color-border); }
.email-row.selected { background: var(--color-primary-light); }
.email-row:last-child { border-bottom: none; }
.inbox-detail { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 26px; flex: 1; min-width: 0; }
.inbox-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--color-primary-light); color: var(--color-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }

/* ---------- Error pages ---------- */
.error-tabs { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 4px; width: 220px; flex: none; }
.error-preview {
  flex: 1; min-width: 0; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 30px; gap: 14px; min-height: 360px;
}
.error-code { font-size: 72px; font-weight: 800; color: var(--color-primary); letter-spacing: -0.02em; line-height: 1; }

/* ---------- UI Kit ---------- */
.uikit-typo-row { display: flex; align-items: baseline; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.uikit-typo-row:last-child { border: none; padding-bottom: 0; }
.uikit-typo-label { width: 100px; flex: none; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.alert-box { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border) 50%, var(--color-surface-alt) 75%); background-size: 200% 100%; animation: fs-shimmer 1.3s ease-in-out infinite; }
