@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Regular.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Bold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Bold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/static/fonts/IRANSansXFaNum-Bold.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-main: "IRANSansX", Tahoma, Arial, sans-serif;
  --bg: #f5f6fa;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --border: rgba(226, 232, 240, 0.88);
  --text: #151923;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --brand: #e30613;
  --brand-2: #b90913;
  --brand-soft: rgba(227, 6, 19, 0.10);
  --dark: #111827;
  --dark-2: #1f2937;
  --green: #16a34a;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.07);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body,
button,
input,
textarea,
select,
a,
table,
th,
td,
strong,
small,
span,
p,
h1,
h2,
h3,
label {
  font-family: var(--font-main) !important;
  font-feature-settings: "ss02" 1, "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.45;
  font-weight: 900;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.55;
  font-weight: 900;
}

p {
  line-height: 2;
}

.muted {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 2;
}

.no-margin {
  margin: 0;
}

.grid {
  display: grid;
  gap: 16px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.wide-form {
  width: 100%;
  max-width: 920px;
}

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

.field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  color: #374151;
  font-size: 14px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid #dde4ee;
  border-radius: var(--radius-md);
  padding: 0 16px;
  color: #172033;
  background: rgba(255, 255, 255, 0.96);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
  min-height: 108px;
  padding-top: 14px;
  resize: vertical;
  line-height: 1.9;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 22px) calc(50% + 2px), calc(100% - 16px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(227, 6, 19, 0.42);
  box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.08);
  background: #fff;
}

input:disabled {
  background: #f1f5f9;
  color: #64748b;
}

input::placeholder,
textarea::placeholder {
  color: #a4adbb;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(227, 6, 19, 0.20);
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(227, 6, 19, 0.24);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.10);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

button.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

button.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}

button.small {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 13px;
}

button.block {
  width: 100%;
}

.alert {
  border-radius: 18px;
  padding: 13px 16px;
  margin-bottom: 18px;
  line-height: 1.8;
  font-size: 14px;
  font-weight: 700;
}

.alert.error {
  color: #991b1b;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.alert.success {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
}

/* =========================
   Auth / Login
   ========================= */

.auth-body,
.login-body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(8, 9, 12, 0.58), rgba(8, 9, 12, 0.58)),
    radial-gradient(circle at 12% 88%, rgba(227, 6, 19, 0.22), transparent 28rem),
    url('/static/login-bg.jpg') center center / cover no-repeat fixed;
}

.auth-page,
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card,
.login-card {
  width: 100%;
  max-width: 445px;
  margin: 0 auto;
  padding: 34px 32px 32px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.login-card-wide {
  max-width: 560px;
}

.login-heading {
  margin: 0 0 8px;
  color: #141821;
  text-align: center;
  font-size: 27px;
  line-height: 1.65;
  font-weight: 900;
}

.login-heading span {
  color: #d10a16;
}

.login-lead {
  margin: 0 0 22px;
  color: #4b5563;
  text-align: center;
  line-height: 2;
  font-size: 15px;
  font-weight: 700;
}

.login-form {
  gap: 14px;
  margin-top: 0;
}

.login-field label {
  display: block;
  margin-bottom: 8px;
}

.login-phone-field label {
  text-align: center;
}

.login-input-wrap {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  min-height: 54px;
  border: 1px solid rgba(229, 231, 235, 0.92);
  border-radius: 16px;
  background: #fafafa;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.login-input-wrap:focus-within {
  border-color: rgba(209, 10, 22, 0.45);
  box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.08);
  background: #fff;
}

.login-input-wrap input {
  width: 100%;
  min-height: 52px;
  border: 0;
  padding: 0 16px;
  background: transparent;
  color: #111827;
  font-size: 16px;
  box-shadow: none !important;
}

.login-phone-input {
  direction: ltr;
  text-align: center !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  letter-spacing: 1px;
}

.login-input-wrap-full input {
  text-align: right;
  direction: rtl;
}

.otp-input-wrap input {
  direction: ltr;
  text-align: center !important;
  letter-spacing: 10px;
  font-size: 21px;
  font-weight: 900;
}

.login-button {
  min-height: 54px;
  border-radius: 17px;
  background: linear-gradient(135deg, #e30613, #c70a15);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(227, 6, 19, 0.24);
}

.login-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #da0612, #b90913);
}

.auth-flow-panel {
  transition: opacity 0.24s ease, transform 0.24s ease;
  animation: authPanelIn 0.34s cubic-bezier(.2, .9, .2, 1) both;
}

.auth-flow-panel.is-leaving {
  opacity: 0;
  transform: translateY(10px) scale(0.985);
}

.auth-flow-panel.is-entering {
  animation: authPanelIn 0.34s cubic-bezier(.2, .9, .2, 1) both;
}

@keyframes authPanelIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-alert {
  margin: 0 0 16px;
}

.login-timer-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  margin: 0 0 16px;
  padding: 0 16px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(229, 231, 235, 0.92);
  color: #374151;
  font-size: 14px;
  font-weight: 800;
}

.login-timer-box strong,
#otp-timer {
  direction: ltr;
  color: #d10a16;
  font-size: 20px;
  font-weight: 900;
}

.login-timer-box strong.expired,
#otp-timer.expired {
  color: #991b1b;
}

.auth-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.auth-secondary-actions.single-action {
  grid-template-columns: 1fr;
}

.auth-inline-form {
  margin: 0;
}

.login-button-soft,
.login-link-button {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(229, 231, 235, 0.92);
  color: #374151;
  font-size: 14px;
  font-weight: 900;
}

.login-button-soft:hover:not(:disabled),
.login-link-button:hover {
  background: #ffffff;
  color: #d10a16;
}

.login-button-soft.ready,
#resend-button.ready {
  background: rgba(22, 163, 74, 0.10);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.28);
}

.login-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.login-textarea {
  width: 100%;
  min-height: 92px;
  border-radius: 16px;
  border: 1px solid rgba(229, 231, 235, 0.92);
  background: #fafafa;
  padding: 14px 16px;
}

.login-file-input {
  min-height: 54px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(229, 231, 235, 0.92);
  background: #fafafa;
}

.register-complete-form {
  gap: 12px;
}

/* =========================
   Dashboard Shell
   ========================= */

