html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ---------- Theme palette: every colour below is derived from these tokens ---------- */
:root {
  --brand: #dc7836;
  --brand-hover: #c9682b;
  --brand-soft: #f9ede3;
  --brand-ring: rgba(220, 120, 54, 0.16);
  --bg: #f8f5f0;
  --surface: #fff;
  --surface-soft: #fcfaf7;
  --text: #44372f;
  --muted: #75675d;
  --subtle: #95897f;
  --border: #e9e1d8;
  --input: #fff;
  --shadow: 0 18px 55px rgba(68, 55, 47, 0.10);
  --success: #568064;
  --success-soft: #eaf1ec;
  --danger: #bd5b53;
  --danger-soft: #f8eceb;
}

:root {
  --login-white: #ffffff;
  --login-white-muted: rgba(255, 255, 255, 0.82);
  --login-white-soft: rgba(255, 255, 255, 0.6);
  --login-hero: var(--brand);
  --login-hero-shadow: rgba(68, 55, 47, 0.2);
  --login-accent-bright: var(--brand);
  --login-accent: var(--brand);
  --login-accent-hover: var(--brand-hover);
  --login-accent-focus: var(--brand-ring);
  --login-button-shadow: rgba(220, 120, 54, 0.18);
  --login-panel: var(--surface-soft);
  --login-mobile-gradient-start: var(--brand-soft);
  --login-mobile-gradient-middle: rgba(220, 120, 54, 0.28);
  --login-mobile-gradient-end: var(--surface-soft);
  --login-text: var(--text);
  --login-label: var(--text);
  --login-muted: var(--muted);
  --login-muted-dark: var(--muted);
  --login-placeholder: var(--subtle);
  --login-icon: var(--brand);
  --login-input-border: var(--brand);
  --login-input-focus: var(--brand);
  --login-input-focus-ring: var(--brand-ring);
  --login-border: var(--border);
  --login-border-hover: var(--subtle);
  --login-link: var(--brand-hover);
  --login-link-hover: var(--brand-hover);
  --login-message: var(--muted);
  --login-error: var(--danger);
  --login-footer: var(--subtle);
  --login-mark-bg: var(--brand-soft);
  --login-mark: var(--brand);
  --login-social: var(--muted);
  --login-social-border: var(--border);
  --login-social-hover: var(--brand-hover);
  --login-social-hover-bg: var(--brand-soft);
}

html:has(.login-page) {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-size: 16px;
}

body.login-page {
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--login-text);
  background: linear-gradient(135deg, var(--login-hero), var(--login-accent-bright));
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.login-page *,
.login-page *::before,
.login-page *::after {
  box-sizing: border-box;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(390px, 0.88fr) minmax(0, 1.12fr);
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px clamp(36px, 7vw, 112px);
  background:
    radial-gradient(ellipse at 2% 2%, rgba(244, 210, 184, 0.36), transparent 38%),
    var(--login-panel);
}

.login-content {
  width: min(100%, 420px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 68px;
  color: var(--login-text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: var(--login-mark-bg);
  color: var(--login-mark);
}

.brand-mark svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-name {
  font-size: 1.18rem;
  font-weight: 750;
  letter-spacing: -0.045em;
}

.brand-name span {
  color: var(--login-mark);
}

.login-heading {
  margin-bottom: 34px;
}

.eyebrow,
.hero-kicker {
  margin: 0 0 12px;
  color: var(--login-link);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.login-heading h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3.2vw, 2.35rem);
  font-weight: 720;
  letter-spacing: -0.055em;
  line-height: 1.15;
}

.login-intro {
  margin: 14px 0 0;
  color: var(--login-muted-dark);
  font-size: 0.98rem;
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 22px;
}

.form-field {
  display: grid;
  gap: 9px;
}

.form-field label {
  color: var(--login-label);
  font-size: 0.88rem;
  font-weight: 650;
}

.input-shell {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 13px;
  padding: 0 16px;
  border: 1.5px solid var(--login-input-border);
  border-radius: 11px;
  background: var(--login-white);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input-shell:hover {
  border-color: var(--login-border-hover);
}

.input-shell:focus-within {
  border: 2px solid var(--login-input-focus);
  box-shadow: 0 0 0 4px var(--login-input-focus-ring);
}

.input-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--login-icon);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  padding: 15px 0;
  border: 0;
  outline: 0;
  color: var(--login-text);
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
}

.input-shell input::placeholder {
  color: var(--login-placeholder);
  opacity: 1;
}

.input-shell input:focus-visible {
  outline: 0;
}

.login-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 12px;
  margin-top: 6px;
}

