:root {
  --bg: #f6fbf5;
  --surface: #ffffff;
  --primary: #2d5a27;
  --primary-soft: #4d7c0f;
  --text: #1f2937;
  --muted: #4b5563;
  --border: #d9e7d4;
  --danger: #b91c1c;

  /* Публичные страницы (макеты design/work) */
  --pub-bg: #f5f7f5;
  --pub-heading: #1b4d3e;
  --pub-accent: #3a5a38;
  --pub-accent-soft: #e8f5e9;
  --pub-icon-bg: #f1f8e9;
  --pub-icon-stroke: #558b2f;
  --pub-text-muted: #666666;
  --pub-border: #e5e7eb;
  --pub-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --pub-container-max: 1400px;
  --pub-radius-lg: 16px;
  --pub-radius-md: 12px;
  --pub-radius-sm: 8px;
  --pub-action-bg: #e8f5e9;
  --pub-action-color: #2e7d32;
  --pub-action-hover-bg: #c8e6c9;
  --pub-action-hover-color: #1b5e20;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top left, #eef8eb, var(--bg));
  color: var(--text);
}

body.service-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.service-page > .container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

body.service-page footer[data-global-footer] {
  flex-shrink: 0;
  margin-top: auto;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem;
}

/* Шапка — design/work/index1_2, index2 */
.topbar {
  position: sticky;
  top: 0.5rem;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.7rem 1.35rem;
  margin-bottom: 1rem;
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}

.topbar .nav-link,
.topbar .nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  color: #2c4c3b;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar .nav-link:hover,
.topbar .nav-link-btn:hover {
  color: #1b5e20;
  background: #e8f5e9;
}

.topbar .nav-link:focus-visible,
.topbar .nav-link-btn:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #3b6bc4;
  outline-offset: 2px;
}

.topbar .nav-link-active {
  color: #1b5e20;
  background: #e8f5e9;
  font-weight: 600;
}

.topbar .nav-link-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.topbar .nav-link-login {
  color: #2c4c3b;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0.15rem 0.25rem;
  border-radius: 12px;
  font: inherit;
  text-align: right;
  transition: background-color 0.2s ease;
}

.topbar-user:hover {
  background: #f1f8e9;
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

.topbar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #4b5563;
}

.topbar-user-role {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: lowercase;
}

.topbar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.topbar-user-chevron {
  width: 0.65rem;
  height: 0.65rem;
  flex-shrink: 0;
  opacity: 0.55;
}

.page-crumb {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
}

.page-crumb a {
  color: var(--primary-soft);
  text-decoration: none;
}

.page-crumb a:hover {
  text-decoration: underline;
}

.page-lead {
  margin: 0 0 0.65rem;
  max-width: 78ch;
  line-height: 1.5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  color: var(--primary);
}

.brand-link {
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #2c4c3b;
}

.brand-subtitle {
  font-size: 0.8125rem;
  color: #4a7c59;
  font-weight: 500;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(45, 90, 39, 0.12);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: #244720;
}

.btn-soft {
  background: #dff0d9;
  color: #1f4a1a;
  border: 1px solid #9fc692;
}

.btn-soft:hover {
  background: #d1e8c9;
}

.btn-ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #f3f8f0;
  color: #294f24;
}

.section,
.panel {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fbfef9;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #b6d3ad;
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.08);
}

.global-footer {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem 0 1.5rem;
  text-align: center;
}

.ui-title {
  margin: 0 0 0.65rem;
  color: var(--primary);
}

.ui-subtitle {
  margin: 0 0 0.6rem;
  color: var(--primary);
}

.ui-form-grid {
  display: grid;
  gap: 0.75rem;
  max-width: 760px;
}

.ui-label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.95rem;
}

.ui-input-narrow {
  max-width: 5.5rem;
  min-width: 4rem;
}

.ui-toolbar label,
.ui-toolbar-field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.ui-toolbar--align-end {
  align-items: end;
}

.ui-toolbar .ui-limit-label,
.ui-toolbar label.ui-limit-label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  white-space: normal;
}

.ui-limit-input {
  font-weight: 400;
  min-width: 4.5rem;
  max-width: 5.5rem;
}

.help-page .section.panel {
  margin-top: 1rem;
}

.help-tabs {
  display: inline-flex;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.35rem;
  background: #f8fcf7;
  margin-top: 0.5rem;
}

