/* =========================================================
   LIKESTAR MANAGEMENT — SALES PAGE
   management-sales.css
   ========================================================= */


/* =========================================================
   1. ROOT / BRAND TOKENS
   ========================================================= */

:root {
  --blue: #0B5ED7;
  --blue-dark: #084298;
  --blue-hover: #0956C6;
  --blue-light: #EAF3FF;

  --orange: #F7931E;
  --orange-dark: #D97706;
  --orange-light: #FFF4E5;

  --white: #FFFFFF;
  --black: #14213D;

  --text: #26364A;
  --muted: #64748B;
  --muted-light: #94A3B8;

  --border: #E2E8F0;
  --border-light: #EDF1F5;

  --light: #F7F9FC;
  --surface-soft: #F8FAFD;

  --success: #16A34A;
  --success-light: #ECFDF3;

  --danger: #DC2626;
  --danger-light: #FEF2F2;

  --warning: #F59E0B;
  --warning-light: #FFFBEB;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 6px 22px rgba(20, 33, 61, 0.06);
  --shadow-md: 0 18px 45px rgba(20, 33, 61, 0.12);
  --shadow-lg: 0 28px 70px rgba(20, 33, 61, 0.18);

  --sidebar-width: 260px;
  --topbar-height: 76px;

  --font-body: "DM Sans", sans-serif;
  --font-heading: "Plus Jakarta Sans", sans-serif;

  --transition: 0.25s ease;
}


/* =========================================================
   2. RESET
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;

  background: var(--light);
  color: var(--text);

  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

input,
select,
textarea {
  outline: none;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}


/* =========================================================
   3. SIDEBAR
   ========================================================= */

.sidebar {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;

  display: flex;
  flex-direction: column;

  width: var(--sidebar-width);
  height: 100vh;

  padding: 22px 14px 16px;

  background: var(--white);
  border-right: 1px solid var(--border);

  overflow: hidden;

  transition:
    transform var(--transition),
    box-shadow var(--transition);
}


/* =========================================================
   4. SIDEBAR BRAND
   ========================================================= */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;

  padding: 2px 9px 21px;
}

.brand-mark {
  display: grid;
  flex: 0 0 40px;

  width: 40px;
  height: 40px;

  place-items: center;

  background: var(--blue);
  color: var(--white);

  border-radius: 12px;

  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 800;

  box-shadow:
    0 7px 18px rgba(11, 94, 215, 0.18);
}

.brand-copy {
  display: flex;
  flex-direction: column;

  min-width: 0;
}

.brand-copy strong {
  color: var(--black);

  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;

  line-height: 1.1;
}

.brand-copy span {
  margin-top: 3px;

  color: var(--muted);

  font-size: 10px;
  font-weight: 600;

  letter-spacing: 0.05em;
}


/* =========================================================
   5. SIDEBAR AUTH PROFILE
   ========================================================= */

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;

  min-width: 0;

  margin: 0 2px 18px;
  padding: 12px;

  background: var(--surface-soft);

  border: 1px solid var(--border-light);
  border-radius: 14px;
}

.sidebar-avatar-wrap {
  position: relative;

  flex: 0 0 42px;

  width: 42px;
  height: 42px;
}

.sidebar-avatar {
  display: block;

  width: 42px;
  height: 42px;

  object-fit: cover;

  background: var(--blue-light);

  border: 2px solid var(--white);
  border-radius: 50%;

  box-shadow:
    0 3px 10px rgba(20, 33, 61, 0.12);
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;

  min-width: 0;
  flex: 1;
}