.dashboard-body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(227, 6, 19, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgba(15, 23, 42, 0.09), transparent 34rem),
    linear-gradient(135deg, #f8fafc, #eef2f7 58%, #fff5f5);
}

.dashboard-bg-glow {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.55;
}

.glow-one {
  width: 280px;
  height: 280px;
  right: 290px;
  top: -110px;
  background: rgba(227, 6, 19, 0.12);
}

.glow-two {
  width: 360px;
  height: 360px;
  left: -140px;
  bottom: -150px;
  background: rgba(15, 23, 42, 0.08);
}

.sidebar {
  position: fixed;
  z-index: 20;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: 290px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #fff;
  background:
    linear-gradient(155deg, rgba(17, 24, 39, 0.98), rgba(42, 16, 20, 0.96)),
    radial-gradient(circle at top right, rgba(227, 6, 19, 0.28), transparent 18rem);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 30px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: -120px -90px auto auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: rgba(227, 6, 19, 0.18);
  pointer-events: none;
}

.sidebar-brand-wrap,
.side-nav,
.logout-form {
  position: relative;
  z-index: 1;
}

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, #ffe5e7);
  color: var(--brand);
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

.sidebar-brand-title {
  font-size: 17px;
  font-weight: 900;
}

.sidebar-brand-subtitle {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 700;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 900;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.side-nav a::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.side-nav a.active,
.side-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  transform: translateX(-2px);
}

.side-nav a.active::before,
.side-nav a:hover::before {
  background: #fff;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.10);
}


.logout-form {
  margin: 0;
}

.logout-button {
  min-height: 46px;
}

.dashboard-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  margin-right: 326px;
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 10;
  min-height: 76px;
  margin: 18px 18px 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.menu-toggle {
  display: none;
  width: 46px;
  min-height: 46px;
  padding: 0;
  place-items: center;
  border-radius: 16px;
  box-shadow: none;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 3px auto;
  border-radius: 2px;
  background: #fff;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.topbar-title strong {
  color: #111827;
  font-size: 17px;
  font-weight: 900;
}

.topbar-date {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.88);
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

#live-clock {
  direction: ltr;
  color: var(--brand);
}

.dashboard-content {
  padding: 24px 18px 34px;
}

.dashboard-section-head,
.section-head {
  margin-bottom: 22px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 2;
}

.hero-kicker,
.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 10% 90%, rgba(227, 6, 19, 0.20), transparent 20rem),
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(57, 20, 25, 0.96));
  color: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  left: -90px;
  top: -110px;
  width: 270px;
  height: 270px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}

.hero-copy h1 {
  margin: 14px 0 8px;
  color: #fff;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.hero-card {
  min-height: 154px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-card span,
.hero-card small {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.hero-card strong {
  display: block;
  margin: 8px 0 10px;
  direction: ltr;
  text-align: right;
  color: #fff;
  font-size: 36px;
  font-weight: 900;
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card,
.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px) saturate(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 138px;
  padding: 20px;
}

.stat-card::after {
  content: "";
  position: absolute;
  left: -32px;
  top: -32px;
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: rgba(227, 6, 19, 0.08);
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  color: #101827;
  font-size: 28px;
  font-weight: 900;
}

.stat-card-red {
  background: linear-gradient(135deg, rgba(227, 6, 19, 0.95), rgba(185, 9, 19, 0.95));
  color: #fff;
}

.stat-card-red span,
.stat-card-red strong,
.stat-card-red small {
  color: #fff;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
}

.panel-accent {
  border-color: rgba(227, 6, 19, 0.14);
  background:
    radial-gradient(circle at 0% 100%, rgba(227, 6, 19, 0.08), transparent 18rem),
    var(--surface);
}

.panel-form-focus {
  max-width: 780px;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title-row h2 {
  margin: 9px 0 0;
}

.dashboard-grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.quick-links {
  display: grid;
  gap: 10px;
}

.quick-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  color: #1f2937;
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.86);
  text-decoration: none;
  font-weight: 900;
}

.quick-links a::after {
  content: "←";
  color: var(--brand);
}

/* Profile */
.profile-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.profile-summary-card {
  text-align: center;
}

.avatar-box {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.avatar-box img,
.avatar-placeholder {
  width: 154px;
  height: 154px;
  border-radius: 36px;
  object-fit: cover;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff1f2, #fee2e2);
  color: var(--brand);
  font-size: 48px;
  font-weight: 900;
}

.profile-summary-card h2 {
  margin-bottom: 4px;
}

.profile-summary-card p {
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 800;
}

.profile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.80);
  text-align: right;
}

.profile-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-meta strong {
  direction: ltr;
  font-weight: 900;
}

.profile-form-card {
  min-width: 0;
}

.styled-form {
  margin-top: 0;
}

.upload-field input[type="file"] {
  padding-top: 14px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.modern-table-wrap {
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.86);
  background: rgba(255, 255, 255, 0.65);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.80);
  text-align: right;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: #475569;
  background: rgba(248, 250, 252, 0.78);
  font-weight: 900;
}

td {
  color: #1f2937;
  font-weight: 700;
}

.inline-form {
  margin: 0;
}

.uuid-cell {
  direction: ltr;
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.success-pill {
  color: #166534;
  background: #dcfce7;
}

.muted-pill {
  color: #475569;
  background: #e2e8f0;
}

/* Settings */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.settings-tabs a {
  text-decoration: none;
  color: #475569;
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: 999px;
  padding: 12px 17px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.settings-tabs a.active,
.settings-tabs a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  transform: translateY(-1px);
}

.license-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 190px;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 26px;
  border-radius: 32px;
  color: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.license-card::before {
  content: "";
  position: absolute;
  inset: -80px auto auto -80px;
  width: 230px;
  height: 230px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.license-card.active {
  background: linear-gradient(135deg, #16a34a, #0f766e);
}

.license-card.inactive {
  background: linear-gradient(135deg, #1f2937, #991b1b);
}

.license-card-main,
.license-days {
  position: relative;
  z-index: 1;
}

.license-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
  font-weight: 900;
}

.license-card h2 {
  margin: 14px 0 8px;
  color: #fff;
  font-size: 26px;
}

.license-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
}

.license-days {
  min-height: 154px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.license-days strong {
  direction: ltr;
  font-size: 48px;
  line-height: 1;
  color: #fff;
  font-weight: 900;
}

.license-days span {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 900;
}

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

.details-grid div {
  padding: 15px;
  border-radius: 17px;
  background: rgba(248, 250, 252, 0.90);
  border: 1px solid rgba(226, 232, 240, 0.86);
}

.details-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.details-grid strong {
  display: block;
  direction: ltr;
  text-align: right;
  color: #172033;
  word-break: break-all;
  font-weight: 900;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.90);
  border: 1px solid rgba(226, 232, 240, 0.86);
  color: #334155;
  font-weight: 900;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  accent-color: var(--brand);
}

.check-row.warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

/* Compatibility classes from older templates */
.brand,
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff1f2;
  color: var(--brand);
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 14px;
}

.timer-box,
.modal-box {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  background: var(--surface-soft);
}

.link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 900;
}

