/* ATS Premium UI — Green / Yellow Enterprise SaaS */
:root {
  --ats-font-sans:
    "Inter", "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;

  --ats-primary: var(--ats-theme-primary, #74b48b);
  --ats-secondary: var(--ats-theme-secondary, #132efb);
  --ats-accent: var(--ats-theme-accent, #22c55e);
  --ats-bg: var(--ats-theme-bg, #f7faf7);
  --ats-text: var(--ats-theme-text, #0f172a);
  --ats-gradient: var(
    --ats-theme-gradient,
    linear-gradient(135deg, #22c55e, #fde047)
  );

  --ats-primary-2: var(--ats-theme-primary-2, var(--ats-accent));
  --ats-primary-dark: var(--ats-theme-primary-dark, #106c31);
  --ats-primary-soft: var(--ats-theme-primary-soft, #ecfdf3);

  --ats-accent-2: var(--ats-theme-accent-2, var(--ats-secondary));
  --ats-accent-dark: var(--ats-theme-accent-dark, #ca8a04);
  --ats-accent-soft: var(--ats-theme-accent-soft, #fffbeb);

  --ats-bg-2: var(--ats-theme-bg-2, #fbfdf9);
  --ats-surface: var(--ats-theme-surface, #ffffff);
  --ats-surface-2: var(--ats-theme-surface-2, #fcfffc);
  --ats-muted: var(--ats-theme-muted, #64748b);
  --ats-line: var(--ats-theme-line, rgba(15, 23, 42, 0.08));

  --ats-success: var(--ats-theme-success, #16a34a);
  --ats-warning: var(--ats-theme-warning, #eab308);
  --ats-danger: var(--ats-theme-danger, #ef4444);
  --ats-info: var(--ats-theme-info, #0ea5e9);

  --ats-sidebar: var(--ats-theme-sidebar, #0f5d2f);
  --ats-theme-sidebar_2: var(--ats-theme-sidebar-2, #16773d);
  --ats-sidebar-text: var(--ats-theme-sidebar-text, #f0fdf4);
  --ats-sidebar-muted: var(
    --ats-theme-sidebar-muted,
    rgba(240, 253, 244, 0.78)
  );

  --ats-admin-font-size-base: var(--ats-theme-admin_font_size_base, 15px);
  --ats-admin-heading-scale: var(--ats-theme-admin_heading_scale, 1.18);
  --ats-admin-small-scale: var(--ats-theme-admin_small_scale, 0.88);

  --ats-user-font-size-base: var(--ats-theme-user_font_size_base, 16px);
  --ats-user-heading-scale: var(--ats-theme-user_heading_scale, 1.22);
  --ats-user-small-scale: var(--ats-theme-user_small_scale, 0.92);

  --ats-radius-2xl: 30px;
  --ats-radius-xl: 24px;
  --ats-radius-lg: 20px;
  --ats-radius-md: 16px;
  --ats-radius-sm: 12px;

  --ats-shadow-sm: 0 10px 28px rgba(15, 23, 42, 0.05);
  --ats-shadow-md: 0 20px 50px rgba(15, 23, 42, 0.08);
  --ats-shadow-lg: 0 32px 90px rgba(22, 155, 69, 0.16);

  --sidebar-w: 308px;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--ats-font-sans);
  font-size: var(--ats-user-font-size-base);
  line-height: 1.5;
  color: var(--ats-text);
  background:
    radial-gradient(
      circle at top right,
      rgba(250, 204, 21, 0.1),
      transparent 26%
    ),
    radial-gradient(
      circle at top left,
      rgba(34, 197, 94, 0.09),
      transparent 28%
    ),
    linear-gradient(180deg, #f7fbf4 0%, #f5f8f2 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a {
  text-decoration: none;
  color: inherit;
}
img {
  max-width: 100%;
  display: block;
}
button,
input,
select,
textarea {
  font: inherit;
}

/* Typography system */
.admin-layout,
.admin-layout .main-panel,
.admin-layout .page-card,
.admin-layout .table,
.admin-layout .table th,
.admin-layout .table td,
.admin-layout .input,
.admin-layout .textarea,
.admin-layout select,
.admin-layout .btn,
.admin-layout .badge,
.admin-layout .alert,
.admin-layout .sidebar-item,
.admin-layout .nav-section-title {
  font-size: var(--ats-admin-font-size-base);
}

.admin-layout small,
.admin-layout .text-muted,
.admin-layout .panel-sub,
.admin-layout .page-subtitle,
.admin-layout .meta-box div,
.admin-layout .help-text {
  font-size: calc(var(--ats-admin-font-size-base) * var(--ats-admin-small-scale));
}

.admin-layout h1,
.admin-layout .page-title,
.admin-layout .panel-title {
  font-size: calc(var(--ats-admin-font-size-base) * 2 * var(--ats-admin-heading-scale));
  line-height: 1.08;
}

.admin-layout h2 {
  font-size: calc(var(--ats-admin-font-size-base) * 1.45 * var(--ats-admin-heading-scale));
  line-height: 1.12;
}

.admin-layout h3 {
  font-size: calc(var(--ats-admin-font-size-base) * 1.2 * var(--ats-admin-heading-scale));
  line-height: 1.18;
}

.user-layout,
.public-layout,
.checkin-layout,
.user-layout .btn,
.public-layout .btn,
.checkin-layout .btn,
.user-layout .input,
.public-layout .input,
.checkin-layout .input,
.user-layout .textarea,
.public-layout .textarea,
.checkin-layout .textarea,
.user-layout .badge,
.public-layout .badge,
.checkin-layout .badge,
.user-layout .pill,
.public-layout .pill,
.checkin-layout .pill {
  font-size: var(--ats-user-font-size-base);
}

.user-layout small,
.public-layout small,
.checkin-layout small,
.user-layout .text-muted,
.public-layout .text-muted,
.checkin-layout .text-muted,
.user-layout .login-subtitle,
.public-layout .hero-copy,
.checkin-layout .ci-meta-value,
.checkin-layout .ci-meta-label {
  font-size: calc(var(--ats-user-font-size-base) * var(--ats-user-small-scale));
}

.user-layout h1,
.public-layout h1,
.checkin-layout h1,
.user-layout .login-title,
.public-layout .hero-title,
.checkin-layout .ci-hero-title {
  font-size: calc(var(--ats-user-font-size-base) * 2 * var(--ats-user-heading-scale));
  line-height: 1.08;
}

.user-layout h2,
.public-layout h2,
.checkin-layout h2 {
  font-size: calc(var(--ats-user-font-size-base) * 1.45 * var(--ats-user-heading-scale));
  line-height: 1.12;
}

.user-layout h3,
.public-layout h3,
.checkin-layout h3 {
  font-size: calc(var(--ats-user-font-size-base) * 1.2 * var(--ats-user-heading-scale));
  line-height: 1.18;
}

.container {
  width: min(100% - 32px, 1380px);
  margin-inline: auto;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
}
.topbar-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.brand,
.brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--ats-primary), var(--ats-primary-2));
  box-shadow: var(--ats-shadow-lg);
}
.brand-text strong,
.brand-title strong {
  display: block;
  font-size: 1.38rem;
  letter-spacing: -0.04em;
}
.brand-text span,
.brand-title span {
  display: block;
  color: var(--ats-muted);
  font-weight: 600;
}
.top-actions,
.hero-actions,
.form-actions,
.table-actions,
.actions,
.checks {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--ats-primary), var(--ats-primary-2));
  color: #fff;
  box-shadow: var(--ats-shadow-lg);
}
.btn-accent,
.btn-qr {
  background: linear-gradient(135deg, var(--ats-accent), var(--ats-accent-2));
  color: #1f2937;
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--ats-line);
  color: var(--ats-text);
}
.btn-soft,
.btn-member {
  background: var(--ats-primary-soft);
  color: var(--ats-primary-dark);
  border: 1px solid rgba(22, 155, 69, 0.12);
}
.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
}
.btn-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.18);
}
.btn-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.22);
}
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.92rem;
}

/* Generic premium surfaces */
.card,
.page-card,
.project-item,
.project-card,
.meta-box,
.meta,
.login-card {
  background: linear-gradient(180deg, var(--ats-surface), var(--ats-surface-2));
  border: 1px solid var(--ats-line);
  border-radius: var(--ats-radius-xl);
  box-shadow: var(--ats-shadow-sm);
}
.page-card,
.project-item,
.project-card,
.login-card {
  padding: 24px;
}
.page-card + .page-card,
.project-item + .project-item {
  margin-top: 18px;
}
.section-head h2,
.hero-title,
h1,
h2,
h3 {
  letter-spacing: -0.04em;
}

.meta-grid,
.project-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.meta,
.meta-box {
  padding: 14px 16px;
  border-radius: 18px;
  background: #fafcf8;
  border: 1px solid rgba(22, 155, 69, 0.08);
}

.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  font-weight: 700;
}
.alert.success {
  background: #ecfdf5;
  color: #15803d;
}
.alert.error {
  background: #fef2f2;
  color: #b91c1c;
}

.badge,
.switch-chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
}
.badge {
  background: #eef2ff;
  color: #4338ca;
}
.switch-chip {
  background: #ecfdf5;
  color: #15803d;
}
.badge-success {
  background: #ecfdf5;
  color: #15803d;
}
.badge-warning {
  background: #fef9c3;
  color: #a16207;
}
.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
}
.badge-soft {
  background: #eef2ff;
  color: #4338ca;
}
.pill {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--ats-line);
  text-align: left;
  vertical-align: top;
}
.table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--ats-muted);
  letter-spacing: 0.05em;
}
.table tbody tr:hover {
  background: rgba(22, 155, 69, 0.02);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border-radius: 16px;
  border: 1px solid #dbe4e0;
  background: #fff;
  color: var(--ats-text);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(22, 155, 69, 0.35);
  box-shadow: 0 0 0 4px rgba(22, 155, 69, 0.1);
}
.textarea {
  padding: 14px 15px;
  min-height: 120px;
  resize: vertical;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-grid label,
.form-stack label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

/* Hero / landing */
.hero {
  padding: 42px 0 56px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 24px;
  align-items: center;
}
.hero-card {
  padding: 36px;
  border-radius: var(--ats-radius-2xl);
  min-height: 620px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 80% 18%,
      rgba(255, 255, 255, 0.15),
      transparent 22%
    ),
    linear-gradient(135deg, rgba(8, 44, 22, 0.94), rgba(22, 155, 69, 0.88)),
    linear-gradient(135deg, var(--ats-primary), var(--ats-primary-2));
  box-shadow: var(--ats-shadow-lg);
}
.hero-card:before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 46px 46px;
}
.hero-card > * {
  position: relative;
  z-index: 1;
}
.hero-title {
  margin: 22px 0 16px;
  font-size: clamp(2.7rem, 5vw, 5.15rem);
  line-height: 0.95;
  font-weight: 900;
}
.hero-copy {
  max-width: 760px;
  font-size: 1.16rem;
  line-height: 1.72;
  color: rgba(255, 255, 255, 0.9);
}
.preview-shell {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 32px;
  padding: 22px;
  box-shadow: var(--ats-shadow-md);
}
.preview-app {
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, #0f5d2f, #169b45);
  padding: 16px;
  color: #fff;
}
.preview-top {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  opacity: 0.92;
}
.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
}
.dot.red {
  background: #fb7185;
}
.dot.yellow {
  background: #facc15;
}
.dot.green {
  background: #4ade80;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  border-radius: 20px;
  padding: 18px 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.kpi strong {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}
.kpi span {
  font-size: 0.95rem;
  opacity: 0.92;
}
.feed-item {
  background: #fff;
  color: var(--ats-text);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.feed-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar,
.user-badge,
.user-pic {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--ats-theme-primary),var(--ats-theme-primary_2));
}

/* Admin layout */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background:
    radial-gradient(
      circle at 85% 8%,
      rgba(250, 204, 21, 0.18),
      transparent 20%
    ),
    linear-gradient(180deg, var(--ats-sidebar), var(--ats-theme-sidebar_2));
  color: var(--ats-sidebar-text);
  padding: 22px 18px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}
