:root {
  --accent: #f54c00;
  --accent-dark: #d94300;
  --black: #000000;
  --white: #ffffff;
  --ink: #151515;
  --muted: #696969;
  --soft: #f7f7f7;
  --line: #dedede;
  --line-strong: #c9c9c9;
  --success: #187c31;
  --success-bg: #eef9f0;
  --danger: #c52d2d;
  --danger-bg: #fff1f1;
  --sidebar-width: 264px;
  --topbar-height: 66px;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --font-body: 17px;
  --font-callout: 16px;
  --font-subheadline: 15px;
  --font-table: 14px;
  --font-footnote: 13px;
  --font-caption: 12px;
  --font-caption-small: 11px;
  --scrollbar-track: #f1f1f1;
  --scrollbar-thumb: #b8b8b8;
  --scrollbar-thumb-hover: #929292;
  --shadow-modal: 0 24px 70px rgba(0, 0, 0, .2), 0 3px 10px rgba(0, 0, 0, .08);
  --ease: 180ms ease;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  min-width: 40px;
  min-height: 40px;
  border: 2px solid var(--scrollbar-track);
  border-radius: 999px;
  background: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

html {
  min-height: 100%;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
  color-scheme: light;
  background: var(--white);
  font-family: "Almarai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-body);
}

body {
  width: 100%;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  margin: 0;
  color: var(--ink);
  background: var(--white);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.splash-active {
  overflow: hidden;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--white);
  background: var(--black);
  opacity: 1;
  visibility: visible;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.app-splash.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-splash-content {
  display: grid;
  width: min(300px, 74vw);
  place-items: center;
  gap: 26px;
  text-align: center;
  transform: translateY(0) scale(1);
  transition: transform 280ms ease;
}

.app-splash.is-leaving .app-splash-content {
  transform: translateY(-4px) scale(.985);
}

.app-splash-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.app-splash-loading {
  display: grid;
  place-items: center;
  gap: 11px;
  color: #b7b7b7;
  font-size: var(--font-footnote);
}

.app-splash .spinner {
  width: 25px;
  height: 25px;
  border-color: rgba(255, 255, 255, .22);
  border-top-color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline: none;
}

:focus-visible {
  outline: 3px solid rgba(245, 76, 0, .26);
  outline-offset: 2px;
}

button {
  color: inherit;
}

.app-shell {
  max-width: 100%;
  overflow-x: clip;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: hidden;
  color: #f6f6f6;
  background: var(--black);
  transition: transform 220ms ease;
}

.sidebar-head {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  padding-top: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-link {
  display: flex;
  width: 100%;
  max-width: 184px;
  align-items: center;
  justify-content: center;
}

.sidebar-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 44px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 12px 28px;
  scrollbar-width: thin;
  scrollbar-color: #444 transparent;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  border-color: var(--black);
  background: #444;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

.nav-group {
  margin-bottom: 14px;
}

.nav-standalone {
  margin-bottom: 14px;
}

.nav-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  padding: 11px 12px 9px;
  color: #9f9f9f;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-group-toggle svg {
  width: 15px;
  transition: transform var(--ease);
}

.nav-group.is-open .nav-group-toggle svg {
  transform: rotate(180deg);
}

.nav-group-items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--ease);
}

.nav-group-items > div {
  overflow: hidden;
}

.nav-group.is-open .nav-group-items {
  grid-template-rows: 1fr;
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  margin: 3px 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ededed;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color var(--ease), background var(--ease);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #c7c7c7;
}

.nav-link:hover {
  background: #171717;
}

.nav-link.is-active {
  color: var(--accent);
  background: #1d1d1d;
  font-weight: 700;
}

.nav-link.is-active::before {
  position: absolute;
  inset: 8px auto 8px -12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  content: "";
}

.nav-link.is-active svg {
  color: var(--accent);
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  margin-left: var(--sidebar-width);
  background: var(--white);
  transition: margin-left 220ms ease;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

body.sidebar-collapsed .workspace {
  margin-left: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  gap: 18px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(12px);
}

.menu-button {
  display: inline-grid;
}

.breadcrumbs {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs svg {
  width: 14px;
  color: #a2a2a2;
}

.topbar-account {
  position: relative;
  flex: 0 0 auto;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 5px 7px;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background var(--ease);
}

.topbar-user:hover,
.topbar-user[aria-expanded="true"] {
  background: #f3f3f3;
}

.realtime-status {
  display: inline-flex;
  min-width: 84px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  font-size: 9px;
  font-weight: 700;
}

.realtime-status[hidden] {
  display: none;
}

.realtime-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9a9a9a;
}

.realtime-status[data-state="live"] {
  border-color: #cce8d1;
  color: var(--success);
  background: var(--success-bg);
}

.realtime-status[data-state="live"] .realtime-dot {
  background: #24943d;
  box-shadow: 0 0 0 3px rgba(36, 148, 61, .12);
}

.realtime-status[data-state="connecting"] .realtime-dot,
.realtime-status[data-state="reconnecting"] .realtime-dot {
  background: var(--accent);
  animation: realtime-pulse 1.1s ease-in-out infinite;
}

@keyframes realtime-pulse {
  50% { opacity: .35; transform: scale(.8); }
}

.topbar-user-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
  text-align: left;
}

.topbar-user strong,
.account-menu-profile strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user small,
.account-menu-profile small {
  color: var(--muted);
  font-size: 10px;
}

.account-menu-chevron {
  display: inline-grid;
  width: 16px;
  place-items: center;
  color: var(--muted);
  transition: transform var(--ease);
}

.account-menu-chevron svg {
  width: 14px;
}

.topbar-user[aria-expanded="true"] .account-menu-chevron {
  transform: rotate(180deg);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  width: min(280px, calc(100vw - 30px));
  border: 1px solid var(--line);
  padding: 7px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .16), 0 2px 7px rgba(0, 0, 0, .08);
  animation: account-menu-in 150ms ease both;
}

.account-menu[hidden] {
  display: none;
}

@keyframes account-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(.985); }
}

.account-menu-profile {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px;
}

.account-menu-profile > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-menu-divider {
  height: 1px;
  margin: 5px 0;
  background: var(--line);
}

.account-menu-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 9px 10px;
  border-radius: 7px;
  color: #b3261e;
  background: transparent;
  font-size: var(--font-table);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--ease);
}

.account-menu-item:hover {
  background: #fff1ef;
}

.account-menu-item:disabled {
  cursor: wait;
  opacity: .6;
}

.account-menu-item svg {
  width: 18px;
  height: 18px;
}

.avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--black);
  font-size: 11px;
  font-weight: 800;
}

.avatar-soft {
  color: #59200b;
  background: #ffe3d7;
}

.avatar-has-image {
  overflow: hidden;
  color: transparent;
  background: #ececec;
}