.help-tab-btn {
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.help-tab-btn.active {
  color: var(--primary);
  background: #e8f4e4;
  border-color: #c8dfbf;
}

.help-panel {
  margin-top: 1rem;
}

.help-panel.is-hidden {
  display: none;
}

.concept-nav-table td:last-child {
  white-space: nowrap;
}

.page-lead {
  max-width: 75ch;
}

.help-quick-nav {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.75rem;
}

.help-quick-nav a.card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.help-quick-nav a.card:hover {
  border-color: var(--primary-soft);
  box-shadow: 0 6px 16px rgba(45, 90, 39, 0.12);
}

.help-quick-nav a.card h3 {
  margin: 0 0 0.35rem;
  color: var(--primary);
  font-size: 1.05rem;
}

.help-quick-nav a.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ui-table td.ui-num,
.ui-table th.ui-num {
  text-align: right;
}

.ui-input,
.ui-form-grid input,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
select,
textarea {
  color: var(--text);
  background-color: #fff;
}

.ui-input,
.ui-form-grid input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font: inherit;
}

.ui-input::placeholder,
.ui-toolbar input::placeholder,
.ui-form-grid input::placeholder,
.profile-grid input::placeholder {
  color: #6b7280;
  opacity: 1;
}

.ui-file-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.ui-hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ui-check,
.ui-switch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.35;
  user-select: none;
}

.ui-switch-row {
  display: flex;
  min-height: 2rem;
}

.ui-check input[type="checkbox"],
.ui-check input[type="radio"],
.ui-switch-row input[type="checkbox"],
.ui-switch-row input[type="radio"],
.ui-choice-group input[type="checkbox"],
.ui-choice-group input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.ui-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f6fbf4;
}

.ui-choice-group legend {
  padding: 0 0.35rem;
  font-weight: 600;
  color: var(--primary);
}

.ui-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ui-toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.ui-toolbar input,
.ui-toolbar select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  min-width: 170px;
  font: inherit;
  color: var(--text);
  background-color: #fff;
}

.ui-toolbar .ui-toolbar-wide {
  min-width: 260px;
}

.ui-msg {
  min-height: 1.2rem;
  font-weight: 600;
}

.ui-msg.ok {
  color: var(--primary);
}

td.error,
.ui-msg.error {
  color: var(--danger);
}

.ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.ui-table th,
.ui-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.5rem 0.35rem;
  vertical-align: top;
}

.ui-table th.ui-th-sortable {
  cursor: pointer;
  white-space: nowrap;
  color: var(--primary);
}

.ui-table th.ui-th-sortable:hover {
  background: #eef8ea;
}

.ui-table th.ui-th-sort-asc::after {
  content: " ▲";
  font-size: 0.72em;
  opacity: 0.75;
}

.ui-table th.ui-th-sort-desc::after {
  content: " ▼";
  font-size: 0.72em;
  opacity: 0.75;
}

.users-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
}

body.user-panel-open .users-layout {
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.05fr);
}

.user-drawer {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcf6 100%);
  box-shadow: 0 14px 32px rgba(31, 41, 55, 0.1);
  padding: 1rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
  position: sticky;
  top: 5.5rem;
  animation: drawer-in 0.22s ease;
}

.user-drawer[hidden] {
  display: none !important;
}

.user-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.user-drawer .profile-grid {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ui-stat {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.25rem 0 0;
}

body.popup-page {
  margin: 0;
  background: #f4f8f2;
  min-height: 100vh;
}

.popup-root {
  max-width: 100%;
  padding: 1rem 1.1rem 1.5rem;
  box-sizing: border-box;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

body.ui-modal-open {
  overflow: hidden;
}

.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  background: rgba(15, 23, 42, 0.45);
}

.ui-modal-dialog {
  width: min(100%, 520px);
  max-height: calc(100dvh - 2.5rem);
  margin: auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.ui-modal-dialog--profile {
  width: min(100%, 720px);
  max-height: calc(100dvh - 1.5rem);
}

.ui-modal-dialog--profile .popup-root {
  overflow: auto;
  max-height: calc(100dvh - 2.5rem);
  padding: 1rem 1.15rem 1.1rem;
}

.ui-modal-dialog--help {
  width: min(100%, 640px);
}

.ui-modal-dialog--help .popup-root {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2.5rem);
}

.help-modal-header {
  flex-shrink: 0;
}

.help-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.25rem 0.15rem 0.5rem;
  line-height: 1.45;
  text-align: justify;
}

.help-modal-body p {
  margin: 0 0 0.75rem;
}