.login-button,
.reset-button {
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 11px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.login-button {
  color: var(--login-white);
  background: var(--login-accent);
  box-shadow: 0 8px 18px var(--login-button-shadow);
}

.login-button:hover {
  background: var(--login-accent-hover);
  transform: translateY(-1px);
}

.reset-button {
  border-color: var(--login-border);
  color: var(--login-muted-dark);
  background: transparent;
}

.reset-button:hover {
  border-color: var(--login-border-hover);
  color: var(--login-link);
  background: var(--login-social-hover-bg);
}

.login-button:focus-visible,
.reset-button:focus-visible {
  outline: 3px solid var(--login-input-focus);
  outline-offset: 3px;
}

.login-status {
  min-height: 1.35em;
  margin: -8px 0 0;
  color: var(--login-message);
  font-size: 0.84rem;
  line-height: 1.5;
}

.login-status:empty {
  display: none;
}

.login-footnote {
  margin: 34px 0 0;
  color: var(--login-footer);
  font-size: 0.78rem;
  line-height: 1.5;
}

.login-hero {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 72px clamp(36px, 6vw, 96px);
  color: var(--login-white);
  background: linear-gradient(145deg, var(--login-hero), var(--login-accent-bright) 60%, var(--login-accent));
}

.login-hero::before {
  position: absolute;
  inset: 0;
  background: url("/image/aacbg.jpg") center / cover no-repeat;
  content: "";
  opacity: 0.36;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  text-align: center;
}

.hero-copy h2 {
  max-width: 18ch;
  margin: 0 auto;
  color: var(--login-white);
  font-size: clamp(2.15rem, 4vw, 3.45rem);
  font-weight: 720;
  letter-spacing: -0.06em;
  line-height: 1.12;
  text-shadow: 0 2px 18px rgba(48, 22, 10, 0.45);
}

.hero-copy p {
  max-width: 520px;
  margin: 22px auto 0;
  color: var(--login-white-muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
  text-shadow: 0 2px 12px rgba(48, 22, 10, 0.45);
}

.hero-copy strong {
  color: var(--login-white);
  font-weight: 750;
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: minmax(350px, 0.95fr) minmax(0, 1.05fr);
  }

  .login-panel {
    padding-right: 42px;
    padding-left: 42px;
  }

  .login-hero {
    padding-right: 36px;
    padding-left: 36px;
  }

}

@media (max-width: 700px) {
  body.login-page {
    background: linear-gradient(145deg, var(--login-mobile-gradient-start), var(--login-mobile-gradient-middle) 48%, var(--login-mobile-gradient-end));
  }

  .login-shell {
    display: flex;
    min-height: 100svh;
    flex-direction: column;
    overflow: visible;
    padding: clamp(16px, 5vw, 30px);
  }

  .login-panel {
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
    padding: clamp(22px, 6vw, 38px) clamp(22px, 7vw, 42px);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    background: rgba(255, 248, 241, 0.96);
    box-shadow: 0 18px 48px rgba(106, 49, 13, 0.12);
  }

  .brand {
    margin-bottom: clamp(24px, 7vw, 40px);
  }

  .login-heading {
    margin-bottom: 28px;
  }

  .login-hero {
    display: none;
  }
}

@media (max-width: 390px) {
  .login-shell {
    padding: 12px;
  }

  .login-panel {
    padding-right: 20px;
    padding-left: 20px;
  }

  .login-heading {
    margin-bottom: 22px;
  }

  .login-heading h1 {
    font-size: clamp(1.7rem, 8vw, 2rem);
  }

  .login-form {
    gap: 16px;
  }

  .input-shell {
    min-height: 50px;
  }

  .input-shell input {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .login-button,
  .reset-button {
    min-height: 48px;
  }

  .login-footnote {
    margin-top: 22px;
  }

  .login-actions {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 9px;
  }
}

@media (max-width: 700px) and (max-height: 620px) {
  .login-shell {
    padding: 8px;
  }

  .login-panel {
    padding: 16px 18px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .login-heading {
    margin-bottom: 12px;
  }

  .login-intro {
    display: none;
  }

  .login-form {
    gap: 12px;
  }

  .form-field {
    gap: 6px;
  }

  .input-shell {
    min-height: 44px;
  }

  .input-shell input {
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .login-button,
  .reset-button {
    min-height: 44px;
  }

  .login-footnote {
    margin-top: 14px;
  }
}

@media (max-width: 700px) and (max-height: 460px) {
  .login-panel {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .login-footnote {
    display: none;
  }
}

@media (min-width: 701px) and (max-height: 700px) {
  .login-panel {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .brand {
    margin-bottom: 24px;
  }

  .login-heading {
    margin-bottom: 22px;
  }

  .login-heading h1 {
    font-size: 1.9rem;
  }

  .login-form {
    gap: 14px;
  }

  .input-shell {
    min-height: 48px;
  }

  .input-shell input {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .login-button,
  .reset-button {
    min-height: 46px;
  }

  .login-footnote {
    margin-top: 18px;
  }

  .login-hero {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .hero-copy p {
    margin-top: 14px;
  }
}

@media (min-width: 701px) and (max-height: 560px) {
  .login-shell {
    grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  }

  .login-panel,
  .login-hero {
    min-height: 0;
  }

  .login-panel {
    padding: 12px 18px;
  }

  .login-content {
    width: min(100%, 420px);
  }

  .brand {
    margin-bottom: 12px;
  }

  .login-heading {
    margin-bottom: 10px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.64rem;
  }

  .login-heading h1 {
    font-size: clamp(1.45rem, 2.1vw, 1.7rem);
  }

  .login-intro,
  .login-footnote {
    display: none;
  }

  .login-form {
    gap: 10px;
  }

  .form-field {
    gap: 5px;
  }

  .input-shell {
    min-height: 42px;
  }

  .input-shell input {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .login-actions {
    margin-top: 0;
  }

  .login-button,
  .reset-button {
    min-height: 42px;
  }

  .login-hero {
    padding: 12px 20px;
  }

  .hero-copy h2 {
    font-size: clamp(1.55rem, 2.6vw, 2rem);
  }

  .hero-copy p {
    margin-top: 10px;
    font-size: 0.9rem;
  }
}

@media (max-height: 500px) {
  .brand {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

:root {
  --app-ink: var(--text);
  --app-muted: var(--muted);
  /* Smooth orange sidebar: soft apricot gradient, dark warm text, white highlights for hover / active. */
  --app-sidebar: #c9682b; /* deep brand orange */
  --app-sidebar-edge: rgba(110, 45, 8, 0.3);
  --app-sidebar-line: rgba(255, 241, 228, 0.3);
  --app-sidebar-hover: #dc7836;
  --app-sidebar-hover-text: #ffe974; /* soft yellow on the brand orange */
  --app-sidebar-open: rgba(255, 255, 255, 0.1);
  --app-sidebar-active: rgba(255, 255, 255, 0.9);
  --app-sidebar-text: #fff1e4;      /* light cream (maroon is unreadable on this darker orange) */
  --app-sidebar-strong: #fff7ef;
  --app-sidebar-accent-text: #6b1d1d; /* maroon on the white active highlight */
  --app-sidebar-muted: rgba(255, 241, 228, 0.82);
  --app-canvas: var(--bg);
  --app-card: var(--surface);
  --app-line: var(--border);
  --app-orange: var(--brand);
  --app-orange-soft: var(--brand-soft);
  --app-shadow: var(--shadow);
}

body.admin-page {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--app-ink);
  background: var(--app-canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.admin-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  min-height: 0;
  flex-direction: column;
  padding: 22px 14px 16px;
  overflow-y: auto;
  color: var(--app-sidebar-strong);
  background: var(--app-sidebar);
  border-right: 1px solid var(--app-sidebar-edge);
  scrollbar-color: rgba(255, 241, 228, 0.4) transparent;
  scrollbar-width: thin;
}

.sidebar-brand {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  color: var(--app-sidebar-strong);
  text-decoration: none;
}

.sidebar-brand .brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: var(--brand-hover);
  background: var(--login-white);
}

.sidebar-brand .brand-name {
  font-size: 1.08rem;
}

.sidebar-navigation {
  display: grid;
  align-content: start;
  gap: 5px;
  margin-top: 32px;
}

.sidebar-link,
.sidebar-group > summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--app-sidebar-text);
  font-size: 0.87rem;
  font-weight: 570;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease;
}

.sidebar-link:hover,
.sidebar-group > summary:hover {
  color: var(--app-sidebar-hover-text);
  background: var(--app-sidebar-hover);
}

.sidebar-link.is-active,
.sidebar-sublink.is-active {
  color: var(--app-sidebar-accent-text);
  background: var(--app-sidebar-active);
  box-shadow: inset 3px 0 0 var(--brand);
  font-weight: 650;
}

.sidebar-group[open] > summary {
  color: var(--app-sidebar-strong);
  background: var(--app-sidebar-open);
}

.sidebar-link svg,
.sidebar-group > summary svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.sidebar-group {
  min-width: 0;
}

.sidebar-group > summary {
  cursor: pointer;
  list-style: none;
}

.sidebar-group > summary::-webkit-details-marker {
  display: none;
}

.sidebar-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 140ms ease;
}

.sidebar-group[open] > summary .sidebar-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.sidebar-submenu {
  display: grid;
  gap: 2px;
  margin: 3px 0 5px 21px;
  padding-left: 12px;
  border-left: 1px solid var(--app-sidebar-line);
}

.sidebar-sublink {
  display: flex;
  min-height: 35px;
  align-items: center;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--app-sidebar-text);
  font-size: 0.81rem;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease;
}

.sidebar-sublink:hover {
  color: var(--app-sidebar-hover-text);
  background: var(--app-sidebar-hover);
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 16px 7px 2px;
  border-top: 1px solid var(--app-sidebar-line);
}

.account-avatar,
.dashboard-welcome-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--login-white);
  background: var(--app-orange);
  font-size: 0.9rem;
  font-weight: 750;
}


.sidebar-account .account-avatar {
  color: var(--brand-hover);
  background: var(--login-white);
}

.account-details {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-details span {
  color: var(--app-sidebar-muted);
  font-size: 0.68rem;
}

.account-details strong {
  overflow: hidden;
  color: var(--app-sidebar-strong);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account form {
  margin-left: auto;
}

.signout-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--app-sidebar-muted);
  background: transparent;
  cursor: pointer;
}

.signout-button:hover {
  color: var(--app-sidebar-hover-text);
  background: var(--app-sidebar-hover);
}

.signout-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.admin-main {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(20px, 3.2vw, 48px);
  border-bottom: 1px solid var(--app-line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  color: var(--app-ink);
  background: var(--app-card);
  cursor: pointer;
}

.sidebar-toggle svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.topbar-title {
  display: grid;
  gap: 4px;
}

.topbar-title h1 {
  margin: 0;
  color: var(--app-ink);
  font-size: 1.18rem;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.topbar-notification {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--app-line);
  border-radius: 11px;
  background: var(--input);
}

.notification-indicator {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.topbar-notification div {
  display: grid;
  gap: 2px;
}

.topbar-notification strong {
  color: var(--app-ink);
  font-size: 0.75rem;
  font-weight: 700;
}

.topbar-notification div span {
  color: var(--app-muted);
  font-size: 0.68rem;
}

.topbar-notification > svg {
  width: 18px;
  margin-left: 3px;
  fill: none;
  stroke: var(--app-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.admin-content {
  width: 100%;
  max-width: 1600px;
  flex: 1 0 auto;
  align-self: center;
  padding: 32px clamp(20px, 3.2vw, 48px);
}

.admin-content.category-list-content {
  max-width: none;
  align-self: stretch;
  padding: 10px 12px;
}

.admin-footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(20px, 3.2vw, 48px);
  border-top: 1px solid var(--app-line);
  color: var(--app-muted);
  background: var(--app-card);
  font-size: 0.73rem;
}

.dashboard-page {
  display: grid;
  gap: 30px;
}

.dashboard-welcome {
  display: flex;
  min-height: 190px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--brand-soft);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 18%, var(--brand-ring), transparent 25%),
    linear-gradient(120deg, var(--input), var(--brand-soft));
}

.dashboard-eyebrow {
  display: inline-block;
  margin-bottom: 9px;
  color: var(--login-link);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.dashboard-welcome h2,
.dashboard-section-heading h2,
.module-intro h2 {
  margin: 0;
  color: var(--app-ink);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 720;
  letter-spacing: -0.045em;
}

.dashboard-welcome p,
.module-intro p {
  margin: 10px 0 0;
  color: var(--app-muted);
  font-size: 0.94rem;
}

.dashboard-welcome-mark {
  width: 66px;
  height: 66px;
  margin-right: 2%;
  border-radius: 20px;
  color: var(--login-mark);
  background: var(--login-mark-bg);
  font-size: 1.5rem;
}

.dashboard-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.dashboard-section-heading h2 {
  font-size: 1.22rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-card {
  display: grid;
  min-height: 180px;
  align-content: start;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  color: var(--app-ink);
  background: var(--app-card);
  box-shadow: var(--app-shadow);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.dashboard-card:hover {
  border-color: rgba(220, 120, 54, 0.35);
  color: var(--app-ink);
  box-shadow: 0 16px 34px rgba(48, 34, 24, 0.1);
  transform: translateY(-2px);
}

.dashboard-card-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--login-link);
  background: var(--app-orange-soft);
  font-size: 0.68rem;
  font-weight: 750;
}

.dashboard-card-title {
  font-size: 0.97rem;
  font-weight: 720;
}

.dashboard-card-description {
  color: var(--app-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.module-page {
  display: grid;
  gap: 24px;
}

.module-intro {
  padding: 4px 0 10px;
}

.module-placeholder {
  display: grid;
  min-height: 280px;
  align-content: center;
  justify-items: center;
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.module-placeholder-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 15px;
  color: var(--login-link);
  background: var(--app-orange-soft);
  font-size: 1.35rem;
}

.module-placeholder h3 {
  margin: 0;
  color: var(--app-ink);
  font-size: 1rem;
  font-weight: 700;
}

.module-placeholder p {
  max-width: 440px;
  margin: 8px 0 0;
  color: var(--app-muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.category-page {
  display: grid;
  gap: 10px;
}

.category-page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.category-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-add-button,
.category-cancel-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #fff;
  background: var(--login-hero);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}

.category-add-button:hover {
  color: #fff;
  background: var(--login-accent-hover);
  transform: translateY(-1px);
}

.category-add-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.category-cancel-button {
  border-color: var(--app-line);
  color: var(--app-ink);
  background: #fff;
}

.category-cancel-button:hover {
  color: var(--app-ink);
  background: var(--surface-soft);
}

.category-notice {
  padding: 10px 14px;
  border: 1px solid rgba(86, 128, 100, 0.3);
  border-radius: 9px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 0.86rem;
}

.category-page-heading h2 {
  margin: 0;
  color: var(--app-ink);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 720;
  letter-spacing: -0.045em;
}

.category-page-heading p {
  margin: 4px 0 0;
  color: var(--app-muted);
  font-size: 0.9rem;
}

.print-button,
.category-search-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--login-white);
  background: var(--login-hero);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}

.print-button:hover,
.category-search-button:hover {
  color: var(--login-white);
  background: var(--login-accent-hover);
  transform: translateY(-1px);
}

.print-button:focus-visible,
.category-search-button:focus-visible,
.category-search-input:focus-within {
  outline: 3px solid var(--login-input-focus-ring);
  outline-offset: 2px;
}

.print-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.category-list-card {
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: var(--app-card);
  box-shadow: var(--app-shadow);
}

.category-toolbar {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--app-line);
}

.category-toolbar label {
  color: var(--app-ink);
  font-size: 0.8rem;
  font-weight: 700;
}

.category-search-row {
  display: flex;
  max-width: 760px;
  gap: 8px;
}

.category-search-input {
  display: flex;
  min-width: 0;
  min-height: 40px;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input);
}

.category-search-input:focus-within {
  border-color: var(--login-input-focus);
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

.category-search-input svg {
  width: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--app-muted);
  stroke-linecap: round;
  stroke-width: 1.7;
}

.category-search-input input {
  width: 100%;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: 0;
  color: var(--app-ink);
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
}

.category-search-input input::placeholder {
  color: var(--subtle);
}

.category-search-button {
  min-width: 88px;
}

.product-search-form {
  gap: 12px;
}

.product-search-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

.product-search-field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
}

.product-search-field label {
  color: var(--app-ink);
  font-size: 0.76rem;
  font-weight: 700;
}

.product-search-field input,
.product-search-field select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--app-ink);
  background: var(--input);
  font: inherit;
  font-size: 0.82rem;
}

.product-combobox {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

.product-combobox.has-clear {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.product-combobox [data-combobox-input] {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  color: var(--app-ink);
  background: var(--input);
  font: inherit;
  font-size: 0.84rem;
}

.product-search-field .product-combobox [data-combobox-input] {
  min-height: 38px;
  padding: 7px 9px;
  font-size: 0.82rem;
}

.product-combobox [data-combobox-input]:focus {
  position: relative;
  z-index: 1;
  border-color: var(--login-input-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

.product-combobox-toggle,
.product-combobox-clear {
  display: inline-flex;
  min-width: 38px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--app-ink);
  background: var(--input);
  cursor: pointer;
}

.product-search-field .product-combobox-toggle,
.product-search-field .product-combobox-clear {
  min-height: 38px;
}

.product-combobox-toggle {
  grid-column: 2;
  border-radius: 0 8px 8px 0;
}

.product-combobox.has-clear .product-combobox-toggle {
  border-radius: 0;
}

.product-combobox-toggle span {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.product-combobox-clear {
  grid-column: 3;
  min-width: 48px;
  margin-left: 5px;
  border-radius: 7px;
  color: var(--login-link);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.product-combobox-toggle:hover,
.product-combobox-clear:hover {
  border-color: var(--login-border-hover);
  background: var(--surface-soft);
}

.product-combobox-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--app-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--app-shadow);
  list-style: none;
}

.product-combobox-list[hidden],
.product-combobox-list [hidden] {
  display: none;
}

.product-combobox-list li {
  padding: 8px 9px;
  border-radius: 5px;
  color: var(--app-ink);
  font-size: 0.84rem;
  cursor: pointer;
}

.product-search-field .product-combobox-list li {
  font-size: 0.8rem;
}

.product-combobox-list li:hover,
.product-combobox-list li.is-highlighted {
  color: var(--text);
  background: var(--brand-soft);
}

.product-combobox-list li.product-combobox-empty {
  color: var(--app-muted);
  cursor: default;
}

.product-search-field input:focus,
.product-search-field select:focus {
  border-color: var(--login-input-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

.product-search-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.product-search-actions .category-cancel-button {
  min-height: 42px;
}

/* Filters and the Search / Clear buttons on one row, buttons on the right (Member Register, Supplier List). */
.search-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}

.search-inline-form .product-search-grid {
  flex: 1 1 420px;
  grid-template-columns: repeat(2, minmax(160px, 300px));
}

.search-inline-form .product-search-actions {
  margin-left: auto;
  flex-wrap: nowrap;
}

.search-inline-form .product-search-actions .category-search-button,
.search-inline-form .product-search-actions .category-cancel-button {
  min-height: 38px;
}

@media (max-width: 600px) {
  .search-inline-form .product-search-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.product-table {
  min-width: 1040px;
}

.product-active-badge {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.product-active-badge.is-active {
  color: var(--success);
  background: var(--success-soft);
}

.product-active-badge.is-inactive {
  color: var(--muted);
  background: var(--bg);
}

.product-active-badge.is-blocked {
  color: #8a4b00;
  background: #fff1d6;
}

.category-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
}

.category-results-heading > div {
  display: flex;
  align-items: baseline;
  gap: 11px;
}

.category-results-heading h3 {
  margin: 0;
  color: var(--app-ink);
  font-size: 0.95rem;
  font-weight: 720;
}

.category-results-heading span {
  color: var(--app-muted);
  font-size: 0.76rem;
}

.category-table-wrap {
  overflow-x: auto;
  padding: 0 10px 8px;
}

.category-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.category-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--app-line);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--bg);
  color: var(--app-ink);
  font-size: 0.86rem;
}

.category-table tbody tr:last-child td {
  border-bottom: 0;
}

.category-table tbody tr:hover {
  background: var(--surface-soft);
}

.category-table td:first-child {
  width: 72px;
  color: var(--app-muted);
  font-variant-numeric: tabular-nums;
}

.category-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-actions-cell form {
  display: contents;
}

.category-icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--brand-hover);
  border-radius: 7px;
  color: #fff;
  background: var(--brand-hover);
  text-decoration: none;
  cursor: pointer;
}

.category-icon-button:hover {
  border-color: var(--brand-hover);
  color: #fff;
  background: var(--brand-hover);
}

.category-icon-button:focus-visible {
  outline: 3px solid var(--login-input-focus-ring);
  outline-offset: 2px;
}

.category-icon-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.category-form-card {
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: var(--app-card);
  box-shadow: var(--app-shadow);
}

.category-form-card-heading {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--app-line);
}

.category-form-card-heading h3 {
  margin: 0;
  color: var(--app-ink);
  font-size: 0.98rem;
  font-weight: 720;
}

.category-form-card-heading span {
  color: var(--app-muted);
  font-size: 0.78rem;
}

.category-form {
  display: grid;
  gap: 18px;
  max-width: 620px;
  padding: 20px 18px;
}

.category-form-field {
  display: grid;
  gap: 7px;
}

.category-form-field label {
  color: var(--brand-hover);
  font-size: 0.84rem;
  font-weight: 700;
}

.category-form-field label span {
  color: var(--danger);
}

.category-form-field input,
.category-form-field select,
.product-addon-fields input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--app-ink);
  background: var(--input);
  font: inherit;
  font-size: 0.88rem;
}