.avatar-has-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.main-content {
  display: flex;
  min-width: 0;
  width: 100%;
  min-height: calc(100vh - var(--topbar-height));
  overflow-x: clip;
  max-width: none;
  flex-direction: column;
  margin: 0 auto;
  padding: 0;
}

#resource-area {
  display: flex;
  min-width: 0;
  width: 100%;
  min-height: 0;
  max-width: 100%;
  overflow-x: clip;
  flex: 1;
  flex-direction: column;
  padding-bottom: 57px;
}

.page-loading {
  display: flex;
  min-height: 62vh;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.main-content.has-page-status,
#resource-area.has-page-status {
  height: calc(100vh - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
}

#resource-area.has-page-status {
  padding-bottom: 0;
}

.page-status {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px 15px;
  color: var(--muted);
  text-align: center;
}

.page-status.page-loading {
  min-height: 0;
}

.page-status .spinner {
  width: 26px;
  height: 26px;
}

.page-status svg {
  width: 32px;
  height: 32px;
  color: #999;
}

.page-status strong {
  color: #333;
  font-size: var(--font-subheadline);
}

.page-status > span:last-child {
  max-width: 420px;
  font-size: var(--font-footnote);
}

.page-error-state .button {
  margin-top: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e1e1e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .72s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--white);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), color var(--ease), transform var(--ease), box-shadow var(--ease);
}

.button:hover {
  border-color: #a5a5a5;
  background: #fafafa;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-primary {
  border-color: var(--accent);
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(245, 76, 0, .16);
}

.button-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button-danger {
  border-color: #ffd1d1;
  color: var(--danger);
  background: var(--danger-bg);
}

.button-full {
  width: 100%;
}

.button[hidden] {
  display: none;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 15px 15px 15px;
}

.table-search {
  width: min(560px, 100%);
  min-width: 0;
}

.search-control {
  position: relative;
}

.resource-search-button {
  position: absolute;
  top: 50%;
  right: 4px;
  display: inline-grid;
  width: 38px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  transform: translateY(-50%);
  color: var(--white);
  background: var(--accent);
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
}

.resource-search-button:hover {
  background: var(--accent-dark);
}

.resource-search-button:active {
  transform: translateY(-50%) scale(.97);
}

.resource-search-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .2);
}

.resource-search-button svg {
  width: 18px;
  height: 18px;
}

.table-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 52px 10px 12px;
  color: var(--ink);
  background: var(--white);
  font-size: 13px;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.table-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .12);
  outline: 0;
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.table-toolbar-actions .button.is-active {
  border-color: #ffc7ad;
  color: var(--accent-dark);
  background: #fff3ed;
}

.filter-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 999px;
  color: var(--white);
  background: var(--accent);
  font-size: 9px;
  font-weight: 800;
}

.control,
.field input,
.field select,
.field textarea,
.filter-row input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--white);
  font-size: 13px;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.field input,
.field select,
.field textarea,
.filter-row input {
  padding: 10px 12px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .12);
}

.select2-container {
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 13px;
}

select.select2-hidden-accessible + .select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 40px;
  padding-left: 12px;
  color: var(--ink);
  line-height: 40px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #777;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 0;
  right: 8px;
  height: 40px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .12);
}

.select2-container--default.select2-container--open .select2-selection--single {
  border-radius: var(--radius-sm);
}

.select2-dropdown {
  z-index: 115;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .14);
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 12px;
}

.select2-search--dropdown {
  padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .12);
  outline: 0;
}

.select2-results__option {
  padding: 9px 12px;
}

.select2-container--default .select2-results__option--selected {
  color: var(--ink);
  background: #fff1eb;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  color: var(--white);
  background: var(--accent);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

#resource-area.is-tree-resource {
  padding-bottom: 0;
}

.account-tree-frame {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-top: 1px solid var(--line);
  background: var(--white);
  -webkit-overflow-scrolling: touch;
}

.account-tree {
  min-width: 980px;
  color: var(--ink);
  font-size: var(--font-table);
}

.account-tree-head,
.account-tree-row {
  display: grid;
  grid-template-columns: var(--tree-grid-columns, minmax(380px, 2fr) minmax(130px, .7fr) minmax(145px, .72fr) minmax(150px, .78fr) minmax(110px, .55fr) 108px);
  align-items: center;
}

.account-tree.no-actions .account-tree-head,
.account-tree.no-actions .account-tree-row {
  grid-template-columns: var(--tree-grid-columns, minmax(420px, 2fr) minmax(140px, .7fr) minmax(150px, .72fr) minmax(160px, .78fr) minmax(120px, .55fr));
}

.account-tree-head {
  position: relative;
  z-index: 12;
  min-height: 52px;
  color: #383838;
  background: #f1f1f1;
  font-size: var(--font-footnote);
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 1px 0 var(--line);
}

.sticky-account-tree-header {
  position: fixed;
  z-index: 24;
  visibility: hidden;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #f1f1f1;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .06);
  opacity: 0;
  pointer-events: none;
}

.sticky-account-tree-header.is-visible {
  visibility: visible;
  opacity: 1;
}

.sticky-account-tree-header-scroll {
  overflow: hidden;
}

.sticky-account-tree-header .account-tree-head {
  position: static;
}

.account-tree-head > span {
  padding: 10px 15px;
}

.account-tree-head > span:last-child {
  text-align: center;
}

.account-tree-row {
  min-height: 52px;
  border-bottom: 1px solid #e8e8e8;
  background: var(--white);
  transition: background var(--ease);
}

.account-tree-row:hover {
  background: #fcfcfc;
}

.account-tree-row.is-group {
  font-weight: 700;
}

.account-tree-row[aria-level="1"] {
  background: #fafafa;
  box-shadow: inset 3px 0 0 transparent;
}

.account-tree-row[aria-level="1"]:hover,
.account-tree-row[aria-level="1"].is-expanded {
  background: #f7f7f7;
  box-shadow: inset 3px 0 0 var(--accent);
}

.account-tree-row.is-context .account-tree-name {
  color: #555;
}

.account-tree-account {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px var(--tree-indent, 15px);
}

.account-tree-toggle,
.account-tree-toggle-spacer {
  display: inline-grid;
  width: 26px;
  height: 30px;
  flex: 0 0 26px;
  place-items: center;
}

.account-tree-toggle {
  border: 0;
  border-radius: 6px;
  color: #555;
  background: transparent;
  cursor: pointer;
}

.account-tree-toggle:hover {
  color: var(--accent);
  background: #fff1eb;
}

.account-tree-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--ease);
}

.account-tree-row.is-expanded > .account-tree-account .account-tree-toggle svg {
  transform: rotate(90deg);
}

.account-tree-kind {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  color: #545454;
}