.ui-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.help-trigger {
  flex-shrink: 0;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--pub-accent, #2d6a4f);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.help-trigger:hover,
.help-trigger:focus-visible {
  background: #eef6f0;
  border-color: var(--pub-accent, #2d6a4f);
  outline: none;
}

.topbar .nav-link-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.nav-help-trigger {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.82rem;
  margin-left: 0.05rem;
}

.nav-section-tip {
  position: absolute;
  z-index: 1300;
  max-width: min(22rem, calc(100vw - 1.5rem));
  padding: 0.75rem 2rem 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}

.nav-section-tip__text {
  margin: 0;
}

.nav-section-tip__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  border: none;
  background: transparent;
  color: var(--pub-text-muted, #6b7280);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.15rem 0.25rem;
}

.ui-modal-dialog--wide {
  width: min(100%, 800px);
}

.ui-modal-dialog--graph {
  width: min(100%, 880px);
  max-width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
}

.ui-modal-dialog--graph .popup-root {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100dvh - 3.5rem);
  padding: 1rem 1.1rem 1rem;
}

.seasons-graph-modal {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.sg-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sg-preview-subtitle {
  margin-top: 0.3rem !important;
  font-size: 0.9rem;
  line-height: 1.4;
}

.sg-preview-chart {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: min(52dvh, 430px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  overflow: hidden;
}

.sg-preview-loading {
  margin: 0;
  font-size: 0.92rem;
}

.sg-preview-svg {
  width: 100%;
  max-height: 100%;
}

.sg-preview-svg svg {
  width: 100%;
  height: auto;
  max-height: min(50dvh, 400px);
  display: block;
}

.sg-preview-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sg-preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}

.sg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.sg-swatch {
  flex-shrink: 0;
  display: inline-block;
}

.sg-swatch--green {
  background: #008000;
  height: 0.22rem;
  width: 1.35rem;
  border-radius: 2px;
}

.sg-swatch--red {
  background: #e53935;
  height: 0.22rem;
  width: 1.35rem;
  border-radius: 2px;
}

.sg-swatch--blue {
  background: #1e40af;
  height: 0.65rem;
  width: 0.14rem;
  border-radius: 1px;
}

.sg-swatch--gray {
  background: #94a3b8;
  height: 0.22rem;
  width: 1.1rem;
  border-radius: 2px;
}

.sg-preview-note {
  margin: 0;
  font-size: 0.84rem;
}

.sg-preview-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}

.profile-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfef9;
}

.profile-summary-grid dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-summary-grid dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
  color: var(--text);
}

.nav-link-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0.35rem 0.55rem;
}

.ui-modal-dialog .popup-root {
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100dvh - 2.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.25rem 1.35rem 1.4rem;
  box-sizing: border-box;
}

.ui-modal-dialog .popup-root.panel {
  margin-top: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

/* Профиль — design/work/index1 */
.profile-card-ui {
  position: relative;
}

.profile-footer {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.profile-footer-msg {
  margin: 0 0 0.65rem;
  min-height: 0;
}

.profile-footer-msg:empty {
  display: none;
  margin: 0;
}

.profile-card-ui > .profile-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}

.profile-card-ui .profile-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f5f5f5;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.profile-card-ui .profile-header h1 {
  margin: 0 0 0.65rem;
  padding-right: 2.5rem;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 700;
  color: #1e4620;
  line-height: 1.25;
}

.profile-card-ui .profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8faf8;
}

.profile-card-ui .profile-meta-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-card-ui .profile-meta-item dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.2;
}

.profile-card-ui .profile-meta-item dd {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card-ui .profile-meta-mono {
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.8rem;
  font-weight: 500;
}

.profile-card-ui .profile-meta,
.profile-card-ui .profile-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.profile-card-ui .profile-section-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1e4620;
}

.profile-card-ui .profile-section-title--spaced {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.profile-email-login {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8faf8;
}

.profile-email-login-line {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.profile-email-login-line strong {
  color: #1e4620;
  word-break: break-all;
}

.profile-email-login-empty {
  margin: 0;
  font-size: 0.88rem;
}

.profile-email-login-forms {
  display: grid;
  gap: 0.85rem;
}

.profile-email-login-block {
  padding-top: 0.15rem;
}

.profile-email-login-title {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.profile-email-login-grid {
  margin-bottom: 0.55rem;
}

.profile-email-login--admin .profile-action-buttons--compact {
  margin-top: 0.35rem;
  gap: 0.5rem;
}

.profile-action-buttons--compact {
  flex-wrap: wrap;
}

.profile-card-ui .profile-form-grid,
.ui-modal-dialog .profile-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
}

.profile-card-ui .profile-input-group--wide {
  grid-column: 1 / -1;
}

.profile-card-ui .profile-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-card-ui .profile-input-group > span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding-left: 0.2rem;
}

.profile-card-ui .profile-input-group input,
.profile-card-ui .profile-form-grid input,
.profile-card-ui .profile-form-grid select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
}

