:root {
  --admin-bg: #f7f7f8;
  --admin-panel: #ffffff;
  --admin-border: #ececef;
  --admin-border-soft: rgba(55, 53, 47, 0.1);
  --admin-text: #111214;
  --admin-muted: #60646c;
  --admin-sidebar-soft: #fafafb;
  --admin-accent: #ff8a00;
  --admin-accent-hover: #f58400;
  --admin-accent-weak: rgba(255, 138, 0, 0.12);
  --admin-accent-weak-border: rgba(255, 138, 0, 0.25);
  --admin-accent-soft-border: rgba(255, 138, 0, 0.18);
  --admin-accent-focus: rgba(255, 138, 0, 0.55);
  --admin-accent-contrast: #ffffff;
  --admin-orange: var(--admin-accent);
  --admin-orange-weak: var(--admin-accent-weak);
  --admin-btn-orange: var(--admin-accent);
  --admin-orange-weak-border: var(--admin-accent-weak-border);
  --admin-orange-soft-border: var(--admin-accent-soft-border);
  --admin-orange-focus: var(--admin-accent-focus);
  --admin-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  --admin-board-column-min-height: 180px;
  --r: 10px;
}

html,
body {
  height: 100%;
}

html {
  scrollbar-gutter: auto;
}

body {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-text);
  /* Keep scroll inside the main content area (tabs). Sidebar + topbar stay fixed. */
  overflow: hidden;
}

:where(
  a[href],
  button:not(:disabled),
  [role="button"]:not([aria-disabled="true"]),
  summary,
  label[for],
  select:not(:disabled)
) {
  cursor: pointer;
}

:where(
  a[href],
  button:not(:disabled),
  [role="button"]:not([aria-disabled="true"]),
  summary,
  label[for]
) :where(*) {
  cursor: inherit;
}

.btn {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--admin-border-soft);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-tight);
  box-shadow: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.btn:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.btn-primary {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: var(--admin-accent-contrast);
}

.btn-primary:hover {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
}

.btn-secondary {
  background: #fff;
  border-color: var(--admin-border-soft);
  color: #37352f;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--admin-muted);
}

.btn-danger {
  border-color: rgba(237, 21, 21, 0.25);
  background: rgba(237, 21, 21, 0.08);
  color: #b10f0f;
}

.btn-danger:hover {
  border-color: rgba(237, 21, 21, 0.42);
  background: rgba(237, 21, 21, 0.14);
  color: #9f0d0d;
}

.admin-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
}


.topbar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.topbar-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.topbar-workspace-picker {
  position: relative;
}

.topbar-workspace-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #37352f;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.topbar-workspace-trigger:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.topbar-workspace-trigger[aria-expanded="true"] {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.topbar-workspace-icon,
.topbar-workspace-avatar,
.topbar-workspace-option-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
  border: 1px solid var(--admin-border);
}

.topbar-workspace-avatar {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: inherit;
}

.topbar-workspace-arrow {
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-workspace-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
}

.topbar-workspace-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(55, 53, 47, 0.09);
  background: #fff;
  box-shadow: var(--admin-shadow);
  z-index: 60;
}

.topbar-workspace-popover-list {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.topbar-workspace-option-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-workspace-option {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #37352f;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.topbar-workspace-option:hover {
  background: rgba(55, 53, 47, 0.06);
}

.topbar-workspace-option.is-active {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.topbar-workspace-settings-open-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #37352f;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.topbar-workspace-settings-open-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--admin-muted);
}

.topbar-workspace-settings-open-btn span {
  min-width: 0;
}

.topbar-workspace-settings-open-btn:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.topbar-workspace-create-btn {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #37352f;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.topbar-workspace-create-btn:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.topbar-workspace-create-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.topbar-workspace-option-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-workspace-avatar img,
.topbar-workspace-icon img,
.topbar-workspace-option-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.topbar-workspace-avatar.is-lettermark,
.topbar-workspace-icon.is-lettermark,
.topbar-workspace-option-icon.is-lettermark {
  color: #fff;
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-bold);
}

.topbar-workspace-settings-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #fff;
  color: var(--admin-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.topbar-workspace-settings-btn:hover {
  background: #f5f5f7;
  border-color: rgba(96, 100, 108, 0.35);
  color: var(--admin-text);
}

.topbar-workspace-settings-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}


.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
  background: #ffffff;
  border-right: 1px solid rgba(55, 53, 47, 0.09);
  overflow: auto;
  box-sizing: border-box;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sidebar-name {
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-semibold);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  display: none;
}