.account-tree-row.is-group .account-tree-kind {
  color: var(--accent);
}

.account-tree-kind svg {
  width: 19px;
  height: 19px;
}

.item-group-tree-image-trigger {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 7px;
  cursor: zoom-in;
}

.item-group-tree-image {
  display: block;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
}

.item-group-tree-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-tree-code {
  min-width: 54px;
  flex: 0 0 auto;
  color: #3f3f3f;
  font-size: var(--font-footnote);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.account-tree-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tree-value,
.account-tree-balance,
.account-tree-status,
.account-tree-actions {
  min-width: 0;
  padding: 7px 15px;
}

.account-tree-value {
  display: grid;
  gap: 2px;
}

.account-tree-value small,
.account-tree-balance small {
  color: var(--muted);
  font-size: var(--font-caption-small);
  font-weight: 500;
}

.account-tree-balance {
  color: #303030;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.account-tree-status {
  white-space: nowrap;
}

.account-tree-actions {
  border-left: 1px solid var(--line);
}

#resource-area.is-tree-resource.is-empty-resource .account-tree-frame.is-empty-tree {
  display: grid;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  flex: 1 1 auto;
  place-items: center;
}

.account-tree-empty {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px 15px;
  color: var(--muted);
  text-align: center;
}

.account-tree-empty svg {
  width: 30px;
  color: #999;
}

.account-tree-empty strong {
  color: #333;
  font-size: var(--font-subheadline);
}

.account-tree-empty span {
  max-width: 420px;
  font-size: var(--font-footnote);
}

.table-frame {
  position: relative;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
}

#resource-area.is-empty-resource {
  overflow: hidden;
}

#resource-area.is-empty-resource .table-frame.is-empty-table {
  display: grid;
  min-width: 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  flex: 1 1 auto;
  place-items: center;
}

.table-empty-state {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px 15px;
  color: var(--muted);
  text-align: center;
}

.table-empty-state svg {
  width: 32px;
  height: 32px;
  color: #999;
}

.table-empty-state strong {
  color: #333;
  font-size: var(--font-subheadline);
}

.table-empty-state span {
  max-width: 420px;
  font-size: var(--font-footnote);
}

.sticky-table-header {
  position: fixed;
  z-index: 24;
  visibility: hidden;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .06);
  opacity: 0;
  pointer-events: none;
}

.sticky-table-header.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.sticky-table-header-scroll {
  overflow: hidden;
}

.sticky-table-header .data-table th {
  position: static;
}

.sticky-table-header .data-table {
  table-layout: fixed;
}

.sticky-table-header .data-table .actions-head {
  position: sticky;
}

.table-scroll,
.permission-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #b5b5b5 #efefef;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e8e8e8;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  z-index: 3;
  height: 52px;
  padding: 10px 14px;
  color: #383838;
  background: #f1f1f1;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table td {
  height: 47px;
  padding: 7px 20px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fcfcfc;
}

.table-grid-row {
  pointer-events: none;
  user-select: none;
}

.data-table tbody .table-grid-row td,
.data-table tbody .table-grid-row:hover td,
.data-table tbody .table-grid-row:hover .actions-cell {
  height: var(--table-grid-row-height, 47px);
  color: transparent;
  background: var(--white);
}

.data-table .actions-cell,
.data-table .actions-head {
  position: sticky;
  right: 0;
  z-index: 5;
  width: 116px;
  min-width: 116px;
  border-left: 1px solid var(--line);
  text-align: center;
  background: var(--white);
  box-shadow: -7px 0 14px rgba(0, 0, 0, .035);
}

.data-table .actions-head {
  z-index: 8;
  background: #f1f1f1;
}

.data-table tbody tr:hover .actions-cell {
  background: #fcfcfc;
}

.sort-button {
  display: flex;
  width: calc(100% + 16px);
  min-height: 34px;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  border: 0;
  margin: -5px -8px;
  padding: 5px 15px;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.sort-button:hover {
  background: #f1f1f1;
}

.sort-button.is-active {
  color: var(--accent-dark);
}

.sort-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sort-indicator {
  display: inline-grid;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent);
}

.sort-indicator svg {
  width: 12px;
  height: 12px;
}

.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-cell strong {
  font-size: 12px;
}

.cell-muted {
  display: inline-block;
  max-width: 250px;
  overflow: hidden;
  color: #535353;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d5d5d5;
  padding: 5px 9px;
  border-radius: 6px;
  color: #525252;
  background: #f7f7f7;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5e5e5e;
  content: "";
}

.status-active {
  border-color: #cce8d1;
  color: var(--success);
  background: var(--success-bg);
}

.status-active::before {
  background: #24943d;
}

.status-present,
.status-approved,
.status-paid {
  border-color: #cce8d1;
  color: var(--success);
  background: var(--success-bg);
}

.status-present::before,
.status-approved::before,
.status-paid::before {
  background: #24943d;
}

.status-pending,
.status-leave,
.status-half_day {
  border-color: #b9d7f4;
  color: #145b99;
  background: #edf6ff;
}

.status-pending::before,
.status-leave::before,
.status-half_day::before {
  background: #287fc5;
}

.status-absent,
.status-rejected {
  border-color: #efc7c7;
  color: #a32929;
  background: #fff0f0;
}

.status-absent::before,
.status-rejected::before {
  background: #c53c3c;
}

.status-draft {
  border-color: #d8d8d8;
  color: #555;
  background: #f5f5f5;
}

.status-submitted {
  border-color: #b9d7f4;
  color: #145b99;
  background: #edf6ff;
}

.status-submitted::before {
  background: #287fc5;
}

.status-cancelled {
  border-color: #efc7c7;
  color: #a32929;
  background: #fff0f0;
}

.status-cancelled::before {
  background: #c53c3c;
}

.money-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.money-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.timestamp {
  border-bottom: 1px dotted #9a9a9a;
  color: #414141;
  cursor: help;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.icon-button,
.row-action {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.row-action {
  color: #666;
}

.row-action:hover {
  color: var(--accent);
  background: #fff1eb;
}

.row-action.is-danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.row-action:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.row-action svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.empty-state svg {
  width: 28px;
  color: #999;
}

.empty-state strong {
  color: #333;
  font-size: 13px;
}

.table-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: var(--sidebar-width);
  z-index: 20;
  display: flex;
  width: min(1580px, calc(100vw - var(--sidebar-width)));
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-inline: auto;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .035);
  font-size: 11px;
  transform: none;
  backdrop-filter: blur(12px);
}

body.sidebar-collapsed .table-footer {
  left: 0;
  width: min(1580px, 100vw);
}

.table-footer-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.page-button {
  display: inline-grid;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #333;
  background: var(--white);
  font-size: 11px;
  cursor: pointer;
}