/* Responsive */
@media (max-width: 1180px) {
  .dashboard-grid-two,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-summary-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    text-align: right;
    gap: 14px 18px;
  }

  .profile-summary-card .avatar-box {
    grid-row: span 4;
    margin-bottom: 0;
  }
}

@media (max-width: 980px) {
  .sidebar {
    top: 12px;
    right: 12px;
    bottom: 12px;
    transform: translateX(calc(100% + 24px));
    transition: transform 0.24s ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .dashboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .dashboard-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-shell {
    margin-right: 0;
  }

  .menu-toggle {
    display: grid;
  }

  .topbar {
    top: 12px;
    margin: 12px 12px 0;
  }

  .dashboard-content {
    padding: 18px 12px 28px;
  }

  .dashboard-hero,
  .cards-grid,
  .details-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-page,
  .login-page {
    padding: 18px;
  }

  .auth-card,
  .login-card,
  .login-card-wide {
    max-width: 390px;
    padding: 28px 22px 24px;
    border-radius: 22px;
  }

  .login-heading {
    font-size: 23px;
  }

  .login-lead {
    font-size: 14px;
  }

  .auth-form-grid,
  .auth-secondary-actions,
  .form-row {
    grid-template-columns: 1fr;
  }

  .otp-input-wrap input {
    letter-spacing: 7px;
  }

  .sidebar {
    width: calc(100vw - 24px);
  }

  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .topbar-title {
    flex: 1;
  }

  .topbar-date {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-hero {
    padding: 22px;
    border-radius: 26px;
  }

  .hero-card strong {
    font-size: 30px;
  }

  .panel,
  .stat-card {
    border-radius: 20px;
  }

  .profile-summary-card {
    display: block;
    text-align: center;
  }

  .profile-summary-card .avatar-box {
    justify-content: center;
    margin-bottom: 16px;
  }
}

/* Scale Management */
.scale-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.14), transparent 17rem),
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(153, 27, 27, 0.94));
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.16);
}

.scale-hero-panel h2,
.scale-hero-panel p {
  color: #fff;
}

.scale-hero-panel h2 {
  margin: 8px 0 7px;
}

.scale-hero-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.scale-add-button {
  min-width: 172px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

.scale-add-button:hover:not(:disabled) {
  background: #fff;
}

.empty-scale-state,
.empty-mini-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.86);
  color: #475569;
}

.empty-scale-state strong {
  color: #172033;
}

.scale-row-deleted {
  opacity: 0.68;
}

.scale-status-pill {
  gap: 6px;
}

.scale-status-active {
  color: #166534;
  background: #dcfce7;
}

.scale-status-unused {
  color: #92400e;
  background: #fef3c7;
}

.scale-status-deleted {
  color: #475569;
  background: #e2e8f0;
}

.scale-modal-open {
  overflow: hidden;
}

.scale-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.scale-modal-backdrop[hidden] {
  display: none;
}

.scale-modal {
  position: relative;
  width: min(900px, 100%);
  max-height: min(92vh, 880px);
  overflow: auto;
  border-radius: 34px;
  padding: 28px;
  background:
    radial-gradient(circle at 0% 100%, rgba(227, 6, 19, 0.08), transparent 20rem),
    rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 38px 90px rgba(15, 23, 42, 0.32);
}

.scale-modal-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.96);
  color: #1f2937;
  box-shadow: none;
  font-size: 28px;
  line-height: 1;
}

.scale-modal-head {
  padding-left: 54px;
  margin-bottom: 18px;
}

.scale-modal-head h2 {
  margin: 8px 0 7px;
}

.scale-modal-head p,
.scale-step p,
.form-hint {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.scale-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.scale-stepper span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 900;
}

.scale-stepper span.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 12px 28px rgba(227, 6, 19, 0.20);
}

.scale-step {
  display: none;
  animation: scaleStepIn 0.22s ease both;
}

.scale-step.active {
  display: block;
}

@keyframes scaleStepIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.scale-step h3 {
  margin: 0 0 7px;
  color: #172033;
  font-size: 22px;
}

.scale-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.scale-type-card {
  position: relative;
  cursor: pointer;
  display: grid;
  gap: 10px;
  min-height: 230px;
  padding: 16px;
  border-radius: 26px;
  background: rgba(248, 250, 252, 0.92);
  border: 2px solid rgba(226, 232, 240, 0.94);
  transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.scale-type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-type-card:has(input:checked),
.scale-type-card:hover {
  transform: translateY(-2px);
  border-color: rgba(227, 6, 19, 0.60);
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.10);
  background: #fff;
}

.scale-type-card strong {
  color: #172033;
  font-size: 18px;
  font-weight: 900;
}

.scale-type-card small {
  color: var(--muted);
  font-weight: 800;
}