.sidebar .brand-title span,
.sidebar .brand-text span {
  color: var(--ats-sidebar-muted) !important;
}
.sidebar-menu {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border-radius: 18px;
  font-weight: 800;
  color: var(--ats-sidebar-muted) !important;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
}
.sidebar-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 24px rgba(0, 0, 0, 0.1);
}
.main-panel {
  padding: 28px;
}
.top-panel,
.panel-top,
.toolbar,
.project-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Checkin / login */
.checkin-shell {
  min-height: 100vh;
  background: var(--ats-bg);
}
.checkin-header {
  color: #fff;
  padding: 26px 0;
  box-shadow: var(--ats-shadow-lg);
  background: linear-gradient(135deg, #106c31, #22c55e 55%, #fde047);
}
.checkin-grid {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 22px;
  margin-top: 24px;
}
.clock-card {
  overflow: hidden;
}
.clock-top {
  min-height: 300px;
  padding: 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #106c31, #22c55e 55%, #84cc16);
}
.clock-top {
  min-height: 300px;
  padding: 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.big-clock {
  font-size: clamp(4rem, 8vw, 7.6rem);
  line-height: 0.9;
  font-weight: 900;
  letter-spacing: -0.06em;
}
.clock-bottom {
  padding: 22px;
  text-align: center;
}
.ghost,
.ghost-circle {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  background: #f0fdf4;
  color: #169b45;
  font-size: 4rem;
  font-weight: 900;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at top right,
      rgba(250, 204, 21, 0.18),
      transparent 24%
    ),
    linear-gradient(180deg, #f0fdf4, #fffbeb);
}
.login-card {
  width: min(100%, 560px);
  padding: 30px;
  border-radius: 28px;
}

/* Utility */
.theme-preview-card {
  background: linear-gradient(135deg, var(--ats-primary), var(--ats-accent));
  color: #fff;
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--ats-shadow-md);
}
.theme-note {
  color: var(--ats-muted);
  font-size: 0.95rem;
}
.link-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--ats-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1180px) {
  .hero-grid,
  .kpi-grid,
  .checkin-grid,
  .project-meta,
  .meta-grid,
  .form-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

/* Theme JSON runtime integration */
body {
  background:
    radial-gradient(
      circle at top right,
      color-mix(in srgb, var(--ats-accent) 18%, transparent),
      transparent 26%
    ),
    radial-gradient(
      circle at top left,
      color-mix(in srgb, var(--ats-primary) 16%, transparent),
      transparent 28%
    ),
    linear-gradient(180deg, var(--ats-bg-2) 0%, var(--ats-bg) 100%);
}
.btn-ghost {
  background: var(--ats-surface);
}
.feed-item {
  background: var(--ats-surface);
}
.meta,
.meta-box {
  background: var(--ats-surface-2);
}
.theme-preview-card {
  background: var(--ats-gradient);
}

/* Theme runtime aliases for live preview + project override */
:root {
  --ats-primary_2: var(
    --ats-theme-primary_2,
    var(--ats-theme-primary-2, var(--ats-primary-2))
  );
  --ats-primary_dark: var(
    --ats-theme-primary_dark,
    var(--ats-theme-primary-dark, var(--ats-primary-dark))
  );
  --ats-primary_soft: var(
    --ats-theme-primary_soft,
    var(--ats-theme-primary-soft, var(--ats-primary-soft))
  );

  --ats-accent_2: var(
    --ats-theme-accent_2,
    var(--ats-theme-accent-2, var(--ats-accent-2))
  );
  --ats-accent_dark: var(
    --ats-theme-accent_dark,
    var(--ats-theme-accent-dark, var(--ats-accent-dark))
  );
  --ats-accent_soft: var(
    --ats-theme-accent_soft,
    var(--ats-theme-accent-soft, var(--ats-accent-soft))
  );

  --ats-bg_2: var(--ats-theme-bg_2, var(--ats-theme-bg-2, var(--ats-bg-2)));
  --ats-surface: var(--ats-theme-surface, var(--ats-surface));
  --ats-surface_2: var(
    --ats-theme-surface_2,
    var(--ats-theme-surface-2, var(--ats-surface-2))
  );
  --ats-sidebar_2: var(
    --ats-theme-sidebar_2,
    var(--ats-theme-sidebar-2, var(--ats-theme-sidebar_2))
  );
  --ats-sidebar_text: var(
    --ats-theme-sidebar_text,
    var(--ats-theme-sidebar-text, var(--ats-sidebar-text))
  );
  --ats-sidebar_muted: var(
    --ats-theme-sidebar_muted,
    var(--ats-theme-sidebar-muted, var(--ats-sidebar-muted))
  );
}

.page-title {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--ats-muted);
  line-height: 1.7;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-label {
  font-weight: 800;
  color: var(--ats-text);
}

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

.department-form .textarea {
  min-height: 120px;
}
.page-title {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--ats-muted);
  line-height: 1.7;
}