.page-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-button.is-current {
  border-color: var(--accent);
  color: var(--white);
  background: var(--accent);
}

.page-button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.page-button svg {
  width: 15px;
}

.page-limit {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-limit select {
  width: 74px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: var(--white);
  font-size: 11px;
}

.page-limit .select2-container {
  width: 74px !important;
  font-size: 11px;
}

.page-limit .select2-container--default .select2-selection--single {
  height: 36px;
  border-color: var(--line);
  border-radius: 6px;
}

.page-limit .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 28px;
  padding-left: 9px;
  line-height: 34px;
}

.page-limit .select2-container--default .select2-selection--single .select2-selection__arrow {
  right: 3px;
  height: 34px;
}

#image-lightbox-root:empty {
  display: none;
}

.image-lightbox-trigger {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
}

.image-lightbox-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 92%);
  animation: fade-in 150ms ease both;
}

.image-lightbox-dialog {
  position: relative;
  display: grid;
  width: 80vw;
  height: 80vh;
  max-width: 1400px;
  max-height: 1000px;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 14px;
  background: #090909;
  box-shadow: 0 28px 80px rgb(0 0 0 / 55%);
}

.image-lightbox-dialog.is-shaking {
  animation: image-lightbox-shake 260ms ease both;
}

@keyframes image-lightbox-shake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.image-lightbox-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
}

.image-lightbox-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 140ms ease;
}

.image-lightbox-stage.is-loaded .image-lightbox-image {
  opacity: 1;
}

.image-lightbox-loading,
.image-lightbox-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  color: #d8d8d8;
  font-size: var(--font-footnote);
  text-align: center;
}

.image-lightbox-loading .spinner {
  border-color: rgb(255 255 255 / 30%);
  border-top-color: var(--accent);
}

.image-lightbox-stage.is-loaded .image-lightbox-loading,
.image-lightbox-stage.has-error .image-lightbox-loading,
.image-lightbox-error[hidden] {
  display: none;
}

.image-lightbox-caption {
  overflow: hidden;
  padding: 11px 56px 12px 15px;
  color: #f3f3f3;
  background: #151515;
  font-size: var(--font-footnote);
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-close {
  position: absolute;
  right: 12px;
  bottom: 7px;
  z-index: 2;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: rgb(255 255 255 / 12%);
  cursor: pointer;
}

.image-lightbox-close:hover,
.image-lightbox-close:focus-visible {
  background: var(--accent);
  outline: 0;
}

.image-lightbox-close svg {
  width: 18px;
  height: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px;
  background: rgb(0 0 0 / 76%);
  animation: fade-in 150ms ease both;
}

.modal {
  width: min(900px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid #d9d9d9;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-modal);
  animation: modal-in 180ms ease both;
}

.modal-large {
  width: min(1120px, 100%);
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(9px) scale(.986); }
}

.modal.modal-settled {
  animation: none;
}

.modal.modal-shake {
  animation: modal-shake 420ms cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes modal-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--accent-dark);
  color: var(--white);
  background: var(--accent);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.02em;
}

.modal-close {
  flex: 0 0 auto;
  color: var(--white);
}

.modal-close:hover {
  color: var(--white);
  background: rgba(255, 255, 255, .16);
}

.modal-body {
  max-height: calc(100vh - 205px);
  overflow-y: auto;
  padding: 20px 22px;
}

.modal-body.has-modal-tabs {
  padding-top: 0;
}

.modal-body.has-modal-tabs > .record-change-alert:not([hidden]) {
  margin-top: 14px;
}

.modal-tabs-sticky {
  position: sticky;
  top: 0;
  z-index: 14;
  margin: 0 -22px 20px;
  padding: 4px 22px 0;
  border-bottom: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 4px 10px rgb(0 0 0 / 4%);
}

.modal-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  margin: 0;
  scrollbar-width: none;
}

.modal-tabs::-webkit-scrollbar {
  display: none;
}

.modal-tab {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 9px 13px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: var(--font-footnote);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.modal-tab::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  content: "";
}

.modal-tab:hover {
  color: var(--ink);
  background: #fafafa;
}

.modal-tab.is-active {
  color: var(--accent-dark);
}

.modal-tab.is-active::after {
  background: var(--accent);
}

.modal-tab:focus-visible {
  outline: 2px solid rgba(245, 76, 0, .28);
  outline-offset: -2px;
}

.modal-tab svg {
  width: 16px;
  height: 16px;
}

.modal-tab-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #555;
  background: #e9e9e9;
  font-size: var(--font-caption-small);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color var(--ease), background var(--ease);
}

.modal-tab-count[hidden] {
  display: none;
}

.modal-tab.is-active .modal-tab-count {
  color: var(--white);
  background: var(--accent);
}

.modal-tab-panel[hidden] {
  display: none;
}

.attachments-layout {
  display: grid;
  gap: 16px;
}

.attachment-uploader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.attachment-uploader-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.attachment-uploader-copy strong {
  color: var(--ink);
  font-size: var(--font-footnote);
}

.attachment-uploader-copy span {
  color: var(--muted);
  font-size: var(--font-caption);
}

.attachment-uploader .button svg {
  width: 16px;
  height: 16px;
}

.attachment-uploader .button.is-loading {
  opacity: .6;
  pointer-events: none;
}

.attachment-error-message {
  grid-column: 1 / -1;
  min-height: 0;
  color: var(--danger);
  font-size: var(--font-caption);
}

.attachment-error-message:empty {
  display: none;
}

.attachment-list {
  display: grid;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  list-style: none;
}

.attachment-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
}

.attachment-item:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.attachment-file-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-dark);
  background: #fff1e9;
}

.attachment-file-icon svg {
  width: 18px;
  height: 18px;
}

.attachment-image-trigger {
  cursor: zoom-in;
  transition: color var(--ease), background var(--ease), transform var(--ease);
}

.attachment-image-trigger:hover {
  color: var(--white);
  background: var(--accent);
  transform: scale(1.04);
}

.attachment-content {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.attachment-name {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: var(--font-footnote);
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.attachment-name-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.attachment-preview-name {
  min-width: 0;
  color: var(--ink);
  cursor: zoom-in;
  text-align: left;
}

.attachment-preview-name:hover {
  color: var(--accent-dark);
}

.attachment-inline-download {
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
}

.attachment-inline-download:hover {
  color: var(--accent-dark);
  background: #fff1e9;
}

.attachment-inline-download svg {
  width: 14px;
  height: 14px;
}

.attachment-name:hover {
  color: var(--accent-dark);
}

.attachment-name svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.attachment-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--muted);
  font-size: var(--font-caption);
}

.attachment-meta > span:not(:last-child)::after {
  margin-left: 10px;
  color: #b3b3b3;
  content: "·";
}

