﻿/* ══ KPI CARDS ══════════════════════════════════════════════ */
.kpi {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
  cursor: default;
}
.kpi::before {
  content: '';
  position: absolute;
  top: -30px;
  inset-inline-end: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand-light) 0%, transparent 70%);
  opacity: .6;
  pointer-events: none;
}
.kpi::after {
  content: '';
  position: absolute;
  bottom: -20px;
  inset-inline-start: -16px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), transparent);
  opacity: .45;
  pointer-events: none;
}
.kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
  border-color: var(--brand-light);
}
.kpi .num {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
}
.kpi .lbl {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-3);
  margin-top: 7px;
  text-transform: uppercase;
  letter-spacing: .5px;
  position: relative;
  z-index: 1;
}
.kpi .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  position: relative;
  z-index: 1;
}
.kpi .bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-3);
  margin-top: 14px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.kpi .bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.kpi.soft { background: var(--brand-bg); border-color: var(--brand-light) }
.bar.orange > i { background: var(--grad-brand) }
.bar.blue   > i { background: var(--grad-blue) }
.bar.green  > i { background: var(--grad-green) }
.bar.purple > i { background: linear-gradient(90deg,#8b5cf6,#c4b5fd) }
.bar.teal   > i { background: var(--grad-teal) }
.bar.red    > i { background: var(--grad-red) }

/* ══ ALERTS ════════════════════════════════════════════════ */
.alert {
  border-radius: var(--r-sm);
  padding: 12px 16px;
  margin: 12px 0;
  border: 1.5px solid transparent;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.alert svg, .alert .alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
  width: 18px;
  height: 18px;
}
.alert.ok,
.alert.success {
  background: var(--success-bg);
  border-color: var(--success-bdr);
  color: var(--success-text);
}
.alert.danger {
  background: var(--danger-bg);
  border-color: var(--danger-bdr);
  color: var(--danger-text);
}
.alert.info {
  background: var(--info-bg);
  border-color: var(--info-bdr);
  color: var(--info-text);
}
.alert.warning {
  background: var(--warning-bg);
  border-color: var(--warning-bdr);
  color: var(--warning-text);
}

/* ══ BUTTONS ════════════════════════════════════════════════ */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  background: var(--grad-brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--t-fast),
    box-shadow var(--t-fast),
    background var(--t-fast),
    border-color var(--t-fast),
    color var(--t-fast);
  box-shadow: var(--sh-brand);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
/* Ripple-ready shine layer */
button::after, .btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}
button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-brand-lg);
  background: var(--grad-brand-h);
}
button:active, .btn:active {
  transform: translateY(0);
  box-shadow: var(--sh-brand);
}
.btn.full, button.full {
  width: 100%;
  height: 46px;
  font-size: 15px;
}
.btn.sm, button.sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}
.btn.xs, button.xs {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

/* Outline */
.btn.outline {
  background: var(--card);
  color: var(--text-2);
  border-color: var(--border-2);
  box-shadow: var(--sh-xs);
}
.btn.outline::after { display: none }
.btn.outline:hover {
  background: var(--bg-2);
  border-color: var(--border-3);
  box-shadow: var(--sh-sm);
  color: var(--text);
}

/* Variants */
.btn.primary { background: var(--grad-brand); color: #fff; box-shadow: var(--sh-brand) }
.btn.secondary { background: var(--grad-teal); color: #fff; box-shadow: 0 4px 14px rgba(15,118,110,.28) }
.btn.secondary:hover { box-shadow: 0 6px 20px rgba(15,118,110,.36) }
.btn.info { background: var(--grad-blue); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.28) }
.btn.info:hover { box-shadow: 0 6px 20px rgba(59,130,246,.36) }
.btn.danger {
  background: var(--grad-red);
  color: #fff;
  box-shadow: var(--sh-danger);
}
.btn.danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.36) }
.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
  box-shadow: none;
}
.btn.ghost::after { display: none }
.btn.ghost:hover { background: var(--bg-2); color: var(--text); box-shadow: none }

/* Disabled */
button[disabled], .btn[disabled] {
  opacity: .42;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* Icon button */
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.iconbtn:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
  box-shadow: var(--sh-xs);
}
.iconbtn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: none }
.iconbtn.danger:hover { background: var(--danger-bg); border-color: var(--danger-bdr); color: var(--danger) }

/* ══ FORMS ══════════════════════════════════════════════════ */
label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}
label .req { color: var(--danger); margin-inline-start: 2px }
input, select, textarea {
  width: 100%;
  padding: 0 14px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-2) }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: var(--subtle) }
input:read-only { background: var(--bg-2); color: var(--text-3) }
textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
  padding: 12px 14px;
  line-height: 1.6;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8a29e' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 38px;
  cursor: pointer;
}
.input-wrap { position: relative }
.input-wrap .input-icon {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  padding-inline-end: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* Form row grid */
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0,1fr)) }
.form-row .full { grid-column: 1 / -1 }
.form-group { display: flex; flex-direction: column; gap: 4px }

/* Section label (divider inside forms) */
.section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1.5px solid var(--border);
  margin: 6px 0 12px;
  display: block;
}