.store-label {
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-muted);
}

.store-select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--admin-border);
  background: #fff;
  font-weight: 600;
  color: var(--admin-text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2716%27%20height%3D%2716%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27%2360646c%27%20stroke-width%3D%272%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpolyline%20points%3D%276%209%2012%2015%2018%209%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.nav {
  display: grid;
  gap: 2px;
  margin-top: 0;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-item {
  text-align: left;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: #37352f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-badge {
  display: inline-flex;
  min-width: 16px;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--admin-accent);
  color: var(--admin-accent-contrast);
  font-weight: var(--admin-fw-bold);
  font-size: var(--admin-fs-xs);
  line-height: 1;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.nav-badge[hidden] {
  display: none !important;
}

.nav-item:hover {
  background: rgba(55, 53, 47, 0.06);
}

.nav-item.is-active {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.sidebar-store-picker {
  margin: 0 0 6px;
}

.admin-store-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
}

.admin-store-filter .admin-store-picker-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.admin-store-filter .admin-store-picker-trigger {
  opacity: 1;
  visibility: visible;
}


.sidebar .settings-store-picker {
  position: relative;
  display: grid;
  gap: 6px;
}

.sidebar .settings-store-trigger {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  box-sizing: border-box;
  gap: 8px;
  color: #605e5a;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: var(--admin-lh-tight);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.sidebar .settings-store-trigger:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.sidebar .settings-store-trigger[aria-expanded="true"] {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
  color: #37352f;
}

.sidebar .settings-store-trigger-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 6px;
  border: 1px solid rgba(55, 53, 47, 0.09);
}

.sidebar .settings-store-trigger-name {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: var(--admin-lh-tight);
  color: inherit;
}

.sidebar .settings-store-trigger-arrow {
  width: 16px;
  height: 16px;
  color: rgba(55, 53, 47, 0.65);
}

.sidebar .settings-store-trigger-arrow svg {
  width: 16px;
  height: 16px;
}

.sidebar .settings-store-popover {
  z-index: 40;
  border: 1px solid rgba(55, 53, 47, 0.1);
  border-radius: 10px;
  box-shadow: var(--admin-shadow);
  padding: 8px;
}

.sidebar .settings-store-option {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  gap: 8px;
  background: #fff;
  color: var(--admin-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: var(--admin-lh-normal);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.sidebar .settings-store-option:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.sidebar .settings-store-option.is-active {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
  box-shadow: none;
}

.sidebar .settings-store-option-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 6px;
  border: 1px solid rgba(55, 53, 47, 0.09);
}

.sidebar .settings-store-option-name {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: var(--admin-lh-normal);
}

.sidebar .settings-sidebar-label {
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-muted);
}

.sidebar .topbar-workspace-picker {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0 0 6px;
}

.sidebar .topbar-workspace-trigger {
  width: 100%;
  justify-content: flex-start;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  gap: 8px;
  box-sizing: border-box;
}

.sidebar .topbar-workspace-trigger:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.sidebar .topbar-workspace-trigger[aria-expanded="true"] {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.sidebar .topbar-workspace-icon,
.sidebar .topbar-workspace-avatar {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex: 0 0 20px;
}

.sidebar .topbar-logo {
  width: 20px;
  height: 20px;
}

.sidebar .topbar-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.sidebar .topbar-workspace-arrow {
  margin-left: auto;
  width: 16px;
  height: 16px;
}

.sidebar .topbar-workspace-arrow svg {
  width: 16px;
  height: 16px;
}

.sidebar .topbar-workspace-popover {
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: min(280px, calc(100vw - 24px));
  max-width: min(320px, calc(100vw - 24px));
  z-index: 80;
}

.sidebar .topbar-workspace-popover-list {
  gap: 6px;
}

.sidebar .topbar-workspace-option-row {
  gap: 8px;
}

.sidebar .topbar-workspace-option {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  gap: 8px;
}

.sidebar .topbar-workspace-option-icon,
.sidebar .topbar-workspace-avatar {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.sidebar .topbar-workspace-option-label {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.sidebar .topbar-workspace-settings-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
}

.sidebar .topbar-workspace-settings-btn:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.sidebar .topbar-workspace-settings-btn svg {
  width: 16px;
  height: 16px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(55, 53, 47, 0.09);
  margin: 6px 8px;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 8px;
  border-top: none;
  display: grid;
  gap: 8px;
}

.sidebar-profile-mount {
  width: 100%;
  min-width: 0;
}

.nav-item[hidden],
.sidebar-divider[hidden],
.sidebar-store-picker[hidden],
.sidebar-bottom[hidden],
.is-workspace-hidden {
  display: none !important;
}

.nav-item-secondary {
  width: 100%;
}

.logout-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.logout-btn-icon {
  width: var(--admin-icon-md);
  height: var(--admin-icon-md);
  flex: 0 0 auto;
  display: block;
}

.content {
  grid-column: 2;
  grid-row: 1;
  padding: 18px 18px 28px;
  height: 100vh;
  overflow: auto;
  /* Keep layout aligned across tabs (reserve scrollbar space even when not needed). */
  scrollbar-gutter: stable;
}

/* Login: hide shell chrome and center auth card */

body.is-login .admin-shell {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

body.is-login .sidebar {
  display: none;
}

body.is-login .content {
  grid-column: 1;
  grid-row: 1;
  height: 100vh;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.page-title {
  display: none;
}

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

.content-header.is-compact {
  margin-bottom: 12px;
}

.content-header.is-compact .page-actions {
  display: none;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 32px;
}


.page-actions [data-page-actions] {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-actions .switch {
  align-self: center;
}

.page-actions .btn {
  align-self: center;
}

/* Ensure header action slots never align to the top due to default block layout */
[data-page-actions] {
  display: flex;
  align-items: center;
  gap: 10px;
}

[data-page-actions][hidden] {
  display: none;
}

.admin-hidden-actions[hidden] {
  display: none !important;
}

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

.page-title {
  margin: 0;
  font-size: var(--admin-fs-2xl);
  line-height: var(--admin-lh-tight);
  font-weight: var(--admin-fw-semibold);
}

.page-title:empty {
  display: none;
}

.page-sub {
  display: none;
}

.view {
  display: none;
  gap: 14px;
}

.view.is-active {
  display: grid;
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel {
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  box-shadow: var(--admin-shadow);
  padding: 14px;
  overflow: hidden;
}

.panel-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title {
  margin: 0;
  font-size: var(--admin-fs-lg);
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-tight);
  text-transform: none;
}

.panel-meta {
  font-size: var(--admin-fs-sm);
  color: var(--admin-muted);
  font-weight: var(--admin-fw-medium);
}

.panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-tab-header .panel-h {
  min-height: 32px;
  margin-bottom: 0;
  align-items: center;
  gap: 12px;
}

.admin-tab-header {
  overflow: visible;
}

.admin-tab-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-tab-header-left,
.admin-tab-header-right,
.admin-tab-header .panel-left,
.admin-tab-header .panel-title {
  display: flex;
  align-items: center;
  min-height: 32px;
  min-width: 0;
}

.admin-tab-header-left {
  flex: 1 1 auto;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-tab-header-right {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-left: auto;
  flex-wrap: wrap;
}

.admin-tab-header-left .admin-header-search {
  flex: 0 1 320px;
  width: min(320px, 100%);
  max-width: 100%;
}

.admin-tab-header .panel-title,
.admin-tab-header-title {
  margin: 0;
  font-size: var(--admin-fs-lg);
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-tight);
}

.admin-tab-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  flex-wrap: wrap;
}

.admin-header-menu {
  position: relative;
  flex: 0 0 auto;
}

.admin-header-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
}

.admin-header-menu-trigger-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.admin-header-menu-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 250px;
  padding: 8px;
  border: 1px solid var(--admin-border-soft);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--admin-shadow);
  z-index: 2600;
}

.admin-header-menu-dropdown[hidden] {
  display: none !important;
}

.admin-header-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--admin-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: var(--admin-lh-tight);
  cursor: pointer;
  text-align: left;
}

.admin-header-menu-item:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.admin-tab-header .admin-tabs,
.admin-tab-header .ads-tabs,
.admin-tab-header .finance-tabs {
  margin-bottom: 0;
}

.admin-tab-header :where(.btn, .input, .date-btn, .icon-btn) {
  min-height: 32px;
  box-sizing: border-box;
}

.admin-tab-header .switch {
  align-self: center;
}

.admin-section-head,
.panel-inner > .panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.admin-section-title,
.panel-inner > .panel-h > .panel-title {
  margin: 0;
  font-size: var(--admin-fs-lg);
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-tight);
  color: var(--admin-text);
}

