/* Account admin board */
.account-admin-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

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

.admin-board-grid {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  align-items: start;
}

.admin-board-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.admin-board-section .table-wrap,
.account-admin-panel .table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto !important;
  overflow-y: auto;
  overscroll-behavior-x: contain;
}

.admin-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.admin-panel-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 340px) minmax(140px, 220px) max-content;
  gap: 8px;
  align-items: end;
  width: 100%;
  max-width: 720px;
  justify-content: start;
}

.admin-inline-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.admin-inline-form label span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 780;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}

.admin-budget-create-form {
  grid-template-columns: minmax(190px, 320px) minmax(160px, 230px) 132px;
  max-width: 700px;
}

.admin-budget-access-form {
  grid-template-columns: minmax(150px, 210px) minmax(150px, 230px) minmax(130px, 170px) max-content;
  max-width: 820px;
}

.admin-inline-form input,
.admin-inline-form select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.admin-status {
  min-height: 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.admin-status:empty {
  display: none;
}

.admin-users-table {
  table-layout: fixed;
  width: 100%;
  min-width: 980px;
  max-width: 100%;
}

.admin-users-table th,
.admin-users-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 34px;
  padding: 5px 8px;
  font-size: 11.6px;
}

.account-admin-panel .table-wrap.side-table,
.enterprise-users-section .table-wrap.side-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.admin-all-users-table th:nth-child(1),
.admin-all-users-table td:nth-child(1),
.admin-user-table th:nth-child(1),
.admin-user-table td:nth-child(1) {
  width: 230px;
  min-width: 230px;
  max-width: 230px;
}

.admin-all-users-table th:nth-child(2),
.admin-all-users-table td:nth-child(2) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.admin-module-cell {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}

.admin-users-table th {
  position: relative;
  overflow: visible;
}

.account-admin-panel .admin-users-table.resizable-table {
  width: 100%;
  max-width: 100% !important;
}

.admin-users-table th {
  color: var(--muted);
  font-weight: 780;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  font-size: 10.8px;
}

.admin-users-table td {
  color: var(--text);
  font-weight: 650;
}

.admin-user-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-user-cell strong,
.admin-user-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-cell strong {
  font-size: 10.8px;
}

.admin-user-cell span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.admin-actions {
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
  text-align: right;
  white-space: nowrap;
  overflow: visible !important;
  text-overflow: clip !important;
}

.admin-users-table th.admin-actions,
.admin-users-table td.admin-actions {
  position: static;
  background: #fff;
  box-shadow: none;
  text-align: right;
}

.admin-users-table th.admin-actions {
  z-index: 4;
  background: #fbfdfd;
}

.admin-users-table .admin-actions .table-action-button {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  margin-left: 0 !important;
}

.admin-enterprise-table th.admin-actions,
.admin-enterprise-table td.admin-actions {
  width: 86px !important;
  min-width: 86px !important;
  max-width: 86px !important;
}

.admin-enterprise-table td.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.superadmin-settings-page {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.superadmin-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.superadmin-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
}

.superadmin-tab.is-active {
  background: rgba(10, 186, 181, 0.08);
}

.superadmin-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 320px) minmax(120px, 170px) max-content;
  gap: 8px;
  align-items: center;
  width: min(100%, 680px);
}

.superadmin-search,
.superadmin-status-filter {
  min-height: 32px !important;
  font-size: 12px !important;
}

.superadmin-section {
  gap: 8px;
  max-width: 100%;
}