.attachment-delete {
  color: var(--muted);
}

.attachments-read-only,
.attachments-limit-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-caption);
}

.attachments-empty,
.attachments-error,
.attachments-pending {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.attachments-empty svg {
  width: 30px;
  height: 30px;
  color: #a5a5a5;
}

.attachments-empty strong,
.attachments-error strong {
  color: var(--ink);
  font-size: var(--font-subheadline);
}

.attachments-empty span,
.attachments-error span,
.attachments-pending span {
  font-size: var(--font-footnote);
}

.attachments-loading {
  min-height: 220px;
}

.comments-layout {
  display: grid;
  gap: 18px;
}

.comment-composer {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.comment-composer label {
  color: var(--ink);
  font-size: var(--font-footnote);
  font-weight: 800;
}

.comment-composer textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: var(--font-callout);
  line-height: 1.55;
}

.comment-composer textarea:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(245, 76, 0, .1);
}

.comment-composer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-error {
  flex: 1 1 auto;
  color: var(--danger);
  font-size: var(--font-caption);
}

.comment-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--font-caption);
}

.comment-composer .button svg {
  width: 16px;
  height: 16px;
}

.comments-live-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #ffc591;
  border-radius: 7px;
  color: #7a2f00;
  background: #fff5ec;
  font-size: var(--font-caption);
}

.comments-live-notice[hidden] {
  display: none;
}

.comments-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.comment-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 11px;
  min-width: 0;
}

.comment-avatar .avatar {
  width: 40px;
  height: 40px;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--line);
}

.comment-content {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.comment-content header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-content header strong {
  color: var(--ink);
  font-size: var(--font-footnote);
}

.comment-content header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--font-caption);
}

.comment-content p {
  margin: 0;
  color: #3f3f3f;
  font-size: var(--font-table);
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comments-read-only,
.comments-limit-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-caption);
}

.comments-empty,
.comments-error,
.comments-pending {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.comments-empty svg {
  width: 30px;
  height: 30px;
  color: #a5a5a5;
}

.comments-empty strong,
.comments-error strong {
  color: var(--ink);
  font-size: var(--font-subheadline);
}

.comments-empty span,
.comments-error span,
.comments-pending span {
  font-size: var(--font-footnote);
}

.comments-loading {
  min-height: 220px;
}

.history-loading {
  min-height: 220px;
}

.history-timeline {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 0 0 22px;
}

.history-item:not(:last-child)::before {
  position: absolute;
  top: 38px;
  bottom: 0;
  left: 19px;
  width: 1px;
  background: var(--line);
  content: "";
}

.history-item-avatar {
  position: relative;
  z-index: 1;
}

.history-item-avatar .avatar {
  width: 40px;
  height: 40px;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--line);
}

.history-item-content {
  min-width: 0;
  padding: 3px 0 0;
}

.history-event-title {
  margin: 0;
  color: #3f3f3f;
  font-size: var(--font-table);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.history-actor,
.history-field {
  color: var(--ink);
  font-weight: 800;
}

.history-value {
  display: inline;
  color: var(--accent-dark);
  font-weight: 700;
}

.history-value.is-empty {
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

.history-changes {
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.history-changes h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: #f7f7f7;
  font-size: var(--font-footnote);
}

.history-change-head,
.history-change-row {
  display: grid;
  grid-template-columns: minmax(120px, .75fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.history-change-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fcfcfc;
  font-size: var(--font-caption-small);
  font-weight: 800;
  text-transform: uppercase;
}

.history-change-head span,
.history-change-row > * {
  min-width: 0;
  padding: 8px 10px;
}

.history-change-head span:not(:last-child),
.history-change-row > *:not(:last-child) {
  border-right: 1px solid var(--line);
}

.history-change-row:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.history-change-row > .history-field {
  color: #383838;
  background: #fafafa;
  font-size: var(--font-footnote);
}

.history-change-value {
  color: var(--muted);
  font-size: var(--font-footnote);
  overflow-wrap: anywhere;
}

.history-change-value.is-new {
  background: #fff8f4;
}

.history-change-value small {
  display: none;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: var(--font-caption-small);
  font-weight: 800;
  text-transform: uppercase;
}

.history-legacy {
  display: grid;
  gap: 3px;
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: #fafafa;
  font-size: var(--font-caption);
  line-height: 1.45;
}

.history-legacy strong {
  color: #484848;
  font-size: var(--font-footnote);
}

.history-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--font-caption);
}

.history-limit-note {
  margin: 4px 0 0 52px;
  color: var(--muted);
  font-size: var(--font-caption);
}

.history-empty,
.history-error,
.history-pending {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.history-empty svg {
  width: 30px;
  height: 30px;
  color: #a5a5a5;
}

.history-empty strong,
.history-error strong {
  color: var(--ink);
  font-size: var(--font-subheadline);
}

.history-empty span,
.history-error span,
.history-pending span {
  font-size: var(--font-footnote);
}

.modal-record-loading {
  min-height: 180px;
}

.record-change-alert {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 10px;
  line-height: 1.5;
}

.record-presence[hidden],
.record-change-alert[hidden] {
  display: none;
}

.record-presence {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  margin-right: auto;
}

.record-presence-viewers {
  display: flex;
  min-width: 0;
  align-items: center;
  padding-left: 7px;
}

.record-viewer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -7px;
  border-radius: 50%;
  cursor: default;
}

.record-viewer .avatar {
  width: 32px;
  height: 32px;
  border: 2px solid #fbfbfb;
  box-shadow: 0 0 0 1px #d2d2d2;
  font-size: 10px;
}

.record-viewer-overflow {
  display: inline-grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  margin-left: -7px;
  border: 2px solid #fbfbfb;
  border-radius: 999px;
  color: #4c4c4c;
  background: #e8e8e8;
  box-shadow: 0 0 0 1px #d2d2d2;
  font-size: var(--font-caption);
  font-weight: 800;
  cursor: default;
}

.record-change-alert {
  justify-content: space-between;
  border: 1px solid #ffc591;
  color: #7a2f00;
  background: #fff5ec;
}

.record-change-alert button {
  flex: 0 0 auto;
  border: 0;
  padding: 5px 7px;
  color: var(--accent-dark);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 15px 22px;
  border-top: 1px solid var(--line);
  background: #fbfbfb;
}

.modal-action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

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

.field {
  display: grid;
  gap: 7px;
}

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

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

.journal-lines-field {
  gap: 9px;
}

.journal-lines-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.journal-lines-heading > div {
  display: grid;
  gap: 3px;
}

.journal-lines-heading strong {
  font-size: var(--font-subheadline);
}

.journal-lines-heading span {
  color: var(--muted);
  font-size: var(--font-caption);
}

.journal-lines-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  overscroll-behavior-inline: contain;
}

