/* Ryze ecom — base elements: reset, typography, buttons, inputs,
   badges, status pills, cards, tables, tabs, skeletons */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.625;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { flex-shrink: 0; }

/* ---------- Typography ---------- */
h1 { font-size: var(--text-h1); font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
h2 { font-size: var(--text-h2); font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
h3 { font-size: var(--text-h3); font-weight: 600; line-height: 1.3; }
h4 { font-size: var(--text-h4); font-weight: 600; line-height: 1.3; }
h5 { font-size: var(--text-h5); font-weight: 600; line-height: 1.35; }
h6 { font-size: var(--text-h6); font-weight: 600; line-height: 1.4; }

.text-muted { color: var(--muted-foreground); }
.text-small { font-size: var(--text-small); }
.text-sub { font-size: var(--text-sub); }
.text-meta { font-size: var(--text-meta); }
.tabnum { font-variant-numeric: tabular-nums; }

/* Uppercase tracked caption — table headers, section labels */
.caption {
  font-size: var(--text-sub);
  font-weight: 600;
  color: var(--muted-foreground);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(169, 162, 154, 0.5); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: rgba(31, 31, 31, 0.82); }
.btn-outline { border-color: var(--border); background: var(--background); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: rgba(244, 241, 234, 0.8); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-destructive { background: rgba(220, 38, 38, 0.1); color: var(--destructive); }
.btn-destructive:hover { background: rgba(220, 38, 38, 0.2); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-deep); }

.btn-xs { height: 24px; padding: 0 8px; font-size: var(--text-sub); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.8px; }
.btn-lg { height: 36px; padding: 0 12px; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-icon.btn-xs { width: 24px; }

/* kbd chip (⌘J in navbar) */
.kbd {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--muted);
  font-size: var(--text-tiny);
  font-weight: 600;
  color: var(--muted-foreground);
}

/* ---------- Inputs ---------- */
.input {
  height: 36px;
  width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: transparent;
  font-family: inherit;
  font-size: var(--text-body);
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(169, 162, 154, 0.5);
}
.input:disabled { background: rgba(231, 226, 216, 0.5); opacity: 0.5; }
.input[aria-invalid="true"] { border-color: var(--destructive); }
.input-sm { height: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--text-small); font-weight: 500; }
.field > .hint { font-size: var(--text-sub); color: var(--muted-foreground); }

select.input { appearance: none; cursor: pointer; }

/* Search box (table toolbar style) */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.search-box svg { width: 14px; height: 14px; color: var(--muted-foreground); }
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--text-small);
  color: var(--foreground);
  width: 160px;
}
.search-box input::placeholder { color: var(--muted-foreground); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-sub);
  font-weight: 500;
}
.badge-default { background: var(--primary); color: var(--primary-foreground); }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { border-color: var(--border); color: var(--foreground); }
.badge-destructive { background: rgba(220, 38, 38, 0.1); color: var(--destructive); }
.badge-brand { background: rgba(193, 151, 103, 0.15); color: var(--brand-deep); }

/* ---------- Status pill (product signature) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--muted);
  font-size: var(--text-meta);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.status-pill.sm { font-size: 10.5px; }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-positive { background: var(--status-positive); }
.dot-neutral { background: var(--status-neutral); }
.dot-warn { background: var(--status-warn); }
.dot-danger { background: var(--status-danger); }
.dot-offscope { background: var(--status-offscope); }

/* ---------- Cards ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 16px 0;
  font-size: var(--text-body);
  color: var(--card-foreground);
  box-shadow: var(--ring-hairline);
}
.card-sm { gap: 12px; padding: 12px 0; }
.card-header, .card-content, .card-footer { padding: 0 16px; }
.card-sm .card-header, .card-sm .card-content { padding: 0 12px; }
.card-title { font-size: var(--text-h6); font-weight: 500; line-height: 1.375; }
.card-description { font-size: var(--text-body); color: var(--muted-foreground); }
.card-footer {
  border-top: 1px solid var(--border);
  background: rgba(244, 241, 234, 0.5);
  padding: 16px;
  margin-bottom: -16px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-md);
  background: var(--muted);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: var(--text-body);
  font-weight: 500;
  color: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.tab:hover { color: var(--foreground); }
.tab.active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* line variant */
.tabs-line { background: transparent; padding: 0; gap: 16px; border-radius: 0; height: 36px; }
.tabs-line .tab { padding: 0 2px; border-radius: 0; position: relative; }
.tabs-line .tab.active { background: transparent; box-shadow: none; }
.tabs-line .tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--foreground);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: var(--text-sub);
  font-weight: 600;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-body);
  overflow-wrap: break-word;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color 0.1s; }
.table tbody tr:hover { background: rgba(244, 241, 234, 0.5); }

/* ---------- Skeleton ---------- */
.skeleton {
  border-radius: 6px;
  background: rgba(231, 229, 228, 0.7);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
  font-size: var(--text-tiny);
  font-weight: 700;
  color: var(--foreground);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-brand {
  background: radial-gradient(circle at 35% 35%, var(--brand-light), var(--brand-deep));
  color: #fff;
}
.avatar-logo {
  background: var(--card);
  box-shadow: var(--ring-hairline);
}
.avatar-logo img { object-fit: contain; padding: 3px; }
.avatar-lg { width: 32px; height: 32px; font-size: var(--text-sub); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Product thumb */
.thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: var(--ring-hairline);
  flex-shrink: 0;
  background: var(--muted);
}
.thumb-lg { width: 44px; height: 44px; }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  text-align: center;
}
.empty-state .icon-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
}
.empty-state p { font-size: var(--text-body); color: var(--muted-foreground); max-width: 320px; }

/* ---------- Banner ---------- */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  font-size: var(--text-body);
}
.banner-destructive {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.1);
}

/* ---------- Divider ---------- */
.divider { height: 1px; background: var(--border); border: none; }


/* ---------- Motion: smooth everything ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* page content eases in on every navigation */
.page { animation: fade-up 0.3s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

/* re-rendered detail panels (tickets, suppliers, insight categories) fade in */
#ticket-detail > *, #sup-detail > *, #cat-detail > * { animation: fade-in 0.22s ease both; }

/* approvals accordion body slides in when opened */
.appr-card.open .appr-body { animation: fade-up 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

/* view switches (Blog | Off-page etc) fade when shown */
#view-blog, #view-offpage { animation: fade-in 0.2s ease both; }

/* softer interactive feedback */
.table tbody tr { transition: background-color 0.18s ease; }
.card { transition: box-shadow 0.2s ease; }
.btn { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease; }
.btn:active { transform: translateY(1px) scale(0.99); }
.badge, .status-pill { transition: background-color 0.18s ease; }
.agent-suggestion, .tab { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.15s ease; }
.feed-item, .mini-row, .kb-row, .ticket-row, .sup-row, .cat-row, .approval-row, .dom-row, .voice { transition: background-color 0.18s ease; }

/* accessibility: honor reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