.sidebar-user-info strong {
  display: block;

  min-width: 0;

  color: var(--black);

  font-size: 12px;
  font-weight: 800;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-info span {
  display: block;

  margin-top: 2px;

  color: var(--blue);

  font-size: 10px;
  font-weight: 700;

  text-transform: capitalize;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================================
   6. SIDEBAR NAVIGATION
   ========================================================= */

.sidebar-nav {
  flex: 1;

  min-height: 0;

  padding: 2px 0;

  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.nav-section-label {
  padding: 16px 11px 7px;

  color: var(--muted-light);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;

  display: flex;
  align-items: center;
  gap: 11px;

  min-height: 42px;

  margin: 2px 0;
  padding: 0 11px;

  color: var(--muted);

  border-radius: 10px;

  font-size: 12px;
  font-weight: 600;

  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition);
}

.nav-item:hover {
  background: var(--blue-light);
  color: var(--blue);
}

.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 800;
}

.nav-item.active::before {
  content: "";

  position: absolute;

  top: 8px;
  bottom: 8px;
  left: 0;

  width: 3px;

  background: var(--blue);

  border-radius: 0 4px 4px 0;
}

.nav-icon {
  display: grid;

  width: 22px;
  height: 22px;

  flex: 0 0 22px;

  place-items: center;

  color: currentColor;

  font-size: 16px;
  font-weight: 700;
}

.nav-item span:last-child {
  white-space: nowrap;
}


/* =========================================================
   7. SIDEBAR FOOTER
   ========================================================= */

.sidebar-footer {
  flex-shrink: 0;

  padding: 15px 9px 1px;
}

.sidebar-footer-line {
  width: 100%;
  height: 1px;

  margin-bottom: 12px;

  background: var(--border-light);
}

.sidebar-footer > span {
  display: block;

  color: var(--text);

  font-size: 10px;
  font-weight: 700;
}

.sidebar-footer small {
  display: block;

  margin-top: 2px;

  color: var(--muted-light);

  font-size: 9px;
  font-weight: 500;
}


/* =========================================================
   8. MOBILE SIDEBAR OVERLAY
   ========================================================= */

.sidebar-overlay {
  position: fixed;
  z-index: 900;
  inset: 0;

  display: none;

  background: rgba(20, 33, 61, 0.42);

  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
  display: block;
}


/* =========================================================
   9. MAIN CONTENT
   ========================================================= */

.main-content {
  min-height: 100vh;

  margin-left: var(--sidebar-width);
}


/* =========================================================
   10. TOPBAR
   ========================================================= */

.topbar {
  position: sticky;
  z-index: 500;
  top: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: var(--topbar-height);

  padding: 0 30px;

  background: rgba(255, 255, 255, 0.94);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
}

.topbar-left {
  min-width: 0;
}

.topbar-right {
  gap: 10px;
}


/* =========================================================
   11. MOBILE MENU
   ========================================================= */

.mobile-menu-button {
  display: none;

  width: 40px;
  height: 40px;

  margin-right: 12px;
  padding: 8px;

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: 10px;
}

.mobile-menu-button span {
  display: block;

  width: 100%;
  height: 2px;

  margin: 4px 0;

  background: var(--black);

  border-radius: 5px;

  transition: var(--transition);
}


/* =========================================================
   12. PAGE HEADING
   ========================================================= */

.page-heading {
  min-width: 0;
}

.eyebrow {
  color: var(--blue);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.1em;
  text-transform: uppercase;

  line-height: 1.2;
}

.page-heading h1 {
  margin: 3px 0 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 800;

  line-height: 1.2;
  letter-spacing: -0.025em;
}


/* =========================================================
   13. TOPBAR ACTIONS
   ========================================================= */

.icon-button {
  display: grid;

  width: 38px;
  height: 38px;

  place-items: center;

  background: var(--white);
  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 10px;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.icon-button:hover {
  color: var(--blue);

  background: var(--blue-light);

  border-color: #CFE0FA;
}

.notification-icon {
  font-size: 18px;
  line-height: 1;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  min-height: 38px;

  padding: 0 13px;

  background: var(--white);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 10px;

  font-size: 11px;
  font-weight: 700;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.refresh-button:hover {
  color: var(--blue);

  background: var(--blue-light);

  border-color: #CFE0FA;
}

.refresh-button:active {
  transform: scale(0.98);
}

.refresh-icon {
  font-size: 17px;
  line-height: 1;
}


/* =========================================================
   14. TOPBAR AUTH PROFILE
   ========================================================= */

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;

  min-width: 0;

  margin-left: 3px;
  padding-left: 11px;

  border-left: 1px solid var(--border);
}

.topbar-avatar {
  width: 36px;
  height: 36px;

  flex: 0 0 36px;

  object-fit: cover;

  background: var(--blue-light);

  border: 2px solid var(--white);
  border-radius: 50%;

  box-shadow:
    0 3px 9px rgba(20, 33, 61, 0.12);
}

.topbar-user-copy {
  display: flex;
  flex-direction: column;

  min-width: 0;
  max-width: 135px;
}

.topbar-user-copy strong {
  display: block;

  color: var(--black);

  font-size: 11px;
  font-weight: 800;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-copy span {
  display: block;

  margin-top: 1px;

  color: var(--blue);

  font-size: 9px;
  font-weight: 700;

  text-transform: capitalize;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================================
   15. PAGE CONTAINER
   ========================================================= */

.page-container {
  width: 100%;
  max-width: 1600px;

  margin: 0 auto;

  padding: 30px;
}


/* =========================================================
   16. PAGE INTRO
   ========================================================= */

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  margin-bottom: 24px;
}

.page-intro h2 {
  margin: 5px 0 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 23px;
  font-weight: 800;

  line-height: 1.2;
  letter-spacing: -0.03em;
}

.page-intro p {
  max-width: 650px;

  margin: 7px 0 0;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.6;
}


/* =========================================================
   17. STATISTICS
   ========================================================= */

.stats-grid {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 16px;

  margin-bottom: 22px;
}

.stat-card {
  min-width: 0;

  padding: 18px;

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  box-shadow: var(--shadow-sm);

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    border-color var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);

  border-color: #D5E2F2;

  box-shadow:
    0 12px 30px rgba(20, 33, 61, 0.08);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

.stat-label {
  color: var(--muted);

  font-size: 10px;
  font-weight: 700;

  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-icon {
  display: grid;

  width: 31px;
  height: 31px;

  flex: 0 0 31px;

  place-items: center;

  border-radius: 9px;

  font-size: 14px;
  font-weight: 800;
}

.stat-icon-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.stat-icon-orange {
  background: var(--orange-light);
  color: var(--orange-dark);
}

.stat-icon-green {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon-dark {
  background: #EEF2F7;
  color: var(--black);
}

.stat-value {
  display: block;

  margin-top: 14px;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 800;

  line-height: 1.2;
  letter-spacing: -0.025em;

  overflow-wrap: anywhere;
}

.stat-description {
  display: block;

  margin-top: 5px;

  color: var(--muted-light);

  font-size: 10px;
  font-weight: 500;
}


/* =========================================================
   18. PANELS
   ========================================================= */

.panel {
  min-width: 0;

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  box-shadow: var(--shadow-sm);
}

.filters-panel {
  margin-bottom: 20px;
}

.sales-table-panel {
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  padding: 20px 22px;

  border-bottom: 1px solid var(--border-light);
}

.panel-head h2 {
  margin: 4px 0 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;

  line-height: 1.25;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 5px 0 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.5;
}


/* =========================================================
   19. FILTER PANEL
   ========================================================= */

.filters-grid {
  display: grid;

  grid-template-columns:
    minmax(220px, 1.7fr)
    minmax(145px, 1fr)
    minmax(145px, 1fr)
    minmax(145px, 1fr)
    auto;

  gap: 13px;

  padding: 19px 22px;
}

.filter-field {
  min-width: 0;
}

.filter-field label {
  display: block;

  margin-bottom: 6px;

  color: var(--text);

  font-size: 10px;
  font-weight: 800;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;

  top: 50%;
  left: 11px;

  transform: translateY(-50%);

  color: var(--muted-light);

  font-size: 16px;

  pointer-events: none;
}

.filter-field input,
.filter-field select {
  display: block;

  width: 100%;
  min-width: 0;
  height: 40px;

  padding: 0 11px;

  background: var(--white);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 9px;

  outline: none;

  font-size: 11px;
  font-weight: 500;

  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.search-field input {
  padding-left: 34px;
}

.filter-field input::placeholder {
  color: var(--muted-light);
}

.filter-field input:hover,
.filter-field select:hover {
  border-color: #C8D5E4;
}

.filter-field input:focus,
.filter-field select:focus {
  border-color: var(--blue);

  box-shadow:
    0 0 0 3px rgba(11, 94, 215, 0.09);
}

.filter-field select {
  cursor: pointer;
}

.filter-action {
  min-width: 115px;
}


/* =========================================================
   20. SECONDARY BUTTON
   ========================================================= */

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  min-height: 40px;

  padding: 0 13px;

  background: var(--white);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 9px;

  font-size: 11px;
  font-weight: 700;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.secondary-button:hover {
  color: var(--blue);

  background: var(--blue-light);

  border-color: #C9DDF8;
}

.secondary-button:active {
  transform: scale(0.98);
}


/* =========================================================
   21. FILTER FOOTER
   ========================================================= */

.filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 40px;

  padding: 0 22px;

  border-top: 1px solid var(--border-light);
}

.result-count {
  color: var(--muted);

  font-size: 10px;
  font-weight: 700;
}


/* =========================================================
   22. SALES TABLE
   ========================================================= */

.table-panel-head {
  border-bottom: 1px solid var(--border-light);
}

.table-container {
  width: 100%;

  overflow-x: auto;
  overflow-y: hidden;

  -webkit-overflow-scrolling: touch;

  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.table-container::-webkit-scrollbar {
  height: 7px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--surface-soft);
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.sales-table {
  width: 100%;
  min-width: 980px;
}

.sales-table th {
  padding: 12px 14px;

  background: var(--surface-soft);

  color: var(--muted);

  border-bottom: 1px solid var(--border);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;

  white-space: nowrap;
}

.sales-table td {
  padding: 13px 14px;

  color: var(--text);

  border-bottom: 1px solid var(--border-light);

  font-size: 11px;
  font-weight: 500;

  white-space: nowrap;
}

.sales-table tbody tr {
  transition: background var(--transition);
}

.sales-table tbody tr:hover {
  background: #FBFCFE;
}

.sales-table tbody tr:last-child td {
  border-bottom: 0;
}

.sales-table td:first-child {
  color: var(--blue);
  font-weight: 800;
}

.sales-table td:nth-child(7) {
  color: var(--success);
  font-weight: 800;
}


/* =========================================================
   23. TABLE ACTION
   ========================================================= */

.sales-table button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 30px;

  padding: 0 10px;

  background: var(--blue-light);
  color: var(--blue);

  border: 1px solid #D3E3F9;
  border-radius: 7px;

  font-size: 10px;
  font-weight: 800;

  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition);
}

.sales-table button:hover {
  background: #DCEBFF;

  border-color: #BED5F6;
}

.sales-table button:active {
  transform: scale(0.97);
}


/* =========================================================
   24. EMPTY STATE
   ========================================================= */

.empty-state {
  display: flex;

  min-height: 250px;

  padding: 35px 20px;

  align-items: center;
  justify-content: center;

  flex-direction: column;

  text-align: center;
}

.empty-state-icon {
  display: grid;

  width: 48px;
  height: 48px;

  margin-bottom: 12px;

  place-items: center;

  background: var(--blue-light);
  color: var(--blue);

  border-radius: 14px;

  font-size: 22px;
  font-weight: 800;
}

.empty-state h3 {
  margin: 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
}

.empty-state p {
  max-width: 430px;

  margin: 6px 0 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.55;
}


/* =========================================================
   25. PAGINATION
   ========================================================= */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  min-height: 60px;

  padding: 10px 22px;

  border-top: 1px solid var(--border-light);
}

.pagination-info {
  color: var(--muted);

  font-size: 10px;
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pagination-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 7px;

  min-height: 34px;

  padding: 0 11px;

  background: var(--white);
  color: var(--text);

  border: 1px solid var(--border);
  border-radius: 8px;

  font-size: 10px;
  font-weight: 700;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.pagination-button:hover:not(:disabled) {
  color: var(--blue);

  background: var(--blue-light);

  border-color: #C9DDF8;
}

.pagination-button:disabled {
  color: var(--muted-light);

  background: var(--surface-soft);

  opacity: 0.65;
}


/* =========================================================
   26. SALES TREND PANEL
   ========================================================= */

.sales-trend-panel {
  position: relative;

  min-width: 0;

  margin-top: 20px;

  overflow: hidden;

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: 18px;

  box-shadow: var(--shadow-sm);
}

.sales-trend-panel::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 3px;

  background: var(--blue);
}

.sales-trend-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 24px;

  min-width: 0;

  padding: 23px 24px 18px;

  border-bottom: 1px solid var(--border-light);
}

.sales-trend-panel .panel-head > div:first-child {
  min-width: 0;
}

.sales-trend-panel .panel-head h2 {
  margin-top: 4px;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;

  line-height: 1.2;
  letter-spacing: -0.02em;
}

.sales-trend-panel .panel-head p {
  margin-top: 6px;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.55;
}


/* =========================================================
   27. TREND TOTAL
   ========================================================= */

.trend-meta {
  min-width: 155px;

  flex-shrink: 0;

  padding: 11px 15px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 12px;

  text-align: right;
}

.trend-label {
  display: block;

  margin-bottom: 4px;

  color: var(--muted);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trend-total {
  display: block;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;

  line-height: 1.25;

  overflow-wrap: anywhere;
}


/* =========================================================
   28. CHART CONTAINER
   ========================================================= */

.sales-chart-wrap {
  position: relative;

  width: 100%;
  min-width: 0;

  height: 330px;

  padding: 20px 24px;

  overflow: hidden;

  touch-action: pan-y;
}

.sales-chart-wrap canvas {
  display: block;

  width: 100% !important;
  height: 100% !important;

  max-width: 100%;
  min-width: 0;
}


/* =========================================================
   29. CHART EMPTY STATE
   ========================================================= */

.sales-chart-empty {
  position: absolute;

  z-index: 2;

  inset: 20px 24px;

  display: none;

  align-items: center;
  justify-content: center;

  flex-direction: column;

  padding: 20px;

  color: var(--muted);

  text-align: center;

  pointer-events: none;
}

.chart-empty-icon {
  display: grid;

  width: 44px;
  height: 44px;

  margin-bottom: 10px;

  place-items: center;

  background: var(--blue-light);
  color: var(--blue);

  border-radius: 12px;

  font-size: 20px;
  font-weight: 800;
}

.sales-chart-empty h3 {
  margin: 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
}

.sales-chart-empty p {
  max-width: 430px;

  margin: 6px auto 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.5;
}


/* =========================================================
   30. CHART FOOTER
   ========================================================= */

.chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;

  min-height: 48px;

  padding: 12px 24px;

  border-top: 1px solid var(--border-light);
}

.chart-legend {
  display: inline-flex;
  align-items: center;

  gap: 8px;

  color: var(--text);

  font-size: 11px;
  font-weight: 700;
}

.legend-dot {
  display: block;

  width: 8px;
  height: 8px;

  flex: 0 0 8px;

  background: var(--blue);

  border-radius: 50%;
}

.chart-note {
  color: var(--muted-light);

  font-size: 10px;
  font-weight: 600;

  text-align: right;

  overflow-wrap: anywhere;
}


/* =========================================================
   31. MODAL OVERLAY
   ========================================================= */

.modal-overlay {
  position: fixed;
  z-index: 2000;
  inset: 0;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 24px;

  background: rgba(20, 33, 61, 0.48);

  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);

  overflow-y: auto;
}

.modal-overlay[hidden] {
  display: none;
}


/* =========================================================
   32. MODAL
   ========================================================= */

.modal {
  width: 100%;
  max-width: 620px;

  max-height: calc(100vh - 48px);

  background: var(--white);

  border: 1px solid var(--border);
  border-radius: 18px;

  box-shadow: var(--shadow-lg);

  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  padding: 22px 24px 18px;

  border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
  margin: 4px 0 0;

  color: var(--black);

  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;

  line-height: 1.2;
}

.modal-header p {
  margin: 5px 0 0;

  color: var(--muted);

  font-size: 11px;
}

.modal-close {
  display: grid;

  width: 34px;
  height: 34px;

  flex: 0 0 34px;

  place-items: center;

  background: var(--surface-soft);
  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 9px;

  font-size: 22px;
  font-weight: 400;

  line-height: 1;

  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);

  border-color: #FECACA;
}


