:root {
  --bg: #f4efe6;
  --panel: rgba(255, 251, 245, 0.95);
  --panel-strong: #fffdf9;
  --line: #d7c6ae;
  --line-strong: #b89d78;
  --text: #2b241b;
  --muted: #726552;
  --accent: #9b6b2f;
  --accent-soft: #ead8bc;
  --danger: #b12f2f;
  --ok: #2c7a4b;
  --edit: #fff0be;
  --shadow: 0 18px 48px rgba(82, 57, 21, 0.12);
  --radius: 7px;
  --font: "Avenir Next", "Segoe UI", sans-serif;
}

body[data-theme="dark"] {
  --bg: #0f1419;
  --panel: rgba(19, 24, 32, 0.94);
  --panel-strong: #151b23;
  --line: #3f4753;
  --line-strong: #d0b188ff;
  --text: #f5efe6;
  --muted: #b7a891;
  --accent: #d0b188ff;
  --accent-soft: #2d2417;
  --danger: #ef6a6a;
  --ok: #93c47dff;
  --edit: #2b2a22;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: #0f1722 !important;
  border-color: #465162;
  color: #f5efe6;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #9ba6b8;
}

body[data-theme="dark"] .settings-tabs button {
  background: rgba(20, 27, 37, 0.86);
}

body[data-theme="dark"] .table-wrap {
  background: #111a25 !important;
  border-color: #3f4b5c !important;
}