.category-form-field input:focus,
.category-form-field select:focus {
  border-color: var(--login-input-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

.category-field-error,
.category-validation-summary {
  color: var(--danger);
  font-size: 0.8rem;
}

.category-validation-summary:empty,
.category-validation-summary.validation-summary-valid {
  display: none;
}

.category-notice.is-error {
  border-color: rgba(189, 91, 83, 0.3);
  color: var(--danger);
  background: var(--danger-soft);
}

.category-validation-summary ul {
  margin: 0;
  padding-left: 20px;
}

.category-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.product-form {
  max-width: none;
  gap: 14px;
}

.product-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

.product-form-column {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 12px;
}

.product-form .category-form-field {
  grid-template-columns: minmax(105px, 130px) minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
}

.product-form .category-form-field > label {
  grid-column: 1;
  margin: 0;
}

.product-form .category-form-field > input,
.product-form .category-form-field > select,
.product-form .category-form-field > .product-combobox,
.product-form .category-form-field > .product-addon-fields {
  grid-column: 2;
}

.product-addon-fields {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
}

.product-addon-fields > div {
  min-width: 0;
}

.product-code-lookup-status {
  display: block;
  min-height: 1em;
  margin-top: 3px;
  color: var(--app-muted);
  font-size: 0.7rem;
}

.product-form .category-form-field > span {
  grid-column: 2;
}

.product-form .product-combobox [data-combobox-input],
.product-form .product-combobox-toggle,
.product-form .product-combobox-clear {
  min-height: 42px;
}

.product-form-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid var(--app-line);
}

.product-active-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-active-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand-hover);
}