.scale-illustration {
  position: relative;
  min-height: 124px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff1f2, #f8fafc);
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.scale-illustration::before,
.scale-illustration::after {
  content: "";
  position: absolute;
  display: block;
}

.light-scale-visual::before {
  width: 90px;
  height: 54px;
  left: calc(50% - 45px);
  top: 38px;
  border-radius: 18px;
  background: linear-gradient(135deg, #334155, #0f172a);
  box-shadow: 0 18px 24px rgba(15, 23, 42, 0.16);
}

.light-scale-visual::after {
  width: 118px;
  height: 12px;
  left: calc(50% - 59px);
  top: 88px;
  border-radius: 999px;
  background: var(--brand);
}

.road-scale-visual::before {
  inset: 36px 50px auto 50px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f172a, #475569);
  box-shadow: 0 18px 24px rgba(15, 23, 42, 0.16);
}

.road-scale-visual::after {
  right: 30px;
  left: 30px;
  bottom: 28px;
  height: 10px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, var(--brand) 0 22px, #fecaca 22px 38px);
}

.employee-select-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.employee-select-list.disabled-list {
  opacity: 0.55;
}

.employee-select-card {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.92);
  cursor: pointer;
}

.employee-select-card input {
  grid-row: span 2;
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.employee-select-card .mini-avatar {
  grid-row: span 2;
  width: 38px;
  height: 38px;
}

.employee-select-card strong,
.employee-select-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-select-card strong {
  color: #172033;
  font-weight: 900;
}

.employee-select-card small {
  color: var(--muted);
  direction: ltr;
  text-align: right;
  font-weight: 800;
}

.allow-all-row {
  margin-top: 14px;
}

.quick-employee-toggle {
  margin-top: 4px;
}

.quick-employee-box {
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.scale-wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(226, 232, 240, 0.86);
}

.scale-wizard-actions button:last-child {
  margin-right: auto;
}

@media (max-width: 760px) {
  .scale-hero-panel,
  .scale-type-grid,
  .employee-select-list {
    grid-template-columns: 1fr;
  }

  .scale-add-button {
    width: 100%;
  }

  .scale-modal {
    padding: 22px;
    border-radius: 26px;
  }
}

/* Business settings for printable invoices */
.settings-subtitle {
  margin: 16px 0 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.settings-subtitle p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.9;
}

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

.form-grid .full-span {
  grid-column: 1 / -1;
}

.settings-business-grid textarea,
.settings-business-grid input,
.settings-phone-box input {
  width: 100%;
}

.settings-phone-box {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px dashed rgba(203, 213, 225, 0.95);
}

.settings-phone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #172033;
}

.settings-phone-head strong {
  font-size: 14px;
  font-weight: 900;
}

.settings-phone-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-mobile-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr);
  gap: 10px;
}

.settings-upload-grid {
  margin: 14px 0;
}