body[data-theme="dark"] .nav-dropdown {
  background: #111a25;
  border-color: #3f4b5c;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

body[data-theme="dark"] .nav-dropdown-item {
  color: #f5efe6;
}

body[data-theme="dark"] .topbar-org-dropdown {
  background: #111a25;
  border-color: #3f4b5c;
}

body[data-theme="dark"] .topbar-org-item {
  background: #0f1722;
  border-color: #465162;
  color: #f5efe6;
}

body[data-theme="dark"] th,
body[data-theme="dark"] td {
  border-color: rgba(116, 130, 149, 0.34) !important;
}

body[data-theme="dark"] th {
  background: #1c2735 !important;
  color: #ead8bc !important;
}

body[data-theme="dark"] td {
  background: #121a26 !important;
  color: #f5efe6 !important;
}

body[data-theme="dark"] .report-card {
  background: #111a25 !important;
  border-color: #3f4b5c !important;
}

body[data-theme="dark"] .editable-cell {
  background: #2a3342 !important;
}

body[data-theme="dark"] .danger {
  color: #ef8d8d !important;
}

body[data-theme="dark"] .ok {
  color: #93c47dff !important;
}

body[data-theme="dark"] input:disabled,
body[data-theme="dark"] select:disabled,
body[data-theme="dark"] textarea:disabled {
  background: #1a2330 !important;
  border-color: #4a5566 !important;
  color: #d9cdbb !important;
  -webkit-text-fill-color: #d9cdbb;
  opacity: 1;
}

body[data-theme="dark"] .report-card td input:disabled,
body[data-theme="dark"] .report-card td select:disabled,
body[data-theme="dark"] .report-card td textarea:disabled {
  background: #1a2330 !important;
  border-color: #4a5566 !important;
  color: #d9cdbb !important;
  -webkit-text-fill-color: #d9cdbb;
  opacity: 1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

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

.shell {
  width: min(100%, calc(100% - 24px));
  margin: 0 auto 24px;
}

.shell-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.topbar,
.panel {
  background: var(--panel);
  border: 1px solid rgba(184, 157, 120, 0.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 10px 22px 8px;
  margin-bottom: 10px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  min-height: 60px;
  position: relative;
  z-index: 40;
  overflow: visible;
}

.topbar.menu-open {
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-right: 4px;
}

.brand-logo {
  width: 79px;
  height: 62px;
  object-fit: contain;
  object-position: left center;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.topbar-title,
.brand-title {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.03em;
  display: flex;
  gap: 0;
  color: #7a5b38;
}

.brand-sales {
  color: #9b7d56;
}

.brand-control {
  color: #3f2c1c;
}

.brand-subtitle {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  color: #ccaa75;
}

.brand-subtitle-keep {
  color: #ccaa75;
}

body[data-theme="dark"] .brand-sales {
  color: #d0b188ff;
}

body[data-theme="dark"] .brand-control {
  color: #f5efe6;
}

body[data-theme="dark"] .brand-subtitle,
body[data-theme="dark"] .brand-subtitle-keep {
  color: #ccaa75;
}

.nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  padding-left: 10px;
}

.nav-menu {
  position: relative;
}

.nav button,
.primary,
.secondary,
.icon,
.mini {
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav button {
  min-width: 114px;
  padding: 7px 16px 8px;
  font-size: 11px;
  line-height: 1;
  border-width: 1px;
  font-weight: 400;
  border-color: #d0b188ff;
  box-shadow: none;
}

.nav button.active,
.primary {
  background: #d0b188ff;
  color: #1f1b16;
  border-color: #d0b188ff;
}

.nav-menu.open > button {
  background: #d0b188ff;
  color: #1f1b16;
  border-color: #d0b188ff;
}

.nav > button:hover,
.nav-menu > button:hover {
  background: var(--panel-strong);
  color: var(--text);
  border-color: #d0b188ff;
}

.nav > button.active:hover,
.nav-menu.open > button:hover,
.nav-menu.open > button.active:hover {
  background: #d0b188ff;
  color: #1f1b16;
  border-color: #d0b188ff;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  display: none;
  min-width: 190px;
  padding: 8px 8px 6px;
  border: 1px solid rgba(208, 177, 136, 0.75);
  border-radius: 7px;
  background: rgba(255, 251, 245, 0.98);
  box-shadow: 0 18px 36px rgba(82, 57, 21, 0.16);
  z-index: 120;
}

.nav-menu.open .nav-dropdown {
  display: grid;
  gap: 6px;
}

.nav-dropdown-item {
  width: 100%;
  min-width: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: none;
}

.nav-dropdown-item.active {
  background: transparent;
  color: var(--text);
}

.secondary {
  padding: 10px 16px;
}

.icon,
.mini {
  padding: 6px 10px;
}

.nav button:hover,
.primary:hover,
.secondary:hover,
.icon:hover,
.mini:hover {
  transform: translateY(-1px);
}

.page {
  display: grid;
  gap: 18px;
}

.settings-page {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 12px;
  align-self: start;
  padding: 0;
  overflow: hidden;
}

.settings-nav-title {
  padding: 18px 16px;
  background: var(--panel-strong);
  border-bottom: 1px solid rgba(184, 157, 120, 0.18);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.settings-tabs {
  display: grid;
}

.settings-tabs button {
  width: 100%;
  padding: 22px 20px;
  border: 0;
  border-top: 1px solid rgba(184, 157, 120, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.42);
  text-align: left;
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  color: var(--text);
  box-shadow: none;
}

.settings-tabs button:first-child {
  border-top: 0;
}

.settings-tabs button.active {
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
}

.settings-content {
  min-width: 0;
}

.settings-panel {
  min-height: 100%;
}

.settings-panel .table-wrap {
  overflow: auto;
}

.settings-panel table {
  min-width: 100%;
}

.settings-panel th,
.settings-panel td {
  font-size: 15px;
  padding: 6px 8px;
}

.settings-panel th {
  font-size: 16px;
  line-height: 1.1;
}

.settings-panel td input,
.settings-panel td select,
.settings-panel td textarea {
  padding: 8px 10px;
  font-size: 15px;
}

.settings-list {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  font-size: 13px;
}

.settings-actions {
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}

.settings-actions .mini {
  min-width: 0;
  padding: 6px 8px;
  margin: 0 2px;
  line-height: 1;
}

.settings-actions .mini.active {
  background: #d0b188ff;
  color: white;
  border-color: #d0b188ff;
}

.settings-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.permission-stack {
  display: grid;
  gap: 6px;
  align-content: start;
}

.settings-check {
  font-size: 13px;
  line-height: 1.15;
  align-items: flex-start;
}

.settings-check input {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  flex: 0 0 14px;
  margin-top: 2px;
}

.settings-footer-actions .save-button {
  min-width: 160px;
}

.role-name-display {
  padding: 10px 0;
  font-size: 16px;
  line-height: 1.2;
}

.permission-readonly-list {
  display: grid;
  gap: 6px;
  padding: 4px 0;
}

.role-permission-readonly {
  font-size: 15px;
  line-height: 1.2;
}

.readonly-cell,
.readonly-list {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.86);
  display: block;
}

.settings-users-table .readonly-cell,
.settings-users-table .readonly-list {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.readonly-list {
  display: grid;
  gap: 4px;
}

.settings-users-table .readonly-list {
  gap: 4px;
}

.project-name-display {
  padding: 10px 0;
  font-size: 16px;
  line-height: 1.2;
}

.project-users-display {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  font-size: 15px;
  line-height: 1.2;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(46, 38, 29, 0.36);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: start center;
  padding: 84px 24px 24px;
  z-index: 200;
}

.modal-panel {
  width: min(92vw, 760px);
  border-radius: 7px;
  background: var(--panel-strong);
  border: 1px solid rgba(184, 157, 120, 0.35);
  box-shadow: 0 30px 90px rgba(46, 38, 29, 0.18);
  padding: 22px 26px 22px;
}

.modal-panel h2 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.user-form {
  gap: 12px;
}

.user-form-modal {
  width: min(92vw, 760px);
  padding: 22px 26px 20px;
}

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

.modal-grid .field {
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.user-form .field label {
  font-size: 13px;
  color: var(--muted);
  padding-top: 11px;
}

.user-form input,
.user-form select {
  min-height: 42px;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 8px;
}

.user-form select {
  padding-right: 34px;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.modal-actions .primary,
.modal-actions .secondary {
  min-width: 150px;
  padding: 10px 14px;
  font-size: 15px;
}

.panel {
  padding: 16px;
}

.planning-hero {
  padding: 10px 14px;
}

.planning-hero h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.05;
}

.planning-hero-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.planning-hero .field {
  gap: 4px;
  flex: 0 1 182px;
  max-width: 182px;
}

.planning-hero .field input,
.planning-hero .field select {
  width: 100%;
  min-width: 112px;
  max-width: 182px;
  padding: 7px 10px;
  font-size: 21px;
  line-height: 1.1;
}

.report-hero {
  padding: 10px 14px;
}

.panel.report-hero .grid-5.report-hero-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 10px;
}

.panel.report-hero .grid-5.report-hero-fields .field {
  gap: 4px;
  flex: 0 1 182px;
  max-width: 182px;
}

.panel.report-hero .grid-5.report-hero-fields .field input,
.panel.report-hero .grid-5.report-hero-fields .field select {
  width: 100%;
  min-width: 112px;
  max-width: 182px;
  padding: 7px 10px;
  font-size: 21px;
  line-height: 1.1;
}

.plain-value {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  padding: 0 2px;
  font-size: 21px;
  line-height: 1.1;
  color: var(--text);
}

.auth-panel {
  width: min(100%, 520px);
}

.auth-error {
  border: 1px solid rgba(177, 47, 47, 0.35);
  background: rgba(177, 47, 47, 0.1);
  color: var(--danger);
  border-radius: 7px;
  padding: 10px 12px;
  font-weight: 600;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
  letter-spacing: -0.03em;
}

.toolbar,
.grid-2,
.grid-3,
.grid-4,
.grid-5 {
  display: grid;
  gap: 14px;
}

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

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

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

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

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

.field label,
.hint {
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  font-size: 16px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(155, 107, 47, 0.18);
  border-color: var(--accent);
}

textarea {
  min-height: 44px;
  height: 44px;
  resize: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.stack {
  display: grid;
  gap: 18px;
}

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

.summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 12px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--text);
}

.chip-muted {
  opacity: 0.65;
}

.danger {
  color: var(--danger);
}

.ok {
  color: var(--ok);
}

.table-wrap {
  overflow: hidden;
  border: 1px solid rgba(184, 157, 120, 0.35);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  table-layout: fixed;
}

.compact-index table th:first-child,
.compact-index table td:first-child {
  width: 44px;
  min-width: 44px;
  white-space: nowrap;
}

.wide-first-col table th:first-child,
.wide-first-col table td:first-child {
  width: 260px;
  min-width: 260px;
}

.planning-page-year .wide-first-col table th:first-child,
.planning-page-year .wide-first-col table td:first-child {
  width: 221px;
  min-width: 221px;
}

.planning-page-year .employee-revenue-table td:not(:first-child) {
  padding: 3px;
  font-size: 13px;
}

.planning-page-year .employee-revenue-table td:not(:first-child) input,
.planning-page-year .employee-revenue-table td:not(:first-child) select,
.planning-page-year .employee-revenue-table td:not(:first-child) textarea {
  padding: 3px 4px;
  font-size: 13px;
}

.planning-page-year .employee-revenue-table td:last-child,
.planning-page-year .employee-revenue-table th:last-child {
  font-size: 13px;
}

.planning-page-year .revenue-target-table td:not(:first-child) {
  padding: 3px;
  font-size: 13px;
}

.planning-page-year .revenue-target-table td:not(:first-child) input,
.planning-page-year .revenue-target-table td:not(:first-child) select,
.planning-page-year .revenue-target-table td:not(:first-child) textarea {
  padding: 3px 4px;
  font-size: 13px;
}

.employee-filter {
  width: auto;
  min-width: 280px;
}

.employee-filter-narrow {
  min-width: 180px;
  max-width: 180px;
}

th,
td {
  border: 1px solid rgba(184, 157, 120, 0.28);
  padding: 6px;
  vertical-align: top;
  font-size: 16px;
  word-break: break-word;
}

th {
  background: rgba(234, 216, 188, 0.58);
  font-size: 13px;
}

td input,
td select,
td textarea {
  min-width: 0;
  padding: 6px 8px;
  font-size: 16px;
}

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

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.section-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.report-card {
  padding: 14px;
  border-radius: 7px;
  background: rgba(255, 253, 249, 0.82);
  border: 1px solid rgba(184, 157, 120, 0.35);
}

.report-card table th,
.report-card table td {
  font-size: 16px;
  padding: 4px;
  line-height: 1.05;
  word-break: normal;
  overflow-wrap: normal;
}

.report-card table th:first-child,
.report-card table td:first-child {
  width: 176px;
  min-width: 176px;
}

.report-card td input,
.report-card td select,
.report-card td textarea {
  padding: 4px 6px;
  font-size: 16px;
}

.report-card tbody td:not(:first-child) {
  text-align: center;
  vertical-align: middle;
}

.report-card tbody td:not(:first-child) input,
.report-card tbody td:not(:first-child) select,
.report-card tbody td:not(:first-child) textarea {
  text-align: center;
}

.report-card td.metric-percent {
  width: 35px;
  min-width: 35px;
  max-width: 35px;
  white-space: nowrap;
  padding-left: 0;
  padding-right: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: clip;
}

.report-card td.metric-goal,
.report-card td.metric-fact,
.report-card td.metric-total {
  white-space: nowrap;
  padding-left: 0;
  padding-right: 0;
  vertical-align: middle;
  text-align: center;
}

.report-card th.metric-percent {
  width: 35px;
  min-width: 35px;
  max-width: 35px;
  padding-left: 0;
  padding-right: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: clip;
}

.report-card th.metric-goal,
.report-card th.metric-fact {
  padding-left: 0;
  padding-right: 0;
}

.report-card td.metric-total {
  border-left-color: rgba(184, 157, 120, 0.22);
  border-right-color: rgba(184, 157, 120, 0.22);
}

.report-card td input:disabled,
.report-card td select:disabled,
.report-card td textarea:disabled {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  color: var(--text);
  white-space: nowrap;
}

.topbar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 74px;
  min-width: 74px;
  height: 32px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--accent);
  overflow: hidden;
  flex: 0 0 auto;
}

.theme-toggle .theme-icon {
  position: relative;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.theme-toggle .theme-icon svg {
  width: 15px;
  height: 15px;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  transition: left 0.2s ease;
}

.theme-toggle.dark::before {
  left: calc(100% - 4px - 22px);
}

.theme-toggle.light .theme-icon.sun,
.theme-toggle.dark .theme-icon.moon {
  color: #fff;
}

.topbar-controls select,
.topbar-controls button {
  width: auto;
  min-width: 0;
}

.topbar-controls .secondary,
.topbar-controls .mini {
  min-width: auto;
}

.topbar-pill,
.topbar-user {
  min-height: 32px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid #d0b188ff;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 12px;
  line-height: 28px;
  white-space: nowrap;
}

.topbar-pill {
  min-width: 126px;
  appearance: none;
  background-image: none;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
}

.topbar-user-menu {
  position: relative;
}

.topbar-user-button {
  gap: 8px;
  cursor: pointer;
}

.topbar-user-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text);
  transform: translateY(2px);
}

.topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  display: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  z-index: 140;
}

