/* Klipea Design Tokens, Typography, Scrollbars, and Reusable Controls */

:root {
  --bg: #09090B;
  --panel: #13151A;
  --surface: #13151A;
  --card: #191C23;
  --card-2: #1F232C;
  --line: #292D36;
  --line-2: #353A45;

  --text: #FFFFFF;
  --text-2: #C9CDD6;
  --muted: #9299A8;
  --faint: #636A78;

  --accent: #FFD500;
  --accent-2: #FFE34D;
  --accent-ink: #111111;
  --accent-soft: rgba(255, 213, 0, 0.12);

  --ok: #3DDC97;
  --info: #6EA8FE;
  --danger: #FF5A5F;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Dark thin scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #2C313B;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3B414E;
}

/* Buttons */
.btn {
  height: 38px;
  padding: 0 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.btn:hover:not(:disabled) {
  background: #272C37;
  border-color: var(--line-2);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(255, 213, 0, 0.24);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #FFEA70, var(--accent-2));
  box-shadow: 0 8px 26px rgba(255, 213, 0, 0.34);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn.ghost:hover:not(:disabled) {
  background: var(--card-2);
  border-color: var(--line);
  color: var(--text);
}

.btn.danger {
  background: rgba(255, 90, 95, 0.12);
  border-color: rgba(255, 90, 95, 0.35);
  color: #FF8589;
}

.btn.danger:hover:not(:disabled) {
  background: rgba(255, 90, 95, 0.22);
}

.btn.sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
}

.btn.lg {
  height: 46px;
  padding: 0 22px;
  font-size: 15px;
  border-radius: var(--r);
}

.btn.icon {
  width: 38px;
  padding: 0;
}

.btn.icon.sm {
  width: 32px;
}

/* Inputs & Controls */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select option,
.select optgroup {
  background: var(--panel);
  color: var(--text);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Cards & Badges */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
}

.badge.accent {
  background: var(--accent-soft);
  border-color: rgba(255, 213, 0, 0.35);
  color: var(--accent);
}

.badge.ok {
  background: rgba(61, 220, 151, 0.13);
  border-color: rgba(61, 220, 151, 0.35);
  color: var(--ok);
}

.badge.info {
  background: rgba(110, 168, 254, 0.14);
  border-color: rgba(110, 168, 254, 0.35);
  color: var(--info);
}

.badge.danger {
  background: rgba(255, 90, 95, 0.14);
  border-color: rgba(255, 90, 95, 0.35);
  color: var(--danger);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Progress */
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #232732;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #E5BC00, var(--accent-2));
  border-radius: 999px;
  transition: width 0.3s var(--ease);
}

/* Toasts & Modals */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9500;
}

.toast {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--r);
  padding: 11px 15px;
  font-size: 13.5px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
  min-width: 250px;
  max-width: 380px;
  animation: toastIn 0.22s var(--ease);
}

.toast.ok { border-left-color: var(--ok); }
.toast.danger { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 8000;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
}
