/* FarmMint Admin — PREMIUM DESIGN LAYER (Sprint 4 reference, pending approval).
   Everything here is scoped to `.shell.is-premium` (enabled for the Dashboard only by main.js) or to the new `.dx-*` classes,
   so the other pages keep the approved look until this design is approved for rollout. Colours: only the two official brand
   colours (#203968 / #4CAF61 via tokens, incl. alpha tints of them), white, the documented neutrals and the status tints. */

.shell.is-premium {
  --dx-ease: cubic-bezier(0.22, 0.8, 0.3, 1);
  --dx-dur: 0.25s;
  --dx-line: rgb(32 57 104 / 8%);                       /* brand navy @ 8% */
  --dx-shadow: 0 1px 2px rgb(32 57 104 / 6%), 0 10px 28px -6px rgb(32 57 104 / 12%);
  --dx-shadow-lg: 0 2px 4px rgb(32 57 104 / 8%), 0 18px 44px -10px rgb(32 57 104 / 22%);
}

/* ---------- Sidebar ---------- */
.shell.is-premium .sidebar {
  background: linear-gradient(180deg, var(--fm-primary) 0%, var(--fm-primary-dark) 100%);
  padding: 20px 12px 16px; gap: 8px; overflow-y: auto; scrollbar-width: thin;
}
.shell.is-premium .sidebar__brand { padding: 0 4px 12px; }
.shell.is-premium .brand-full { --fm-logo-h: 104px; padding: 10px; border-radius: 16px; box-shadow: 0 10px 28px rgb(0 0 0 / 28%); }
.shell.is-premium .brand-emblem { box-shadow: 0 6px 16px rgb(0 0 0 / 25%); }
.shell.is-premium .nav-group {
  display: block; padding: 18px 12px 6px; font: 600 11px/16px var(--fm-font); letter-spacing: 0.09em;
  text-transform: uppercase; color: rgb(255 255 255 / 62%);
}
.shell.is-premium .nav-item {
  position: relative; min-height: 42px; padding: 0 12px; gap: 12px; border: 0; border-radius: 10px;
  color: rgb(255 255 255 / 84%); font: 500 14px/20px var(--fm-font);
  transition: background-color var(--dx-dur) var(--dx-ease), color var(--dx-dur) var(--dx-ease);
}
.shell.is-premium .nav-item__icon { display: none; }
.shell.is-premium .nav-item__svg { display: inline-flex; flex: none; transition: transform var(--dx-dur) var(--dx-ease), color var(--dx-dur) var(--dx-ease); }
.shell.is-premium .nav-item:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.shell.is-premium .nav-item:hover .nav-item__svg { transform: translateX(2px); }
.shell.is-premium .nav-item.is-active { background: rgb(255 255 255 / 13%); color: #fff; font-weight: 600; border-left-color: transparent; }
.shell.is-premium .nav-item.is-active .nav-item__svg { color: var(--fm-accent); }
.shell.is-premium .nav-item.is-active::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--fm-accent);
}
.shell.is-premium.is-collapsed .nav-group { font-size: 0; padding: 10px 8px 4px; border-top: 1px solid rgb(255 255 255 / 10%); margin-top: 6px; }
.shell.is-premium.is-collapsed .nav-item { justify-content: center; }
@media (min-width: 640px) { .shell.is-premium .sidebar { position: sticky; top: 0; align-self: flex-start; height: 100vh; } }