.product-active-field label {
  margin: 0;
  color: var(--app-ink);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ---------- Tighter two-column entry form (product, member) so it fits on one screen ---------- */
.category-form-card-heading.is-compact {
  padding: 10px 16px;
}

.product-form {
  gap: 8px;
  padding: 12px 16px;
}

.product-form-grid {
  gap: 0 24px;
}

.product-form-column {
  gap: 0;
}

.product-form .category-form-field {
  gap: 0 12px;
}

.product-form .category-form-field > input,
.product-form .category-form-field > select,
.product-form .product-addon-fields input,
.product-form .product-combobox [data-combobox-input],
.product-form .product-combobox-toggle,
.product-form .product-combobox-clear {
  min-height: 36px;
}

.product-form .category-form-field > input,
.product-form .category-form-field > select,
.product-form .product-addon-fields input,
.product-form .product-combobox [data-combobox-input] {
  padding: 6px 10px;
}

/*
   Every field keeps one line reserved for its message under the input, so a "required" message appears in
   space that is already there instead of pushing the form down. The line stays invisible until there is a
   message to show.
*/
.product-form .category-form-field > .category-field-error {
  display: block;
  min-height: 16px;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-form .category-form-field > .category-field-error.field-validation-valid,
.product-form .category-form-field > .category-field-error:empty {
  visibility: hidden;
}

/* The add-on code lookup status floats over the field's reserved message line instead of adding height. */
.product-form .product-addon-fields > div {
  position: relative;
}

.product-form .product-code-lookup-status {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
  font-size: 0.68rem;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-form .product-form-flags {
  padding-top: 8px;
}

.product-form .category-form-actions {
  padding-top: 0;
}

.category-empty-state {
  display: grid;
  min-height: 100px;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 14px;
  color: var(--app-muted);
  text-align: center;
}

.category-empty-state strong {
  color: var(--app-ink);
  font-size: 0.9rem;
}

.category-empty-state span {
  max-width: 420px;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---------- Secondary header buttons (Import, Back) ---------- */
.category-cancel-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

/* ---------- Product import ---------- */
.import-form {
  max-width: 760px;
}

.import-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--app-ink);
  font-size: 0.86rem;
  line-height: 1.5;
}

.import-steps a {
  color: var(--brand-hover);
  font-weight: 700;
}

.import-form input[type="file"] {
  padding: 8px;
  cursor: pointer;
}

/* ---------- Employee ---------- */
.employee-form {
  display: grid;
  gap: 12px;
}

.employee-form-section .employee-form-grid,
.employee-basic-layout {
  padding: 16px 18px 18px;
}

.employee-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  align-items: start;
}

.employee-basic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 18px 24px;
  align-items: start;
}

