/* ==========================================================
   SPCMS
   SALES PERFORMANCE & COMMISSION MANAGEMENT SYSTEM
   GLOBAL PREMIUM UI SYSTEM
   ========================================================== */

/* ==========================================================
   DESIGN TOKENS
   ========================================================== */

:root {
  /* Brand */
  --brand-dark: #0b1120;
  --brand-dark-2: #111827;
  --brand-dark-3: #1e293b;

  --accent: #d4a72c;
  --accent-dark: #a97800;
  --accent-soft: #fff8df;

  /* Backgrounds */
  --body-bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;

  /* Text */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Borders */
  --border: #e2e8f0;
  --border-soft: #edf1f5;

  /* States */
  --success: #15803d;
  --success-bg: #ecfdf3;

  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-bg: #fef2f2;

  --warning: #d97706;
  --warning-bg: #fff7ed;

  --info: #2563eb;
  --info-bg: #eff6ff;

  --purple: #7c3aed;
  --purple-bg: #f5f3ff;

  /* Layout */
  --sidebar-width: 258px;
  --topbar-height: 72px;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 12px;
  --radius-lg: 17px;
  --radius-xl: 22px;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.04);

  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.05);

  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);

  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.14);

  /* Animation */
  --transition: 0.2s ease;
}

/* ==========================================================
   RESET
   ========================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;

  min-height: 100vh;

  font-family: Inter, "Segoe UI", Arial, sans-serif;

  font-size: 14px;
  line-height: 1.5;

  color: var(--text);

  background: var(--body-bg);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  transition: var(--transition);
}

img {
  max-width: 100%;
}

/* ==========================================================
   SCROLLBARS
   ========================================================== */

* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==========================================================
   APPLICATION BODY
   ========================================================== */

.app-body {
  background: var(--body-bg);
}

.auth-body {
  background: var(--brand-dark);
}

/* ==========================================================
   SIDEBAR
   ========================================================== */

.sidebar {
  position: fixed;

  top: 0;
  bottom: 0;
  left: 0;

  z-index: 100;

  width: var(--sidebar-width);

  padding: 24px 15px;

  overflow-y: auto;
  overflow-x: hidden;

  color: #ffffff;

  background:
    radial-gradient(
      circle at 10% 0%,
      rgba(212, 167, 44, 0.09),
      transparent 26%
    ),
    linear-gradient(180deg, #080e1a 0%, #0d1625 54%, #0a111e 100%);

  border-right: 1px solid rgba(255, 255, 255, 0.05);

  box-shadow: 10px 0 35px rgba(15, 23, 42, 0.08);
}

/* ==========================================================
   SIDEBAR BRAND
   ========================================================== */

.brand {
  position: relative;

  margin: 0 10px 28px;

  padding: 4px 2px 16px;

  color: #ffffff;

  font-size: 23px;
  font-weight: 850;

  letter-spacing: -0.5px;

  overflow-wrap: anywhere;
}

.brand::after {
  content: "";

  position: absolute;

  left: 2px;
  bottom: 0;

  width: 42px;
  height: 3px;

  border-radius: 20px;

  background: linear-gradient(90deg, var(--accent), #f6cc5d);
}

/* ==========================================================
   SIDEBAR NAV
   ========================================================== */

.sidebar nav {
  display: flex;
  flex-direction: column;

  gap: 5px;
}

.sidebar nav a,
.sidebar a {
  position: relative;

  display: flex;
  align-items: center;

  min-height: 43px;

  gap: 11px;

  padding: 10px 13px;

  border-radius: 10px;

  color: #b9c4d2;

  font-size: 13px;
  font-weight: 650;

  text-decoration: none;

  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition);
}

.sidebar nav a:hover,
.sidebar a:hover {
  color: #ffffff;

  background: rgba(255, 255, 255, 0.065);

  transform: translateX(2px);
}

.sidebar nav a.active,
.sidebar a.active {
  color: #ffffff;

  background: linear-gradient(
    90deg,
    rgba(212, 167, 44, 0.17),
    rgba(212, 167, 44, 0.04)
  );
}

.sidebar nav a.active::before,
.sidebar a.active::before {
  content: "";

  position: absolute;

  left: -15px;

  width: 4px;
  height: 24px;

  border-radius: 0 10px 10px 0;

  background: var(--accent);
}

/* ==========================================================
   APPLICATION MAIN AREA
   ========================================================== */

.app-main {
  min-height: 100vh;

  margin-left: var(--sidebar-width);

  background: var(--body-bg);
}

/* ==========================================================
   TOPBAR
   ========================================================== */

.topbar {
  position: sticky;

  top: 0;

  z-index: 50;

  height: var(--topbar-height);

  padding: 0 30px;

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 20px;

  background: rgba(255, 255, 255, 0.94);

  border-bottom: 1px solid var(--border-soft);

  backdrop-filter: blur(16px);

  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.025);
}