/* ---------- Header ---------- */
.shell.is-premium .main { background: radial-gradient(1000px 360px at 88% -8%, rgb(76 175 97 / 9%), transparent 62%), var(--fm-background); }
.shell.is-premium .header {
  height: 76px; position: sticky; top: 0; z-index: 5; gap: 12px;
  background: rgb(255 255 255 / 82%); -webkit-backdrop-filter: saturate(160%) blur(10px); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--dx-line);
}
.shell.is-premium .header__title { font: 700 20px/26px var(--fm-font); letter-spacing: -0.02em; flex: none; }
.shell.is-premium .header__sub { display: block; margin: 2px 0 0; font: 400 13px/18px var(--fm-font); color: var(--fm-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell.is-premium .header__toggle { border-radius: 12px; transition: background-color var(--dx-dur) var(--dx-ease); }
.shell.is-premium .header__toggle .tg-old { display: none; }
.shell.is-premium .header__toggle .tg-new { display: inline-flex; }
.shell.is-premium .header__user {
  display: inline-flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; background: var(--fm-surface);
  border: 1px solid var(--fm-border); border-radius: var(--fm-radius-full); font: 600 13px/18px var(--fm-font); color: var(--fm-text);
}
.shell.is-premium .header__avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--fm-primary); color: #fff; font: 700 12px/1 var(--fm-font); letter-spacing: 0.03em; }
@media (min-width: 640px) { .shell.is-premium .content { padding: 28px 32px 40px; } }
@media (max-width: 639px) {
  .shell.is-premium .header { height: 68px; }
  .shell.is-premium .header__user-name { display: none; }
  .shell.is-premium .header__user { padding: 3px; }
}

/* ---------- Dashboard ---------- */
.dx { display: grid; gap: 24px; }
.dx-card {
  min-width: 0; padding: 20px 22px; background: var(--fm-surface); border: 1px solid var(--dx-line);
  border-radius: 16px; box-shadow: var(--dx-shadow);
}
.dx-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dx-card__title { margin: 0; font: 700 16px/24px var(--fm-font); letter-spacing: -0.01em; color: var(--fm-primary); }
.dx-card__sub { margin: 2px 0 0; font: 400 13px/18px var(--fm-font); color: var(--fm-text-secondary); }
.dx-link { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/20px var(--fm-font); text-decoration: none; white-space: nowrap; }
.dx-link svg { transition: transform var(--dx-dur) var(--dx-ease); }
.dx-link:hover svg { transform: translateX(3px); }

/* KPI cards */
.dx-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } /* eight cards: 4 × 2 on desktop, 2 columns on tablet, see the media rules below */
.dx-kpi { position: relative; overflow: hidden; padding: 18px 20px; transition: transform var(--dx-dur) var(--dx-ease), box-shadow var(--dx-dur) var(--dx-ease); }
.dx-kpi::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--fm-accent), transparent 72%); opacity: 0; transition: opacity var(--dx-dur) var(--dx-ease); }
.dx-kpi:hover { transform: translateY(-3px); box-shadow: var(--dx-shadow-lg); }
.dx-kpi:hover::before { opacity: 1; }
.dx-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dx-kpi__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgb(32 57 104 / 8%); color: var(--fm-primary); }
.dx-delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--fm-radius-full); font: 600 12px/16px var(--fm-font); font-variant-numeric: tabular-nums; }
.dx-delta--good { background: var(--fm-accent-light); color: var(--fm-accent-text); }
.dx-delta--watch { background: #fef3c7; color: #92400e; }
.dx-kpi__label { margin: 16px 0 2px; font: 500 13px/18px var(--fm-font); color: var(--fm-text-secondary); }
.dx-kpi__value { margin: 0; font: 700 30px/38px var(--fm-font); letter-spacing: -0.025em; color: var(--fm-primary); font-variant-numeric: tabular-nums; }
.dx-kpi__foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dx-kpi__note { font: 400 12px/16px var(--fm-font); color: var(--fm-text-secondary); white-space: nowrap; }
.dx-spark { flex: none; overflow: visible; }
.dx-spark__area { fill: rgb(32 57 104 / 8%); }
.dx-spark__line { fill: none; stroke: var(--fm-primary); stroke-width: 2; stroke-linecap: round; }
.dx-spark__dot { fill: var(--fm-accent); stroke: #fff; stroke-width: 1.5; }

/* Layout grids */
.dx-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; }

/* Orders chart */
.dx-chart { width: 100%; height: auto; display: block; overflow: visible; }
.dx-chart__grid { stroke: var(--dx-line); stroke-dasharray: 3 5; }
.dx-chart__axis { fill: var(--fm-text-secondary); font: 400 11px var(--fm-font); }
.dx-chart__stop-a { stop-color: var(--fm-primary); stop-opacity: 0.22; }
.dx-chart__stop-b { stop-color: var(--fm-primary); stop-opacity: 0; }
.dx-chart__area { animation: dx-fade 0.9s var(--dx-ease) 0.35s both; }
.dx-chart__line { fill: none; stroke: var(--fm-primary); stroke-width: 2.5; stroke-linecap: round; }
.dx-chart__dot { fill: #fff; stroke: var(--fm-primary); stroke-width: 2.5; transition: r var(--dx-dur) var(--dx-ease); animation: dx-fade 0.5s var(--dx-ease) 0.9s both; }
.dx-chart__dot:hover { r: 7; }
.dx-chart__dot--now { fill: var(--fm-accent); stroke: #fff; stroke-width: 3; filter: drop-shadow(0 2px 4px rgb(32 57 104 / 35%)); }

/* "Needs attention" list */
.dx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dx-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--fm-text); text-decoration: none; transition: background-color var(--dx-dur) var(--dx-ease), transform var(--dx-dur) var(--dx-ease); }
.dx-item:hover { background: var(--fm-background); transform: translateX(2px); }
.dx-item:focus-visible { outline: 2px solid var(--fm-primary); outline-offset: 2px; }
.dx-item__icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.dx-item__icon--warn { background: #fef3c7; color: #92400e; }
.dx-item__icon--info { background: #dbeafe; color: #1e40af; }
.dx-item__icon--good { background: var(--fm-accent-light); color: var(--fm-accent-text); }
.dx-item__text { flex: 1; min-width: 0; font: 400 14px/20px var(--fm-font); }
.dx-item__text strong { font: 700 16px/20px var(--fm-font); color: var(--fm-primary); font-variant-numeric: tabular-nums; }
.dx-item__go { color: var(--fm-text-secondary); transition: transform var(--dx-dur) var(--dx-ease), color var(--dx-dur) var(--dx-ease); }
.dx-item:hover .dx-item__go { transform: translateX(3px); color: var(--fm-primary); }

/* Category bars */
.dx-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.dx-bars__row { display: flex; justify-content: space-between; gap: 12px; font: 500 14px/20px var(--fm-font); }
.dx-bars__val { color: var(--fm-text-secondary); font: 400 13px/20px var(--fm-font); font-variant-numeric: tabular-nums; }
.dx-bars__track { height: 8px; margin-top: 8px; border-radius: var(--fm-radius-full); background: rgb(32 57 104 / 8%); overflow: hidden; }
.dx-bars__fill { height: 100%; width: var(--w); border-radius: inherit; background: var(--fm-primary); animation: dx-grow 0.9s var(--dx-ease) calc(var(--i, 0) * 90ms + 400ms) both; }

/* Premium tables (scoped) */
.shell.is-premium .fm-table-wrap { border: 0; border-radius: 12px; background: transparent; margin: 0 -8px; }
.shell.is-premium .fm-table th {
  position: static; background: transparent; padding: 10px 14px; border-bottom: 1px solid var(--dx-line);
  font: 600 11px/16px var(--fm-font); letter-spacing: 0.07em; text-transform: uppercase; color: var(--fm-text-secondary);
}
.shell.is-premium .fm-table td { padding: 14px; border-bottom: 1px solid var(--dx-line); font-variant-numeric: tabular-nums; }
.shell.is-premium .fm-table td:first-child { font-weight: 600; color: var(--fm-primary); }
.shell.is-premium .fm-table tbody tr { transition: background-color var(--dx-dur) var(--dx-ease); }
.shell.is-premium .fm-table tbody tr:hover { background: rgb(32 57 104 / 3.5%); }
/* Status chips get a leading dot (status is still conveyed by text) */
.shell.is-premium .fm-chip { padding: 3px 10px; letter-spacing: 0.01em; }
.shell.is-premium .fm-chip::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.shell.is-premium .header__tag.fm-chip::before { display: none; }

/* ---------- Motion ---------- */
.dx-rise { animation: dx-rise 0.55s var(--dx-ease) both; animation-delay: calc(var(--i, 4) * 70ms + 40ms); }
.dx-grid + .dx-grid .dx-rise { --i: 6; }
.dx-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: dx-draw 1.1s var(--dx-ease) 0.25s forwards; }
@keyframes dx-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes dx-fade { from { opacity: 0; } }
@keyframes dx-draw { to { stroke-dashoffset: 0; } }
@keyframes dx-grow { from { width: 0; } }
@media (prefers-reduced-motion: reduce) {
  .dx-rise, .dx-chart__area, .dx-chart__dot, .dx-bars__fill { animation: none; }
  .dx-draw { animation: none; stroke-dashoffset: 0; }
  .shell.is-premium * { transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dx-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 639px) {
  .dx { gap: 16px; }
  .dx-kpis { gap: 12px; }
  .dx-card { padding: 16px; border-radius: 14px; }
  .dx-kpi { padding: 14px; }
  .dx-kpi__icon { width: 34px; height: 34px; border-radius: 10px; }
  .dx-kpi__label { margin-top: 12px; }
  .dx-kpi__value { font-size: 24px; line-height: 32px; }
  .dx-kpi__note { display: none; }
  .dx-delta { padding: 2px 7px; }
}
/* Dashboard: financial KPI cards (no invented trend line — they show their own breakdown) and the Needs-attention sub-line */
.dx-kpi__detail { display: flex; flex-direction: column; gap: 3px; min-height: 40px; margin-top: 8px; }
.dx-kpi__sub { margin: 0; font-size: .8125rem; font-weight: 600; color: var(--fm-text); }
.dx-kpi__line { margin: 0; font-size: .75rem; color: var(--fm-text-secondary); font-variant-numeric: tabular-nums; }
.dx-item__sub { display: block; font-size: .75rem; color: var(--fm-text-secondary); font-weight: 400; }
.dx-kpi--link:hover { box-shadow: var(--dx-shadow-lg), 0 0 0 1px var(--fm-primary); }

/* Dashboard time-period control (Total Orders + trade margin cards) */
.dx-period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.dx-period__label { font-size: .8125rem; font-weight: 600; color: var(--fm-text-secondary); margin-right: 4px; }
.dx-period__btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--fm-border, #d9dfe9); border-radius: 999px; background: #fff; color: var(--fm-navy, #203968); font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.dx-period__btn:hover { border-color: var(--fm-navy, #203968); }
.dx-period__btn[aria-pressed="true"] { background: var(--fm-navy, #203968); border-color: var(--fm-navy, #203968); color: #fff; }
.dx-period__btn:focus-visible { outline: 2px solid var(--fm-green, #4CAF61); outline-offset: 2px; }
.dx-period__note { flex-basis: 100%; font-size: .75rem; color: var(--fm-text-secondary); margin: 0; }
@media (min-width: 900px) { .dx-period__note { flex-basis: auto; margin-left: 8px; } }

/* KYC verification panel + registration (Buyer / Seller) */
.kp-summary { display: flex; flex-wrap: wrap; gap: 20px; padding: 14px 16px; border: 1px solid var(--fm-border, #e3e8f0); border-radius: 14px; background: #f7f9fc; }
.kp-summary > div { display: flex; flex-direction: column; gap: 6px; }
.kp-summary__label { font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--fm-text-secondary); font-weight: 700; }
.kp-card { border: 1px solid var(--fm-border, #e3e8f0); border-radius: 14px; padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.kp-card__head { display: flex; align-items: center; gap: 10px; }
.kp-card__icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #eef2f9; color: #203968; }
.kp-card__title { margin: 0; flex: 1; font-size: .9375rem; color: #203968; }
.kp-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: .75rem; color: var(--fm-text-secondary); }
.rg { display: flex; flex-direction: column; gap: 20px; max-width: 920px; }
.rg-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.rg-step { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--fm-border, #e3e8f0); border-radius: 14px; background: #fff; font-weight: 600; font-size: .875rem; color: var(--fm-text-secondary); }
.rg-step__n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eef2f9; color: #203968; font-size: .8125rem; }
.rg-step.is-active { border-color: #203968; color: #203968; box-shadow: 0 0 0 2px rgba(32,57,104,.12); }
.rg-step.is-active .rg-step__n { background: #203968; color: #fff; }
.rg-step.is-done .rg-step__n { background: #4CAF61; color: #1F2937; }
.rg-bar { height: 6px; border-radius: 99px; background: #e8edf5; overflow: hidden; }
.rg-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #203968, #4CAF61); transition: width .3s ease; }
.rg-card { border: 1px solid var(--fm-border, #e3e8f0); border-radius: 18px; padding: 24px; background: #fff; display: flex; flex-direction: column; gap: 18px; }
.rg-card h3 { margin: 0; color: #203968; font-size: 1.125rem; }
.rg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rg-grid .is-wide { grid-column: 1 / -1; }
.rg-role { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rg-role button { text-align: left; padding: 18px; border-radius: 16px; border: 2px solid var(--fm-border, #e3e8f0); background: #fff; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 6px; min-height: 96px; }
.rg-role button[aria-pressed="true"] { border-color: #203968; background: #f3f6fb; }
.rg-role strong { color: #203968; font-size: 1rem; }
.rg-upload { border: 2px dashed #b9c4d8; border-radius: 14px; padding: 18px; display: flex; gap: 12px; align-items: center; background: #fafbfd; }
.rg-upload.has-file { border-style: solid; border-color: #4CAF61; background: #f3faf5; }
.rg-consent { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 12px; background: #f3f6fb; font-size: .875rem; }
.rg-result { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--fm-border, #e3e8f0); }
.rg-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 860px) { .rg-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .rg-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rg-grid, .rg-role { grid-template-columns: 1fr; } .rg-card { padding: 16px; } }

/* Inline payment entries (Verify / Reject beside each pending payment) */
.pv-entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.pv-entry { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--fm-border, #e3e8f0); border-radius: 10px; background: #fff; }
.pv-entry--pending { border-color: #f1c36d; background: #fffaf0; }
.pv-entry--rejected { background: #fdf4f3; }
.pv-entry__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pv-entry__act { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 720px) { .pv-entry { flex-direction: column; align-items: flex-start; } }
.pv-cell { display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.pv-record { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pv-record button[disabled] { opacity: .55; cursor: not-allowed; }
.fm-menu__item.is-disabled { opacity: .6; cursor: not-allowed; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.fm-menu__hint { font-size: .7rem; font-weight: 400; color: var(--fm-text-secondary, #5b6678); white-space: normal; max-width: 240px; }
.pv-pick { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-pick button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--fm-border, #e3e8f0); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; }
.pv-pick button:hover, .pv-pick button:focus-visible { border-color: #b3261e; background: #fdf4f3; outline: none; }