.employee-basic-layout .employee-form-grid {
  padding: 0;
}

.employee-form .category-form-field {
  gap: 5px;
  min-width: 0;
}

.employee-form .category-form-field label {
  font-size: 0.8rem;
}

.employee-field-wide {
  grid-column: span 2;
}

.employee-field-full {
  grid-column: 1 / -1;
}

.employee-form input:disabled {
  color: var(--app-muted);
  background: var(--bg);
  cursor: not-allowed;
}

/* ---------- Child-row grids (dependents, contact persons) ---------- */
.repeater-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.repeater-heading > div {
  display: grid;
  gap: 4px;
}

.repeater-heading .category-cancel-button {
  min-height: 38px;
}

.repeater-heading .category-cancel-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.repeater-error {
  display: block;
  padding: 8px 18px 0;
}

.repeater-table {
  min-width: 560px;
  margin-top: 6px;
}

.repeater-table td {
  vertical-align: top;
}

.repeater-table td:first-child {
  width: 40px;
  padding-top: 14px;
}

.repeater-table td:last-child {
  width: 46px;
}

.repeater-table input,
.repeater-table select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--app-ink);
  background: var(--input);
  font: inherit;
  font-size: 0.84rem;
}

.repeater-table input:focus,
.repeater-table select:focus {
  border-color: var(--login-input-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

.repeater-table .category-field-error {
  display: block;
  margin-top: 3px;
}

.repeater-table .category-icon-button {
  margin-top: 4px;
}

.repeater-empty {
  margin: 4px 8px 12px;
  color: var(--app-muted);
  font-size: 0.82rem;
}

.employee-checkbox-field {
  align-self: end;
  min-height: 42px;
  align-content: center;
}

.employee-uppercase {
  text-transform: uppercase;
}

.employee-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 10px 0;
  background: linear-gradient(to top, var(--app-canvas) 70%, transparent);
}

.employee-photo {
  display: grid;
  gap: 8px;
  justify-items: stretch;
}

.employee-photo-label {
  color: var(--brand-hover);
  font-size: 0.8rem;
  font-weight: 700;
}

.employee-photo-preview {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--app-muted);
  background: var(--input);
  font-size: 0.8rem;
}