/* ==========================================================
   MAIN PAGE AREA
   ========================================================== */

.page {
  width: 100%;

  max-width: 1640px;

  margin: 0 auto;

  padding: 30px;
}

/* ==========================================================
   PAGE HEADERS
   ========================================================== */

.page-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 22px;

  margin-bottom: 24px;
}

.page-head > div:first-child {
  min-width: 0;
}

.page-head h1 {
  margin: 0;

  color: var(--text);

  font-size: 29px;
  font-weight: 850;

  line-height: 1.2;

  letter-spacing: -0.7px;
}

.page-head p {
  margin: 6px 0 0;

  color: var(--text-muted);

  font-size: 13px;
}

/* ==========================================================
   TYPOGRAPHY
   ========================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text);
}

h1 {
  font-size: 30px;
}

h2 {
  margin-top: 0;

  font-size: 21px;
  font-weight: 800;

  letter-spacing: -0.3px;
}

h3 {
  font-size: 17px;
  font-weight: 800;
}

p {
  color: var(--text-muted);
}

small {
  color: var(--text-light);
}

/* ==========================================================
   ORGANIZATION / COMPANY LABEL
   ========================================================== */

.page-company {
  display: inline-flex;

  align-items: center;

  gap: 7px;

  margin-bottom: 7px;

  color: var(--accent-dark);

  font-size: 10px;
  font-weight: 850;

  letter-spacing: 0.8px;

  text-transform: uppercase;
}

.page-company::before {
  content: "";

  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--accent);
}

/* ==========================================================
   CARDS
   ========================================================== */

.card {
  margin: 18px 0;

  padding: 22px;

  overflow-x: auto;

  background: var(--surface);

  border: 1px solid var(--border-soft);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);

  transition:
    box-shadow var(--transition),
    transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 15px;

  margin-bottom: 18px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

.card-header p {
  margin: 4px 0 0;

  font-size: 12px;
}

/* ==========================================================
   STAT CARDS
   ========================================================== */

.stats-grid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));

  gap: 16px;

  margin: 22px 0;
}

.stat {
  position: relative;

  min-height: 125px;

  padding: 20px;

  overflow: hidden;

  background: var(--surface);

  border: 1px solid var(--border-soft);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-sm);

  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.stat::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;

  width: 100%;
  height: 3px;

  background: linear-gradient(90deg, var(--accent), transparent);
}

.stat::after {
  content: "";

  position: absolute;

  top: -45px;
  right: -45px;

  width: 105px;
  height: 105px;

  border-radius: 50%;

  background: #f8fafc;
}

.stat:hover {
  transform: translateY(-2px);

  box-shadow: var(--shadow-md);
}

.stat span {
  position: relative;

  z-index: 2;

  display: block;

  color: var(--text-muted);

  font-size: 11px;
  font-weight: 800;

  letter-spacing: 0.65px;

  text-transform: uppercase;
}

.stat strong {
  position: relative;

  z-index: 2;

  display: block;

  margin-top: 12px;

  color: var(--text);

  font-size: 28px;
  font-weight: 850;

  letter-spacing: -0.8px;
}

/* ==========================================================
   BUTTON SYSTEM
   ========================================================== */

