/* =========================================
   RESELLLEDGER — ASYMMETRIC DASHBOARD
========================================= */

:root {
  color-scheme: dark;

  --bg: #0d1012;
  --sidebar: #090c0e;
  --panel: #12181c;
  --panel-alt: #171e22;
  --border: #29343b;

  --text: #f1f3f4;
  --muted: #9ba8b0;
  --subtle: #71808a;

  --main-color: #f5ed00;
  --side-color: #090c0e;

  --green: #35d889;
  --red: #f07878;
  --yellow: #f5ed00;

  --radius: 8px;
  --sidebar-width: 245px;
}

/* RESET */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--main-color);
  outline-offset: 3px;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* APP SHELL */

.app-shell {
  min-height: 100vh;
}

/* =========================================
   SIDEBAR — PRESERVED
========================================= */

.sidebar {
  position: fixed;
  z-index: 100;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 26px 17px 18px;
  background: var(--side-color);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 7px 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  border-radius: 9px;
  background: var(--main-color);
  color: #101010;
  font-size: 22px;
  font-weight: 900;
}

.brand-title {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.5px;
}

.sidebar-section {
  margin-bottom: 27px;
}

.sidebar-label {
  margin: 0 0 11px 11px;
  color: #77828a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 46px;
  margin: 4px 0;
  padding: 11px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b3bdc4;
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  transition: background .15s, color .15s;
}

.sidebar-link .nav-icon {
  display: grid;
  place-items: center;
  width: 20px;
  font-size: 19px;
}

.sidebar-link:hover {
  background: #171d21;
  color: white;
}

.sidebar-link.active {
  background: #191f22;
  color: var(--main-color);
  border-left: 3px solid var(--main-color);
  padding-left: 10px;
  font-weight: 650;
}

