:root {
  --color-primary: #0f766e;
  --color-primary-light: #ccfbf1;
  --color-primary-dark: #115e59;
  --color-navy: #0f172a;
  --color-bg: #f8fafc;
  --color-bg-soft: #eef2f7;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-error: #dc2626;
  --color-info: #2563eb;
  --color-purple: #7c3aed;
  --admin-sidebar-width: 292px;
  --admin-sidebar-expanded-width: 292px;
  --admin-sidebar-collapsed-width: 84px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, 0.14);
}

body:has(.admin-app) {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-shell {
  display: block;
  min-height: 100vh;
  padding: 0;
  background: var(--color-bg);
}

.admin-panel {
  width: 100%;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: var(--color-bg);
  box-shadow: none;
}

.admin-panel > header {
  display: none;
}

.admin-app {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0%, rgba(13, 148, 136, 0.08), transparent 28%),
    var(--color-bg);
}

.admin-mobile-toggle {
  display: none;
}

.admin-sidebar-backdrop {
  display: none;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--admin-sidebar-width);
  height: 100vh;
  overflow: hidden;
  gap: 20px;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.2), transparent 32%),
    linear-gradient(160deg, #08111f 0%, #0f172a 62%, #102033 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.2s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 18px;
  min-height: 60px;
  overflow: hidden;
}

.sidebar-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: white;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(20, 184, 166, 0.24);
}

.admin-sidebar-head strong {
  display: block;
  color: white;
  font-size: 18px;
  white-space: nowrap;
}

.admin-sidebar-head span {
  display: block;
  color: #94a3b8;
  white-space: nowrap;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 18px;
  min-height: 0;
  margin: 0 -6px;
  padding: 2px 6px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.admin-sidebar nav::-webkit-scrollbar {
  width: 8px;
}

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

.admin-sidebar nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.32);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-group p {
  padding: 0 10px;
  color: #5eead4;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 5px 10px;
  color: #cbd5e1;
  font-weight: 800;
  text-decoration: none;
}

.admin-sidebar nav a span {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: inherit;
  white-space: nowrap;
}

.admin-sidebar nav a span .nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #99f6e4;
}

.admin-sidebar nav a span .nav-icon::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  -webkit-mask: var(--icon) center / contain no-repeat;
}