.department-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-card {
  background: linear-gradient(180deg, var(--ats-surface), var(--ats-surface-2));
  border: 1px solid var(--ats-line);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--ats-shadow-sm);
}

.summary-label {
  color: var(--ats-muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.summary-value {
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ats-text);
}

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

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.list-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.list-subtitle {
  margin: 6px 0 0;
  color: var(--ats-muted);
  line-height: 1.6;
}

.table-responsive {
  width: 100%;
  overflow: auto;
}

.table-professional {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
}

.table-professional thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ats-surface);
  color: var(--ats-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 14px;
  border-bottom: 1px solid var(--ats-line);
}

.table-professional tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--ats-line);
  vertical-align: top;
  background: transparent;
}

.table-professional tbody tr:hover td {
  background: rgba(15, 23, 42, 0.02);
}

.id-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--ats-primary-soft);
  color: var(--ats-primary-dark);
  font-weight: 800;
  font-size: 0.84rem;
}

.code-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--ats-line);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.row-title {
  font-weight: 800;
  color: var(--ats-text);
  line-height: 1.35;
}

.row-subtitle {
  margin-top: 6px;
  color: var(--ats-muted);
  line-height: 1.6;
  max-width: 520px;
}

.row-subtitle-muted {
  font-style: italic;
  opacity: 0.85;
}

