/* ==========================================================================
   Wellen Print ERP — Component styles
   Class-based component layer on top of the token file. Styles both static
   specimens and the runtime bundle's emitted classes (e.g. `btn primary md`,
   `badge`). Import after colors_and_type.css. All color comes from tokens, so
   the whole layer follows the Wellen orange brand.
   ========================================================================== */

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--control-md); padding: 0 14px; border: 1px solid transparent;
  border-radius: var(--radius-md); font-family: var(--font-sans);
  font-size: 13.5px; font-weight: var(--fw-semibold); line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:focus-visible { outline: none; box-shadow: var(--ring-primary); }
/* sizes */
.btn.xs { height: var(--control-xs); padding: 0 10px; font-size: 12.5px; }
.btn.sm { height: var(--control-sm); padding: 0 12px; font-size: 13px; }
.btn.md { height: var(--control-md); }
.btn.lg { height: var(--control-lg); padding: 0 18px; font-size: 14px; }
/* variants */
.btn.primary   { background: var(--primary-600); color: #fff; }
.btn.primary:hover   { background: var(--primary-700); }
.btn.primary:active  { background: var(--primary-800); }
.btn.secondary { background: #fff; color: var(--fg-2); border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.btn.secondary:hover { background: var(--gray-50); }
.btn.ghost     { background: transparent; color: var(--fg-2); }
.btn.ghost:hover     { background: var(--gray-100); }
.btn.soft      { background: var(--primary-50); color: var(--primary-700); }
.btn.soft:hover      { background: var(--primary-100); }
.btn.neutral   { background: var(--gray-100); color: var(--fg-1); }
.btn.neutral:hover   { background: var(--gray-200); }
.btn.success   { background: var(--success-600); color: #fff; }
.btn.success:hover   { background: var(--success-700); }
.btn.danger    { background: var(--error-600); color: #fff; }
.btn.danger:hover    { background: var(--error-700); }
.btn.disabled, .btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .icon, .btn svg { width: 15px; height: 15px; }

/* ---- Badges / status pills ---------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--fw-semibold);
  background: var(--gray-100); color: var(--fg-2); white-space: nowrap;
}
.badge::before { content: ""; }
.badge.dot::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.brand   { background: var(--primary-50);  color: var(--primary-700); }
.badge.success { background: var(--success-50);  color: var(--success-700); }
.badge.warning { background: var(--warning-50);  color: var(--warning-700); }
.badge.error   { background: var(--error-50);    color: var(--error-700); }
.badge.info    { background: var(--info-50);      color: var(--info-700); }
.badge.neutral { background: var(--gray-100);     color: var(--fg-3); }
.badge.dark    { background: var(--gray-800);     color: #fff; }

/* ---- Form fields --------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--fg-2); }
.field > label .req { color: var(--error-500); margin-left: 2px; }
.input, .select {
  display: flex; align-items: center; gap: 8px; height: var(--control-sm);
  padding: 0 var(--control-pad-md); background: #fff; color: var(--fg-1);
  border: 1px solid var(--border-2); border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: var(--control-font-md); width: 100%;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder { color: var(--fg-4); }
.input:focus, .input.focus, .select:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring-primary-sm); }
.input.error { border-color: var(--error-500); }
.input.success { border-color: var(--success-500); }
.input:disabled, .input.disabled { background: var(--gray-50); color: var(--fg-4); cursor: not-allowed; }
.help { font-size: var(--text-xs); color: var(--fg-3); }
.help.error { color: var(--error-600); }
.help.success { color: var(--success-600); }

/* ---- Chips --------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px;
  background: var(--primary-50); color: var(--primary-700); border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: var(--fw-medium);
}
.chip .x { cursor: pointer; opacity: .7; font-weight: 700; }
.chip .x:hover { opacity: 1; }

/* ---- Avatars ------------------------------------------------------------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-100);
  color: var(--primary-800); font-size: 13px; font-weight: var(--fw-semibold);
  text-transform: uppercase; flex: none;
}
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.md { width: 36px; height: 36px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 56px; height: 56px; font-size: 18px; }
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid #fff;
}
.presence-online { background: var(--presence-online); }
.presence-away   { background: var(--presence-away); }
.presence-busy   { background: var(--presence-busy); }
.presence-offline{ background: var(--presence-offline); }

/* ---- Cards / surfaces ---------------------------------------------------- */
.card { background: var(--bg-surface); border: 1px solid var(--border-1); border-radius: var(--radius-lg); }
.card.pad { padding: var(--space-lg); }

/* ---- Nav items (sidebar) ------------------------------------------------- */
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px;
  border-radius: var(--radius-md); color: var(--fg-2); font-size: var(--text-sm);
  font-weight: var(--fw-medium); cursor: pointer; text-decoration: none;
}
.nav-item:hover { background: var(--gray-100); color: var(--fg-1); }
.nav-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: var(--fw-semibold); }
.nav-item .count { margin-left: auto; font-size: var(--text-xs); color: var(--fg-3); }
/* Attention pill: a queue waiting on the viewer (warning-700 on warning-100 is ~4.9:1). */
.nav-item .count.attn { flex: none; min-width: 24px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); background: var(--warning-100); color: var(--warning-700); font-weight: var(--fw-semibold); line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-section { font-size: 10px; font-weight: var(--fw-semibold); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-4); padding: 0 12px; margin: 14px 0 6px; }

/* ---- Sidebar: icon rail + white nav panel ------------------------------- */
.sidebar-shell { display: flex; height: 100%; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-1); box-shadow: var(--shadow-sm); }
.rail {
  width: 56px; flex: none; background: var(--gray-900);
  display: flex; flex-direction: column; align-items: center; padding: 10px 0 14px; gap: 2px;
  border-right: 1px solid rgba(255,255,255,0.06);
  min-height: 0; overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { width: 0; height: 0; }
.rail-logo { padding-bottom: 12px; flex: none; }
.rail-btn {
  flex: none;
  width: 40px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: rgba(255,255,255,0.42);
  border-radius: var(--radius-md); cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast);
}
.rail-btn:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.85); }
.rail-btn.active { background: rgba(204,97,0,0.18); color: var(--primary-600); }
.rail svg { width: 20px; height: 20px; }
.rail-spacer { margin-top: auto; }
/* white nav panel */
.panel { width: 240px; flex: none; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.panel-head { padding: 14px 16px 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-title b { font-size: 13.5px; font-weight: var(--fw-bold); color: var(--fg-1); letter-spacing: -0.01em; }
.panel-tabs { display: flex; margin: 0 -16px; padding: 0 16px; border-bottom: 1px solid var(--border-1); }
.panel-tab { padding: 5px 10px 7px; border: none; background: transparent; font-family: var(--font-sans); font-size: 12.5px; font-weight: var(--fw-semibold); color: var(--fg-4); border-bottom: 2px solid transparent; cursor: pointer; }
.panel-tab.active { color: var(--fg-1); border-bottom-color: var(--primary-600); }
.panel-nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-item svg { width: 17px; height: 17px; color: var(--fg-4); flex: none; }
.nav-item.active svg { color: var(--primary-600); }