.journal-lines-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--font-table);
}

.journal-lines-table th,
.journal-lines-table td {
  height: 47px;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.journal-lines-table th:last-child,
.journal-lines-table td:last-child {
  border-right: 0;
}

.journal-lines-table thead th {
  color: #383838;
  background: #f1f1f1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.journal-lines-table th:nth-child(1),
.journal-lines-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

.journal-lines-table th:nth-child(2),
.journal-lines-table td:nth-child(2) {
  width: 230px;
}

.journal-lines-table th:nth-child(3),
.journal-lines-table td:nth-child(3) {
  width: 190px;
}

.journal-lines-table th:nth-child(4),
.journal-lines-table td:nth-child(4) {
  width: 205px;
}

.journal-lines-table th:nth-child(5),
.journal-lines-table td:nth-child(5),
.journal-lines-table th:nth-child(6),
.journal-lines-table td:nth-child(6) {
  width: 130px;
}

.journal-lines-table th:nth-child(7),
.journal-lines-table td:nth-child(7) {
  width: 45px;
  text-align: center;
}

.journal-lines-table input,
.journal-lines-table .select2-container .select2-selection--single {
  min-height: 35px;
  height: 35px;
  font-size: var(--font-table);
}

.journal-lines-table input {
  width: 100%;
  padding: 6px 8px;
}

.journal-lines-table .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 33px;
}

.journal-lines-table tfoot th,
.journal-lines-table tfoot td {
  border-bottom: 0;
  background: #fafafa;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.journal-lines-table tfoot th {
  text-align: right;
}

.journal-line-number {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.journal-money-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bundle-components-table {
  min-width: 760px;
}

.bundle-components-table th:nth-child(2),
.bundle-components-table td:nth-child(2) {
  width: 300px;
}

.bundle-components-table th:nth-child(3),
.bundle-components-table td:nth-child(3) {
  width: 130px;
}

.bundle-components-table th:nth-child(4),
.bundle-components-table td:nth-child(4) {
  width: 110px;
}

.bundle-components-table th:nth-child(5),
.bundle-components-table td:nth-child(5) {
  width: 155px;
}

.bundle-components-table th:nth-child(6),
.bundle-components-table td:nth-child(6) {
  width: 45px;
  text-align: center;
}

.journal-balance-summary {
  justify-self: end;
  padding: 5px 9px;
  border-radius: 7px;
  color: #8a2d1f;
  background: #fff0ed;
  font-size: var(--font-caption);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.journal-balance-summary.is-balanced {
  color: var(--success);
  background: var(--success-bg);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.user-image-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
  align-items: center;
  gap: 7px;
  height: 45px;
  min-height: 45px;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  transition: none;
  margin-top: -8px;
}

.user-image-card.is-dragging {
  border-color: var(--accent);
  background: #fff1e9;
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .1);
}

.user-image-preview-wrap {
  position: relative;
  flex: 0 0 auto;
}

.user-image-preview {
  display: flex;
}

.user-image-lightbox-trigger {
  display: inline-flex;
  border-radius: 50%;
  cursor: zoom-in;
}

.user-image-preview .avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--white);
  font-size: 10px;
  box-shadow: 0 2px 9px rgba(0, 0, 0, .09);
}

.item-group-image-placeholder,
.item-group-image-preview {
  display: inline-grid;
  width: 34px;
  height: 34px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: #fff4ee;
  box-shadow: 0 2px 9px rgba(0, 0, 0, .07);
}

.item-group-image-placeholder svg {
  width: 18px;
  height: 18px;
}

.item-group-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-group-image-field .user-image-lightbox-trigger {
  border-radius: 8px;
}

.user-image-remove {
  position: absolute;
  right: 1px;
  bottom: 1px;
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  color: var(--white);
  background: rgba(27, 27, 27, .78);
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}

.user-image-remove svg {
  width: 8px;
  height: 8px;
}

.user-image-remove[hidden] {
  display: none;
}

.user-image-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "meta actions"
    "error error";
  min-width: 0;
  align-items: center;
  gap: 2px 10px;
}

.user-image-meta {
  display: block;
  grid-area: meta;
  min-width: 0;
}

.user-image-meta > span {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--font-caption);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-image-actions {
  display: flex;
  grid-area: actions;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field .image-upload-button {
  display: inline-grid;
  width: 25px;
  min-height: 25px;
  padding: 3px;
  place-items: center;
  color: var(--accent-dark);
  background: var(--white);
  cursor: pointer;
}

.field .image-upload-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.user-image-remove:hover {
  background: var(--danger);
  transform: scale(1.06);
}

.user-image-content > .field-error {
  grid-area: error;
}

.field label {
  color: #303030;
  font-size: 11px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.field-error {
  color: var(--danger);
  font-size: 10px;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
}

.field.has-error .select2-container--default .select2-selection--single {
  border-color: var(--danger);
}

.form-alert {
  border: 1px solid #ffc6c6;
  margin: 0 0 15px;
  padding: 11px 12px;
  border-radius: 7px;
  color: #9d2222;
  background: var(--danger-bg);
  font-size: 11px;
  line-height: 1.5;
}

.column-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.column-selector label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  padding: 11px 12px;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}

.column-selector label:hover {
  border-color: #ffc7ad;
  background: #fff8f4;
}

.column-selector label > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.column-selector strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-selector small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-builder-head,
.filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.05fr) minmax(185px, 1fr) minmax(220px, 1.25fr) 36px;
  gap: 10px;
  align-items: center;
}

.filter-builder-head {
  padding: 0 2px 7px;
  color: #555;
  font-size: 10px;
  font-weight: 800;
}

#filter-builder {
  display: grid;
  gap: 9px;
}

.filter-row {
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 9px;
  background: #fcfcfc;
}

.filter-value-wrap {
  min-width: 0;
}

.filter-no-value {
  display: flex;
  min-height: 42px;
  align-items: center;
  border: 1px dashed #d7d7d7;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: #f8f8f8;
  font-size: 10px;
}

.filter-remove {
  color: #777;
}

.filter-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.filter-builder-empty {
  border: 1px dashed #d7d7d7;
  padding: 28px 16px;
  border-radius: 9px;
  color: var(--muted);
  background: #fafafa;
  font-size: 11px;
  text-align: center;
}

.filter-builder-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.button-compact {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 10px;
}

.text-button {
  border: 0;
  padding: 7px 3px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent-dark);
}

.permission-section {
  margin-top: 22px;
}

.permission-section h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.permission-section > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.permission-scroll {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permission-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 11px;
}

.permission-table th,
.permission-table td {
  height: 47px;
  border-bottom: 1px solid #ebebeb;
  padding: 8px 10px;
  text-align: center;
}