.sidebar-link.active .nav-icon {
  color: var(--main-color);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.sidebar-profit {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 20px;
  padding: 13px 8px;
  background: transparent;
}

.sidebar-profit span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-profit strong {
  font-size: 25px;
  font-weight: 750;
}

.sidebar-profit small {
  color: var(--muted);
  font-size: 11px;
}

.sidebar-storage {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  color: #aeb8bf;
  font-size: 11px;
}

.status-dot {
  display: inline-block;
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.sidebar-version {
  margin: 16px 8px 0;
  color: #68747c;
  font-size: 10px;
}

/* =========================================
   MAIN CONTENT
========================================= */

.main-wrapper {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.app-container {
  width: 100%;
  max-width: 1650px;
  margin: 0 auto;
  padding: 29px 32px 50px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-enter .16s ease-out;
}

@keyframes page-enter {
  from {
    opacity: .7;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* TOPBAR */

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 73px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 16, 18, .97);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.desktop-page-title {
  font-size: 14px;
  font-weight: 650;
}

.topbar-right {
  gap: 19px;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(440px, 38vw);
  padding: 0 13px;
  border: 1px solid #303c43;
  border-radius: 7px;
  background: #171e22;
}

.header-search span {
  color: #aab4bb;
  font-size: 22px;
}

.header-search input {
  width: 100%;
  min-height: 41px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.header-search input:focus {
  outline: none;
}

.header-search input::placeholder {
  color: #85919a;
}

.header-profile {
  display: grid;
  place-items: center;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 50%;
  background: var(--main-color);
  color: #101010;
  font-size: 14px;
  font-weight: 850;
}

.mobile-brand {
  display: none;
}

.mobile-search-toggle {
  display: none;
}

/* HEADINGS */

.page-heading,
.dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 23px;
}

.page-heading h1,
.dashboard-heading h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 720;
  letter-spacing: -.8px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--main-color);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.page-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

/* =========================================
   DASHBOARD STATISTICS
========================================= */

.stats-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr 1fr .9fr;
  gap: 12px;
  margin-bottom: 13px;
}

.stat-card {
  min-width: 0;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat-card:hover {
  border-color: #40505a;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: #c4cdd2;
  font-size: 12px;
  font-weight: 550;
}

.stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  border-radius: 6px;
  background: #202a2f;
  color: var(--main-color);
  font-size: 15px;
  font-weight: 750;
}

.stat-card h2 {
  overflow-wrap: anywhere;
  margin: 13px 0 3px;
  color: white;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 750;
  letter-spacing: -.8px;
}

.stat-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.inventory-status-card {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

.inventory-status-card .stat-top {
  color: #c4cdd2;
  font-size: 12px;
  font-weight: 550;
}

.inventory-status-card .stat-icon {
  background: #202a2f;
  color: var(--main-color);
}

.inventory-status-content {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.inventory-status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #c5cdd2;
  font-size: 11px;
}

.inventory-status-line strong {
  margin-left: auto;
  color: white;
  font-size: 12px;
}

.inventory-status-line .status-dot {
  background: var(--green);
}

.inventory-status-line .sold-dot {
  background: #85939b;
}

.inventory-status-line .pending-dot {
  background: var(--main-color);
}

.inventory-status-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}

.inventory-status-card .text-button {
  color: var(--main-color);
}

/* FINANCIAL STATISTICS */

.financial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.25fr;
  gap: 12px;
  margin-bottom: 23px;
}

.financial-card {
  padding: 14px 17px;
}

.financial-card h2 {
  font-size: 22px;
}

.profit-card {
  border-color: #3c4630;
  background: #151b18;
}

.profit-card h2 {
  color: var(--green);
}

/* =========================================
   ASYMMETRIC DASHBOARD PANELS
========================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(270px, .85fr);
  gap: 15px;
  margin-bottom: 16px;
  align-items: stretch;
}

.lower-dashboard-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .85fr);
}

/* Sales gets more space */

.sales-overview-panel {
  min-height: 390px;
  padding: 22px 23px;
}

.sales-overview-panel .chart-container {
  height: 255px;
}

/* Recent inventory gets more width */

.recent-items-panel {
  min-height: 310px;
}

/* Activity stays narrower and more compact */

.activity-panel {
  min-height: 275px;
  padding: 17px;
}

.categories-panel {
  min-height: 235px;
  padding: 17px;
}

.panel {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.panel-heading h3 {
  margin: 0;
  color: #f0f3f4;
  font-size: 16px;
  font-weight: 680;
}

.panel-heading .eyebrow {
  margin-bottom: 3px;
}

.panel-badge {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #171e22;
  color: #b5c0c6;
  font-size: 10px;
}

/* CHART */

.chart-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.chart-summary strong {
  font-size: 29px;
  font-weight: 750;
  letter-spacing: -.7px;
}

.chart-summary span {
  color: var(--muted);
  font-size: 11px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 215px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
}

/* CATEGORY BREAKDOWN */

.category-overview {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr);
  align-items: center;
  gap: 17px;
  min-height: 170px;
}

.category-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 125px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(
    var(--main-color) 0deg,
    #8d9ba3 120deg,
    #52616b 220deg,
    #29343b 300deg,
    var(--main-color) 360deg
  );
}

.category-donut::before {
  content: "";
  position: absolute;
  width: 67%;
  height: 67%;
  border-radius: 50%;
  background: var(--panel);
}

.donut-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center strong {
  font-size: 24px;
  font-weight: 750;
}

.donut-center span {
  color: var(--muted);
  font-size: 10px;
}

.category-legend {
  display: grid;
  gap: 0;
}

.category-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.category-legend-row:last-child {
  border-bottom: 0;
}

.category-color {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.category-name {
  flex: 1;
  min-width: 0;
  color: #dce2e5;
}

.category-count {
  color: white;
  font-weight: 700;
}

.category-percent {
  min-width: 35px;
  color: var(--muted);
  text-align: right;
}

/* RECENT ACTIVITY */

.activity-list {
  display: grid;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  place-items: center;
  flex: 0 0 33px;
  width: 33px;
  height: 33px;
  border-radius: 6px;
  background: #202a2f;
  color: var(--main-color);
  font-size: 14px;
  font-weight: 750;
}

.activity-icon.paid {
  background: rgba(53, 216, 137, .12);
  color: var(--green);
}

.activity-icon.updated {
  background: #263138;
  color: #c8d1d6;
}

.activity-main {
  flex: 1;
  min-width: 0;
}

.activity-main strong {
  display: block;
  overflow: hidden;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-main span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  flex-shrink: 0;
  color: var(--green);
  font-size: 10px;
}

/* =========================================
   BUTTONS
========================================= */

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  transition: background .15s, border-color .15s;
}

.primary-button {
  background: var(--main-color);
  color: #111;
}