/* =========================================================
   33. MODAL BODY
   ========================================================= */

.modal-body {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 0;

  max-height: calc(100vh - 230px);

  padding: 4px 24px;

  overflow-y: auto;
}

.detail-item {
  min-width: 0;

  padding: 14px 0;

  border-bottom: 1px solid var(--border-light);
}

.detail-item:nth-child(odd) {
  padding-right: 18px;
}

.detail-item:nth-child(even) {
  padding-left: 18px;

  border-left: 1px solid var(--border-light);
}

.detail-item:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.detail-label {
  display: block;

  margin-bottom: 4px;

  color: var(--muted-light);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-value {
  display: block;

  color: var(--black);

  font-size: 12px;
  font-weight: 700;

  line-height: 1.4;

  overflow-wrap: anywhere;
}

.detail-item-highlight {
  padding: 15px;

  background: var(--success-light);

  border: 1px solid #D1FAE5 !important;
  border-radius: 11px;
}

.detail-item-highlight .detail-label {
  color: var(--success);
}

.detail-item-highlight .detail-value {
  color: var(--success);

  font-family: var(--font-heading);
  font-size: 15px;
}


/* =========================================================
   34. MODAL FOOTER
   ========================================================= */

.modal-footer {
  display: flex;
  justify-content: flex-end;

  padding: 14px 24px;

  border-top: 1px solid var(--border-light);
}

.modal-footer .secondary-button {
  width: auto;
  min-width: 90px;
}


/* =========================================================
   35. FOCUS STATES
   ========================================================= */

.secondary-button:focus-visible,
.icon-button:focus-visible,
.refresh-button:focus-visible,
.pagination-button:focus-visible,
.mobile-menu-button:focus-visible,
.modal-close:focus-visible,
.nav-item:focus-visible,
.filter-field input:focus-visible,
.filter-field select:focus-visible {
  outline: 3px solid rgba(11, 94, 215, 0.18);
  outline-offset: 2px;
}


/* =========================================================
   36. LARGE TABLET — <= 1180px
   ========================================================= */

@media (max-width: 1180px) {

  .page-container {
    padding: 26px;
  }

  .topbar {
    padding: 0 26px;
  }

  .stats-grid {
    gap: 13px;
  }

  .filters-grid {
    grid-template-columns:
      minmax(200px, 1.5fr)
      repeat(2, minmax(140px, 1fr))
      minmax(140px, 1fr);

    gap: 12px;
  }

  .search-field {
    grid-column: span 2;
  }
}


/* =========================================================
   37. TABLET — <= 1000px
   ========================================================= */

@media (max-width: 1000px) {

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .filters-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .search-field {
    grid-column: span 2;
  }

  .sales-chart-wrap {
    height: 310px;
  }

  .sales-trend-panel .panel-head {
    gap: 18px;
  }

  .modal-body {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .detail-item:nth-child(odd),
  .detail-item:nth-child(even) {
    padding-left: 0;
    padding-right: 0;

    border-left: 0;
  }

  .detail-item:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--border-light);
  }

  .detail-item:last-child {
    border-bottom: 0;
  }
}