.topbar-user-menu.open .topbar-user-dropdown {
  display: grid;
  gap: 6px;
}

.topbar-user-item {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}

.topbar-org {
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  margin-left: 12px;
}

.topbar-org-menu {
  position: relative;
}

.topbar-org-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.topbar-org-button .topbar-org {
  margin-left: 12px;
}

.topbar-org-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text);
  transform: translateY(2px);
}

.topbar-org-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  display: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  z-index: 140;
}

.topbar-org-menu.open .topbar-org-dropdown {
  display: grid;
  gap: 6px;
}

.topbar-org-item {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--text);
  text-align: left;
  padding: 7px 10px;
  cursor: pointer;
}

.topbar-org-item.active {
  background: #d0b188ff;
  border-color: #d0b188ff;
  color: #1f1b16;
}

.notice-panel {
  margin: 10px 0;
}

.nested-panel {
  box-shadow: none;
  background: rgba(255, 255, 255, 0.72);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

.check input {
  width: auto;
}

.editable-cell {
  background: var(--edit);
}

.save-bar {
  position: sticky;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 7px;
  background: rgba(43, 36, 27, 0.92);
  color: white;
  box-shadow: var(--shadow);
}

.save-bar .primary {
  background: white;
  color: var(--text);
  border-color: white;
}

.divider {
  height: 1px;
  background: rgba(184, 157, 120, 0.38);
  margin: 10px 0 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 7px;
  background: rgba(112, 145, 94, 0.12);
  color: var(--text);
}

.save-button {
  min-width: 122px;
  border: 1px solid #d0b188ff;
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--text);
}