.employee-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-camera {
  position: absolute;
  inset: 0;
  background: var(--text);
}

.employee-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-photo-preview [hidden],
.employee-photo [hidden] {
  display: none !important;
}

.employee-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.employee-photo-button {
  min-height: 36px;
  flex: 1 1 auto;
  padding: 0 10px;
  font-size: 0.76rem;
}

.employee-photo-button:focus-within {
  outline: 3px solid var(--login-input-focus-ring);
  outline-offset: 2px;
}

.employee-photo-status {
  color: var(--app-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.employee-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.employee-name-cell img,
.employee-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.employee-avatar {
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ---------- Step tabs on a form (member: Member Details / Membership Details) ---------- */
.member-form-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
}

.member-form-tabs > span {
  color: var(--app-muted);
  font-size: 0.78rem;
}

.cf-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg);
}

.cf-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  color: var(--app-muted);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.cf-tab[aria-selected="true"] {
  color: #fff;
  background: var(--login-hero);
}

.cf-tab.has-error:not([aria-selected="true"]) {
  color: var(--danger);
}

.cf-tab:focus-visible {
  outline: 3px solid var(--login-input-focus-ring);
  outline-offset: 1px;
}

.cf-step {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.7rem;
}

.cf-tab[aria-selected="true"] .cf-step {
  background: rgba(255, 255, 255, 0.25);
}