/* =========================================================
   38. MOBILE SIDEBAR — <= 900px
   ========================================================= */

@media (max-width: 900px) {

  .sidebar {
    transform: translateX(-100%);

    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);

    box-shadow:
      12px 0 40px rgba(20, 33, 61, 0.14);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-button {
    display: block;
  }

  .topbar {
    min-height: 68px;

    padding: 0 20px;
  }

  .page-container {
    padding: 24px 20px;
  }

  .page-intro {
    margin-bottom: 20px;
  }

  .sales-chart-wrap {
    height: 295px;
  }
}


/* =========================================================
   39. MOBILE — <= 680px
   ========================================================= */

@media (max-width: 680px) {

  .topbar {
    min-height: 64px;

    padding: 0 15px;
  }

  .mobile-menu-button {
    display: block;

    width: 37px;
    height: 37px;

    margin-right: 9px;
    padding: 8px;
  }

  .page-heading .eyebrow {
    display: none;
  }

  .page-heading h1 {
    font-size: 17px;
  }

  .topbar-right {
    gap: 6px;
  }

  .icon-button {
    width: 35px;
    height: 35px;
  }

  .refresh-button {
    width: 35px;
    height: 35px;

    padding: 0;
  }

  .refresh-button span:last-child {
    display: none;
  }

  .topbar-user {
    margin-left: 2px;
    padding-left: 7px;
  }

  .topbar-avatar {
    width: 34px;
    height: 34px;

    flex-basis: 34px;
  }

  .topbar-user-copy {
    display: none;
  }

  .page-container {
    padding: 20px 15px 30px;
  }

  .page-intro {
    margin-bottom: 18px;
  }

  .page-intro h2 {
    font-size: 20px;
  }

  .page-intro p {
    font-size: 11px;
  }


  /* Stats */

  .stats-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 10px;

    margin-bottom: 16px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    margin-top: 11px;

    font-size: 17px;
  }


  /* Panels */

  .panel {
    border-radius: 14px;
  }

  .panel-head {
    padding: 17px;
  }

  .panel-head h2 {
    font-size: 15px;
  }

  .panel-head p {
    font-size: 10px;
  }


  /* Filters */

  .filters-grid {
    grid-template-columns:
      minmax(0, 1fr);

    gap: 11px;

    padding: 16px 17px;
  }

  .search-field {
    grid-column: auto;
  }

  .filter-field input,
  .filter-field select {
    height: 42px;
  }

  .filter-footer {
    min-height: 38px;

    padding: 0 17px;
  }


  /* Table */

  .sales-table {
    min-width: 900px;
  }


  /* Pagination */

  .pagination {
    align-items: flex-start;

    flex-direction: column;

    padding: 13px 17px;
  }

  .pagination-controls {
    width: 100%;
  }

  .pagination-button {
    flex: 1;
  }


  /* Sales trend */

  .sales-trend-panel {
    margin-top: 16px;

    border-radius: 15px;
  }

  .sales-trend-panel .panel-head {
    align-items: stretch;

    flex-direction: column;

    gap: 13px;

    padding: 19px 17px 16px;
  }

  .sales-trend-panel .panel-head h2 {
    font-size: 16px;
  }

  .sales-trend-panel .panel-head p {
    font-size: 10px;
  }

  .trend-meta {
    width: 100%;
    min-width: 0;

    padding: 10px 12px;

    text-align: left;
  }

  .trend-total {
    font-size: 14px;
  }

  .sales-chart-wrap {
    height: 270px;

    padding: 14px 9px 12px;
  }

  .sales-chart-empty {
    inset: 14px 9px 12px;

    padding: 15px;
  }

  .chart-empty-icon {
    width: 40px;
    height: 40px;

    font-size: 18px;
  }

  .sales-chart-empty h3 {
    font-size: 13px;
  }

  .sales-chart-empty p {
    max-width: 300px;

    font-size: 10px;
  }

  .chart-footer {
    align-items: flex-start;

    flex-direction: column;

    gap: 7px;

    padding: 12px 17px;
  }

  .chart-note {
    text-align: left;
  }


  /* Modal */

  .modal-overlay {
    align-items: flex-end;

    padding: 0;
  }

  .modal {
    max-width: none;

    max-height: 92vh;

    border-radius: 18px 18px 0 0;
  }

  .modal-header {
    padding: 19px 17px 16px;
  }

  .modal-body {
    padding: 3px 17px;
  }

  .modal-footer {
    padding: 12px 17px;
  }

  .modal-footer .secondary-button {
    width: 100%;
  }
}