.settings-sample-image {
  max-width: 180px;
  max-height: 92px;
  display: block;
  object-fit: contain;
  margin: 6px 0 10px;
  padding: 8px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.alert.muted {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

@media (max-width: 760px) {
  .form-grid.two-col,
  .settings-mobile-row {
    grid-template-columns: 1fr;
  }

  .settings-phone-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Settings business invoice wizard */
.settings-general-form { gap: 18px; }
.settings-currency-grid { margin-bottom: 4px; }

.settings-invoice-hero,
.settings-report-sms-box {
  display: grid;
  gap: 16px;
  margin: 16px 0;
  padding: 22px;
  border-radius: 28px;
  border: 1px solid rgba(226, 232, 240, 0.86);
  background:
    radial-gradient(circle at 8% 85%, rgba(227, 6, 19, 0.10), transparent 15rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07);
}

.settings-invoice-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background:
    radial-gradient(circle at 5% 100%, rgba(255, 255, 255, 0.18), transparent 16rem),
    linear-gradient(135deg, #111827, #991b1b);
  color: #fff;
  border: 0;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
}

.settings-invoice-hero .eyebrow,
.settings-invoice-hero h2,
.settings-invoice-hero p { color: #fff; }
.settings-invoice-hero h2 { margin: 7px 0 8px; line-height: 1.7; }
.settings-invoice-hero p { margin: 0; max-width: 760px; color: rgba(255, 255, 255, 0.78); font-weight: 800; line-height: 2; }

.settings-business-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.settings-business-summary span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 900;
}

.settings-business-summary strong { color: #fff; }
.settings-open-wizard { max-width: 300px; white-space: normal; line-height: 1.9; }
.settings-business-dialog { width: min(960px, 100%); }
.settings-stepper span { width: 40px; height: 40px; }
.settings-report-sms-box { background: #fff; }

.settings-upload-card {
  padding: 14px;
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.settings-empty-upload {
  display: grid;
  place-items: center;
  min-height: 92px;
  margin: 6px 0 10px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px dashed rgba(203, 213, 225, 0.95);
  color: #64748b;
  font-size: 13px;
  font-weight: 900;
}

.settings-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.settings-theme-card {
  position: relative;
  display: grid;
  gap: 10px;
  cursor: pointer;
  padding: 14px;
  border-radius: 26px;
  background: rgba(248, 250, 252, 0.94);
  border: 2px solid rgba(226, 232, 240, 0.94);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.settings-theme-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-theme-card:has(input:checked),
.settings-theme-card:hover {
  transform: translateY(-2px);
  background: #fff;
  border-color: rgba(227, 6, 19, 0.58);
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.10);
}

.settings-theme-card strong {
  color: #172033;
  font-size: 17px;
  font-weight: 900;
}

.settings-theme-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.9;
}

.settings-theme-preview {
  position: relative;
  display: block;
  height: 154px;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.settings-theme-preview i,
.settings-theme-preview b,
.settings-theme-preview em,
.settings-theme-preview strong {
  position: absolute;
  display: block;
  content: "";
}

.theme-clean-navy i { inset: 14px 16px auto 16px; height: 52px; border-radius: 16px 16px 0 0; background: #121433; }
.theme-clean-navy b { inset: 62px 24px auto 24px; height: 18px; background: #e1b322; }
.theme-clean-navy em { inset: 86px 24px auto 24px; height: 44px; background: repeating-linear-gradient(to bottom, #e8e8e6 0 18px, #fff 18px 36px); }
.theme-clean-navy strong { left: 26px; bottom: 14px; width: 86px; height: 22px; border-radius: 8px; background: #121433; }

.theme-modern-red i { inset: 14px 16px auto 16px; height: 54px; border-radius: 16px; background: linear-gradient(135deg, #b91c1c, #f97316); }
.theme-modern-red b { right: 24px; top: 78px; width: 38%; height: 14px; border-radius: 999px; background: #fecaca; }
.theme-modern-red em { inset: 100px 24px auto 24px; height: 26px; background: repeating-linear-gradient(to bottom, #f1f5f9 0 10px, #fff 10px 20px); }
.theme-modern-red strong { left: 26px; bottom: 14px; width: 96px; height: 24px; border-radius: 999px; background: #b91c1c; }

.field-attention {
  border-color: rgba(227, 6, 19, 0.8) !important;
  box-shadow: 0 0 0 4px rgba(227, 6, 19, 0.12) !important;
}

.settings-save-general { align-self: flex-start; }

@media (max-width: 840px) {
  .settings-invoice-hero,
  .settings-theme-grid {
    grid-template-columns: 1fr;
  }
  .settings-open-wizard { max-width: none; width: 100%; }
}

/* Settings pages as dashboard submenu */
.side-accordion {
  display: grid;
  gap: 6px;
}

.side-accordion-toggle {
  justify-content: space-between;
}

.side-accordion-toggle span {
  flex: 1;
}

.side-accordion-toggle i {
  font-style: normal;
  font-size: 15px;
  opacity: 0.75;
  transition: transform 0.18s ease;
}

.side-accordion.open .side-accordion-toggle i {
  transform: rotate(180deg);
}

.side-subnav {
  display: none;
  margin: -2px 18px 4px 0;
  padding: 7px 10px 7px 0;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0 0 16px 0;
}

.side-accordion.open .side-subnav,
.side-accordion:hover .side-subnav {
  display: grid;
  gap: 6px;
}

.side-nav .side-subnav a {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  background: transparent;
  transform: none;
}

.side-nav .side-subnav a::before {
  width: 6px;
  height: 6px;
  margin-left: 8px;
  background: rgba(255, 255, 255, 0.24);
}

.side-nav .side-subnav a.active,
.side-nav .side-subnav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
}

.settings-tabs { display: none !important; }

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

.settings-page-panel {
  border-radius: 30px;
}

.settings-form-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(226, 232, 240, 0.9);
}

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

.settings-clean-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 0 100%, rgba(227, 6, 19, 0.08), transparent 12rem),
    linear-gradient(135deg, #fff, #f8fafc);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

.settings-clean-card h2 {
  margin: 0;
  color: #172033;
  font-size: 20px;
  font-weight: 900;
}

.settings-clean-card p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.9;
}

.settings-toggle-list {
  display: grid;
  gap: 10px;
}

.settings-invoice-hero-clean {
  margin-top: 0;
  border-radius: 34px;
  background:
    radial-gradient(circle at 8% 100%, rgba(255, 255, 255, 0.20), transparent 17rem),
    radial-gradient(circle at 92% 0, rgba(248, 113, 113, 0.20), transparent 16rem),
    linear-gradient(135deg, #111827, #7f1d1d);
}

.settings-modal-head-soft {
  margin: -4px -4px 0;
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 0 0, rgba(227, 6, 19, 0.11), transparent 13rem),
    linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid rgba(226, 232, 240, 0.88);
}

.settings-business-dialog {
  border-radius: 32px;
}

.settings-wizard-step {
  margin-top: 14px;
  padding: 18px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.settings-paper-size-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.settings-paper-size-box > span {
  color: #172033;
  font-size: 14px;
  font-weight: 900;
  margin-left: auto;
}

.settings-paper-size-box label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  background: #f8fafc;
  color: #334155;
  font-weight: 900;
  cursor: pointer;
}

.settings-paper-size-box label:has(input:checked) {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

@media (max-width: 840px) {
  .settings-clean-grid {
    grid-template-columns: 1fr;
  }
}
.side-nav {
  overflow-y: auto;
  padding-left: 4px;
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

/* v4 settings: smoother sidebar accordion and full-width invoice setup card */
.side-accordion {
  overflow: hidden;
  border-radius: 18px;
}

.side-accordion-toggle {
  cursor: pointer;
}

.side-subnav {
  display: grid !important;
  gap: 6px;
  max-height: 0;
  margin: 0 18px 0 0;
  padding: 0 10px 0 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height 0.34s cubic-bezier(.22,.9,.25,1), opacity 0.24s ease, transform 0.24s ease, padding 0.24s ease, margin 0.24s ease;
  will-change: max-height, opacity, transform;
}

.side-accordion.open .side-subnav {
  max-height: 190px;
  margin: -2px 18px 4px 0;
  padding: 8px 10px 8px 0;
  opacity: 1;
  transform: translateY(0);
}

.side-accordion:hover .side-subnav {
  max-height: inherit;
}

.side-accordion:not(.open):hover .side-subnav {
  max-height: 0;
  margin: 0 18px 0 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-8px);
}

.side-accordion.open .side-accordion-toggle {
  background: rgba(255, 255, 255, 0.12);
}

.side-accordion.open .side-accordion-toggle i {
  transform: rotate(180deg);
}

.settings-invoice-hero-full {
  width: 100%;
  min-height: 280px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: stretch;
  gap: 24px;
  padding: clamp(26px, 4vw, 42px);
  position: relative;
  overflow: hidden;
}

.settings-invoice-hero-full::after {
  content: "";
  position: absolute;
  left: 34px;
  top: 34px;
  bottom: 34px;
  width: min(280px, 28vw);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.72)),
    repeating-linear-gradient(to bottom, rgba(15,23,42,.08) 0 14px, transparent 14px 32px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45), 0 22px 54px rgba(0,0,0,.12);
  pointer-events: none;
}

.settings-invoice-hero-full > div,
.settings-invoice-hero-full > button {
  position: relative;
  z-index: 1;
}

.settings-invoice-hero-full h2 {
  max-width: 760px;
  font-size: clamp(24px, 3vw, 36px);
}

.settings-invoice-hero-full .settings-open-wizard {
  justify-self: stretch;
  align-self: center;
  max-width: none;
  min-height: 92px;
  padding: 0 24px;
  border-radius: 28px;
  font-size: 17px;
  color: #991b1b;
  background: rgba(255,255,255,.96);
  box-shadow: 0 24px 56px rgba(0,0,0,.20);
}

.settings-business-dialog {
  width: min(1120px, calc(100vw - 36px));
  max-height: min(94vh, 920px);
}

.settings-invoice-sms-row {
  background: rgba(255, 247, 237, 0.86);
  border-color: #fed7aa;
}

@media (max-width: 920px) {
  .settings-invoice-hero-full {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .settings-invoice-hero-full::after { display: none; }
}
.side-accordion.open:hover .side-subnav { max-height: 190px; }


/* v5: settings launch panel aligned with scales page */
.settings-launch-panel {
  margin-top: 6px;
  min-height: 126px;
  border-radius: 34px;
}

.settings-launch-copy {
  display: grid;
  gap: 10px;
}

.settings-launch-panel .settings-launch-kicker,
.settings-launch-panel h2,
.settings-launch-panel p {
  color: #fff;
}

.settings-launch-panel h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.55;
}

.settings-launch-panel p {
  margin: 0;
  max-width: 980px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  font-weight: 800;
  line-height: 2;
}

.settings-business-summary-inline {
  margin-top: 4px;
}

.settings-launch-panel .settings-open-wizard-wide {
  min-width: 174px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 20px;
  font-size: 16px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .settings-launch-panel {
    grid-template-columns: 1fr;
  }

  .settings-launch-panel .settings-open-wizard-wide {
    width: 100%;
  }
}

/* smoother settings accordion */
.side-subnav {
  display: grid !important;
  gap: 6px;
  margin: 0 18px 0 0;
  padding: 0 10px 0 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: max-height 0.34s cubic-bezier(.22,.9,.25,1), opacity 0.24s ease, transform 0.24s ease, padding 0.24s ease, margin 0.24s ease;
  will-change: max-height, opacity, transform;
}

.side-subnav a {
  border-radius: 14px;
  transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.side-subnav a:hover {
  transform: translateX(-2px);
}

.side-accordion .side-subnav {
  max-height: 0;
}

.side-accordion.open .side-subnav {
  max-height: 400px;
  margin: 4px 18px 8px 0;
  padding: 8px 10px 8px 0;
  opacity: 1;
  transform: translateY(0);
}

.side-accordion .side-accordion-toggle i {
  transition: transform 0.26s ease;
}

.side-accordion.open .side-accordion-toggle i {
  transform: rotate(180deg);
}


/* v6: settings page should use full available content width */
.settings-general-form,
.settings-page-panel,
.settings-page-head,
.settings-license-panel,
.settings-sessions-panel {
  width: 100%;
  max-width: none !important;
}

.settings-general-form.wide-form,
.settings-page-panel.wide-form,
form.settings-general-form {
  max-width: none !important;
}

.settings-general-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: stretch;
}

.settings-general-form > section,
.settings-general-form > div,
.settings-general-form > article,
.settings-general-form > .panel {
  width: 100%;
  max-width: none;
}

.settings-clean-grid {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-clean-card,
.settings-launch-panel,
.settings-invoice-hero,
.settings-invoice-hero-full {
  width: 100%;
  max-width: none;
}


/* v8: completed business invoice profile state */
.settings-launch-panel-ready {
  background:
    radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.16), transparent 18rem),
    linear-gradient(135deg, #16a34a, #0f766e) !important;
}

.settings-launch-panel-ready .settings-launch-kicker {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.settings-launch-panel-ready .settings-open-wizard-wide,
.settings-launch-panel-ready button.settings-open-wizard-wide {
  color: #166534 !important;
}

.settings-business-filled-card {
  width: 100%;
  margin-top: -4px;
  padding: 22px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 0 100%, rgba(22, 163, 74, 0.08), transparent 14rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 244, 0.94));
  border: 1px solid rgba(187, 247, 208, 0.95);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

.settings-business-filled-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.settings-business-filled-head h3 {
  margin: 0;
  color: #14532d;
  font-size: 20px;
  font-weight: 900;
}

.settings-business-filled-card .eyebrow {
  background: rgba(22, 163, 74, 0.11);
  color: #15803d;
}

.settings-business-filled-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.settings-business-filled-item {
  min-height: 88px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(187, 247, 208, 0.86);
}

.settings-business-filled-item span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.settings-business-filled-item strong {
  display: block;
  color: #172033;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.9;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .settings-business-filled-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .settings-business-filled-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .settings-business-filled-grid {
    grid-template-columns: 1fr;
  }
}


/* v9 upload cleanup actions for seal and signature */
.settings-upload-preview {
  display: grid;
  min-height: 104px;
}

.settings-upload-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  margin: 2px 0 10px;
}

.settings-remove-upload {
  min-height: 38px;
  padding: 0 14px !important;
  border-radius: 14px !important;
  color: #991b1b !important;
  background: #fff1f2 !important;
  border: 1px solid #fecdd3 !important;
  box-shadow: none !important;
}

.settings-remove-upload:hover {
  background: #ffe4e6 !important;
}

/* v10: stronger OTP captcha image */
.captcha-field {
  gap: 8px;
}

.captcha-challenge {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
}

.captcha-challenge img {
  width: min(238px, 100%);
  height: auto;
  display: block;
  border-radius: 16px;
  user-select: none;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.captcha-challenge strong {
  display: grid;
  place-items: center;
  min-height: 70px;
  padding: 0 18px;
  border-radius: 16px;
  background: #fff;
  color: #111827;
  direction: ltr;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 5px;
}

.captcha-challenge span {
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.8;
}

.captcha-input-wrap input,
#captcha_answer {
  direction: ltr !important;
  text-align: center !important;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 900 !important;
}

@media (max-width: 560px) {
  .captcha-challenge {
    grid-template-columns: 1fr;
  }
  .captcha-challenge img {
    justify-self: center;
  }
}

/* v10: employees inside settings/general */
.settings-employees-card {
  margin-top: 0;
  background:
    radial-gradient(circle at 0 100%, rgba(227, 6, 19, 0.055), transparent 14rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border-color: rgba(226, 232, 240, 0.95);
}

.settings-employees-card .eyebrow {
  background: var(--brand-soft);
  color: var(--brand);
}

.settings-employees-card .settings-business-filled-head h3 {
  color: #172033;
}

.settings-employees-head > div {
  display: grid;
  gap: 8px;
}

.settings-employee-add-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 16px;
  font-size: 13px;
  box-shadow: 0 12px 26px rgba(227, 6, 19, 0.16);
}

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

.settings-employee-tile {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.settings-employee-info {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.settings-employee-info strong {
  overflow: hidden;
  color: #172033;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-employee-info span {
  direction: ltr;
  color: #64748b;
  text-align: right;
  font-size: 12px;
  font-weight: 900;
}

.settings-employee-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-employee-actions .inline-form,
.settings-employee-delete-form {
  margin: 0;
}

.settings-employee-edit,
.settings-employee-delete {
  min-height: 32px !important;
  padding: 0 10px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
}

.settings-employee-edit.secondary {
  color: #334155 !important;
  background: #f8fafc !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
}

.settings-employee-delete {
  box-shadow: none !important;
}

.settings-employee-empty {
  grid-column: 1 / -1;
  min-height: 88px;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px dashed rgba(203, 213, 225, 0.95);
  color: #64748b;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.9;
  text-align: center;
}

.settings-employee-dialog {
  width: min(620px, calc(100vw - 36px));
  border-radius: 32px;
}

.settings-employee-form {
  max-width: none;
  margin-top: 16px;
}

.settings-employee-form-grid input {
  width: 100%;
}

.settings-employee-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.settings-employee-modal-actions .secondary {
  color: #475569 !important;
  background: #f8fafc !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
}

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

@media (max-width: 720px) {
  .settings-employees-head {
    align-items: stretch;
    flex-direction: column;
  }
  .settings-employee-add-button {
    width: 100%;
  }
  .settings-employees-grid,
  .settings-employee-form-grid {
    grid-template-columns: 1fr;
  }
  .settings-employee-tile {
    align-items: stretch;
    flex-direction: column;
  }
  .settings-employee-actions,
  .settings-employee-modal-actions {
    width: 100%;
  }
  .settings-employee-actions > *,
  .settings-employee-actions button,
  .settings-employee-modal-actions button {
    flex: 1 1 0;
  }
}


/* FIX: sidebar accordion visibility on small / short screens */
.side-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 4px;
  padding-bottom: 6px;
  overscroll-behavior: contain;
}

.side-accordion {
  flex: 0 0 auto;
  overflow: visible;
  border-radius: 18px;
}

.side-subnav {
  display: grid !important;
  gap: 6px;
  max-height: 0 !important;
  margin: 0 18px 0 0;
  padding: 0 10px 0 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0 0 16px 0;
  transition:
    max-height 0.28s cubic-bezier(.22,.9,.25,1),
    opacity 0.2s ease,
    transform 0.2s ease,
    padding 0.2s ease,
    margin 0.2s ease;
}

.side-accordion.open .side-subnav,
.side-accordion.open:hover .side-subnav {
  max-height: 420px !important;
  margin: 4px 18px 8px 0;
  padding: 8px 10px 8px 0;
  opacity: 1;
  transform: translateY(0);
}

.side-accordion:not(.open) .side-subnav,
.side-accordion:not(.open):hover .side-subnav {
  max-height: 0 !important;
  margin: 0 18px 0 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-8px);
}

.side-nav .side-subnav a {
  flex: 0 0 auto;
  min-height: 36px;
}

/* Better fit on short-height screens */
@media (max-height: 700px) {
  .sidebar {
    top: 10px;
    bottom: 10px;
    padding: 14px;
    gap: 12px;
  }

  .sidebar-brand-wrap {
    padding-bottom: 12px;
  }

  .side-nav {
    gap: 6px;
  }

  .side-nav a {
    min-height: 42px;
  }

  .side-nav .side-subnav a {
    min-height: 34px;
    font-size: 12px;
  }

  .logout-button {
    min-height: 42px;
  }
}
/* صفحه ویژه مدیریت پنل */
.side-nav a.panel-admin-nav {
  background: linear-gradient(135deg, rgba(37, 99, 235, .18), rgba(14, 165, 233, .12));
  border-color: rgba(59, 130, 246, .38);
  color: #dbeafe;
}
.side-nav a.panel-admin-nav.active,
.side-nav a.panel-admin-nav:hover {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  box-shadow: 0 18px 35px rgba(37, 99, 235, .25);
}
.admin-hero {
  border: 1px solid rgba(59, 130, 246, .25);
  background: linear-gradient(135deg, rgba(30, 64, 175, .94), rgba(14, 116, 144, .86));
}
.admin-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.24);
}
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.admin-stat-card,
.admin-action-card,
.admin-section,
.admin-created-codes,
.admin-user-card {
  border: 1px solid rgba(148, 163, 184, .2);
}
.admin-stat-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}
.admin-stat-card span,
.admin-action-card p,
.admin-section p,
.admin-user-head p,
.admin-license-summary,
.muted {
  color: #64748b;
}
.admin-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  color: #0f172a;
}
.admin-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}
.admin-action-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 190px;
}
.admin-action-card h2,
.admin-section h2,
.admin-user-card h3 {
  margin: 0 0 8px;
}
.admin-license-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.admin-license-summary span,
.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 800;
}
.admin-pill.active { background: #dcfce7; color: #166534; }
.admin-pill.used { background: #e0f2fe; color: #075985; }
.admin-pill.inactive { background: #fee2e2; color: #991b1b; }
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, .2);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}
.admin-table th,
.admin-table td {
  padding: 13px 14px;
  text-align: right;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  white-space: nowrap;
}
.admin-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}
.admin-table td code,
.admin-code-list code {
  direction: ltr;
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 5px 8px;
  border-radius: 10px;
  font-weight: 800;
}
.compact-table { min-width: 520px; }
.empty-cell,
.empty-state {
  text-align: center !important;
  color: #94a3b8;
  padding: 18px !important;
}
.admin-user-list {
  display: grid;
  gap: 16px;
}
.admin-user-card {
  border-radius: 24px;
  padding: 16px;
  background: #fff;
}
.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.admin-user-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.admin-user-metrics span {
  border-radius: 999px;
  padding: 8px 11px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}
.admin-created-codes { margin-bottom: 18px; }
.admin-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-modal[hidden] { display: none; }
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(8px);
}
.admin-modal-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 28px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
}
.admin-modal-close {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-end: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 24px;
  cursor: pointer;
}
.admin-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.admin-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 800;
}
.admin-form input,
.admin-form select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 12px 13px;
  font: inherit;
  background: #fff;
}
.admin-checkboxes {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
}
.admin-check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}
.admin-check-row input {
  width: auto;
}
@media (max-width: 980px) {
  .admin-stats-grid,
  .admin-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-user-head { flex-direction: column; }
  .admin-user-metrics { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .admin-stats-grid,
  .admin-action-grid { grid-template-columns: 1fr; }
  .admin-hero-badge { width: 100%; }
}
.panel-card {
  padding: 22px;
  border-radius: 28px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 20px 54px rgba(15, 23, 42, .08);
}
.section-heading.compact {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.admin-action-grid {
  display: grid;
  gap: 16px;
}
.admin-hero {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.admin-hero h1,
.admin-hero p { margin: 0; }
.admin-hero h1 { margin-bottom: 8px; color: #fff; }
.admin-hero p { color: rgba(255,255,255,.78); }
.admin-hero .eyebrow { color: rgba(255,255,255,.66); margin-bottom: 8px; }

/* UI layer fix v3: sidebar scrollbar and modal stacking */
.dashboard-shell {
  z-index: auto;
}

.side-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(227, 6, 19, 0.62) transparent;
}

.side-nav::-webkit-scrollbar {
  width: 6px;
}

.side-nav::-webkit-scrollbar-track {
  background: transparent;
}

.side-nav::-webkit-scrollbar-thumb {
  background: rgba(227, 6, 19, 0.58);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.side-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(227, 6, 19, 0.82);
  background-clip: padding-box;
}

.sales-modal-backdrop,
.scale-modal-backdrop,
.store-modal-backdrop,
.fr-print-modal,
.admin-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
}

/* UI cleanup v4: remove sidebar mini profile, neutral scrollbar, mobile-first dashboard menu */
.sidebar-brand-wrap {
  min-height: 56px;
}

.sidebar-brand-copy {
  min-width: 0;
}

.sidebar-close-mobile {
  display: none;
}

.logout-form {
  flex: 0 0 auto;
}

.side-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  padding-left: 6px;
}

.side-nav::-webkit-scrollbar {
  width: 7px;
}

.side-nav::-webkit-scrollbar-track {
  background: transparent;
}

.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.20);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.side-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
  background-clip: padding-box;
}