.admin-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-section-body {
  display: grid;
  gap: 8px;
}

.empty {
  color: var(--admin-muted);
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-medium);
  padding: 12px 0 2px;
}

.panel-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-muted);
}

.link:hover {
  color: var(--admin-text);
}

.input {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--admin-border-soft);
  background: #fff;
  min-width: 240px;
  max-height: 32px;
  font-size: 13px;
  font-weight: var(--admin-fw-medium);
  line-height: var(--admin-lh-normal);
  color: #37352f;
  box-shadow: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.input:hover {
  background: rgba(55, 53, 47, 0.02);
  border-color: rgba(55, 53, 47, 0.14);
}

.input:focus {
  outline: none;
  border-color: rgba(55, 53, 47, 0.2);
  background: #fff;
}

.input::placeholder {
  color: rgba(96, 100, 108, 0.9);
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: rgba(17, 18, 20, 0.86);
  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: var(--admin-fw-semibold);
  font-size: var(--admin-fs-md);
  line-height: var(--admin-lh-tight);
  box-shadow: var(--admin-shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.toast.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.admin-popup-x {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--admin-border);
  background: #fff;
  cursor: pointer;
  color: var(--admin-muted);
  font-weight: var(--admin-fw-semibold);
  line-height: 1;
  font-size: var(--admin-fs-xl);
  padding: 0;
}

.admin-popup-x::before {
  content: "×";
}

.admin-popup-x:hover {
  filter: brightness(0.98);
  color: var(--admin-text);
}

.admin-popup-x:focus-visible {
  outline: 2px solid var(--admin-accent-focus);
  outline-offset: 2px;
}

#workspaceSettingsModal {
  z-index: 2050;
}