/* =========================================================
   40. SMALL PHONES — <= 430px
   ========================================================= */

@media (max-width: 430px) {

  .sidebar {
    width: min(280px, 88vw);
  }

  .topbar {
    padding: 0 12px;
  }

  .page-container {
    padding: 17px 12px 26px;
  }

  .page-intro h2 {
    font-size: 19px;
  }

  .page-intro p {
    font-size: 10px;
  }

  .stats-grid {
    grid-template-columns:
      minmax(0, 1fr);

    gap: 9px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 18px;
  }

  .panel-head {
    padding: 16px 14px;
  }

  .filters-grid {
    padding: 14px;
  }

  .filter-footer {
    padding: 0 14px;
  }


  /* Graph */

  .sales-trend-panel .panel-head {
    padding: 17px 14px 14px;
  }

  .trend-meta {
    padding: 10px 11px;
  }

  .sales-chart-wrap {
    height: 235px;

    padding: 10px 6px;
  }

  .sales-chart-empty {
    inset: 10px 6px;
  }

  .chart-footer {
    padding: 11px 14px;
  }

  .chart-legend {
    font-size: 10px;
  }

  .chart-note {
    font-size: 9px;
  }


  /* Modal */

  .modal-header {
    padding: 17px 14px 14px;
  }

  .modal-body {
    padding: 2px 14px;
  }

  .modal-footer {
    padding: 11px 14px;
  }
}