.primary-button:hover {
  background: #fff72b;
}

.secondary-button {
  border-color: var(--border);
  background: #192126;
  color: #dce3e7;
}

.secondary-button:hover {
  background: #222d33;
  border-color: #40505a;
}

.danger-button {
  border-color: rgba(240, 120, 120, .25);
  background: rgba(240, 120, 120, .1);
  color: var(--red);
}

.danger-button:hover {
  background: rgba(240, 120, 120, .18);
}

.full-button {
  width: 100%;
  margin-top: 8px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--main-color);
  font-size: 11px;
  font-weight: 650;
}

/* =========================================
   INVENTORY
========================================= */

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 11px;
  margin-bottom: 17px;
}

.item-list {
  display: grid;
  gap: 9px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  transition: border-color .15s;
}

.item-row:hover {
  border-color: #40505a;
}

.item-thumbnail {
  display: grid;
  place-items: center;
  flex: 0 0 55px;
  width: 55px;
  height: 55px;
  overflow: hidden;
  border: 1px solid #354149;
  border-radius: 6px;
  background: #202a30;
  color: var(--main-color);
  font-size: 20px;
}

.item-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  overflow: hidden;
  margin-bottom: 4px;
  color: white;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 10px;
}

.item-price {
  flex-shrink: 0;
  text-align: right;
}

.item-price strong {
  display: block;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.item-price span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 5px;
  background: #253038;
  color: #bdc9cf;
  font-size: 10px;
  font-weight: 650;
}

.status-pill.pending {
  background: rgba(245, 237, 0, .12);
  color: var(--main-color);
}

.status-pill.paid {
  background: rgba(53, 216, 137, .12);
  color: var(--green);
}

.empty-state {
  padding: 32px 18px;
  border: 1px dashed #354149;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 7px;
  color: white;
  font-size: 15px;
}

.empty-state p {
  margin: 0;
}

/* =========================================
   FORMS
========================================= */

.form-panel {
  max-width: 850px;
  padding: 23px;
}

.form-group {
  min-width: 0;
  margin-bottom: 17px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  color: #dce3e7;
  font-size: 12px;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #303c43;
  border-radius: 6px;
  background: #101619;
  color: var(--text);
  font-size: 13px;
}

input,
select {
  min-height: 43px;
  padding: 9px 11px;
}

textarea {
  padding: 11px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #78858d;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.form-message {
  color: var(--green);
  font-size: 12px;
}

.form-message.error {
  color: var(--red);
}

/* =========================================
   DETAILS MODAL
========================================= */

.details-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  background: rgba(0, 0, 0, .82);
}

.hidden {
  display: none !important;
}

.auth-locked { display: none !important; }
.auth-gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: #101010; color: #f4f4f4;
}
.auth-card {
  width: min(100%, 440px); padding: 32px; border: 1px solid #34383a;
  border-radius: 18px; background: #17191a; box-shadow: 0 24px 80px #0008;
}
.auth-card h1 { margin: 8px 0; }
.auth-card label { display: block; margin: 18px 0 7px; color: #c9ced1; }
.auth-card input {
  box-sizing: border-box; width: 100%; min-height: 46px; padding: 10px 12px;
  color: #f4f4f4; background: #101010; border: 1px solid #454b50; border-radius: 9px;
}
.auth-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.auth-actions button { flex: 1; min-width: 130px; }
.account-button { margin-right: 10px; }
.auth-card .form-message { min-height: 1.4em; }

.details-panel {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #12181c;
}

.details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 19px;
}

.details-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
}

.details-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #202a30;
  color: white;
  font-size: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 15px;
}

.detail-box {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #101619;
}

.detail-box span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.detail-box strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.details-photo {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin: 15px auto;
  border-radius: 6px;
  object-fit: contain;
}