#workspaceSettingsModal .workspace-settings-modal-card {
  width: min(1100px, calc(100vw - 32px));
  min-width: min(1100px, calc(100vw - 32px));
  max-width: none;
  height: min(762px, calc(100vh - 32px));
  max-height: min(762px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
}

.workspace-settings-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 100%;
}

.workspace-settings-modal-head {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--admin-border);
  background: #fff;
  flex: 0 0 auto;
}

.workspace-settings-modal-subtitle {
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-medium);
  line-height: var(--admin-lh-normal);
}

.workspace-settings-modal-subtitle:empty {
  display: none;
}

#workspaceSettingsModal .modal-body.workspace-settings-modal-body {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  align-items: stretch;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.workspace-settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 12px 10px 12px 12px;
  border-right: 1px solid rgba(55, 53, 47, 0.09);
  background: #fff;
  overflow-y: auto;
  overflow-x: hidden;
}

.workspace-settings-sidebar::before {
  content: "Seções";
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-muted);
}

.workspace-settings-section-btn {
  width: 100%;
  justify-content: flex-start;
}

.workspace-settings-sidebar::before {
  content: none;
}

.workspace-settings-picker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 6px;
}

.workspace-settings-trigger {
  width: 100%;
  justify-content: flex-start;
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-sizing: border-box;
  gap: 8px;
}

.workspace-settings-trigger:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.workspace-settings-trigger[aria-expanded="true"] {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.workspace-settings-trigger-icon,
.workspace-settings-sidebar .topbar-workspace-option-icon,
.workspace-settings-sidebar .topbar-workspace-avatar {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex: 0 0 20px;
}

.workspace-settings-trigger-name,
.workspace-settings-sidebar .topbar-workspace-option-label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.workspace-settings-sidebar .topbar-workspace-arrow {
  margin-left: auto;
  width: 16px;
  height: 16px;
}

.workspace-settings-sidebar .topbar-workspace-arrow svg {
  width: 16px;
  height: 16px;
}

.workspace-settings-sidebar .topbar-workspace-option {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  gap: 8px;
}

.workspace-settings-sidebar .topbar-workspace-create-btn {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.workspace-settings-popover.workspace-settings-dropdown {
  width: var(--workspace-settings-picker-width, min(220px, calc(100vw - 24px)));
  min-width: var(--workspace-settings-picker-width, min(220px, calc(100vw - 24px)));
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px;
}

.workspace-settings-popover {
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  min-width: 0;
  z-index: 80;
}

.workspace-settings-section-btn {
  width: 100%;
  justify-content: flex-start;
}

.workspace-settings-store-area {
  display: grid;
  gap: 2px;
}

.workspace-settings-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: var(--admin-bg);
  align-items: stretch;
}

.workspace-settings-panel {
  display: none;
  min-width: 0;
  min-height: 0;
}

.workspace-settings-panel.is-active {
  display: grid;
  gap: 14px;
  align-content: start;
  height: 100%;
  min-height: 0;
}

.workspace-settings-panel[hidden] {
  display: none !important;
}

.workspace-settings-panel-card {
  display: grid;
  gap: 14px;
  align-content: start;
  justify-items: stretch;
  width: 100%;
  max-width: none;
  padding: 14px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--admin-shadow);
}