.icon-dashboard { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 13h7V4H4v9Zm0 7h7v-5H4v5Zm9 0h7v-9h-7v9Zm0-16v5h7V4h-7Z'/%3E%3C/svg%3E"); }
.icon-users { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 11c1.66 0 3-1.57 3-3.5S17.66 4 16 4s-3 1.57-3 3.5 1.34 3.5 3 3.5ZM8 11c1.66 0 3-1.57 3-3.5S9.66 4 8 4 5 5.57 5 7.5 6.34 11 8 11Zm8 2c-2.33 0-7 1.17-7 3.5V20h14v-3.5c0-2.33-4.67-3.5-7-3.5Zm-8 0c-.29 0-.62.02-.97.05C4.74 13.27 1 14.36 1 16.5V20h6v-3.5c0-1.28.74-2.35 2.03-3.2A8.7 8.7 0 0 0 8 13Z'/%3E%3C/svg%3E"); }
.icon-headset { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a8 8 0 0 0-8 8v5a3 3 0 0 0 3 3h2v-8H6a6 6 0 0 1 12 0h-3v8h3v1h-5v2h5a2 2 0 0 0 2-2v-1a3 3 0 0 0 2-2.83V11a8 8 0 0 0-8-8Zm-5 10v4a1 1 0 0 1-1-1v-3h1Zm11 4h-1v-4h1v4Z'/%3E%3C/svg%3E"); }
.icon-repeat { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7h9.17l-2.58-2.59L15 3l5 5-5 5-1.41-1.41L16.17 9H7a3 3 0 0 0-3 3v1H2v-1a5 5 0 0 1 5-5Zm10 10H7.83l2.58 2.59L9 21l-5-5 5-5 1.41 1.41L7.83 15H17a3 3 0 0 0 3-3v-1h2v1a5 5 0 0 1-5 5Z'/%3E%3C/svg%3E"); }
.icon-plan { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm2 5h10V6H7v2Zm0 5h10v-2H7v2Zm0 5h7v-2H7v2Z'/%3E%3C/svg%3E"); }
.icon-sliders { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h8a3 3 0 0 0 6 0h2V5h-2a3 3 0 0 0-6 0H4v2Zm11-2a1 1 0 1 1 0 2 1 1 0 0 1 0-2ZM4 13h2a3 3 0 0 0 6 0h8v-2h-8a3 3 0 0 0-6 0H4v2Zm5-2a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm-5 8h10a3 3 0 0 0 6 0h0v-2h0a3 3 0 0 0-6 0H4v2Zm13-2a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z'/%3E%3C/svg%3E"); }
.icon-ticket { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 12a3 3 0 0 0 0-6V4H4v2a3 3 0 0 0 0 6 3 3 0 0 0 0 6v2h16v-2a3 3 0 0 0 0-6Zm-2 4v2H6v-2l-.9-.3a1 1 0 0 1 0-1.9L6 13.5v-3l-.9-.3a1 1 0 0 1 0-1.9L6 8V6h12v2l.9.3a1 1 0 0 1 0 1.9l-.9.3v3l.9.3a1 1 0 0 1 0 1.9L18 16Zm-7-8h2v2h-2V8Zm0 3h2v2h-2v-2Zm0 3h2v2h-2v-2Z'/%3E%3C/svg%3E"); }
.icon-invoice { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 2h12a2 2 0 0 1 2 2v18l-3-2-2 2-3-2-3 2-2-2-3 2V4a2 2 0 0 1 2-2Zm2 6h8V6H8v2Zm0 4h8v-2H8v2Zm0 4h5v-2H8v2Z'/%3E%3C/svg%3E"); }
.icon-card { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 5h18a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Zm0 4h18V7H3v2Zm2 6h6v-2H5v2Z'/%3E%3C/svg%3E"); }
.icon-chart { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 19h16v2H2V3h2v16Zm3-2h3V9H7v8Zm5 0h3V5h-3v12Zm5 0h3v-6h-3v6Z'/%3E%3C/svg%3E"); }
.icon-webhook { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4a6 6 0 0 1 5.2 9l-1.73-1A4 4 0 1 0 10 14h1v-2l4 3-4 3v-2h-1A6 6 0 0 1 10 4Zm6 2h2a4 4 0 1 1-3.47 6l1.73-1A2 2 0 1 0 18 8h-2V6ZM6 18h8a2 2 0 1 0-1.73-3l-1.74-1A4 4 0 1 1 14 20H6v-2Z'/%3E%3C/svg%3E"); }
.icon-sync { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4a8 8 0 0 1 7.45 5.1L22 7v7h-7l2.85-2.85A6 6 0 0 0 6.8 9L5.16 7.84A8 8 0 0 1 12 4Zm-7.45 10.9L2 17v-7h7l-2.85 2.85A6 6 0 0 0 17.2 15l1.64 1.16A8 8 0 0 1 4.55 14.9Z'/%3E%3C/svg%3E"); }
.icon-terminal { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 4h18a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm0 2v12h18V6H3Zm3 3 4 3-4 3v-2.5L7.7 12 6 10.5V9Zm6 6h6v2h-6v-2Z'/%3E%3C/svg%3E"); }
.icon-bell { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 22a2.5 2.5 0 0 0 2.45-2h-4.9A2.5 2.5 0 0 0 12 22Zm8-6-2-3V9a6 6 0 0 0-5-5.92V1h-2v2.08A6 6 0 0 0 6 9v4l-2 3v2h16v-2Z'/%3E%3C/svg%3E"); }
.icon-shield { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 4 5v6c0 5.55 3.84 10.74 8 12 4.16-1.26 8-6.45 8-12V5l-8-3Zm0 2.15 6 2.25V11c0 4.35-2.8 8.3-6 9.85C8.8 19.3 6 15.35 6 11V6.4l6-2.25Zm-1 11.02 5.2-5.2-1.4-1.42-3.8 3.78-1.8-1.78-1.4 1.42 3.2 3.2Z'/%3E%3C/svg%3E"); }
.icon-settings { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m19.43 12.98.04-.98-.04-.98 2.1-1.64-2-3.46-2.49 1a7.76 7.76 0 0 0-1.7-.98L15 3.28h-4l-.34 2.66c-.6.24-1.17.57-1.7.98l-2.49-1-2 3.46 2.1 1.64-.04.98.04.98-2.1 1.64 2 3.46 2.49-1c.53.41 1.1.74 1.7.98L11 20.72h4l.34-2.66c.6-.24 1.17-.57 1.7-.98l2.49 1 2-3.46-2.1-1.64ZM13 17h-2l-.25-2.02a5.9 5.9 0 0 1-2.05-1.19l-1.88.76-1-1.73 1.63-1.27a6.7 6.7 0 0 1 0-2.1L5.82 8.18l1-1.73 1.88.76a5.9 5.9 0 0 1 2.05-1.19L11 4h2l.25 2.02c.74.25 1.43.65 2.05 1.19l1.88-.76 1 1.73-1.63 1.27a6.7 6.7 0 0 1 0 2.1l1.63 1.27-1 1.73-1.88-.76a5.9 5.9 0 0 1-2.05 1.19L13 17Zm-1-8a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z'/%3E%3C/svg%3E"); }

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  border-color: rgba(94, 234, 212, 0.18);
  background: rgba(20, 184, 166, 0.13);
  color: white;
}

.admin-sidebar nav b {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  font-size: 11px;
}

.admin-sidebar nav a.active b {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.admin-sidebar-foot {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.admin-sidebar-foot a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  text-decoration: none;
}

.admin-workspace {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  margin-left: var(--admin-sidebar-width);
  padding: 26px clamp(18px, 3vw, 42px) 42px;
  transition: margin-left 0.2s ease;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.sidebar-collapse-toggle {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0;
  background: white;
  color: var(--color-text);
  box-shadow: none;
}

.sidebar-collapse-toggle span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-collapse-toggle span + span {
  margin-top: 4px;
}

.sidebar-collapse-toggle:hover {
  border-color: rgba(13, 148, 136, 0.42);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  box-shadow: none;
  transform: none;
}

body.sidebar-collapsed {
  --admin-sidebar-width: var(--admin-sidebar-collapsed-width);
}

body.sidebar-collapsed .admin-sidebar {
  width: var(--admin-sidebar-collapsed-width);
}

body.sidebar-collapsed .admin-sidebar:hover,
body.sidebar-collapsed .admin-sidebar:focus-within {
  width: var(--admin-sidebar-expanded-width);
  box-shadow: 16px 0 40px rgba(15, 23, 42, 0.18);
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) {
  padding-inline: 12px;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-head {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-head > div:not(.sidebar-logo),
body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .sidebar-group p,
body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a b {
  opacity: 0;
  pointer-events: none;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav {
  margin-inline: 0;
  padding-inline: 0;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a {
  justify-content: center;
  padding-inline: 0;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a span {
  justify-content: center;
  gap: 0;
  width: 100%;
  overflow: hidden;
  font-size: 0;
}

body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-foot {
  display: none;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(460px, 100%);
  min-height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--color-bg);
}

.admin-search span {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-search input,
.filter-bar input,
.filter-bar select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
}

.admin-userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-userbox strong {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-navy);
  color: white;
}

.admin-topline {
  align-items: flex-end;
  border: 0;
  padding: 4px 0 0;
  background: transparent;
}

.admin-topline p {
  color: var(--color-primary);
  letter-spacing: 0.12em;
}

.admin-topline h1 {
  color: var(--color-text);
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: 0;
}

.admin-topline span {
  color: var(--color-muted);
}

.admin-quick-actions a,
.section-row a,
.button-secondary,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--color-surface);
  color: #334155;
  font-weight: 850;
}

.admin-section,
.admin-kpis article,
.feature-guide article,
.feature-card-grid article {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.admin-section {
  padding: clamp(18px, 2vw, 26px);
}

.section-row-rich {
  align-items: flex-start;
}

.section-row h2 {
  color: var(--color-text);
  font-size: 22px;
}

.section-row span,
.form-section-title span {
  color: var(--color-muted);
}

.admin-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-kpis article {
  min-height: 112px;
  padding: 18px;
}

.admin-kpis strong {
  color: var(--color-text);
}

.admin-kpis span {
  color: var(--color-muted);
  letter-spacing: 0;
}

.modern-form {
  display: grid;
  gap: 22px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.form-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.form-section-title strong {
  color: var(--color-text);
  font-size: 16px;
}

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

.span-2 {
  grid-column: span 2;
}

label {
  color: #334155;
}

input,
select,
textarea {
  border-color: var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
  outline: none;
}

.money-input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: white;
}

.money-input b {
  display: grid;
  place-items: center;
  min-width: 48px;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-primary);
}

.money-input input {
  border: 0;
  border-radius: 0;
}

.money-input small {
  grid-column: 1 / -1;
  padding: 0 12px 10px;
  color: var(--color-muted);
}

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

.resource-chip-grid label {
  position: relative;
  display: block;
  min-height: 92px;
  cursor: pointer;
}

.resource-chip-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.resource-chip-grid span {
  display: grid;
  align-content: center;
  gap: 5px;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 900;
}

.resource-chip-grid small {
  color: var(--color-muted);
  font-weight: 700;
}

.resource-chip-grid input:checked + span {
  border-color: rgba(13, 148, 136, 0.45);
  background: linear-gradient(135deg, #ecfdf5, #ccfbf1);
  color: var(--color-primary-dark);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.12);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  justify-content: flex-end;
  border-top: 1px solid var(--color-border);
  margin: 0 -26px -26px;
  padding: 16px 26px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

button,
.form-actions button {
  border-radius: 999px;
  background: var(--color-primary);
  color: white;
  font-weight: 900;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover,
.form-actions button:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 10px 22px rgba(13, 148, 136, 0.18);
  transform: translateY(-1px);
}

.sidebar-collapse-toggle:hover {
  border-color: rgba(13, 148, 136, 0.42);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  box-shadow: none;
  transform: none;
}

.button-secondary,
.button-ghost {
  background: white;
  color: #334155;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  min-height: 40px;
  width: 180px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--color-bg);
}

.crud-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.section-row .crud-toolbar {
  justify-content: flex-end;
  margin: 0;
}

.crud-toolbar label {
  display: grid;
  gap: 6px;
}

.crud-toolbar label span {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crud-toolbar input,
.crud-toolbar select {
  min-height: 40px;
  width: min(220px, 100%);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--color-bg);
}

.crud-search input {
  width: min(320px, 100%);
}

.view-switch,
.crud-pagination {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.view-switch {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px;
  background: var(--color-bg);
}

.view-switch button,
.crud-pagination button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: transparent;
  color: #334155;
  box-shadow: none;
}

.view-switch button.active,
.view-switch button[aria-pressed="true"] {
  background: white;
  color: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}

.view-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
}

.view-icon.list { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h16v2H4V6Zm0 5h16v2H4v-2Zm0 5h16v2H4v-2Z'/%3E%3C/svg%3E"); }
.view-icon.cards { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h7v7H4V4Zm9 0h7v7h-7V4ZM4 13h7v7H4v-7Zm9 0h7v7h-7v-7Z'/%3E%3C/svg%3E"); }

.crud-pagination {
  margin-left: auto;
}

.crud-pagination span {
  min-width: 88px;
  color: var(--color-muted);
  font-weight: 850;
  text-align: center;
}

.crud-pagination button {
  border: 1px solid var(--color-border);
  background: white;
  font-size: 18px;
}

.crud-pagination button:disabled,
.admin-table button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.admin-table {
  display: grid;
  gap: 10px;
}

.admin-table[data-empty-filter]::after {
  content: "Nenhum registro encontrado com os filtros atuais.";
  display: block;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--color-muted);
  background: var(--color-bg);
}

.admin-table article {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--color-bg);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.admin-table article:hover {
  border-color: rgba(13, 148, 136, 0.28);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.modern-data-table {
  gap: 10px;
}

.modern-data-table article {
  border: 1px solid transparent;
  background: var(--color-bg);
}

.modern-data-table article:hover {
  border-color: var(--color-border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.plan-table article {
  grid-template-columns: 1.7fr 120px 120px 130px 1.2fr 96px 86px 110px 150px;
}

.invoice-table article {
  grid-template-columns: 1.25fr 1.6fr 110px 110px 110px 140px 170px;
}

.users-table article {
  grid-template-columns: 1.6fr 120px 140px 150px 220px;
}

.payments-table article {
  grid-template-columns: 1.2fr 1.6fr 110px 110px 120px 110px;
}

.coupon-table article {
  grid-template-columns: 1.5fr 120px 90px 110px 110px 150px;
}

.webhook-table article,
.log-table article,
.notification-table article,
.sync-table article,
.audit-table article {
  grid-template-columns: 1.6fr 1fr 120px 120px 150px 120px;
}

.plan-name-cell {
  color: var(--color-text);
  font-weight: 900;
}

.mini-chip-row {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px !important;
}

.mini-chip-row small {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 850;
}

.row-actions {
  display: flex !important;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px !important;
}

.row-actions form {
  display: inline-flex;
}

.row-actions button,
.row-actions .button-ghost {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.admin-table.view-cards {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-table.view-cards article {
  grid-template-columns: 1fr;
  align-content: start;
  min-height: 100%;
  padding: 16px;
  background: white;
}

.admin-table.view-cards article > span,
.admin-table.view-cards article > form {
  display: grid;
  gap: 3px;
}

.admin-table.view-cards .row-actions {
  justify-content: stretch;
  margin-top: 4px;
}

.admin-table.view-cards .row-actions > *,
.admin-table.view-cards .row-actions button {
  flex: 1 1 120px;
}

.admin-table.view-cards .helpdesk-thread {
  grid-column: 1 / -1;
}

.compact-table article {
  grid-template-columns: 1.5fr 120px 120px;
}

.admin-table article {
  min-width: 0;
}

.admin-table article > span,
.admin-table article > form {
  min-width: 0;
}

.admin-table article > span {
  overflow-wrap: anywhere;
}

.admin-table article a,
.table-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
}

.helpdesk-table {
  gap: 12px;
}

.helpdesk-table article {
  grid-template-columns: 1.1fr 2fr 110px 130px 130px 150px;
}

.helpdesk-thread {
  display: grid;
  gap: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: #f8fafc;
}

.helpdesk-message {
  display: grid;
  gap: 6px;
  max-width: 860px;
  border-radius: 12px;
  padding: 12px;
  background: white;
  color: var(--color-text);
}

.helpdesk-message.ai {
  border-left: 4px solid var(--color-primary);
  background: #ecfdf5;
}

.helpdesk-message.customer {
  border-left: 4px solid var(--color-info);
}

.helpdesk-message p {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.status-pill,
.status-pill.active,
.status-pill.paid,
.status-ativa,
.status-active {
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

.status-pill.open,
.status-pending,
.status-trial {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.inactive,
.status-cancelada,
.status-canceled {
  background: #e2e8f0;
  color: #475569;
}

.status-error,
.status-inadimplente,
.status-vencida,
.status-overdue {
  background: #fee2e2;
  color: #991b1b;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted);
  text-align: center;
}

.empty-state strong {
  color: var(--color-text);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 360px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: white;
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  font-weight: 800;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 1180px) {
  :root {
    --admin-sidebar-width: 248px;
    --admin-sidebar-expanded-width: 248px;
  }

  .admin-workspace {
    padding-inline: 18px;
  }

  .plan-table article {
    grid-template-columns: 1fr;
  }

  .resource-chip-grid,
  .settings-grid.form-grid,
  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 980px) {
  .admin-topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .admin-search {
    order: 3;
    width: 100%;
  }

  .admin-topline {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .admin-topline h1 {
    font-size: clamp(28px, 8vw, 44px);
  }

  .admin-quick-actions {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-quick-actions a {
    flex: 0 0 auto;
  }

  .admin-grid-two {
    grid-template-columns: 1fr;
  }

  .admin-table article,
  .users-table article,
  .payments-table article,
  .invoice-table article,
  .compact-table article,
  .plan-table article,
  .coupon-table article,
  .helpdesk-table article,
  .webhook-table article,
  .log-table article,
  .notification-table article,
  .audit-table article,
  .sync-table article {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
  }

  .admin-table button,
  .admin-table article a {
    min-height: 40px;
    width: 100%;
  }
}

@media (max-width: 900px) {
  :root {
    --admin-sidebar-width: 0px;
    --admin-sidebar-expanded-width: min(86vw, 320px);
  }

  body.sidebar-collapsed {
    --admin-sidebar-width: 0px;
  }

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

  .admin-mobile-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0 14px;
    background: var(--color-navy);
    color: white;
    box-shadow: var(--shadow-md);
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .admin-app {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: min(86vw, 320px);
    transform: translateX(-104%);
    transition: transform 0.22s ease;
  }

  body.sidebar-collapsed .admin-sidebar,
  body.sidebar-collapsed .admin-sidebar:hover,
  body.sidebar-collapsed .admin-sidebar:focus-within {
    width: min(86vw, 320px);
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) {
    padding: 24px 18px;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-head {
    justify-content: flex-start;
    padding: 0 4px 18px;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-head > div:not(.sidebar-logo),
  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .sidebar-group p,
  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a b {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav {
    margin: 0 -6px;
    padding: 2px 6px 12px;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a {
    justify-content: space-between;
    padding: 5px 10px;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar nav a span {
    justify-content: flex-start;
    gap: 9px;
    width: auto;
    overflow: visible;
    font-size: inherit;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-foot a {
    padding: 0;
    overflow: visible;
    font-size: inherit;
  }

  body.sidebar-collapsed .admin-sidebar:not(:hover):not(:focus-within) .admin-sidebar-foot {
    display: grid;
  }

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

  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: block;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }

  body.sidebar-open .admin-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-workspace {
    margin-left: 0;
    padding: 64px 14px 28px;
  }

  .admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    border-radius: var(--radius-md);
  }

  .admin-topbar,
  .admin-topline,
  .section-row-rich,
  .form-section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-userbox {
    justify-content: space-between;
  }

  .resource-chip-grid,
  .settings-grid.form-grid,
  .admin-kpis,
  .feature-guide,
  .feature-card-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .filter-bar input,
  .filter-bar select,
  .sticky-actions,
  .sticky-actions button {
    width: 100%;
  }

  .admin-table article,
  .users-table article,
  .payments-table article,
  .invoice-table article,
  .compact-table article,
  .plan-table article,
  .coupon-table article,
  .helpdesk-table article,
  .webhook-table article,
  .log-table article,
  .notification-table article,
  .audit-table article,
  .sync-table article {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .section-row {
    gap: 10px;
  }

  .section-row a,
  .admin-quick-actions a,
  .button-secondary,
  .button-ghost {
    width: 100%;
  }

  .sticky-actions {
    margin: 0 -18px -18px;
    padding: 14px 18px;
  }
}

@media (max-width: 420px) {
  .admin-workspace {
    padding-inline: 10px;
  }

  .admin-section {
    padding: 14px;
  }

  .admin-topline h1 {
    font-size: 28px;
  }

  .admin-userbox span {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .crud-toolbar,
  .section-row .crud-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    align-items: stretch;
  }

  .crud-toolbar input,
  .crud-toolbar select,
  .crud-search input,
  .view-switch,
  .crud-pagination {
    width: 100%;
  }

  .view-switch button,
  .crud-pagination button {
    flex: 1 1 0;
  }

  .crud-pagination {
    margin-left: 0;
  }

  .admin-table[data-crud-list],
  .admin-table.view-cards {
    grid-template-columns: 1fr;
  }

  .admin-table[data-crud-list] article,
  .users-table article,
  .payments-table article,
  .invoice-table article,
  .compact-table article,
  .plan-table article,
  .coupon-table article,
  .helpdesk-table article,
  .webhook-table article,
  .log-table article,
  .notification-table article,
  .audit-table article,
  .sync-table article {
    grid-template-columns: 1fr;
    align-content: start;
    border-radius: var(--radius-lg);
    padding: 14px;
    background: white;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions > *,
  .row-actions button {
    flex: 1 1 130px;
  }
}