.count-pill {
  display: inline-flex;
  min-width: 44px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--ats-accent-soft);
  color: var(--ats-accent-dark);
  font-weight: 900;
}

.justify-end {
  justify-content: flex-end;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.table-empty {
  padding: 42px 20px;
  text-align: center;
}

.table-empty-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--ats-muted);
  opacity: 0.7;
}

.table-empty-title {
  margin-top: 12px;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.table-empty-subtitle {
  margin-top: 6px;
  color: var(--ats-muted);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.table-toolbar-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-filter-chip {
  border: 1px solid var(--ats-line);
  background: var(--ats-surface);
  color: var(--ats-text);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.table-filter-chip:hover {
  background: rgba(15, 23, 42, 0.03);
}

.table-filter-chip.active {
  background: var(--ats-gradient);
  color: #fff;
  border-color: transparent;
}

.dt-top,
.dt-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_filter input {
  min-height: 42px;
  border: 1px solid var(--ats-line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  margin-left: 8px;
}

.dataTables_wrapper .dataTables_length select {
  min-height: 42px;
  border: 1px solid var(--ats-line);
  border-radius: 14px;
  padding: 0 10px;
  background: #fff;
  margin: 0 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 12px !important;
  border: 1px solid transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--ats-gradient) !important;
  color: #fff !important;
  border-color: transparent !important;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  color: var(--ats-muted);
}

.dt-top,
.dt-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  color: var(--ats-muted);
  font-size: 0.92rem;
}

.dataTables_wrapper .dataTables_filter input {
  min-height: 42px;
  border: 1px solid var(--ats-line);
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  margin-left: 8px;
  outline: none;
  box-shadow: none;
}

.dataTables_wrapper .dataTables_length select {
  min-height: 42px;
  border: 1px solid var(--ats-line);
  border-radius: 14px;
  padding: 0 36px 0 12px;
  background: #fff;
  margin: 0 8px;
  outline: none;
  box-shadow: none;
}

.dataTables_wrapper .dataTables_paginate {
  margin: 0;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_paginate .page-item {
  margin: 0;
  list-style: none;
}

.dataTables_wrapper .dataTables_paginate .page-link {
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  border: 1px solid var(--ats-line) !important;
  background: var(--ats-surface);
  color: var(--ats-text);
  font-weight: 700;
  line-height: 1;
  box-shadow: none !important;
  transition: 0.18s ease;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--ats-text);
  border-color: var(--ats-line) !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
  background: var(--ats-gradient) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
  opacity: 0.45;
  pointer-events: none;
  background: #f8fafc;
  color: var(--ats-muted);
}

.project-members-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 980px) {
  .project-members-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dt-top,
  .dt-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .dataTables_wrapper .dataTables_paginate .pagination {
    justify-content: center;
  }
}

@media (max-width: 960px) {
  .department-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* System alert stack */
.system-alert-stack {
  position: sticky;
  top: 10px;
  z-index: 80;
  padding-top: 12px;
}
.system-alert-stack .container {
  display: grid;
  gap: 12px;
}

/* Pretty inline alert */
.alert{
  --alert-bg: #eff6ff;
  --alert-border: #bfdbfe;
  --alert-text: #1e3a8a;
  --alert-icon-bg: rgba(255,255,255,.72);
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--alert-border);
  border-radius: 18px;
  background: radial-gradient(circle at top right, rgba(255,255,255,.55), transparent 35%), linear-gradient(180deg, var(--alert-bg), rgba(255,255,255,.92));
  color: var(--alert-text);
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
  overflow: hidden;
}
.alert + .alert{ margin-top: 12px; }
.alert::before{ content:""; position:absolute; inset:0 auto 0 0; width:5px; background: currentColor; opacity:.18; }
.alert-icon{ width:42px; height:42px; border-radius:14px; display:grid; place-items:center; background:var(--alert-icon-bg); border:1px solid rgba(255,255,255,.45); box-shadow: inset 0 1px 0 rgba(255,255,255,.55); font-size:1.05rem; font-weight:900; line-height:1; }
.alert-body{ min-width:0; display:grid; gap:4px; }
.alert-title{ margin:0; font-size:1rem; font-weight:900; line-height:1.35; color:inherit; }
.alert-message{ margin:0; line-height:1.7; color:inherit; opacity:.95; word-break:break-word; }
.alert-close{ appearance:none; border:0; background:transparent; color:inherit; width:34px; height:34px; border-radius:10px; cursor:pointer; font-size:1.1rem; line-height:1; opacity:.72; transition: background .15s ease, opacity .15s ease, transform .15s ease; }
.alert-close:hover{ background: rgba(255,255,255,.38); opacity:1; transform: translateY(-1px); }
.alert-success{ --alert-bg:#ecfdf3; --alert-border:#bbf7d0; --alert-text:#166534; }
.alert-error{ --alert-bg:#fef2f2; --alert-border:#fecaca; --alert-text:#991b1b; }
.alert-warning{ --alert-bg:#fffbeb; --alert-border:#fde68a; --alert-text:#92400e; }
.alert-info{ --alert-bg:#eff6ff; --alert-border:#bfdbfe; --alert-text:#1d4ed8; }
.alert-compact{ padding:13px 15px; border-radius:16px; grid-template-columns:auto 1fr; }
.alert-compact .alert-close{ display:none; }



/* Toast */
.toast-stack{
  --toast-gap:12px;
  --toast-side:18px;
  position:fixed;
  top:max(var(--toast-side), env(safe-area-inset-top));
  right:max(var(--toast-side), env(safe-area-inset-right));
  left:auto;
  z-index:9999;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:var(--toast-gap);
  width:min(420px, calc(100dvw - max(var(--toast-side), env(safe-area-inset-left)) - max(var(--toast-side), env(safe-area-inset-right))));
  max-width:calc(100dvw - max(var(--toast-side), env(safe-area-inset-left)) - max(var(--toast-side), env(safe-area-inset-right)));
  pointer-events:none;
  box-sizing:border-box;
}
.toast-stack > *{ pointer-events:auto; }

.toast,
.toast *,
.toast *::before,
.toast *::after{
  box-sizing:border-box;
}

.toast{
  position:relative;
  display:grid;
  grid-template-columns:5px 42px minmax(0, 1fr) 34px;
  align-items:start;
  gap:12px;
  width:100%;
  max-width:100%;
  min-width:0;
  padding:12px 12px 12px 0;
  border-radius:22px;
  border:1px solid rgba(15,23,42,.08);
  background:rgba(255,255,255,.96);
  box-shadow:0 18px 40px rgba(15,23,42,.14);
  color:var(--ats-text);
  overflow:hidden;
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  animation:toastEnter .24s cubic-bezier(.2,.8,.2,1);
  isolation:isolate;
}
.toast::after{
  content:'';
  position:absolute;
  inset:auto 0 0 0;
  height:1px;
  background:linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.85), rgba(255,255,255,0));
  pointer-events:none;
}
.toast.is-leaving{
  opacity:0;
  transform:translateY(-8px) scale(.985);
  transition:opacity .2s ease, transform .2s ease;
}

.toast__accent{
  align-self:stretch;
  width:5px;
  border-radius:999px;
  margin-left:10px;
}
.toast__icon{
  width:42px;
  height:42px;
  margin-top:1px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:rgba(15,23,42,.05);
  font-weight:900;
  font-size:1rem;
  line-height:1;
}
.toast__content{
  min-width:0;
  width:100%;
  display:grid;
  gap:4px;
  padding-top:2px;
}
.toast__title{
  margin:0;
  max-width:100%;
  font-size:.95rem;
  font-weight:800;
  line-height:1.35;
  color:var(--ats-text);
  overflow-wrap:anywhere;
}
.toast__message{
  margin:0;
  max-width:100%;
  font-size:.92rem;
  line-height:1.55;
  color:var(--ats-muted);
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.toast__close{
  width:34px;
  height:34px;
  margin-top:1px;
  padding:0;
  border:0;
  background:transparent;
  border-radius:12px;
  display:grid;
  place-items:center;
  color:var(--ats-muted);
  font-size:1.15rem;
  line-height:1;
  cursor:pointer;
  transition:background .18s ease, color .18s ease, transform .18s ease;
}
.toast__close:hover{
  background:rgba(15,23,42,.06);
  color:var(--ats-text);
}
.toast__close:active{
  transform:scale(.96);
}
.toast__close:focus-visible{
  outline:2px solid rgba(37,99,235,.26);
  outline-offset:2px;
}

.toast-success .toast__accent{ background:linear-gradient(180deg, #22c55e, #16a34a); }
.toast-success .toast__icon{ background:rgba(22,163,74,.11); color:#15803d; }

.toast-error .toast__accent{ background:linear-gradient(180deg, #ef4444, #dc2626); }
.toast-error .toast__icon{ background:rgba(220,38,38,.11); color:#b91c1c; }

.toast-warning .toast__accent{ background:linear-gradient(180deg, #fbbf24, #f59e0b); }
.toast-warning .toast__icon{ background:rgba(245,158,11,.14); color:#b45309; }

.toast-info .toast__accent{ background:linear-gradient(180deg, #3b82f6, #2563eb); }
.toast-info .toast__icon{ background:rgba(37,99,235,.11); color:#1d4ed8; }

@media (max-width: 991.98px){
  .toast-stack{
    --toast-side:14px;
    width:min(400px, calc(100dvw - max(var(--toast-side), env(safe-area-inset-left)) - max(var(--toast-side), env(safe-area-inset-right))));
  }
  .toast{
    border-radius:20px;
    grid-template-columns:5px 40px minmax(0, 1fr) 32px;
    gap:11px;
    padding:11px 11px 11px 0;
  }
  .toast__icon{
    width:40px;
    height:40px;
    border-radius:13px;
  }
}

@media (max-width: 767.98px){
  .toast-stack{
    --toast-side:10px;
    top:auto;
    bottom:max(10px, env(safe-area-inset-bottom));
    left:max(var(--toast-side), env(safe-area-inset-left));
    right:max(var(--toast-side), env(safe-area-inset-right));
    width:auto;
    max-width:none;
  }
  .toast{
    grid-template-columns:4px 38px minmax(0, 1fr) 30px;
    gap:10px;
    padding:10px 10px 10px 0;
    border-radius:18px;
    box-shadow:0 16px 32px rgba(15,23,42,.16);
  }
  .toast__accent{
    width:4px;
    margin-left:8px;
  }
  .toast__icon{
    width:38px;
    height:38px;
    border-radius:12px;
    font-size:.98rem;
  }
  .toast__title{
    font-size:.92rem;
  }
  .toast__message{
    font-size:.88rem;
    line-height:1.5;
  }
  .toast__close{
    width:30px;
    height:30px;
    border-radius:10px;
    font-size:1rem;
  }
}

@media (max-width: 479.98px){
  .toast-stack{
    --toast-side:8px;
    bottom:max(8px, env(safe-area-inset-bottom));
    left:max(var(--toast-side), env(safe-area-inset-left));
    right:max(var(--toast-side), env(safe-area-inset-right));
    gap:8px;
  }
  .toast{
    grid-template-columns:4px 34px minmax(0, 1fr) 28px;
    gap:8px;
    padding:9px 8px 9px 0;
    border-radius:16px;
  }
  .toast__accent{
    margin-left:7px;
  }
  .toast__icon{
    width:34px;
    height:34px;
    border-radius:11px;
    font-size:.9rem;
  }
  .toast__content{
    gap:3px;
  }
  .toast__title{
    font-size:.88rem;
    line-height:1.32;
  }
  .toast__message{
    font-size:.82rem;
    line-height:1.45;
  }
  .toast__close{
    width:28px;
    height:28px;
    font-size:.95rem;
  }
}

@media (prefers-reduced-motion: reduce){
  .toast,
  .toast.is-leaving{
    animation:none;
    transition:none;
  }
}

@keyframes toastEnter{
  from{ opacity:0; transform:translateY(10px) scale(.985); }
  to{ opacity:1; transform:none; }
}

to{ opacity:1; transform:none;} }

/* Modern confirm modal */
.has-modal-open{ overflow:hidden; }
.confirm-modal{
  position:fixed; inset:0; z-index:10020; display:none;
}
.confirm-modal.is-open{ display:block; }
.confirm-modal__backdrop{
  position:absolute; inset:0; background:rgba(2,6,23,.52); backdrop-filter:blur(6px);
}
.confirm-modal__dialog{
  position:relative; width:min(480px, calc(100vw - 28px)); margin:10vh auto 0; background:rgba(255,255,255,.98); border:1px solid rgba(15,23,42,.08);
  border-radius:28px; box-shadow:0 30px 80px rgba(15,23,42,.24); padding:24px; display:grid; gap:18px; outline:none; animation:confirmPop .18s ease;
}
.confirm-modal__icon{
  width:58px; height:58px; border-radius:20px; display:grid; place-items:center; font-size:1.25rem; font-weight:900; color:#b91c1c;
  background:linear-gradient(180deg, rgba(254,226,226,.95), rgba(254,242,242,.95)); border:1px solid rgba(248,113,113,.24);
}
.confirm-modal__eyebrow{ color:#dc2626; font-size:.8rem; font-weight:900; letter-spacing:.05em; text-transform:uppercase; }
.confirm-modal__title{ margin:6px 0 0; font-size:1.35rem; line-height:1.12; letter-spacing:-.03em; color:var(--ats-text); }
.confirm-modal__message{ margin:8px 0 0; color:var(--ats-muted); line-height:1.75; }
.confirm-modal__actions{ display:flex; justify-content:flex-end; gap:12px; flex-wrap:wrap; }
@keyframes confirmPop{ from{ opacity:0; transform:translateY(8px) scale(.98);} to{ opacity:1; transform:none;} }





/* Admin responsive sidebar */
.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
}
.nav-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.admin-mobile-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1201;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  border-radius: 16px;
  background: rgba(255,255,255,.96);
  color: var(--ats-text);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .16);
  backdrop-filter: blur(10px);
}
.admin-mobile-toggle__icon {
  width: 20px;
  height: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}
.admin-mobile-toggle__icon span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .24s ease, opacity .24s ease;
}
.admin-mobile-toggle__text {
  font-size: .95rem;
  font-weight: 800;
}
.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1198;
  background: rgba(2, 6, 23, .52);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-mobile-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.sidebar-mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-close {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
}
.sidebar-user-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-user-card__name { font-weight: 800; }
.sidebar-user-card__org,
.sidebar-user-card__roles {
  margin-top: 6px;
  opacity: .9;
}
body.admin-sidebar-open {
  overflow: hidden;
}
body.admin-sidebar-open .admin-sidebar-backdrop {
  opacity: 1;
  visibility: visible;
}
@media (max-width: 1180px) {
  .admin-mobile-toggle {
    display: inline-flex;
  }
  .admin-layout {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    display: flex !important;
    flex-direction: column;
    width: min(88vw, 320px);
    max-width: 320px;
    height: 100vh;
    z-index: 1200;
    padding: 18px 16px 24px;
    transform: translateX(calc(-100% - 18px));
    transition: transform .28s ease, box-shadow .28s ease;
    box-shadow: none;
  }
  .sidebar-mobile-head {
    display: flex;
  }
  .sidebar-brand-desktop {
    display: none;
  }
  .main-panel {
    min-width: 0;
    padding: 76px 16px 22px;
  }
  body.admin-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 20px 54px rgba(15, 23, 42, .28);
  }
  body.admin-sidebar-open .admin-mobile-toggle__icon span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  body.admin-sidebar-open .admin-mobile-toggle__icon span:nth-child(2) {
    opacity: 0;
  }
  body.admin-sidebar-open .admin-mobile-toggle__icon span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}
@media (min-width: 1181px) {
  .admin-sidebar-backdrop,
  .admin-mobile-toggle,
  .sidebar-mobile-head {
    display: none !important;
  }
  .sidebar {
    transform: none !important;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
  }
}


/* Responsive table refinements */
.table-responsive{
  width:100%;
  overflow:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  border-radius:18px;
}
.table-responsive > .table-professional{
  margin-bottom:0;
}
.table-professional{
  width:100%;
}
.table-professional th,
.table-professional td{
  white-space:nowrap;
}
.table-professional td .cell-main,
.table-professional td .cell-sub,
.table-professional td .line-clamp-1,
.table-professional td .line-clamp-2{
  white-space:normal;
}
.dataTables_wrapper{
  width:100%;
}
.dataTables_wrapper .row{
  --bs-gutter-x:12px;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate{
  margin-top:0;
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.dataTables_wrapper .dataTables_filter input{
  min-width:min(280px, 100%);
}
.dataTables_wrapper .dataTables_paginate{
  display:flex;
  justify-content:flex-end;
}
@media (max-width: 992px){
  .table-responsive{
    border-radius:16px;
  }
  .table-professional{
    min-width:760px;
  }
  .table-professional thead th{
    font-size:.75rem;
    padding:13px 12px;
  }
  .table-professional tbody td{
    padding:14px 12px;
    font-size:.93rem;
  }
}
@media (max-width: 768px){
  .table-responsive{
    margin-inline:-2px;
    padding-bottom:2px;
  }
  .table-professional{
    min-width:680px;
  }
  .table-professional thead th{
    font-size:.72rem;
    letter-spacing:.05em;
    padding:12px 11px;
  }
  .table-professional tbody td{
    padding:12px 11px;
    font-size:.9rem;
  }
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate{
    width:100%;
  }
  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label{
    width:100%;
    justify-content:space-between;
  }
  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select{
    width:100%;
    margin-left:0;
    margin-right:0;
  }
  .dataTables_wrapper .dataTables_paginate{
    justify-content:center;
  }
}
@media (max-width: 576px){
  .table-responsive{
    border-radius:14px;
    box-shadow:inset 0 -1px 0 rgba(15,23,42,.04);
  }
  .table-professional{
    min-width:620px;
  }
  .table-professional thead th{
    top:0;
    padding:11px 10px;
    font-size:.69rem;
  }
  .table-professional tbody td{
    padding:11px 10px;
    font-size:.86rem;
  }
  .dataTables_wrapper .dataTables_info{
    text-align:center;
  }
}






/* Dashboard-specific overflow + toast stabilization */
html,
body{
  max-width:100%;
}

body{
  overflow-x:clip;
}

.admin-layout,
.main-panel,
.dashboard-panel,
.page-card,
.top-panel,
.meta-grid,
.dashboard-activity-table{
  min-width:0;
}

.dashboard-panel .page-card{
  overflow:hidden;
}

.dashboard-panel .meta-grid{
  grid-template-columns:repeat(4, minmax(0, 1fr));
}

.dashboard-activity-table{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}

.dashboard-activity-table > .dashboard-table{
  width:100%;
  min-width:720px;
  margin-bottom:0;
}

.dashboard-activity-table .dashboard-table th,
.dashboard-activity-table .dashboard-table td{
  white-space:nowrap;
}

.dashboard-panel h1{
  font-size:clamp(1.6rem, 4vw, 2.8rem) !important;
}

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

@media (max-width: 767.98px){
  .dashboard-panel .meta-grid{
    grid-template-columns:1fr;
  }

  .dashboard-panel{
    padding:16px;
  }

  .dashboard-activity-table{
    margin-inline:-2px;
  }

  .dashboard-activity-table > .dashboard-table{
    min-width:640px;
  }

  #toast-container.toast-stack{
    top:auto !important;
    bottom:max(10px, env(safe-area-inset-bottom)) !important;
    left:max(10px, env(safe-area-inset-left)) !important;
    right:max(10px, env(safe-area-inset-right)) !important;
    inset-inline:max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right)) !important;
    width:auto !important;
    max-width:none !important;
  }
}

@media (max-width: 479.98px){
  .dashboard-panel{
    padding:12px;
  }

  .dashboard-activity-table > .dashboard-table{
    min-width:580px;
  }

  #toast-container.toast-stack{
    left:max(8px, env(safe-area-inset-left)) !important;
    right:max(8px, env(safe-area-inset-right)) !important;
    bottom:max(8px, env(safe-area-inset-bottom)) !important;
    inset-inline:max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)) !important;
  }
}


/* Toast final stabilization */
#toast-container.toast-stack{
  top:max(16px, env(safe-area-inset-top));
  right:max(16px, env(safe-area-inset-right));
  left:auto;
  bottom:auto;
  width:min(420px, calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))));
  max-width:calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right)));
}
#toast-container.toast-stack .toast{
  width:100%;
  max-width:100%;
  min-width:0;
}
#toast-container.toast-stack .toast__content{
  min-width:0;
}
#toast-container.toast-stack .toast__title,
#toast-container.toast-stack .toast__message{
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:break-word;
}
@media (max-width: 767.98px){
  #toast-container.toast-stack{
    top:auto;
    bottom:max(10px, env(safe-area-inset-bottom));
    left:max(10px, env(safe-area-inset-left));
    right:max(10px, env(safe-area-inset-right));
    width:auto;
    max-width:none;
  }
}
@media (max-width: 479.98px){
  #toast-container.toast-stack{
    left:max(8px, env(safe-area-inset-left));
    right:max(8px, env(safe-area-inset-right));
    bottom:max(8px, env(safe-area-inset-bottom));
  }
}