/* =========================================================
   41. VERY SMALL PHONES — <= 360px
   ========================================================= */

@media (max-width: 360px) {

  .topbar {
    padding: 0 9px;
  }

  .mobile-menu-button {
    margin-right: 6px;
  }

  .topbar-right {
    gap: 4px;
  }

  .topbar-avatar {
    width: 31px;
    height: 31px;

    flex-basis: 31px;
  }

  .page-container {
    padding: 15px 9px 24px;
  }

  .page-intro h2 {
    font-size: 18px;
  }

  .stat-card {
    padding: 12px;
  }

  .sales-chart-wrap {
    height: 220px;

    padding: 8px 4px;
  }

  .sales-chart-empty {
    inset: 8px 4px;
  }

  .chart-empty-icon {
    width: 36px;
    height: 36px;

    margin-bottom: 8px;

    font-size: 16px;
  }

  .sales-chart-empty h3 {
    font-size: 12px;
  }

  .sales-chart-empty p {
    font-size: 9px;
  }
}


/* =========================================================
   42. ACCESSIBILITY / REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}


/* =========================================================
   43. PRINT
   ========================================================= */

@media print {

  .sidebar,
  .topbar,
  .filters-panel,
  .pagination,
  .modal-overlay,
  .mobile-menu-button {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
  }

  .page-container {
    max-width: none;

    padding: 0;
  }

  .panel,
  .stat-card {
    box-shadow: none;

    border: 1px solid #D9D9D9;
  }

  .sales-table {
    min-width: 0;
  }

  .sales-trend-panel {
    break-inside: avoid;
  }
}