.superadmin-section .table-wrap {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

.superadmin-split {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.superadmin-table {
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
}

.superadmin-table th,
.superadmin-table td {
  height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
}

.superadmin-table th {
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.superadmin-table td {
  font-weight: 500;
}

.superadmin-actions {
  width: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
}

.superadmin-actions .table-action-button {
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  margin-left: 2px !important;
}

.superadmin-empty-cell {
  color: var(--muted) !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(10, 186, 181, 0.08);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill.is-suspended,
.status-pill.is-blocked,
.status-pill.is-removed {
  background: rgba(193, 139, 0, 0.12);
}

.status-pill.is-deleted {
  background: rgba(180, 35, 58, 0.1);
}

.superadmin-enterprises-table th:nth-child(1),
.superadmin-enterprises-table td:nth-child(1) { width: 150px; }
.superadmin-enterprises-table th:nth-child(2),
.superadmin-enterprises-table td:nth-child(2) { width: 145px; }
.superadmin-enterprises-table th:nth-child(3),
.superadmin-enterprises-table td:nth-child(3) { width: 118px; }
.superadmin-enterprises-table th:nth-child(4),
.superadmin-enterprises-table td:nth-child(4) { width: 135px; }
.superadmin-enterprises-table th:nth-child(5),
.superadmin-enterprises-table td:nth-child(5) { width: 80px; }
.superadmin-enterprises-table th:nth-child(6),
.superadmin-enterprises-table td:nth-child(6) { width: 105px; }
.superadmin-enterprises-table th:nth-child(7),
.superadmin-enterprises-table td:nth-child(7) { width: 90px; }
.superadmin-enterprises-table th:nth-child(8),
.superadmin-enterprises-table td:nth-child(8) { width: 95px; }

.superadmin-users-table th:nth-child(1),
.superadmin-users-table td:nth-child(1) { width: 170px; }
.superadmin-users-table th:nth-child(2),
.superadmin-users-table td:nth-child(2) { width: 210px; }
.superadmin-users-table th:nth-child(3),
.superadmin-users-table td:nth-child(3) { width: 150px; }
.superadmin-users-table th:nth-child(4),
.superadmin-users-table td:nth-child(4) { width: 95px; }
.superadmin-users-table th:nth-child(5),
.superadmin-users-table td:nth-child(5) { width: 105px; }
.superadmin-users-table th:nth-child(6),
.superadmin-users-table td:nth-child(6) { width: 120px; }

.admin-users-table tr.is-muted-row td {
  color: var(--muted);
}

.admin-budget-table th:nth-child(1),
.admin-budget-table td:nth-child(1) {
  width: auto;
}

.admin-budget-table th:nth-child(2),
.admin-budget-table td:nth-child(2) {
  width: 112px;
}

.admin-budget-table th:nth-child(3),
.admin-budget-table td:nth-child(3) {
  width: 92px;
}

.admin-user-table th:nth-child(1),
.admin-user-table td:nth-child(1) {
  width: auto;
}

.admin-user-table th:nth-child(2),
.admin-user-table td:nth-child(2) {
  width: 112px;
}

.admin-user-table th:nth-child(3),
.admin-user-table td:nth-child(3) {
  width: 92px;
}

.admin-budget-access-table th:nth-child(1),
.admin-budget-access-table td:nth-child(1) {
  width: 28%;
}

.admin-budget-access-table th:nth-child(2),
.admin-budget-access-table td:nth-child(2) {
  width: 112px;
}

.admin-budget-access-table th:nth-child(3),
.admin-budget-access-table td:nth-child(3) {
  width: auto;
}

.admin-member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.admin-member-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
  min-height: 24px;
  padding: 2px 7px 2px 9px;
  border: 1px solid rgba(10, 186, 181, 0.28);
  border-radius: 999px;
  background: rgba(10, 186, 181, 0.08);
  color: var(--text);
  font-size: 10px;
  font-weight: 720;
}

.admin-member-pill strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-member-pill small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
  text-transform: uppercase;
}

.admin-member-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.admin-member-pill button:hover {
  background: rgba(180, 35, 58, 0.1);
  color: #b4233a;
}

.admin-inline-action {
  justify-self: start;
  width: auto;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  justify-content: center;
}

.admin-create-budget-button {
  width: 132px;
  padding-inline: 0;
}

.admin-board-section .primary-button,
.admin-board-section .ghost-button,
.admin-board-section .danger-button,
.admin-board-section .neutral-button {
  box-shadow: none;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.admin-badge-admin { background: #7a5af8; }
.admin-badge-user { background: #0abab5; }
.admin-badge-blocked { background: #b4233a; }

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 35, 34, 0.36);
}

.admin-modal.is-confirm {
  align-items: flex-start;
  padding-top: 168px;
}

.admin-modal-box {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.admin-confirm-box {
  width: min(360px, 100%);
  padding: 16px;
  border-radius: 14px;
}

.admin-confirm-box h3 {
  margin-bottom: 8px;
}

.admin-confirm-box p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.4;
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-modal-box h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 16px;
}

.admin-modal-box label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

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

.admin-modal-box label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.admin-modal-box input,
.admin-modal-box select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.category-name-button {
  width: 100%;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #000;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.category-name-button:hover {
  background: rgba(10, 186, 181, 0.08);
  color: var(--blue-dark);
}

.category-operations-modal {
  width: min(620px, 96vw);
  padding: 14px;
}

.category-operations-head,
.category-operations-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.category-operations-head {
  margin-bottom: 8px;
}

.category-operations-head h3 {
  margin: 0;
}

.category-operations-total {
  margin-bottom: 8px;
  justify-content: flex-start;
}

.category-operations-total span {
  color: var(--muted);
}

.category-operations-summary {
  display: grid;
  grid-template-columns: auto auto auto auto auto auto;
  align-items: center;
  gap: 8px;
}

.category-operations-table-wrap {
  max-height: min(56vh, 520px);
}

.category-operations-table-wrap table th,
.category-operations-table-wrap table td {
  height: 34px !important;
  padding-right: 8px !important;
  padding-left: 8px !important;
  font-size: 14px !important;
}

.category-operations-table-wrap table .category-operation-date-col {
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
}

.category-operations-table-wrap table .category-operation-source-col {
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
}

.category-operations-table-wrap table .category-operation-amount-col {
  width: 104px !important;
  min-width: 104px !important;
  max-width: 104px !important;
}

.admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .admin-inline-form {
    grid-template-columns: 1fr;
  }

  .admin-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .admin-inline-action {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .admin-board-section .table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .admin-users-table {
    min-width: 560px;
    table-layout: fixed;
  }

  .admin-users-table th,
  .admin-users-table td {
    height: 31px;
    padding: 4px 8px;
    font-size: 10px;
  }
}

@media (max-width: 560px) {
  .admin-board-section {
    padding: 10px;
  }

  .admin-panel-heading {
    gap: 10px;
    min-height: 26px;
  }

  .admin-panel-heading h3 {
    font-size: 11px;
  }
}

/* AI admin */
.admin-ai-section {
  max-width: 1040px;
}

.account-ai-panel {
  min-width: 0;
}

.account-ai-panel .ai-admin-content {
  display: grid;
  gap: 12px;
}

.ai-admin-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.ai-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-toolbar select {
  width: auto;
  min-width: 160px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.ai-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.ai-status-line {
  min-height: 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
}

.ai-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(10, 186, 181, 0.08);
  color: var(--blue-dark);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.ai-log-table table {
  min-width: 640px;
}

.ai-log-table th,
.ai-log-table td {
  height: 32px;
  padding: 0 10px;
  font-size: 10.5px;
}

.ai-status-badge.is-ok {
  background: rgba(10, 186, 181, 0.12);
  color: var(--blue-dark);
}

.ai-status-badge.is-error {
  background: rgba(180, 35, 58, 0.1);
  color: #b4233a;
}

.ai-log-counter {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.ai-settings-form {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(220px, 320px) minmax(220px, 1fr) minmax(150px, 210px);
  align-items: end;
  gap: 10px;
  max-width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.ai-settings-form label {
  display: grid;
  gap: 5px;
}

.ai-settings-form label span,
.ai-settings-note {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.ai-settings-form input,
.ai-settings-form select,
.ai-prompt-inline-form input,
.ai-prompt-inline-form select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.admin-module-access-select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-settings-form label.is-disabled {
  opacity: 0.55;
}

.ai-secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.ai-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 8px;
}

.ai-settings-note,
.ai-settings-form .admin-form-actions {
  grid-column: 1 / -1;
}

.ai-settings-note {
  text-transform: none;
  line-height: 1.35;
}

.ai-prompt-table table {
  min-width: 0;
}

.ai-prompt-table th,
.ai-prompt-table td {
  height: 34px;
  padding: 0 10px;
  font-size: 10.5px;
}

.ai-prompt-edit-row td {
  padding: 10px;
  background: #fbfdfd;
}

.ai-prompt-editor {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfd;
}

.ai-prompt-inline-form {
  display: grid;
  gap: 9px;
}

.ai-prompt-inline-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(140px, 220px) auto;
  gap: 9px;
  align-items: end;
}

.ai-prompt-inline-form label {
  display: grid;
  gap: 5px;
}

.ai-prompt-inline-form label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  text-transform: uppercase;
}

.ai-prompt-inline-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  resize: vertical;
}

.ai-inline-check {
  align-self: end;
  padding-bottom: 2px;
}

.ai-modal-box {
  width: min(760px, 100%);
}

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

.ai-prompt-form .ai-wide,
.ai-prompt-form .admin-form-actions,
.ai-prompt-form > button {
  grid-column: 1 / -1;
}

.ai-prompt-form textarea,
.ai-test-result {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfd;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.ai-prompt-form-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.ai-modal-check {
  align-self: end;
  padding-bottom: 8px;
}

.ai-test-result {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

/* Current admin baseline */
.account-admin-panel,
.account-admin-panel * {
  color: #000 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.account-admin-panel button,
.account-admin-panel .table-action-button {
  border-color: rgba(10, 186, 181, 0.1) !important;
  background: rgba(10, 186, 181, 0.045) !important;
  box-shadow: none !important;
  color: #000 !important;
}

.account-admin-panel button *,
.account-admin-panel .table-action-button * {
  color: inherit !important;
}

.account-admin-panel button:hover,
.account-admin-panel button.is-active,
.account-admin-panel .table-action-button:hover,
.account-admin-panel .table-action-button.is-active {
  border-color: rgba(10, 186, 181, 0.16) !important;
  box-shadow: none !important;
  color: #000 !important;
}

.account-admin-panel button:hover,
.account-admin-panel .table-action-button:hover {
  background: rgba(10, 186, 181, 0.08) !important;
}

.account-admin-panel button.is-active,
.account-admin-panel .table-action-button.is-active {
  border-color: rgba(10, 186, 181, 0.2) !important;
  background: rgba(10, 186, 181, 0.1) !important;
}

/* Unified table baseline */
.app table {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  table-layout: fixed !important;
  background: #fff !important;
}

.app :is(.table-wrap, .side-table, .excel-wrap, .dashboard-table-wrap, .dashboard-kpi-table-wrap, .plan-summary-table-wrap, .cashflow-table-wrap, .plan-table-wrap, .accounting-table-wrap, .client-search-table-wrap, .lead-contact-table-wrap, .call-table-wrap, .client-report-table-wrap, .personnel-table-wrap, .account-budget-table, .ai-log-table) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  border: 1px solid rgba(215, 230, 229, 0.7) !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.app table th,
.app table td {
  height: 46px !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-bottom: 0 !important;
  background: #fff !important;
  color: #000 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.25 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-transform: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app table th {
  background: #fbfdfd !important;
  border-bottom: 0 !important;
  font-weight: 650 !important;
}

.app table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 6 !important;
  background: #fbfdfd !important;
}

.app .statement-name-input {
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #000 !important;
  font: inherit !important;
  font-weight: inherit !important;
  box-shadow: none !important;
}

.app .statement-name-input:focus {
  padding: 0 8px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 8px !important;
  background: #fff !important;
  outline: none !important;
}

.app table td.num,
.app table th.num,
.app table td:last-child.num,
.app table th:last-child.num {
  text-align: right !important;
}

.app table tbody tr:last-child td,
.app table tfoot tr:last-child td {
  border-bottom: 0 !important;
}

.app table tbody tr:not(.group-row):hover td {
  background: rgba(10, 186, 181, 0.045) !important;
}

.app table tr.is-selected td {
  background: rgba(10, 186, 181, 0.07) !important;
}

.app table .group-row td,
.app table .category-group-row td {
  height: 38px !important;
  padding: 0 16px !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  background: #fff !important;
  color: #000 !important;
  font-weight: 500 !important;
}

.app table :is(.corner-cell, .select-col, .row-number),
.app table td:has(.row-checkbox),
.app table th:has(.row-checkbox) {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  padding-right: 4px !important;
  padding-left: 4px !important;
  text-align: center !important;
}

.app table :is(.table-action-col, .category-action-col, .admin-actions),
.app table td.plan-actions-cell {
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  padding-right: 4px !important;
  padding-left: 4px !important;
  text-align: right !important;
}

.app table .invoice-file-col,
.app .accounting-table-wrap table th.invoice-file-col,
.app .accounting-table-wrap table td.invoice-file-col {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  padding-right: 4px !important;
  padding-left: 4px !important;
  text-align: center !important;
}

.app table .column-resizer {
  top: 9px !important;
  right: 0 !important;
  z-index: 4 !important;
  width: 10px !important;
  height: calc(100% - 18px) !important;
}

.app table .column-resizer::after {
  display: block !important;
  left: 4px !important;
  width: 2px !important;
  background: transparent !important;
}

.app table th:hover .column-resizer::after,
.app table .column-resizer:hover::after,
body.is-resizing-columns .app table .column-resizer::after {
  background: rgba(10, 186, 181, 0.85) !important;
}

.app .plan-table-wrap table tbody tr:not(.group-row):hover td {
  background: #fff !important;
}

.app table.resizable-table th:not(:last-child),
.app table .resizable-table th:not(:last-child) {
  box-shadow: none !important;
}

.app table td.num.is-diff-good,
.app table .num.is-diff-good {
  color: var(--blue-dark) !important;
}

.app table td.num.is-diff-bad,
.app table .num.is-diff-bad {
  color: var(--red) !important;
}

.app :is(.settings-section, .admin-board-section, .account-settings-section, .category-list-panel, .category-create-panel, .accounting-settings-section)
  :is(.table-wrap, .category-table, .accounting-settings-table-wrap, .account-budget-table) {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Final unified table typography */
.app table th,
.app table td,
.app table th *,
.app table td *,
.app :is(.table-input, .statement-input, .code-select, .table-inline-input, .table-inline-select, .settings-inline-input, .admin-module-access-select, .compact-select, .plan-input) {
  font-family: var(--font-main) !important;
  font-size: 14px !important;
  line-height: 1.08 !important;
  font-weight: 400 !important;
}

.app table th,
.app table th * {
  font-weight: 400 !important;
}

.app table th,
.app table td {
  height: 28px !important;
  min-height: 28px !important;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
}

.app table .group-row td,
.app table .category-group-row td {
  height: 28px !important;
  min-height: 28px !important;
  background: rgba(10, 186, 181, 0.035) !important;
}

/* Budget table final rhythm */
#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table :is(th, td),
#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table :is(th, td) *,
#planningLibrary .category-table :is(th, td),
#planningLibrary .category-table :is(th, td) * {
  font-family: var(--font-main) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.14 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table :is(th, td),
#planningLibrary .category-table :is(th, td) {
  height: 30px !important;
  min-height: 30px !important;
  padding-top: 3px !important;
  padding-bottom: 3px !important;
  vertical-align: middle !important;
}

#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table :is(.group-row, .category-group-row) td,
#planningLibrary .category-table :is(.group-row, .category-group-row) td {
  height: 30px !important;
  min-height: 30px !important;
  background: rgba(10, 186, 181, 0.032) !important;
  color: var(--text) !important;
}

#planning .category-name-button,
#planning .category-name-text,
#planning .table-text,
#planningLibrary .category-name-button,
#planningLibrary .category-name-text,
#planningLibrary .table-text {
  display: block !important;
  min-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.14 !important;
}

#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table .num,
#planning :is(.plan-summary-board, .plan-summary-table-wrap, .plan-table-wrap) table .num *,
#planningLibrary .category-table .num,
#planningLibrary .category-table .num * {
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.14 !important;
  font-variant-numeric: tabular-nums !important;
}

/* Table alignment */
.app table th,
.app table td {
  text-align: left !important;
}

.app table :is(th.num, td.num),
.app table :is(th.amount, td.amount),
.app table :is(th.money, td.money),
.app table :is(th.balance, td.balance),
.app table td:has(.num),
.app table td:has(.money),
.app table td:has(.amount) {
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
  font-feature-settings: "tnum" 1 !important;
}

#planning :is(.plan-summary-board, .plan-summary-table-wrap) table th:not(:first-child),
#planning :is(.plan-summary-board, .plan-summary-table-wrap) table td:not(:first-child),
#planning .plan-table-wrap table th:nth-child(2),
#planning .plan-table-wrap table th:nth-child(3),
#planning .plan-table-wrap table th:nth-child(4),
#planning .plan-table-wrap table td:nth-child(2),
#planning .plan-table-wrap table td:nth-child(3),
#planning .plan-table-wrap table td:nth-child(4) {
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
  font-feature-settings: "tnum" 1 !important;
}

#planning :is(.plan-summary-board, .plan-summary-table-wrap) table th:first-child,
#planning :is(.plan-summary-board, .plan-summary-table-wrap) table td:first-child,
#planning .plan-table-wrap table th:first-child,
#planning .plan-table-wrap table td:first-child,
#planningLibrary .category-table th:first-child,
#planningLibrary .category-table td:first-child {
  text-align: left !important;
}

#planning .plan-table-wrap td.num .plan-input-wrap {
  display: flex !important;
  justify-content: flex-end !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

#planning .plan-table-wrap td.num .plan-input {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-right: 16px !important;
  text-align: right !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

#planning .plan-table-wrap td.num .plan-input-wrap span {
  right: 0 !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.14 !important;
  color: var(--text) !important;
}