/* === ATS polish patch: toast / confirm / alert / datatables responsive === */
.system-alert-stack{
  position: sticky;
  top: 12px;
  z-index: 100;
  padding-inline: 12px;
}
.system-alert-stack .container{
  max-width: 1180px;
}
.alert{
  /* grid-template-columns: 44px minmax(0,1fr) auto; */
  gap: 14px;
  border-radius: 18px;
  word-break: break-word;
}
.alert-body{
  min-width: 0;
}
.alert-title{
  margin-bottom: 4px;
}
.alert-message{
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.alert-close{
  flex: 0 0 auto;
  align-self: start;
}
.alert.alert-success, .alert-success{
  --alert-bg:#ecfdf5;
  --alert-border:#86efac;
  --alert-text:#166534;
}
.alert.alert-error, .alert-error{
  --alert-bg:#fef2f2;
  --alert-border:#fca5a5;
  --alert-text:#b91c1c;
}
.alert.alert-warning, .alert-warning{
  --alert-bg:#fffbeb;
  --alert-border:#fcd34d;
  --alert-text:#b45309;
}
.alert.alert-info, .alert-info{
  --alert-bg:#eff6ff;
  --alert-border:#93c5fd;
  --alert-text:#1d4ed8;
}

#toast-container.toast-stack{
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  left: auto;
  bottom: auto;
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  display: grid;
  gap: 12px;
  z-index: 10060;
  pointer-events: none;
}
#toast-container.toast-stack .toast{
  pointer-events: auto;
  min-width: 0;
  max-width: 100%;
}
#toast-container.toast-stack .toast__content,
#toast-container.toast-stack .toast__title,
#toast-container.toast-stack .toast__message{
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#toast-container.toast-stack .toast__message{
  line-height: 1.55;
}

