/* components.css — shared portal styling. Fresh-white design system:
   pure white canvas with soft aurora tints, glassy floating sidebar,
   two accents (iris violet #6C4DFF + mint #00D4A6), gradient hairlines,
   pill buttons, lively-but-calm motion. Same class names as before so all
   portals (app/admin/sales) restyle without JS changes.
   Logical properties throughout for RTL. */
:root {
  --brand: #6c4dff;            /* accent 1 — iris violet */
  --brand2: #00d4a6;           /* accent 2 — mint */
  --brand-dark: #5636e8;
  --ink: #0b0d17;
  --muted: #5f6478;
  --line: rgba(11,13,23,.08);
  --paper: #ffffff;
  --bg: #ffffff;
  --card: #ffffff;
  --fill: #f3f4f9;
  --danger: #d0350f;
  --ok: #0aa570;
  --warn: #c77400;
  --radius: 18px;
  --r-pill: 980px;
  --shadow: 0 1px 2px rgba(11,13,23,.04), 0 10px 30px rgba(11,13,23,.05);
  --shadow-lg: 0 2px 4px rgba(11,13,23,.05), 0 24px 54px rgba(11,13,23,.10);
  --grad: linear-gradient(120deg, #6c4dff, #2ea9e8 55%, #00d4a6);
  /* accent panel tints */
  --p-sky: #eef3ff; --p-peach: #fff2ec; --p-mint: #e6faf4; --p-lav: #f2eeff; --p-sun: #fff8e2;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--paper); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased;
}
/* aurora ambience behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(640px 420px at 88% -8%, rgba(108,77,255,.08), transparent 62%),
    radial-gradient(560px 420px at -6% 30%, rgba(0,212,166,.07), transparent 62%);
}
[dir="rtl"] body, body[dir="rtl"] { font-family: Tahoma, "Segoe UI", system-ui, Arial, sans-serif; }
h1, h2, h3, h4 { letter-spacing: -.02em; }
a { color: var(--brand); }

/* Layout: floating glass sidebar, generous white canvas */
.app-shell { display: flex; min-height: 100vh; gap: 0; padding: 14px; }
.sidebar {
  width: 236px; flex: 0 0 auto; align-self: stretch;
  background: rgba(255,255,255,.78);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  color: var(--ink); border: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 3px;
  border-radius: 26px; position: sticky; top: 14px; height: calc(100vh - 28px);
  box-shadow: var(--shadow-lg);
}
.sidebar .logo { padding: 6px 10px 18px; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.sidebar .logo img { background: #fff; border-radius: 12px; padding: 7px 10px; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(11,13,23,.06); }
.sidebar .logo .logo-sub { font-weight: 700; font-size: .78rem; color: var(--muted); letter-spacing: .02em; padding-inline-start: 2px; }
.sidebar a {
  color: var(--muted); text-decoration: none; padding: 11px 14px; display: block;
  border-radius: 14px; font-size: .92rem; font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.sidebar a:hover { background: var(--p-lav); color: var(--ink); transform: translateX(2px); }
[dir="rtl"] .sidebar a:hover { transform: translateX(-2px); }
.sidebar a.active {
  background: linear-gradient(120deg, var(--brand), var(--brand-dark)); color: #fff;
  box-shadow: 0 6px 18px rgba(108,77,255,.35);
}
.sidebar .spacer { flex: 1; }
.main { flex: 1; padding: 18px 26px; max-width: 1240px; margin-inline: auto; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-block-end: 24px; gap: 12px; }
.topbar h1 { position: relative; font-size: 1.6rem; margin: 0; font-weight: 800; padding-block-end: 10px; }
.topbar h1::after { content: ""; position: absolute; inset-block-end: 0; inset-inline-start: 1px; width: 34px; height: 4px; border-radius: 99px; background: var(--grad); }

/* Cards & panels */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
  transition: box-shadow .25s ease; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { position: relative; overflow: hidden; padding: 22px 24px; transition: transform .3s cubic-bezier(.3,1.2,.4,1), box-shadow .3s ease; }
.stat::before { content: ""; position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 100%; height: 3px; background: var(--grad); opacity: .9; }
.stat:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(11,13,23,.05), 0 18px 40px rgba(108,77,255,.14); }
.stat .num { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat .label { color: var(--muted); font-size: .85rem; margin-block-start: 8px; font-weight: 600; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: start; color: var(--muted); font-weight: 700; padding: 11px 14px; border-block-end: 1.5px solid var(--line); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
table.data td { padding: 12px 14px; border-block-end: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-block-end: none; }
table.data tr:hover td { background: #f8f7ff; }

/* Forms */
label.field { display: block; margin-block-end: 15px; font-size: .86rem; font-weight: 700; color: var(--ink); }
label.field input, label.field select, label.field textarea {
  display: block; width: 100%; margin-block-start: 7px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; font: inherit; font-weight: 400; background: var(--fill); color: var(--ink);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
label.field input:focus, label.field select:focus, label.field textarea:focus {
  outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(108,77,255,.13);
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; } .field-row > * { flex: 1; min-width: 180px; }

/* Buttons: chunky pills — primary rides the violet */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: var(--r-pill);
  border: none; background: linear-gradient(120deg, var(--brand), var(--brand-dark)); color: #fff; font: inherit; font-size: .9rem;
  font-weight: 700; cursor: pointer; text-decoration: none; letter-spacing: -.01em;
  box-shadow: 0 2px 6px rgba(108,77,255,.3), 0 10px 24px rgba(108,77,255,.18);
  transition: transform .18s cubic-bezier(.3,1.4,.4,1), box-shadow .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(108,77,255,.35), 0 14px 32px rgba(108,77,255,.25); filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: 0 1px 3px rgba(108,77,255,.3); }
.btn.secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); box-shadow: 0 8px 20px rgba(108,77,255,.12); filter: none; }
.btn.danger { background: var(--danger); box-shadow: 0 2px 6px rgba(150,30,0,.3); }
.btn.small { padding: 7px 14px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Badges */
.badge { display: inline-block; padding: 4px 12px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 700; }
.badge.ok { background: #d9f7ec; color: #067a55; }
.badge.warn { background: #ffefd2; color: #8a5200; }
.badge.danger { background: #ffe1d8; color: #a02a0d; }
.badge.muted { background: var(--fill); color: var(--muted); }
.badge.brand { background: var(--p-lav); color: var(--brand-dark); }

/* Misc */
.muted { color: var(--muted); }
.mt { margin-block-start: 16px; } .mb { margin-block-end: 16px; }
.right { text-align: end; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex.between { justify-content: space-between; }
.toast {
  position: fixed; inset-block-end: 24px; inset-inline-end: 24px; background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 99; font-size: .9rem; font-weight: 600;
  animation: toast-in .3s cubic-bezier(.3,1.3,.4,1);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.ok { background: var(--ok); } .toast.danger { background: var(--danger); }
dialog { border: none; border-radius: 24px; box-shadow: var(--shadow-lg); padding: 26px; max-width: 560px; width: 92%; background: var(--card); }
dialog::backdrop { background: rgba(11,13,23,.4); backdrop-filter: blur(4px); }

/* Login page */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; width: 400px; max-width: 92vw; padding: 34px 30px; border-radius: 26px;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: var(--shadow-lg); }
.login-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(150deg, rgba(108,77,255,.45), rgba(11,13,23,.06) 45%, rgba(0,212,166,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 20px; font-weight: 800; }

/* Kanban (sales pipeline) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 14px; overflow-x: auto; padding-block-end: 8px; }
.kanban .col { background: var(--fill); border-radius: 20px; padding: 12px; }
.kanban .col h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 6px 12px; font-weight: 800; }
.kanban .kcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-block-end: 8px; font-size: .88rem; box-shadow: var(--shadow); transition: transform .25s cubic-bezier(.3,1.2,.4,1), box-shadow .25s ease; }
.kanban .kcard:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(108,77,255,.14); }

@media (prefers-reduced-motion: reduce) {
  .stat, .btn, .kanban .kcard, .sidebar a { transition: none; }
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; padding: 10px; }
  .sidebar { width: auto; flex-direction: row; overflow-x: auto; align-items: center; position: static; height: auto; border-radius: 20px; padding: 10px; gap: 4px; }
  .sidebar .logo { padding: 6px 12px; }
  .sidebar a { white-space: nowrap; }
  .sidebar .spacer { display: none; }
  .main { padding: 14px 6px; }
}