#planning .plan-table-wrap td:first-child .category-name-button {
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  text-align: left !important;
}

#planning .plan-table-wrap,
#planning .cashflow-table-wrap,
#statement .excel-wrap {
  height: calc(100dvh - 66px) !important;
  min-height: 616px !important;
}

#statement .excel-wrap {
  max-height: none !important;
}

#planningLibrary {
  height: calc(100dvh - 66px) !important;
  min-height: 616px !important;
}

#planningLibrary .category-list-panel {
  min-height: 616px !important;
}

#planningLibrary .category-table {
  min-height: 0 !important;
}

#planningLibrary .category-table th.category-action-col,
#planningLibrary .category-table td:last-child {
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
  overflow: hidden !important;
  text-align: center !important;
}

#planningLibrary .category-table td:last-child .row-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 4px !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#planningLibrary .category-table td:last-child .table-action-button {
  flex: 0 0 24px !important;
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
}

.app .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app .account-admin-panel .superadmin-section .table-wrap.side-table {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

.company-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.company-admin-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.company-admin-menu-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.company-admin-menu-button:hover,
.company-admin-menu-button.is-active {
  background: rgba(10, 186, 181, 0.08);
}

.company-admin-content,
.company-admin-section {
  min-width: 0;
}

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

.company-admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.company-admin-section-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.company-admin-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.company-admin-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 8px;
}