.permission-table th {
  background: #fafafa;
  font-weight: 800;
}

.permission-table th:first-child,
.permission-table td:first-child {
  min-width: 220px;
  text-align: left;
}

.permission-table tr:last-child td {
  border-bottom: 0;
}

.permission-page {
  display: grid;
  gap: 3px;
}

.permission-page strong {
  font-size: 11px;
}

.permission-page small {
  color: var(--muted);
  font-size: 9px;
}

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 150;
  display: grid;
  width: min(360px, calc(100vw - 44px));
  gap: 9px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #323232;
  padding: 13px 14px;
  border-radius: 9px;
  color: var(--white);
  background: #151515;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .2);
  font-size: 11px;
  line-height: 1.5;
  animation: toast-in 180ms ease both;
}

.toast svg {
  width: 17px;
  flex: 0 0 auto;
  color: var(--accent);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

#resource-area.general-ledger-area {
  min-height: calc(100vh - var(--topbar-height));
  padding-bottom: 0;
  overflow-x: clip;
  background: var(--white);
}

.general-ledger-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.ledger-filter-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.ledger-filter-field label {
  color: #383838;
  font-size: var(--font-footnote);
  font-weight: 700;
}

.ledger-filter-field input,
.ledger-filter-field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-size: var(--font-subheadline);
}

.ledger-filter-field input:focus,
.ledger-filter-field select:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(245, 76, 0, .12);
}

.ledger-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ledger-filter-actions .spinner {
  width: 16px;
  height: 16px;
  border-color: rgba(255, 255, 255, .36);
  border-top-color: var(--white);
}

.ledger-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.ledger-summary-card {
  display: grid;
  min-width: 0;
  min-height: 88px;
  align-content: center;
  gap: 7px;
  padding: 14px 15px;
  background: var(--white);
}

.ledger-summary-card > span {
  color: var(--muted);
  font-size: var(--font-footnote);
  font-weight: 700;
}

.ledger-summary-card strong {
  min-width: 0;
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
}

.ledger-summary-card.is-debit strong {
  color: #155f9b;
}

.ledger-summary-card.is-credit strong {
  color: #8e3a18;
}

.ledger-report-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: #fafafa;
  font-size: var(--font-footnote);
}

.ledger-report-context strong {
  flex: 0 0 auto;
  color: #383838;
}

.ledger-report-warning {
  padding: 10px 15px;
  border-bottom: 1px solid #efd2a6;
  color: #7b4a00;
  background: #fff8e9;
  font-size: var(--font-footnote);
}

.ledger-report-body {
  display: grid;
  min-width: 0;
  gap: 15px;
  padding: 15px;
  background: #f7f7f7;
}

.general-ledger-area.is-empty-ledger .ledger-report-body {
  display: flex;
  min-height: 310px;
  flex: 1 1 auto;
  padding: 0;
  background: var(--white);
}

.ledger-empty-state {
  display: grid;
  width: 100%;
  min-height: 100%;
  flex: 1 1 auto;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 32px 15px;
  color: var(--muted);
  text-align: center;
}

.ledger-empty-state svg {
  width: 32px;
  height: 32px;
  color: #9b9b9b;
}

.ledger-empty-state strong {
  color: #383838;
  font-size: var(--font-subheadline);
}

.ledger-empty-state span {
  font-size: var(--font-footnote);
}

.ledger-account-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.ledger-account-head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.ledger-account-head > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 9px;
}

.ledger-account-head > div:first-child > span {
  color: var(--accent-dark);
  font-size: var(--font-footnote);
  font-weight: 800;
}

.ledger-account-head h2 {
  margin: 0;
  font-size: var(--font-callout);
}

.ledger-account-head > div:first-child > small {
  grid-column: 2;
  color: var(--muted);
  font-size: var(--font-caption);
  text-transform: capitalize;
}

.ledger-account-totals {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: var(--font-footnote);
  white-space: nowrap;
}

.ledger-account-totals .ledger-balance {
  margin-left: 5px;
  color: var(--ink);
}

.ledger-table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.ledger-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  color: var(--ink);
  background: var(--white);
  font-size: var(--font-table);
}

.ledger-table th,
.ledger-table td {
  height: 47px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 7px 15px;
  text-align: left;
  vertical-align: middle;
}

.ledger-table th:last-child,
.ledger-table td:last-child {
  border-right: 0;
}