.save-button.pulse {
  background: #93c47dff;
  border-color: #93c47dff;
  color: #1f1b16;
}

.badge.pending {
  background: rgba(177, 47, 47, 0.12);
}

.mop-only-shell {
  max-width: 980px;
  padding-top: 10px;
}

.mop-only-shell .panel {
  margin-left: 0;
  margin-right: 0;
}

.mop-standalone-page .grid-4 {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

@media (max-width: 900px) {
  .mop-only-shell {
    padding-top: 6px;
  }

  .mop-standalone-page .grid-4 {
    grid-template-columns: 1fr;
  }

  .mop-standalone-page .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mop-standalone-page h2 {
    font-size: 36px;
  }
}

@media (max-width: 1100px) {
  .topbar,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    gap: 18px;
    padding: 18px 16px;
  }

  .grid-5,
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

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

  .settings-nav {
    position: static;
  }

  .topbar-controls select,
  .topbar-controls button {
    width: 100%;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .nav button {
    min-width: 0;
    width: 100%;
  }

  .topbar-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .topbar-controls .theme-toggle {
    width: 74px;
    min-width: 74px;
  }

  .topbar-pill,
  .topbar-user,
  .topbar-org {
    width: 100%;
    margin-left: 0;
  }

  .brand-logo {
    width: 72px;
    height: 58px;
  }

  .brand-title {
    font-size: 24px;
  }

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