.details-notes {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #101619;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* SALE FORM */

.sale-form {
  margin-top: 21px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #101619;
}

.sale-form h3 {
  margin-top: 0;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.field input {
  margin-top: 6px;
}

.full-width {
  grid-column: 1 / -1;
}

.sale-summary {
  margin-top: 13px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #192126;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* TOAST */

.toast {
  position: fixed;
  z-index: 300;
  right: 18px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 16px;
  border: 1px solid #354149;
  border-radius: 7px;
  background: #1b252b;
  color: white;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* MOBILE NAVIGATION */

.bottom-nav {
  display: none;
}

.mobile-tools-menu {
  display: none;
}

/* =========================================
   TABLET
========================================= */

@media (max-width: 1150px) {
  :root {
    --sidebar-width: 210px;
  }

  .app-container {
    padding-right: 21px;
    padding-left: 21px;
  }

  .topbar {
    padding-right: 21px;
    padding-left: 21px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .financial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .lower-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sales-overview-panel {
    min-height: 350px;
  }

  .recent-items-panel {
    min-height: 260px;
  }

  .activity-panel,
  .categories-panel {
    min-height: auto;
  }
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .sidebar {
    display: none;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .topbar {
    min-height: 61px;
    padding: 0 14px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    color: white;
    font-size: 15px;
    font-weight: 750;
  }

  .mobile-brand .brand-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    font-size: 17px;
  }

  .desktop-page-title {
    display: none;
  }

  .header-search {
    width: 36px;
    height: 37px;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .header-search span {
    display: none;
  }

  .mobile-search-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 37px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #aab4bb;
    font-size: 23px;
  }

  .header-search.mobile-search-open {
    position: absolute;
    z-index: 61;
    top: 10px;
    right: 12px;
    left: 12px;
    width: auto;
    height: 42px;
    justify-content: stretch;
    padding: 0 5px 0 9px;
    border: 1px solid #46535b;
    background: #171e22;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  }

  .header-search.mobile-search-open .mobile-search-toggle {
    order: 2;
    flex: 0 0 36px;
  }

  .header-search.mobile-search-open input {
    display: block;
    min-width: 0;
    padding: 8px;
    font-size: 14px;
  }

  .header-search input {
    display: none;
  }

  .topbar-right {
    gap: 10px;
  }

  .profile-avatar {
    width: 33px;
    height: 33px;
  }

  .app-container {
    padding: 21px 13px 26px;
  }

  .page-heading,
  .dashboard-heading {
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 18px;
  }

  .page-heading h1,
  .dashboard-heading h1 {
    font-size: 24px;
  }

  .page-description {
    font-size: 11px;
  }

  .dashboard-heading > .primary-button,
  .page-heading > .primary-button {
    min-height: 37px;
    padding: 8px 10px;
    font-size: 10px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .stat-card {
    padding: 13px;
  }

  .stat-top {
    font-size: 10px;
  }

  .stat-card h2 {
    margin-top: 11px;
    font-size: 21px;
  }

  .stat-card > p {
    font-size: 9px;
  }

  .inventory-status-card .stat-top {
    font-size: 11px;
  }

  .inventory-status-line {
    font-size: 10px;
  }

  .inventory-status-footer {
    font-size: 9px;
  }

  .financial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .financial-card {
    padding: 12px;
  }

  .financial-card h2 {
    font-size: 19px;
  }

  .dashboard-grid,
  .lower-dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  .sales-overview-panel {
    min-height: 330px;
    padding: 16px;
  }

  .sales-overview-panel .chart-container {
    height: 215px;
  }

  .recent-items-panel {
    min-height: 250px;
  }

  .activity-panel,
  .categories-panel {
    min-height: auto;
  }

  .panel {
    padding: 15px;
  }

  .panel-heading h3 {
    font-size: 15px;
  }

  .chart-container {
    height: 185px;
  }

  .category-overview {
    grid-template-columns: 105px minmax(0, 1fr);
    gap: 13px;
  }

  .category-donut {
    width: 105px;
  }

  .donut-center strong {
    font-size: 20px;
  }

  .category-legend-row {
    gap: 6px;
    font-size: 10px;
  }

  .activity-time {
    font-size: 9px;
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .form-panel {
    padding: 15px;
  }

  .form-row {
    gap: 10px;
  }

  .item-row {
    gap: 9px;
    padding: 10px;
  }

  .item-thumbnail {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
  }

  .item-title {
    font-size: 12px;
  }

  .item-meta {
    font-size: 9px;
  }

  .item-price strong {
    font-size: 12px;
  }

  .item-price span {
    font-size: 9px;
  }

  /* MOBILE BOTTOM NAV */

  .bottom-nav {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    padding: 7px 5px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(9, 12, 14, .98);
  }

  .nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 48px;
    padding: 5px 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
  }

  .nav-button .nav-icon {
    font-size: 19px;
    line-height: 1.1;
  }

  .nav-button.active {
    background: #1b2429;
    color: var(--main-color);
  }

  .nav-button.add-nav-button .nav-icon {
    font-size: 23px;
  }

  .mobile-tools-menu:not([hidden]) {
    position: fixed;
    z-index: 120;
    right: 10px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    width: min(270px, calc(100vw - 20px));
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #101619;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  }

  .mobile-tool-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .mobile-tool-link:hover,
  .mobile-tool-link:focus-visible {
    background: #1b2429;
    color: var(--main-color);
  }

  .mobile-tool-link .nav-icon {
    display: grid;
    flex: 0 0 22px;
    place-items: center;
    font-size: 19px;
  }

  .toast {
    right: 12px;
    bottom: calc(85px + env(safe-area-inset-bottom));
    left: 12px;
    margin: auto;
  }

  .details-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .details-panel {
    max-width: none;
    max-height: 90vh;
    padding: 19px 15px calc(19px + env(safe-area-inset-bottom));
    border-radius: 10px 10px 0 0;
  }
}

/* SMALL PHONES */

@media (max-width: 370px) {
  .app-container {
    padding-right: 10px;
    padding-left: 10px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-card h2 {
    font-size: 18px;
  }

  .stat-top {
    font-size: 9px;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-overview {
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 10px;
  }

  .category-donut {
    width: 90px;
  }

  .item-thumbnail {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .item-price {
    max-width: 90px;
  }

  .nav-button {
    font-size: 8px;
  }
}

/* ACCESSIBILITY */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.financial-reports-panel { margin-top: 24px; }
.sync-status { border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: transparent; color: #92969b; padding: 7px 10px; font-size: 11px; cursor: pointer; }
.sync-status[data-state="saved"] { color: #39d98a; }
.sync-status[data-state="error"] { color: #ff8b7a; border-color: rgba(255,139,122,.45); }
.report-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0 8px; }
.report-filters label, .ebay-estimate-control { display: flex; flex-direction: column; gap: 6px; color: #b9bec2; font-size: 12px; }
.report-filters input, .report-filters select { min-height: 38px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: #17191a; color: #f3f4f4; }
.ebay-estimate-control { margin: 10px 0 16px; max-width: 520px; }
.ebay-estimate-control input, .sale-payout-allocation input[type="range"], #saleReinvestmentPercent { width: 100%; accent-color: #efff00; }
.ebay-estimate-control small { color: #92969b; }
.sale-payout-allocation { margin: 16px 0; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.025); }
.photo-preview-wrap { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.photo-preview-wrap[hidden] { display: none; }
.photo-preview-wrap img { width: 140px; height: 140px; object-fit: contain; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: #0d0e0e; }
.photo-preview-wrap .form-message { margin: 0; }
.photo-retry-button { position: absolute; z-index: 1; bottom: 8px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 5px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; background: #17191a; color: #efff00; font-size: 11px; cursor: pointer; }
.item-thumbnail, .details-photo { position: relative; }
.item-thumbnail .photo-retry-button { bottom: 4px; }
.details-photo.photo-load-error { opacity: .35; }
.reset-backup-option { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: #c6c9cc; font-size: 13px; }
.reset-backup-option input { accent-color: #efff00; }
.auth-card .text-button { display: block; margin: 12px auto 0; border: 0; background: none; color: #efff00; cursor: pointer; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.report-table-wrap { width: 100%; overflow-x: auto; margin-top: 12px; }
.report-table { width: 100%; min-width: 690px; border-collapse: collapse; text-align: right; }
.report-table th, .report-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.report-table thead th { color: #92969b; font-size: 11px; font-weight: 600; }
.report-table tbody th { text-align: left; font-weight: 600; }
.report-subheading { margin: 24px 0 8px; }

@media (max-width: 720px) {
  .report-actions { width: 100%; }
  .report-actions button { flex: 1 1 45%; }
}

.mobile-account-link { display: none; }
.account-panel, .ebay-import-panel, .ebay-active-import-panel { margin-bottom: 18px; }
.account-reset-panel { margin-bottom: 18px; }
.account-panel .page-description { margin-bottom: 0; }
.ebay-preview-table { min-width: 1240px; }
.ebay-active-preview-table { min-width: 920px; }
.ebay-active-percent input[type="range"] { display: block; width: min(100%, 320px); margin-top: 9px; accent-color: #efff00; }
.ebay-preview-table td:first-child, .ebay-preview-table th:first-child { text-align: center; }
.ebay-preview-table input[type="checkbox"] { accent-color: #efff00; width: 18px; height: 18px; }
.ebay-cost-input { width: 100px; min-width: 90px; }
.ebay-split-control { display: flex; flex-direction: column; gap: 5px; min-width: 145px; }
.ebay-split-control input[type="range"] { width: 135px; accent-color: #efff00; }
.ebay-split-control small { color: #92969b; font-size: 10px; white-space: nowrap; }
.import-sku { display: block; margin-top: 4px; color: #92969b; font-size: 11px; }
.photo-camera-label { display: inline-block; margin-top: 12px; color: #efff00; cursor: pointer; text-decoration: underline; }
.photo-search-button { margin-top: 12px; }
.sale-date-estimate { grid-column: 1 / -1; margin: 0; }

.feature-panel { margin-bottom: 18px; }
.feature-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.feature-form .primary-button { justify-self: start; }
.feature-form .full-width { grid-column: 1 / -1; }
.feature-list { display: grid; gap: 10px; margin-top: 16px; }
.feature-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 13px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.02); }
.feature-row p { margin: 5px 0 0; color: #a5a8ad; font-size: 13px; }
.feature-row small { display: block; margin-top: 5px; color: #92969b; }
.feature-row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.draft-card > img { width: 100%; max-height: 130px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.04); }
.lot-item-choices { display: grid; gap: 7px; max-height: 260px; overflow: auto; }
.lot-item-choice { display: grid; grid-template-columns: 20px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 9px; border-radius: 9px; background: rgba(255,255,255,.035); }
.lot-item-choice small { color: #92969b; }
.goal-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; }
.goal-row p { margin: 5px 0; color: #a5a8ad; }
.goal-meter { height: 7px; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.1); }
.goal-meter span { display: block; height: 100%; background: #efff00; }
.scanner-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.82); }
.scanner-card { width: min(100%,460px); display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: #191a1d; }
.scanner-card video { width: 100%; max-height: 60vh; object-fit: cover; border-radius: 10px; }
.market-value-panel { display: grid; gap: 10px; margin: 18px 0; padding: 15px; border: 1px solid rgba(239,255,0,.18); border-radius: 14px; background: rgba(239,255,0,.025); }
.market-value-panel .panel-heading { margin-bottom: 0; }
.market-value-panel h3 { margin: 4px 0 0; }
.market-source-pill { padding: 5px 9px; border: 1px solid rgba(255,255,255,.13); border-radius: 99px; color: #c2c6c9; font-size: 11px; }
.market-manual-form { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.market-manual-form .field { width: min(100%,240px); }
.market-value-chip { color: #eaff7d !important; }
.deal-mode-switch { margin-bottom: 14px; }
.deal-card { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 14px; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; }
.deal-card-match { border-color: rgba(239,255,0,.65); }
.deal-card > img { width: 100%; max-height: 130px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.04); }
.deal-card-main { display: grid; gap: 6px; }
.deal-card-main span, .deal-card-main small { color: #a5a8ad; font-size: 13px; }
.deal-results { display: grid; gap: 10px; margin-top: 16px; }

@media (max-width: 700px) {
  .mobile-account-link { display: inline-flex; padding: 7px 9px; font-size: 11px; }
  .topbar-right { gap: 6px; }
  .sync-status { padding: 6px 8px; font-size: 10px; }
  .report-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .report-filters label { min-width: 0; }
  .report-filters input, .report-filters select { width: 100%; }
  .photo-preview-wrap { align-items: flex-start; flex-direction: column; }
  .feature-form { grid-template-columns: 1fr; }
  .feature-form .full-width { grid-column: auto; }
  .feature-row { align-items: flex-start; }
  .feature-row-actions { width: 100%; }
  .feature-row-actions button { flex: 1 1 auto; }
  .deal-card { grid-template-columns: 76px minmax(0,1fr); }
  .lot-item-choice { grid-template-columns: 20px minmax(0,1fr); }
  .lot-item-choice small { grid-column: 2; }
  .market-manual-form { align-items: stretch; flex-direction: column; }
  .market-manual-form .field { width: 100%; }
}