.ledger-table th {
  color: #383838;
  background: #f1f1f1;
  font-size: var(--font-footnote);
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.ledger-table .is-numeric {
  text-align: right;
  white-space: nowrap;
}

.ledger-table tbody tr:hover:not(.ledger-opening-row) td {
  background: #fffaf7;
}

.ledger-table tfoot td {
  border-bottom: 0;
  color: #303030;
  background: #f5f5f5;
  font-weight: 800;
}

.ledger-opening-row td {
  color: #535353;
  background: #fafafa;
  font-weight: 700;
}

.ledger-entry-link {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.ledger-entry-link:hover {
  text-decoration: underline;
}

.ledger-entry-number,
.ledger-date-cell,
.ledger-money,
.ledger-balance {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-money small,
.ledger-balance small {
  color: var(--muted);
  font-size: var(--font-caption-small);
  font-weight: 800;
}

.ledger-balance.is-cr small {
  color: #8e3a18;
}

.ledger-balance.is-dr small {
  color: #155f9b;
}

.ledger-description {
  display: grid;
  min-width: 180px;
  gap: 2px;
}

.ledger-description small {
  color: var(--muted);
  font-size: var(--font-caption);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 24px 30px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}

.dashboard-stat {
  min-height: 132px;
  padding: 22px;
  background: var(--white);
}

.dashboard-stat span {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-stat strong {
  display: block;
  margin-top: 13px;
  font-size: 29px;
  letter-spacing: -.04em;
}

.login-page {
  background: var(--black);
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(380px, 1fr) minmax(480px, .82fr);
}

.login-brand {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 48px;
  color: var(--white);
  background: var(--black);
}

.login-brand::after {
  position: absolute;
  right: -120px;
  bottom: -180px;
  width: 440px;
  height: 440px;
  border: 86px solid var(--accent);
  border-radius: 50%;
  opacity: .18;
  content: "";
}

.login-brand-logo {
  width: 245px;
}

.login-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
  padding-bottom: 55px;
}

.login-brand-copy h1 {
  margin: 0 0 15px;
  font-size: clamp(37px, 5vw, 66px);
  line-height: 1.02;
  letter-spacing: -.055em;
}

.login-brand-copy p {
  margin: 0;
  color: #b7b7b7;
  font-size: 15px;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px;
  background: var(--white);
}

.login-card {
  width: min(420px, 100%);
}

.login-card-logo {
  display: none;
  width: 185px;
  margin-bottom: 38px;
}

.login-card h2 {
  margin: 0 0 9px;
  font-size: 30px;
  letter-spacing: -.04em;
}

.login-intro {
  margin: 0 0 29px;
  color: var(--muted);
  font-size: 13px;
}

.login-card form {
  display: grid;
  gap: 17px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  border: 0;
  padding: 6px;
  transform: translateY(-50%);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.login-security {
  margin: 20px 0 0;
  color: #8c8c8c;
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

/* Apple-style readable type scale, adapted to Almarai and dense admin tables. */
.control,
.field input,
.field select,
.field textarea,
.filter-row input,
.select2-container,
.table-search input {
  font-size: var(--font-callout);
}

.breadcrumbs,
.button,
.login-intro,
.nav-link,
.page-loading,
.permission-section h3,
.select2-dropdown {
  font-size: var(--font-subheadline);
}

.data-table,
.person-cell strong {
  font-size: var(--font-table);
}

.column-selector strong,
.dashboard-stat span,
.data-table th,
.field label,
.filter-builder-empty,
.filter-no-value,
.form-alert,
.page-button,
.page-limit select,
.page-limit .select2-container,
.permission-page strong,
.permission-section > p,
.permission-table,
.account-menu-profile strong,
.record-change-alert,
.record-presence,
.table-footer,
.toast,
.topbar-user strong {
  font-size: var(--font-footnote);
}

.avatar,
.button-compact,
.column-selector small,
.field-error,
.field-hint,
.filter-builder-head,
.login-security,
.nav-group-toggle,
.password-toggle,
.permission-page small,
.account-menu-profile small,
.record-change-alert button,
.realtime-status,
.status,
.text-button,
.topbar-user small {
  font-size: var(--font-caption);
}

.filter-count {
  font-size: var(--font-caption-small);
}

.modal-head h2 {
  font-size: 20px;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1120px) {
  .general-ledger-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ledger-filter-actions {
    justify-content: flex-end;
  }

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

@media (max-width: 860px) {
  :root {
    --topbar-height: 60px;
  }

  .sidebar {
    width: min(292px, calc(100vw - 48px));
    transform: translateX(-102%);
  }

  body.sidebar-open {
    overflow: hidden;
  }

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

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    visibility: hidden;
    background: rgba(0, 0, 0, .38);
    opacity: 0;
    transition: opacity var(--ease), visibility var(--ease);
  }

  body.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    padding: 0 15px;
  }

  .main-content {
    padding: 0;
  }

  .topbar-user-copy {
    display: none;
  }

  .realtime-status {
    min-width: 0;
    padding: 7px;
  }

  .realtime-status [data-realtime-label] {
    display: none;
  }

  .table-footer {
    right: 0;
    left: 0;
    width: auto;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-inline: 0;
    padding: 10px 15px;
    transform: none;
  }

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

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-card-logo {
    display: block;
  }

  .login-panel {
    min-height: 100vh;
  }
}

@media (max-width: 680px) {
  #resource-area.general-ledger-area {
    padding-bottom: 0;
  }

  .general-ledger-filters {
    grid-template-columns: 1fr;
  }

  .ledger-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-summary-card {
    min-height: 78px;
  }

  .ledger-summary-card strong {
    font-size: var(--font-callout);
  }

  .ledger-report-context {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .ledger-account-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .ledger-account-totals {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .image-lightbox-backdrop {
    padding: 0;
  }

  .image-lightbox-caption {
    padding-left: 12px;
  }

  .image-lightbox-close {
    right: 10px;
  }

  #resource-area {
    padding-bottom: 118px;
  }

  #resource-area.is-tree-resource {
    padding-bottom: 0;
  }

  .table-footer-left {
    width: 100%;
    justify-content: space-between;
  }

  .pagination {
    width: 100%;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding-inline: 15px;
  }

  .table-search {
    width: 100%;
  }

  .table-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .table-toolbar-actions .button {
    flex: 1;
    min-width: 0;
    gap: 6px;
    padding-inline: 10px;
    font-size: var(--font-table);
    white-space: nowrap;
  }

  .table-toolbar:not(.account-tree-toolbar) .table-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-toolbar:not(.account-tree-toolbar) .table-toolbar-actions #create-record {
    grid-column: 1 / -1;
    width: 100%;
  }

  .account-tree-toolbar .table-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-tree-toolbar .table-toolbar-actions .button {
    width: 100%;
  }

  .account-tree {
    min-width: 0;
  }

  .account-tree-head {
    display: none;
  }

  .sticky-account-tree-header {
    display: none;
  }

  .account-tree-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    align-items: center;
    padding: 7px 0;
  }

  .account-tree.no-actions .account-tree-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-tree-account {
    grid-column: 1 / -1;
    min-height: 42px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .account-tree-value,
  .account-tree-balance,
  .account-tree-status,
  .account-tree-actions {
    padding: 5px 12px;
    border-left: 0;
  }

  .account-tree-row [data-tree-label]::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    content: attr(data-tree-label);
    font-size: var(--font-caption-small);
    font-weight: 700;
    text-transform: uppercase;
  }

  .account-tree-actions {
    display: flex;
    grid-column: 3;
    grid-row: 2 / span 20;
    align-self: stretch;
    align-items: center;
    justify-content: center;
  }

  .column-selector {
    grid-template-columns: 1fr;
  }

  .filter-builder-head {
    display: none;
  }

  .filter-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  }

  .filter-value-wrap {
    grid-column: 1 / 3;
  }

  .filter-remove {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-full,
  .field-span-2 {
    grid-column: auto;
  }

  .journal-lines-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .journal-lines-heading .button {
    align-self: flex-start;
  }

  .journal-lines-table {
    min-width: 920px;
  }

  .bundle-components-table {
    min-width: 760px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal,
  .modal-large {
    width: 100%;
    max-height: 94vh;
    border-radius: 15px 15px 0 0;
  }

  .modal-body {
    max-height: calc(94vh - 160px);
  }

  .modal-tab {
    min-height: 40px;
    gap: 4px;
    padding: 8px 6px;
    font-size: var(--font-caption);
  }

  .attachment-uploader {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .attachment-item {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px;
  }

  .attachment-file-icon {
    width: 34px;
    height: 34px;
  }

  .comment-composer-foot {
    flex-wrap: wrap;
  }

  .comment-error {
    flex-basis: 100%;
  }

  .comment-content header {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .history-change-head {
    display: none;
  }

  .history-change-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-change-row > .history-field {
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .history-change-value small {
    display: block;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    margin: 18px;
  }

  .topbar-user {
    gap: 5px;
    padding: 4px;
  }

  .login-panel {
    padding: 28px 22px;
  }

  .login-card-logo {
    width: 170px;
  }

  .login-card h2 {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