.confirm-modal{
  padding: 18px;
}
.confirm-modal__dialog{
  width: min(520px, calc(100vw - 24px));
  margin: min(10vh, 72px) auto 0;
  padding: 24px;
  gap: 18px;
}
.confirm-modal__body{
  min-width: 0;
}
.confirm-modal__message{
  overflow-wrap: anywhere;
}
.confirm-modal__actions{
  gap: 10px;
}
.confirm-modal__actions .btn{
  min-width: 112px;
}

.dataTables_wrapper{
  width: 100%;
}
.dataTables_wrapper .dt-top,
.dataTables_wrapper .dt-bottom{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate{
  margin: 0;
}
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select{
  max-width: 100%;
}
.table-responsive-ats,
.dataTables_wrapper .table-responsive{
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 18px;
}
.table-responsive-ats table,
.dataTables_wrapper table.dataTable{
  width: 100% !important;
}
.dataTables_wrapper .dataTables_paginate .pagination{
  gap: 8px;
  flex-wrap: wrap;
}
.dataTables_wrapper .dataTables_paginate .page-link{
  white-space: nowrap;
}
.dataTables_wrapper .dataTables_empty{
  padding: 24px 16px !important;
  text-align: center;
  color: var(--ats-muted);
}
.dtr-details{
  width: 100%;
}
.dtr-details li{
  display: grid;
  grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
}
.dtr-title{
  font-weight: 800;
}
.dtr-data{
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 991.98px){
  .confirm-modal{
    padding: 14px;
  }
  .confirm-modal__dialog{
    width: min(100%, 520px);
    margin-top: 56px;
    border-radius: 24px;
  }
}

@media (max-width: 767.98px){
  .alert{
    grid-template-columns: 40px minmax(0,1fr) 30px;
    padding: 14px;
    border-radius: 16px;
  }
  #toast-container.toast-stack{
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    width: auto;
    max-width: none;
  }
  .confirm-modal__dialog{
    width: 100%;
    margin-top: 24px;
    padding: 20px;
    border-radius: 22px;
  }
  .confirm-modal__actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .confirm-modal__actions .btn{
    width: 100%;
    min-width: 0;
  }
  .dataTables_wrapper .dt-top,
  .dataTables_wrapper .dt-bottom{
    flex-direction: column;
    align-items: stretch;
  }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate{
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label{
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select{
    width: 100% !important;
    margin: 0 !important;
  }
  .dataTables_wrapper .dataTables_paginate .pagination{
    justify-content: center;
  }
}

@media (max-width: 479.98px){
  .confirm-modal__actions{
    grid-template-columns: 1fr;
  }
  .dtr-details li{
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


/* PWA install button */
.ats-install-app {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1090;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--ats-primary, #74b48b) 18%, #ffffff 82%);
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ats-surface, #ffffff) 74%, var(--ats-primary-soft, #ecfdf3) 26%), color-mix(in srgb, var(--ats-surface, #ffffff) 84%, var(--ats-primary-soft, #ecfdf3) 16%));
  color: var(--ats-primary-dark, #106c31);
  box-shadow: 0 18px 36px color-mix(in srgb, var(--ats-primary, #74b48b) 18%, transparent), 0 2px 0 rgba(255, 255, 255, .45) inset;
  backdrop-filter: blur(12px);
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, border-color .18s ease;
}
.ats-install-app:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ats-primary, #74b48b) 30%, #ffffff 70%);
  box-shadow: 0 20px 40px color-mix(in srgb, var(--ats-primary, #74b48b) 22%, transparent), 0 2px 0 rgba(255, 255, 255, .5) inset;
}
.ats-install-app__icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ats-gradient, linear-gradient(135deg,#22c55e,#fde047));
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--ats-primary, #74b48b) 18%, transparent);
}
.ats-install-app[hidden] { display: none !important; }
@media (min-width: 992px) { .ats-install-app { left: 24px; bottom: 24px; } }
@media (max-width: 991.98px) { body.admin-sidebar-open .ats-install-app { opacity: 0; pointer-events: none; } }
@media (display-mode: standalone) { .ats-install-app { display: none !important; } }