.profile-card-ui .profile-input-group input:focus,
.profile-card-ui .profile-form-grid input:focus,
.profile-card-ui .profile-form-grid select:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
}

.profile-card-ui .profile-action-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin: 0;
}

.profile-card-ui .btn-profile-save {
  background: #1e4620;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-card-ui .btn-profile-txt {
  background: #e8f3e6;
  color: #1e4620;
  border: 1px solid #c8dcc4;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-card-ui .btn-profile-logout {
  margin-left: auto;
  background: #fff;
  color: #1e4620;
  border: 1px solid #b8cfb4;
  border-radius: 10px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.profile-card-ui .btn-profile-logout:hover {
  background: #f4faf2;
  border-color: #1e4620;
}

.profile-card-ui .btn-profile-logout:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.profile-card-ui .btn-profile-reset {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.65rem 1.35rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-card-ui .ui-choice-group {
  grid-column: 1 / -1;
  background: #f8faf8;
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 12px;
}

@media (max-width: 540px) {
  .ui-modal-backdrop {
    padding: 0.75rem;
  }

  .profile-card-ui .profile-form-grid,
  .ui-modal-dialog .profile-form-grid,
  .profile-summary-grid,
  .profile-card-ui .profile-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-card-ui .btn-profile-logout {
    margin-left: 0;
    width: 100%;
  }
}

.user-drawer .profile-grid input,
.user-drawer .profile-grid select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  font: inherit;
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ui-table-spaced {
  margin-top: 0.6rem;
}

.ui-table th.ui-th-narrow,
.ui-table td.ui-td-email-login {
  width: 6.5rem;
  white-space: nowrap;
  vertical-align: middle;
}

.ui-table th.ui-th-actions,
.ui-table td.ui-td-actions {
  width: 9.75rem;
  min-width: 9.75rem;
  vertical-align: middle;
}

.ui-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}

.ui-pill--ok {
  background: #e8f5e9;
  color: #2e5c2a;
  border: 1px solid #c8e6c9;
}

.btn-table {
  display: block;
  width: 100%;
  max-width: 9.25rem;
  padding: 0.42rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 8px;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

.btn-table:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(45, 90, 39, 0.1);
}

.ui-row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.ui-row-actions--reg {
  min-width: 10.5rem;
  max-width: 12rem;
}

.ui-row-actions--reg .ui-input {
  width: 100%;
  min-width: 0;
  font-size: 0.875rem;
  padding: 0.4rem 0.5rem;
}

.ui-row-actions__danger {
  color: #8b2e2e;
  border-color: #e8c4c4;
}

.ui-row-actions__danger:hover {
  background: #fff5f5;
  color: #6d1f1f;
  border-color: #ddb0b0;
}

.ui-table-frame {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
}

.ui-table-scroll {
  overflow: auto;
  flex: 0 1 auto;
  min-height: 120px;
}

.ui-table-pager {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.15rem 0 0.35rem;
}

.ui-table-pager-info {
  min-width: 8rem;
}

.admin-dash-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 0.5rem;
}

.admin-dash-grid .card {
  margin: 0;
}

.ui-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.ui-grid-auto {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ui-grid-auto input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.ui-form-narrow {
  max-width: 520px;
}

.u-self-end {
  align-self: end;
}

.u-mt-045 {
  margin-top: 0.45rem;
}

.u-mt-05 {
  margin-top: 0.5rem;
}

.u-mt-075 {
  margin-top: 0.75rem;
}

.u-mb-045 {
  margin-bottom: 0.45rem;
}

.ui-title-primary {
  margin-top: 0;
  color: var(--primary);
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    padding: 0.85rem 1rem;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-start;
  }

  .topbar-user {
    justify-content: flex-end;
    width: 100%;
  }

  .section,
  .panel {
    padding: 1rem;
  }
}

@media (max-width: 900px) {
  .ui-two-col {
    grid-template-columns: 1fr;
  }

  body.user-panel-open .users-layout {
    grid-template-columns: 1fr;
  }

  .user-drawer {
    position: static;
    max-height: none;
  }
}