.workspace-settings-panel-card > * {
  width: 100%;
  min-width: 0;
}

.workspace-settings-panel .admin-field {
  width: 100%;
  min-width: 0;
}

.workspace-settings-panel .admin-field-control {
  width: 100%;
}

.workspace-settings-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  width: 100%;
}

.workspace-settings-panel[data-workspace-settings-panel="modules"] .workspace-settings-panel-card {
  width: 100%;
}

.workspace-store-settings-panel.is-active {
  height: 100%;
  align-content: stretch;
}

.workspace-store-settings-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

#workspaceSettingsModal .modal-actions {
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--admin-border);
  background: #fff;
  flex: 0 0 auto;
}

.workspace-settings-shell .modal-f,
.workspace-settings-shell .modal-actions {
  margin-top: auto;
  flex: 0 0 auto;
}

.workspace-settings-modules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

.workspace-settings-module-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.workspace-settings-module-option:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.workspace-settings-module-option.is-active {
  background: rgba(55, 53, 47, 0.08);
  border-color: transparent;
}

.workspace-settings-module-option span {
  font-size: var(--admin-fs-md);
  font-weight: 500;
  color: #37352f;
}

.table {
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  overflow: hidden;
  background: #fff;
}

.t-head,
.t-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.9fr 0.7fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.t-head {
  background: #f5f5f7;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-muted);
  font-weight: var(--admin-fw-semibold);
  font-size: var(--admin-fs-sm);
  line-height: var(--admin-lh-tight);
}

.t-row {
  border-bottom: 1px solid var(--admin-border);
}

.t-row:last-child {
  border-bottom: none;
}

.t-main {
  display: grid;
  gap: 2px;
}

.t-title {
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-normal);
}

.t-sub {
  font-size: var(--admin-fs-sm);
  color: var(--admin-muted);
  font-weight: var(--admin-fw-medium);
  line-height: var(--admin-lh-normal);
}

.t-right {
  justify-self: end;
  text-align: right;
}

@media (max-width: 980px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  #workspaceSettingsModal .workspace-settings-modal-card {
    width: min(100vw - 20px, 1100px);
    min-width: min(100vw - 20px, 1100px);
    height: min(762px, calc(100vh - 20px));
    max-height: min(762px, calc(100vh - 20px));
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    grid-column: 1;
    grid-row: 1;
    border-right: none;
    border-bottom: 1px solid rgba(55, 53, 47, 0.09);
    overflow: visible;
  }

  .content {
    grid-column: 1;
    grid-row: 2;
    padding: 14px;
    height: auto;
    overflow: visible;
  }

  .input {
    min-width: 0;
    width: 100%;
  }

  .t-head,
  .t-row {
    grid-template-columns: 1.6fr 0.9fr 0.7fr;
  }

  .t-head > :nth-child(3),
  .t-row > :nth-child(3) {
    display: none;
  }

  .workspace-settings-modules {
    grid-template-columns: 1fr;
  }

  .workspace-settings-modal-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .workspace-settings-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 16px 16px 14px;
    border-right: none;
    border-bottom: 1px solid var(--admin-border);
  }

  .workspace-settings-sidebar::before {
    content: none;
  }

  .workspace-settings-picker {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .workspace-settings-content {
    padding: 16px;
  }
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  color: rgba(55, 53, 47, 0.72);
}

.nav-icon-slot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item.is-active .nav-icon,
.nav-group.is-active-group > .nav-item .nav-icon {
  color: #37352f;
}

.nav-text {
  flex: 1;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ensure the close icon renders even if file encoding glitches. */
.admin-popup-x::before {
  content: "\00D7";
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--admin-border);
}

.admin-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-pagination-btn {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--admin-border-soft);
  border-radius: 8px;
  background: #fff;
  color: #37352f;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.admin-pagination-btn:hover:not(:disabled) {
  background: rgba(55, 53, 47, 0.06);
  border-color: transparent;
}

.admin-pagination-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.admin-pagination-btn.is-active {
  border-color: var(--admin-accent);
  background: var(--admin-accent);
  color: var(--admin-accent-contrast);
}

.admin-pagination-ellipsis {
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 0 2px;
}

.admin-pagination-info {
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}