.btn {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 7px;

  min-height: 39px;

  padding: 9px 15px;

  border: 1px solid transparent;

  border-radius: 10px;

  outline: none;

  font-size: 12px;
  font-weight: 750;

  line-height: 1;

  text-decoration: none;

  white-space: nowrap;

  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* Primary */

.btn-primary {
  color: #ffffff;

  background: linear-gradient(135deg, #0f172a, #27364d);

  border-color: #172033;

  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.13);
}

.btn-primary:hover {
  color: #ffffff;

  background: linear-gradient(135deg, #172033, #334155);

  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

/* Light */

.btn-light {
  color: #334155;

  background: #f8fafc;

  border-color: #e2e8f0;
}

.btn-light:hover {
  color: #111827;

  background: #eef2f7;

  border-color: #d6dee8;
}

/* Danger */

.btn-danger {
  color: #ffffff;

  background: linear-gradient(135deg, var(--danger), var(--danger-dark));

  border-color: var(--danger);

  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.13);
}

.btn-danger:hover {
  color: #ffffff;

  background: linear-gradient(135deg, #c91e1e, #991b1b);

  box-shadow: 0 7px 16px rgba(220, 38, 38, 0.18);
}

/* Success */

.btn-success {
  color: #ffffff;

  background: #15803d;

  border-color: #15803d;
}

.btn-success:hover {
  color: #ffffff;

  background: #166534;
}

/* Accent */

.btn-accent {
  color: #17120a;

  background: linear-gradient(135deg, #e2b53b, #c99718);

  border-color: #c99718;
}

/* Sizes */

.btn-small {
  min-height: 33px;

  padding: 7px 11px;

  font-size: 11px;
}

.btn-large {
  min-height: 46px;

  padding: 12px 20px;

  font-size: 13px;
}

/* ==========================================================
   TABLES
   ========================================================== */

.table-wrap {
  width: 100%;

  overflow-x: auto;
}

table {
  width: 100%;

  min-width: 720px;

  border-collapse: separate;
  border-spacing: 0;
}

thead {
  background: #f8fafc;
}

th {
  padding: 12px 14px;

  color: #64748b;

  font-size: 10px;
  font-weight: 850;

  letter-spacing: 0.65px;

  text-align: left;
  text-transform: uppercase;

  white-space: nowrap;

  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px;

  color: #334155;

  vertical-align: middle;

  border-bottom: 1px solid var(--border-soft);
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: #fafcff;
}

tbody tr:last-child td {
  border-bottom: none;
}

td strong {
  color: #111827;

  font-weight: 750;
}

td a {
  color: #2563eb;

  font-weight: 650;

  text-decoration: none;
}

td a:hover {
  color: #1d4ed8;
}

td code {
  display: inline-block;

  max-width: 320px;

  padding: 5px 8px;

  overflow: hidden;

  color: #334155;

  font-size: 11px;

  text-overflow: ellipsis;

  white-space: nowrap;

  background: #f1f5f9;

  border: 1px solid #e2e8f0;

  border-radius: 7px;
}

/* ==========================================================
   TABLE ACTIONS
   ========================================================== */

.table-actions {
  display: flex;

  align-items: center;

  gap: 7px;

  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

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

.form-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 19px;
}

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

.form-grid label,
.form-group label {
  display: block;

  color: #334155;

  font-size: 12px;
  font-weight: 750;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.form-control {
  width: 100%;

  margin-top: 7px;

  padding: 11px 12px;

  color: #111827;

  outline: none;

  background: #ffffff;

  border: 1px solid #d8e0e8;

  border-radius: 10px;

  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.form-grid input:hover,
.form-grid select:hover,
.form-grid textarea:hover,
.form-control:hover {
  border-color: #c5cfdb;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.form-control:focus {
  border-color: #64748b;

  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.09);
}

.form-grid textarea,
textarea.form-control {
  min-height: 110px;

  resize: vertical;
}

.form-grid input::placeholder,
.form-grid textarea::placeholder {
  color: #a4afbf;
}

/* ==========================================================
   CHECKBOX
   ========================================================== */

.check {
  display: flex !important;

  align-items: center;

  gap: 9px;
}

.check input {
  width: 17px !important;
  height: 17px;

  margin: 0 !important;
}

/* ==========================================================
   FIELD HELP
   ========================================================== */

.form-help {
  display: block;

  margin-top: 5px;

  color: var(--text-light);

  font-size: 10px;
}

/* ==========================================================
   STATUS BADGES
   ========================================================== */

.status-active,
.status-success,
.badge-success {
  display: inline-flex;

  align-items: center;

  gap: 5px;

  padding: 5px 9px;

  color: var(--success);

  font-size: 10px;
  font-weight: 850;

  text-transform: uppercase;

  background: var(--success-bg);

  border-radius: 999px;
}

.status-inactive,
.status-disabled,
.status-danger,
.badge-danger {
  display: inline-flex;

  align-items: center;

  padding: 5px 9px;

  color: var(--danger);

  font-size: 10px;
  font-weight: 850;

  text-transform: uppercase;

  background: var(--danger-bg);

  border-radius: 999px;
}

.status-pending,
.status-warning,
.badge-warning {
  display: inline-flex;

  align-items: center;

  padding: 5px 9px;

  color: var(--warning);

  font-size: 10px;
  font-weight: 850;

  text-transform: uppercase;

  background: var(--warning-bg);

  border-radius: 999px;
}

.status-info,
.badge-info {
  display: inline-flex;

  align-items: center;

  padding: 5px 9px;

  color: var(--info);

  font-size: 10px;
  font-weight: 850;

  text-transform: uppercase;

  background: var(--info-bg);

  border-radius: 999px;
}

/* ==========================================================
   FLASH MESSAGES
   ========================================================== */

.flash-container {
  position: relative;

  z-index: 40;

  margin-bottom: 18px;
}

.auth-flash-container {
  position: fixed;

  top: 18px;
  left: 50%;

  z-index: 999;

  width: min(500px, calc(100% - 30px));

  transform: translateX(-50%);
}

.alert {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 14px;

  margin-bottom: 10px;

  padding: 12px 14px;

  border: 1px solid transparent;

  border-radius: 11px;

  font-size: 12px;
  font-weight: 650;

  box-shadow: var(--shadow-xs);
}

.alert-content {
  display: flex;

  align-items: center;

  gap: 9px;
}

.alert-indicator {
  width: 8px;
  height: 8px;

  flex-shrink: 0;

  border-radius: 50%;
}

.alert-success {
  color: #166534;

  background: #f0fdf4;

  border-color: #bbf7d0;
}

.alert-success .alert-indicator {
  background: #22c55e;
}

.alert-danger,
.alert-error {
  color: #991b1b;

  background: #fef2f2;

  border-color: #fecaca;
}

.alert-danger .alert-indicator,
.alert-error .alert-indicator {
  background: #ef4444;
}

.alert-warning {
  color: #92400e;

  background: #fffbeb;

  border-color: #fde68a;
}

.alert-warning .alert-indicator {
  background: #f59e0b;
}

.alert-info {
  color: #1e40af;

  background: #eff6ff;

  border-color: #bfdbfe;
}

.alert-info .alert-indicator {
  background: #3b82f6;
}

.alert-close {
  padding: 0;

  color: currentColor;

  font-size: 20px;

  line-height: 1;

  border: none;

  opacity: 0.6;

  background: transparent;
}

.alert-close:hover {
  opacity: 1;
}

/* ==========================================================
   EMPTY STATES
   ========================================================== */

.empty-state {
  padding: 35px 20px !important;

  color: var(--text-light) !important;

  text-align: center !important;
}

/* ==========================================================
   COPY INPUT / TRACKING LINKS
   ========================================================== */

.copy-input {
  width: 100%;

  min-width: 250px;

  padding: 9px 11px;

  color: #334155;

  outline: none;

  background: #f8fafc;

  border: 1px solid #d8e0e8;

  border-radius: 9px;
}

.tracking-url {
  color: #2563eb;

  font-size: 12px;

  overflow-wrap: anywhere;
}

/* ==========================================================
   PUBLIC PRODUCT LANDING PAGE
   ========================================================== */

.public-product {
  width: min(760px, calc(100% - 30px));

  margin: 45px auto;

  padding: 34px;

  background: #ffffff;

  border: 1px solid var(--border-soft);

  border-radius: 22px;

  box-shadow: var(--shadow-lg);
}

.public-product img {
  display: block;

  width: 100%;

  max-width: 340px;

  margin-bottom: 20px;

  border-radius: 15px;

  object-fit: cover;
}

.price {
  margin: 10px 0;

  color: #111827;

  font-size: 27px;
  font-weight: 850;
}

/* ==========================================================
   AUTHENTICATION LAYOUT
   ========================================================== */

/*
   IMPORTANT:
   Auth pages no longer use .page.
   base.html now uses .auth-page.
*/

.auth-main {
  width: 100%;

  min-height: 100vh;

  margin: 0;

  display: block;

  background:
    radial-gradient(circle at 8% 8%, rgba(212, 167, 44, 0.09), transparent 25%),
    radial-gradient(
      circle at 90% 80%,
      rgba(37, 99, 235, 0.08),
      transparent 25%
    ),
    linear-gradient(135deg, #070c14, #0d1625);
}

.auth-page {
  width: 100%;

  min-height: 100vh;

  margin: 0;

  padding: 0;
}

/* ==========================================================
   GENERIC LOGIN FALLBACK
   ========================================================== */

.login-card {
  width: min(440px, 100%);

  margin: auto;

  padding: 34px;

  background: #ffffff;

  border: 1px solid var(--border-soft);

  border-radius: 20px;

  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  margin: 0 0 8px;

  font-size: 28px;
  font-weight: 850;
}

.login-card form {
  display: flex;

  flex-direction: column;

  gap: 11px;

  margin-top: 22px;
}

.login-card input {
  width: 100%;

  padding: 11px 12px;

  outline: none;

  border: 1px solid #d8e0e8;

  border-radius: 10px;
}

.login-card input:focus {
  border-color: #64748b;

  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.09);
}

/* ==========================================================
   GENERAL GRID HELPERS
   ========================================================== */

.grid-2 {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 18px;
}

.grid-3 {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 18px;
}

.grid-4 {
  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 18px;
}

/* ==========================================================
   FLEX UTILITIES
   ========================================================== */

.flex {
  display: flex;
}

.flex-center {
  display: flex;

  align-items: center;
}

.flex-between {
  display: flex;

  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-6 {
  gap: 6px;
}

.gap-8 {
  gap: 8px;
}

.gap-10 {
  gap: 10px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

/* ==========================================================
   TEXT UTILITIES
   ========================================================== */

.text-muted {
  color: var(--text-muted);
}

.text-light {
  color: var(--text-light);
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.font-bold {
  font-weight: 750;
}

/* ==========================================================
   SPACING UTILITIES
   ========================================================== */

.mt-0 {
  margin-top: 0;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ==========================================================
   HORIZONTAL DIVIDER
   ========================================================== */

.divider {
  width: 100%;
  height: 1px;

  margin: 18px 0;

  background: var(--border-soft);
}

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

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 900px) {
  .sidebar {
    position: relative;

    width: 100%;
    height: auto;

    padding: 16px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .sidebar nav {
    flex-direction: row;

    gap: 6px;

    padding-bottom: 4px;

    overflow-x: auto;
  }

  .sidebar nav a,
  .sidebar a {
    flex-shrink: 0;

    white-space: nowrap;
  }

  .sidebar nav a.active::before,
  .sidebar a.active::before {
    display: none;
  }

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

  .topbar {
    height: auto;

    min-height: 65px;

    padding: 12px 18px;
  }

  .page {
    padding: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;

    flex-direction: column;
  }

  .page-head > .btn {
    width: 100%;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 600px) {
  body {
    font-size: 13px;
  }

  .page {
    padding: 16px;
  }

  .page-head {
    margin-bottom: 18px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .card {
    padding: 16px;

    border-radius: 14px;
  }

  .stats-grid {
    grid-template-columns: 1fr;

    gap: 12px;
  }

  .stat {
    min-height: auto;

    padding: 18px;
  }

  .btn {
    min-height: 38px;
  }

  .public-product {
    margin: 18px auto;

    padding: 20px;
  }

  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================
   VERY SMALL DEVICES
   ========================================================== */

@media (max-width: 420px) {
  .page {
    padding: 12px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .card {
    padding: 14px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .table-actions {
    align-items: stretch;

    flex-direction: column;
  }

  .table-actions .btn,
  .table-actions form,
  .table-actions form button {
    width: 100%;
  }
}