.cf-panel {
  display: grid;
  gap: 14px;
}

.cf-panel[hidden],
.category-form-actions [hidden] {
  display: none;
}

/* Photo sits in the right-hand column like any other field. */
/* ---------- Member form: two columns, each row may be split in two ---------- */
.member-form .category-form-field {
  grid-template-columns: 96px minmax(0, 1fr);
}

.member-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  min-width: 0;
}

.member-pair > .category-form-field {
  min-width: 0;
}

/* Residence address: five lines, scrolls instead of resizing. */
.member-textarea-field > label {
  align-self: start;
  padding-top: 8px;
}

.product-form .member-textarea-field > textarea {
  grid-column: 2;
  width: 100%;
  height: calc(5 * 1.4em + 14px);
  padding: 6px 10px;
  overflow-y: auto;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--app-ink);
  background: var(--input);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
}

.product-form .member-textarea-field > textarea:focus {
  border-color: var(--login-input-focus);
  outline: 0;
  box-shadow: 0 0 0 3px var(--login-input-focus-ring);
}

/* Opening balance with a small Dr / Cr drop-down beside it. */
.product-form .category-form-field > .member-amount-type {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 6px;
  min-width: 0;
}

.member-amount-type input,
.member-amount-type select {
  min-height: 36px;
  padding: 6px 8px;
}

.member-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.member-photo-field {
  min-width: 0;
}

.member-photo-field .employee-photo-preview {
  aspect-ratio: 1 / 1;
  max-width: 140px;
}

.member-photo-field .employee-photo-button {
  min-height: 32px;
}

.member-dependents {
  display: grid;
  gap: 4px;
}

.member-dependents h3 {
  margin: 0;
  color: var(--brand-hover);
  font-size: 0.88rem;
}

.member-dependents .repeater-error {
  padding: 0;
}

.member-dependents .category-table-wrap {
  padding: 0;
}

.member-dependents .repeater-table {
  min-width: 0;
}

/* Compact member form: tighter spacing and squarer corners. */
.category-form-card:has(> .member-form) {
  border-radius: 4px;
}

.member-form .cf-tab {
  min-height: 30px;
  padding: 0 10px;
}

.member-form.product-form {
  gap: 6px;
  padding: 8px 10px;
}

.member-form .product-form-grid {
  gap: 0 14px;
}

.member-form .member-pair {
  gap: 0 10px;
}

.member-form .category-form-field {
  gap: 0 8px;
}

.member-form .category-form-field > input,
.member-form .category-form-field > select,
.member-form .member-amount-type input,
.member-form .member-amount-type select,
.member-form .product-combobox [data-combobox-input],
.member-form .product-combobox-toggle,
.member-form .product-combobox-clear {
  min-height: 30px;
}

.member-form .category-form-field input,
.member-form .category-form-field select,
.member-form .category-form-field textarea,
.member-form .product-combobox [data-combobox-input],
.member-form .repeater-table input {
  padding: 4px 7px;
  border-radius: 3px;
}

.member-form .repeater-table input {
  min-height: 30px;
}

.member-form .repeater-table td {
  padding: 3px 4px;
}