@media (max-width: 980px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(334px, calc(100vw - 20px));
    padding: 14px;
    gap: 12px;
    border-radius: 24px;
    transform: translateX(calc(100% + 22px));
    box-shadow: 0 28px 90px rgba(15, 23, 42, 0.36);
  }

  .sidebar-brand-wrap {
    gap: 10px;
    padding-bottom: 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 15px;
    font-size: 20px;
  }

  .sidebar-brand-title {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .sidebar-brand-subtitle {
    font-size: 11px;
  }

  .sidebar-close-mobile {
    display: grid;
    place-items: center;
    width: 38px;
    min-height: 38px;
    height: 38px;
    margin-right: auto;
    padding: 0 !important;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.10) !important;
    color: #fff !important;
    box-shadow: none !important;
    font-size: 25px;
    line-height: 1;
  }

  .side-nav {
    gap: 6px;
    padding: 2px 0 8px 6px;
  }

  .side-nav a {
    min-height: 43px;
    padding: 0 13px;
    border-radius: 14px;
    font-size: 13px;
  }

  .side-nav a::before {
    width: 7px;
    height: 7px;
    margin-left: 8px;
  }

  .side-accordion.open .side-subnav,
  .side-accordion.open:hover .side-subnav {
    margin: 3px 15px 7px 0;
    padding: 7px 9px 7px 0;
  }

  .side-nav .side-subnav a {
    min-height: 34px;
    font-size: 12px;
    border-radius: 12px;
  }

  .logout-button {
    min-height: 43px;
    border-radius: 14px;
  }

  .dashboard-overlay {
    z-index: 19;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .topbar {
    top: 10px;
    min-height: 64px;
    margin: 10px 10px 0;
    padding: 10px;
    border-radius: 20px;
    gap: 10px;
  }

  .menu-toggle {
    width: 44px;
    min-height: 44px;
    border-radius: 14px;
    flex: 0 0 44px;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-title strong {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .topbar-date {
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 15px;
    font-size: 12px;
  }

  .dashboard-content {
    padding: 16px 10px 28px;
  }
}

@media (max-width: 760px) {
  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 18px;
  }

  .dashboard-hero,
  .scale-hero-panel,
  .sales-hero-panel,
  .store-hero-panel,
  .admin-hero {
    grid-template-columns: 1fr !important;
    align-items: stretch;
    min-height: 0;
    padding: 20px;
    border-radius: 24px;
    gap: 14px;
  }

  .admin-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-card,
  .stat-card,
  .panel,
  .panel-card,
  .settings-page-panel {
    border-radius: 20px;
  }

  .panel,
  .panel-card,
  .stat-card {
    padding: 16px;
  }

  .panel-title-row,
  .section-heading.compact,
  .fr-panel-head,
  .fr-invoice-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .panel-title-row h2 {
    margin-top: 0;
  }

  .cards-grid,
  .dashboard-grid-two,
  .details-grid,
  .toggle-grid,
  .settings-employees-grid,
  .settings-business-filled-grid,
  .settings-theme-grid,
  .admin-stats-grid,
  .admin-action-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .scale-add-button,
  .sales-add-button,
  .store-add-button,
  .settings-open-wizard,
  .settings-employee-add-button,
  .panel-title-row button,
  .section-heading.compact button {
    width: 100%;
  }

  .table-wrap,
  .admin-table-wrap,
  .fr-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sales-modal-backdrop,
  .scale-modal-backdrop,
  .store-modal-backdrop,
  .fr-print-modal,
  .admin-modal {
    padding: 10px !important;
    align-items: start !important;
    overflow-y: auto !important;
  }

  .sales-modal,
  .scale-modal,
  .store-modal,
  .fr-print-dialog,
  .admin-modal-panel {
    width: 100% !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 22px !important;
    padding: 18px !important;
  }

  .sales-modal-head,
  .scale-modal-head,
  .store-modal-head {
    padding-left: 48px;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: center;
    flex-wrap: nowrap;
  }

  .topbar-title span {
    display: none;
  }

  .topbar-date {
    flex: 0 0 auto;
    width: auto;
    max-width: 47vw;
    display: grid;
    gap: 2px;
    justify-items: end;
    line-height: 1.5;
  }

  .dashboard-content {
    padding-right: 8px;
    padding-left: 8px;
  }

  .dashboard-hero,
  .scale-hero-panel,
  .sales-hero-panel,
  .store-hero-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-card strong,
  .stat-card strong {
    font-size: 26px;
  }

  input,
  textarea,
  select,
  button {
    font-size: 14px;
  }
}