.company-admin-kpis > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.company-admin-kpis span {
  color: var(--muted);
  font-size: 12px;
}

.company-admin-kpis strong {
  font-size: 16px;
  font-weight: 500;
}

.company-admin-table-wrap {
  max-width: 100%;
  max-height: min(58vh, 520px);
  overflow: auto !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
}

.app .company-admin-layout .company-admin-table-wrap.table-wrap.side-table {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

.company-admin-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.company-admin-table th,
.company-admin-table td {
  height: 32px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 500;
  vertical-align: middle;
}

.company-admin-table th {
  background: #fff;
  color: var(--text);
  font-weight: 500;
}

.company-admin-table .admin-actions {
  width: 64px !important;
  min-width: 64px !important;
  max-width: 64px !important;
}

.company-admin-table .admin-module-access-select,
.company-admin-table .settings-inline-input {
  min-height: 28px !important;
  font-size: 14px !important;
}

.company-admin-users-table th:nth-child(1),
.company-admin-users-table td:nth-child(1) { width: 150px; }
.company-admin-users-table th:nth-child(2),
.company-admin-users-table td:nth-child(2) { width: 170px; }
.company-admin-users-table th:nth-child(3),
.company-admin-users-table td:nth-child(3) { width: 90px; }
.company-admin-users-table th:nth-child(4),
.company-admin-users-table td:nth-child(4),
.company-admin-users-table th:nth-child(5),
.company-admin-users-table td:nth-child(5) { width: 100px; }
.company-admin-users-table th:nth-child(6),
.company-admin-users-table td:nth-child(6),
.company-admin-users-table th:nth-child(7),
.company-admin-users-table td:nth-child(7) { width: 92px; }

.account-enterprise-panel .enterprise-summary {
  display: none !important;
}

@media (max-width: 900px) {
  .company-admin-kpis {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

/* QA admin usability fixes */
.superadmin-tabs,
.company-admin-menu,
.account-tabs,
.account-module-tabs {
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 186, 181, 0.45) rgba(10, 186, 181, 0.08);
}

.account-tab-group {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 4px 0 10px;
  color: rgba(16, 35, 34, 0.62);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.account-tab-module {
  border-left-color: rgba(10, 186, 181, 0.24);
}

.superadmin-tabs::-webkit-scrollbar,
.company-admin-menu::-webkit-scrollbar,
.account-tabs::-webkit-scrollbar,
.account-module-tabs::-webkit-scrollbar {
  height: 8px;
}

.superadmin-tabs::-webkit-scrollbar-track,
.company-admin-menu::-webkit-scrollbar-track,
.account-tabs::-webkit-scrollbar-track,
.account-module-tabs::-webkit-scrollbar-track {
  background: rgba(10, 186, 181, 0.08);
  border-radius: 999px;
}

.superadmin-tabs::-webkit-scrollbar-thumb,
.company-admin-menu::-webkit-scrollbar-thumb,
.account-tabs::-webkit-scrollbar-thumb,
.account-module-tabs::-webkit-scrollbar-thumb {
  background: rgba(10, 186, 181, 0.45);
  border-radius: 999px;
}

.superadmin-tabs,
.company-admin-menu {
  padding-bottom: 8px;
  box-shadow: inset -20px 0 18px -20px rgba(16, 35, 34, 0.35);
}

.superadmin-section .table-wrap {
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior-x: contain;
}

.superadmin-users-table {
  min-width: 880px !important;
}

.superadmin-users-table th:nth-child(1),
.superadmin-users-table td:nth-child(1) {
  width: 190px !important;
}

.superadmin-users-table th:nth-child(2),
.superadmin-users-table td:nth-child(2) {
  width: 230px !important;
}

.superadmin-users-table th:nth-child(3),
.superadmin-users-table td:nth-child(3) {
  width: 160px !important;
}

.superadmin-users-table th:nth-child(4),
.superadmin-users-table td:nth-child(4),
.superadmin-users-table th:nth-child(5),
.superadmin-users-table td:nth-child(5),
.superadmin-users-table th:nth-child(6),
.superadmin-users-table td:nth-child(6) {
  width: 120px !important;
}

.superadmin-table th.admin-actions,
.superadmin-table td.admin-actions {
  position: sticky !important;
  right: 0;
  z-index: 7;
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  background: #fff !important;
  box-shadow: -10px 0 18px -18px rgba(16, 35, 34, 0.45);
}

.superadmin-table thead th.admin-actions {
  z-index: 9;
}

.admin-modal-box {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

.admin-modal-box input[readonly] {
  color: var(--muted);
  background: rgba(10, 186, 181, 0.04);
}

@media (max-width: 700px) {
  .content {
    padding: 14px 10px 28px !important;
  }

  .top-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .top-header-context,
  .top-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-header-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .current-enterprise-name {
    max-width: 100%;
    width: 100%;
    justify-content: center;
  }

  .top-period-control {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    width: 100%;
  }

  .top-period-control .control-label {
    line-height: 1.15;
  }

  .top-period-control .month-button,
  .top-header-actions .export-button,
  .top-account,
  .top-user-button,
  .activity-widget,
  .activity-button {
    width: 100%;
  }

  .top-account {
    justify-content: stretch;
  }

  .top-user-button {
    justify-content: center;
  }

  .planning-tabs,
  .account-tabs,
  .account-module-tabs,
  .superadmin-tabs,
  .company-admin-menu {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .superadmin-settings-page,
  .superadmin-settings-page > *,
  .superadmin-section,
  .superadmin-section > *,
  .account-users-panel,
  .account-users-panel > *,
  .account-admin-panel,
  .account-admin-panel > * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .account-tabs {
    display: flex;
    padding-bottom: 8px;
  }

  .superadmin-table th,
  .superadmin-table td {
    height: 34px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .superadmin-users-table {
    min-width: 760px !important;
  }

  .superadmin-users-table th:nth-child(1),
  .superadmin-users-table td:nth-child(1) {
    width: 140px !important;
  }

  .superadmin-users-table th:nth-child(2),
  .superadmin-users-table td:nth-child(2) {
    width: 190px !important;
  }

  .superadmin-users-table th:nth-child(3),
  .superadmin-users-table td:nth-child(3) {
    width: 130px !important;
  }

  .superadmin-users-table th:nth-child(4),
  .superadmin-users-table td:nth-child(4),
  .superadmin-users-table th:nth-child(5),
  .superadmin-users-table td:nth-child(5),
  .superadmin-users-table th:nth-child(6),
  .superadmin-users-table td:nth-child(6) {
    width: 92px !important;
  }

  .admin-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