.member-form .repeater-table td:first-child {
  padding-top: 9px;
}

/*
   Error lines take space only when there is a message, except on required fields (.member-required-field),
   which always keep a small invisible line so their "required" message never moves the form.
*/
.member-form .category-form-field > .category-field-error {
  display: block;
  min-height: 0;
  overflow: hidden;
  font-size: 0.66rem;
  line-height: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.member-form .category-form-field > .category-field-error.field-validation-valid,
.member-form .category-form-field > .category-field-error:empty,
.member-form .member-amount-type + .category-field-error:not(:has(.field-validation-error)) {
  display: none;
}

.member-form .member-required-field > .category-field-error,
.member-form .member-required-field > .category-field-error.field-validation-valid,
.member-form .member-required-field > .category-field-error:empty {
  display: block;
  height: 12px;
  min-height: 12px;
}

.member-form .member-required-field > .category-field-error.field-validation-valid,
.member-form .member-required-field > .category-field-error:empty {
  visibility: hidden;
}

.member-form .product-form-column {
  gap: 4px;
}

.member-form .product-form-grid {
  gap: 0 10px;
}

.member-form .member-pair {
  gap: 4px 8px;
}

.member-form .member-photos {
  gap: 10px;
  margin-bottom: 6px;
}

.member-form .employee-photo {
  gap: 5px;
}

.member-form .employee-photo-preview {
  border-radius: 3px;
}

.member-form .category-cancel-button,
.member-form .category-add-button,
.member-form .category-icon-button,
.member-form .cf-tab {
  border-radius: 4px;
}

.member-form .employee-photo-button,
.member-form .repeater-heading .category-cancel-button {
  min-height: 28px;
  padding: 3px 8px;
}

.member-form .product-form-flags {
  gap: 14px;
  padding-top: 6px;
}

.member-flag-row {
  display: flex;
  min-height: 30px;
  align-items: center;
  margin-bottom: 4px;
}

/* Four inputs per contact row: keep them readable and let the table scroll sideways if needed. */
.supplier-contacts .repeater-table {
  min-width: 520px;
}

.member-form .supplier-contacts .category-table-wrap {
  overflow-x: auto;
}

/* Cancel / Back / Next / Save sit in the empty half of a row (beside Occupation, beside Opening Bal.). */
.member-actions-slot {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: flex-end;
}

.member-actions-slot > .member-form-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.member-actions-slot .category-cancel-button,
.member-actions-slot .category-add-button {
  min-height: 30px;
  padding: 4px 12px;
}

@media (max-width: 1100px) {
  .member-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .cf-tabs {
    width: 100%;
  }

  .cf-tab {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 6px;
  }
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .employee-basic-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-photo {
    max-width: 260px;
  }
}

@media (max-width: 600px) {
  .employee-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-field-wide,
  .employee-field-full {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .admin-shell.sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    border: 0;
    background: rgba(31, 25, 21, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .admin-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: grid;
  }

  .admin-main {
    grid-column: 1;
  }
}

@media (max-width: 600px) {
  .admin-topbar {
    min-height: 70px;
    gap: 12px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .topbar-title h1 {
    font-size: 1.02rem;
  }

  .topbar-notification {
    min-height: 38px;
    gap: 8px;
    padding: 6px 9px;
  }

  .topbar-notification div {
    display: none;
  }

  .topbar-notification > svg {
    margin: 0;
  }

  .admin-content {
    padding: 22px 16px;
  }

  .dashboard-welcome {
    min-height: 160px;
    padding: 22px;
  }

  .dashboard-welcome-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .dashboard-card {
    min-height: 145px;
  }

  .category-page-heading {
    align-items: start;
  }

  .product-search-grid,
  .product-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-addon-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-form .category-form-field {
    grid-template-columns: minmax(100px, 115px) minmax(0, 1fr);
  }

  .category-heading-actions {
    justify-content: flex-end;
  }

  @media (min-width: 601px) and (max-width: 1000px) {
    .product-search-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .category-page-heading p {
    max-width: 280px;
    line-height: 1.5;
  }

  .category-heading-actions .print-button,
  .category-heading-actions .category-add-button {
    min-height: 40px;
    padding: 0 11px;
  }

  .category-toolbar {
    padding: 10px 12px;
  }

  .category-search-row {
    flex-wrap: wrap;
  }

  .category-search-button {
    min-width: 88px;
  }

  .category-results-heading {
    padding-right: 12px;
    padding-left: 12px;
  }

  .category-table-wrap {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (max-width: 700px) {
  .admin-content.category-list-content {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-toggle,
  .admin-sidebar,
  .sidebar-backdrop,
  .dashboard-card,
  .sidebar-chevron {
    transition-duration: 0.01ms;
  }
}

@media print {
  @page {
    margin: 14mm;
  }

  body.admin-page {
    min-width: 0;
    background: #fff;
  }

  .admin-sidebar,
  .admin-topbar,
  .admin-footer,
  .category-page-heading .print-button,
  .category-toolbar,
  .sidebar-backdrop {
    display: none !important;
  }

  .admin-shell {
    display: block;
    min-height: 0;
  }

  .admin-main {
    min-height: 0;
  }

  .admin-content {
    max-width: none;
    padding: 0;
  }

  .category-list-card {
    border: 0;
    box-shadow: none;
  }

  .category-table-wrap {
    overflow: visible;
    padding: 0;
  }
}