:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #10161d;
  --surface-2: #141b24;
  --surface-3: #0c1118;
  --field: #080d13;
  --line: #233044;
  --line-2: #314159;
  --text: #f5f7fb;
  --muted: #8492aa;
  --blue: #3c82f6;
  --blue-soft: rgba(60, 130, 246, 0.14);
  --cyan: #35c9c1;
  --amber: #d7a44b;
  --green: #10d98e;
  --red: #ef4354;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(14, 21, 30, 0.9), rgba(8, 11, 16, 0.96) 280px),
    radial-gradient(circle at 12% 0%, rgba(60, 130, 246, 0.16), transparent 360px),
    radial-gradient(circle at 90% 18%, rgba(53, 201, 193, 0.1), transparent 320px),
    var(--bg);
}

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

button {
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--text);
  background: var(--field);
  outline: none;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 122px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(60, 130, 246, 0.16);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 22, 29, 0.94);
  box-shadow: var(--shadow);
}

.login-logo,
.brand,
.top-actions,
.section-head,
.bind-head,
.law-head,
.user-card,
.admin-tabs,
.content-card-head {
  display: flex;
  align-items: center;
}

.login-logo {
  gap: 14px;
}

.login-logo p,
.section-kicker,
.hint,
.error-line {
  margin: 0;
}

.login-logo h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.login-logo p,
.section-kicker {
  color: var(--muted);
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-kicker {
  font-size: 12px;
}

.crest {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: linear-gradient(135deg, #c7152c, #ff5363);
  color: #fff;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.crest.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.primary-button,
.chip-button,
.copy-button,
.top-icon,
.logout-button,
.admin-tabs button,
.main-nav button,
.segmented button,
.danger-button,
.ghost-button,
.menu-item,
.law-result,
.article-index-item {
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--text);
  background: var(--surface-3);
  font-weight: 800;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.primary-button {
  height: 46px;
  background: linear-gradient(135deg, var(--blue), #2d6ce0);
}

.primary-button:hover,
.copy-button:hover,
.top-icon:hover,
.logout-button:hover,
.admin-tabs button:hover,
.main-nav button:hover,
.segmented button:hover,
.danger-button:hover,
.ghost-button:hover,
.menu-item:hover,
.law-result:hover,
.article-index-item:hover {
  transform: translateY(-1px);
  border-color: rgba(60, 130, 246, 0.7);
}

.hint {
  color: var(--muted);
  text-align: center;
}

.error-line {
  min-height: 20px;
  color: #ff6776;
  font-weight: 800;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 230px;
  gap: 18px;
  align-items: center;
  min-height: 78px;
  padding: 0 max(22px, calc((100vw - 1700px) / 2));
  border-bottom: 1px solid rgba(49, 65, 89, 0.62);
  background: rgba(15, 21, 29, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  gap: 14px;
  font-size: 22px;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 6px;
  border: 1px solid rgba(49, 65, 89, 0.72);
  border-radius: 15px;
  background: rgba(8, 12, 18, 0.72);
  overflow-x: auto;
}

.bottom-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.main-nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  height: 40px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.main-nav button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #2f72e8);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(49, 65, 89, 0.72);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(8, 12, 18, 0.72);
  font-weight: 850;
}

.bottom-nav button span {
  font-size: 18px;
  line-height: 1;
}

.main-nav button span,
.bottom-nav button span,
.top-icon {
  color: currentColor;
}

.main-nav button svg,
.bottom-nav button svg,
.top-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav button svg,
.top-icon svg {
  width: 20px;
  height: 20px;
}

.bottom-nav button.active {
  color: #fff;
  border-color: rgba(53, 201, 193, 0.5);
  background: rgba(53, 201, 193, 0.14);
}

.top-actions {
  justify-content: flex-end;
  gap: 10px;
}

.top-icon,
.logout-button {
  height: 38px;
  color: var(--muted);
  border-color: rgba(49, 65, 89, 0.72);
  background: rgba(8, 12, 18, 0.72);
}

.top-icon {
  display: grid;
  place-items: center;
  width: 38px;
}

.top-icon.admin-only:not(.hidden) {
  color: #dce7fb;
  background: rgba(60, 130, 246, 0.12);
}

.user-pill {
  max-width: 112px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  padding: 0 12px;
  font-size: 13px;
}

.page {
  display: none;
  width: min(1692px, calc(100% - 48px));
  margin: 32px auto 0;
}

.page.active {
  display: block;
}

.employee-settings,
.admin-create,
.admin-list-panel,
.reader-panel,
.builder-panel,
.preview-panel,
.law-documents,
.law-results-panel,
.bind-card,
.report-card,
.update-item,
.review-card,
.contact-line,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 22, 29, 0.9);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.employee-settings {
  padding: 24px;
  margin-bottom: 28px;
}

.panel-title {
  margin-bottom: 22px;
  color: #b4c5dc;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--field);
}

.segmented button {
  height: 38px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: #fff;
  background: var(--blue);
}

.search-row,
.law-search-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: rgba(16, 22, 29, 0.82);
  color: var(--muted);
}

.bind-search {
  width: 100%;
  height: 54px;
  margin-bottom: 32px;
  padding: 0 16px;
  font-size: 20px;
}

.search-row input,
.law-search-strip input {
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  box-shadow: none;
}

.content-groups {
  display: grid;
  gap: 40px;
}

.group-title {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 18px;
  align-items: center;
  margin: 0 0 22px;
  font-size: 26px;
}

.group-title::after {
  content: "";
  height: 1px;
  background: var(--line);
}

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

.bind-card {
  min-height: 294px;
  padding: 22px;
}

.bind-card.optional {
  border-color: rgba(239, 67, 84, 0.48);
}

.bind-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.bind-head h3,
.report-card h3 {
  margin: 0;
  font-size: 20px;
}

.status-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #ff7380;
  background: rgba(239, 67, 84, 0.14);
}

.required-badge {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 5px 10px;
  border: 1px solid rgba(239, 67, 84, 0.45);
  border-radius: 7px;
  color: #ff7d89;
  background: rgba(239, 67, 84, 0.15);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.key-editor {
  margin-bottom: 18px;
}

.key-editor span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.bind-key-input {
  height: 40px;
  color: var(--blue);
  font-weight: 900;
}

.command-list {
  display: grid;
  gap: 10px;
}

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

.command-code {
  min-height: 38px;
  padding: 10px 13px;
  border-radius: 9px;
  color: var(--green);
  background: #070a0f;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.copy-button {
  width: 42px;
  height: 38px;
  color: var(--muted);
  border-color: rgba(49, 65, 89, 0.62);
}

.split-workspace,
.report-builder,
.law-workspace {
  display: grid;
  gap: 26px;
}

.split-workspace {
  grid-template-columns: 370px minmax(0, 1fr);
}

.report-builder {
  grid-template-columns: 430px minmax(0, 1fr);
}

.law-workspace {
  grid-template-columns: 380px minmax(0, 1fr);
}

.orders-workspace {
  display: grid;
  grid-template-columns: minmax(430px, 0.95fr) minmax(0, 1fr);
  gap: 26px;
  height: calc(100vh - 52px);
}

.orders-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  overflow-y: auto;
}

.orders-left > .builder-panel {
  flex: 0 0 auto;
}

.order-type-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--field);
}

.orders-left .builder-panel {
  min-height: 0;
}

.order-mode-switch {
  margin-bottom: 10px;
}

.order-template-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.order-type-grid button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #a9bad2;
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.order-type-grid button.active {
  color: #fff;
  background: var(--blue);
}

.order-employees {
  display: grid;
  gap: 14px;
}

.order-signature-toggle {
  width: fit-content;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(78, 101, 139, 0.5);
  border-radius: 12px;
  background: rgba(12, 20, 31, 0.76);
}

.order-signer-fields {
  margin-top: 10px;
}

.order-employee {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(78, 101, 139, 0.34);
  border-radius: 16px;
  background: rgba(7, 12, 18, 0.62);
}

.order-employee-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 900;
}

.order-extra-fields {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(78, 101, 139, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.order-extra-fields[open] {
  display: grid;
}

.order-extra-fields summary {
  cursor: pointer;
  color: var(--blue-soft);
  font-weight: 900;
}

.order-extra-fields[open] summary {
  margin-bottom: 12px;
}

.order-preview-panel {
  min-height: 0;
  overflow-y: auto;
}

.order-copy {
  width: auto;
  padding: 0 18px;
}

.order-preview {
  min-height: calc(100% - 88px);
  margin: 20px 0 0;
  padding: 18px;
  border: 1px solid rgba(60, 130, 246, 0.72);
  border-radius: 14px;
  color: #ffffff;
  background: #070a0f;
  font: 800 14px/1.55 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

.order-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: rgba(7, 12, 18, 0.62);
}

.compact-check {
  grid-column: auto;
  min-height: 36px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(78, 101, 139, 0.34);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(12, 17, 24, 0.76);
  font-size: 13px;
}

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

.order-template-textarea {
  min-height: 280px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.variable-bank {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 18, 0.54);
}

.variable-group {
  display: grid;
  gap: 8px;
}

.variable-group strong {
  color: var(--blue-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.variable-chip {
  width: auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(60, 130, 246, 0.52);
  border-radius: 7px;
  color: #d9e8ff;
  background: rgba(28, 75, 139, 0.3);
  font: 800 12px/1 Consolas, "Courier New", monospace;
}

.settings-subpanel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 12, 18, 0.48);
}

.settings-subpanel h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

#page-info .split-workspace,
#page-lessons .static-workspace,
#page-practices .static-workspace,
#page-reports .report-builder,
#page-laws .law-workspace {
  height: calc(100vh - 52px);
  align-items: stretch;
}

#page-info .section-menu,
#page-info .reader-panel,
#page-lessons .section-menu,
#page-lessons .reader-panel,
#page-practices .section-menu,
#page-practices .reader-panel,
#page-reports .builder-panel,
#page-reports .preview-panel,
#page-laws .law-documents,
#page-laws .law-results-panel {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}

.simple-workspace {
  width: 100%;
}

.developer-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  align-items: start;
  gap: 26px;
}

.reader-panel.developer-card {
  grid-column: 1 / -1;
  min-height: 0;
  padding: 28px;
}

.developer-profile {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 0;
  text-align: center;
}

.developer-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border: 1px solid rgba(53, 201, 193, 0.38);
  border-radius: 24px;
  color: #eafdfb;
  background:
    linear-gradient(145deg, rgba(53, 201, 193, 0.22), rgba(60, 130, 246, 0.14)),
    rgba(255, 255, 255, 0.04);
  font-size: 30px;
  font-weight: 900;
}

.developer-profile .reader-lead {
  margin-top: 14px;
}

.full-workspace,
.full-reader {
  min-height: calc(100vh - 52px);
}

.section-menu,
.law-documents,
.builder-panel,
.preview-panel,
.law-results-panel,
.reader-panel {
  min-height: 640px;
}

.section-menu {
  padding: 12px 0;
}

.law-documents,
.builder-panel,
.preview-panel,
.law-results-panel,
.reader-panel {
  padding: 24px;
}

.vertical-menu {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.menu-item {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 58px;
  padding: 0 16px;
  color: #b5c5da;
  text-align: center;
  border-color: transparent;
  background: rgba(20, 27, 36, 0.92);
}

.menu-item span {
  color: var(--muted);
  font-size: 12px;
}

.menu-item.active {
  color: #fff;
  border-color: rgba(60, 130, 246, 0.55);
  background: var(--blue-soft);
}

.section-menu .menu-item {
  grid-template-columns: 30px minmax(0, 1fr);
  place-items: center stretch;
  text-align: left;
}

.info-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(78, 101, 139, 0.26);
  border-radius: 10px;
  color: #90a7c4;
  background: rgba(5, 10, 16, 0.36);
}

.info-icon svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.info-title {
  justify-self: start;
  overflow-wrap: anywhere;
}

.info-group {
  display: grid;
  gap: 8px;
}

.info-group-toggle {
  grid-template-columns: 30px minmax(0, 1fr) 20px !important;
}

.info-chevron {
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.info-group.open .info-chevron {
  transform: rotate(0deg);
}

.info-submenu {
  display: none;
  gap: 8px;
  padding-left: 12px;
}

.info-group.open .info-submenu {
  display: grid;
}

.info-menu-item.nested {
  min-height: 48px;
  padding: 0 12px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.info-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}

.info-copy-row pre {
  margin: 0;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.info-copy-row pre:hover {
  border-color: rgba(53, 201, 193, 0.5);
  background: rgba(2, 12, 18, 0.78);
}

.info-copy-button {
  width: 42px;
  height: 48px;
  min-height: 0;
  align-self: center;
}

.reader-panel h2,
.builder-panel h2,
.section-head h2 {
  margin: 6px 0 0;
  font-size: 28px;
}

.reader-text {
  margin-top: 24px;
  color: #cfd9e8;
  font-size: 16px;
  line-height: 1.75;
}

.reader-lead {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.update-timeline,
.review-list {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.static-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.static-section-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(78, 101, 139, 0.34);
  border-radius: 18px;
  background: rgba(10, 17, 25, 0.82);
}

.static-section-card span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(53, 201, 193, 0.36);
  border-radius: 14px;
  color: #dffdfa;
  background: rgba(53, 201, 193, 0.1);
  font-weight: 900;
}

.static-section-card h3 {
  margin: 0;
  font-size: 18px;
}

.static-section-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.update-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.update-item time,
.review-card time {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 900;
}

.update-item h3,
.review-card p {
  margin: 0;
}

.update-item .reader-text {
  margin-top: 10px;
}

.contact-line {
  margin-top: 22px;
  padding: 14px 16px;
  color: #d9e6f7;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.developer-profile .contact-line {
  display: inline-flex;
  justify-content: center;
  width: auto;
  max-width: min(520px, 100%);
  margin-top: 18px;
  padding: 13px 18px;
  text-align: center;
  text-decoration: none;
}

.builder-panel.feedback-panel,
.reader-panel.reviews-panel {
  min-height: 0;
}

.contact-link {
  color: #dffdfa;
  border-color: rgba(53, 201, 193, 0.36);
  background: rgba(53, 201, 193, 0.1);
}

.contact-link:hover {
  transform: translateY(-1px);
  border-color: rgba(53, 201, 193, 0.68);
}

.feedback-panel textarea {
  min-height: 150px;
}

.review-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.review-head,
.review-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.review-head > div {
  display: grid;
  gap: 5px;
}

.stars,
.rating-input button.active {
  color: #ffd166;
}

.rating-input {
  display: flex;
  gap: 8px;
}

.rating-input button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #536174;
  background: rgba(255, 255, 255, 0.035);
  font-size: 22px;
}

.admin-answer {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(53, 201, 193, 0.32);
  border-radius: 14px;
  background: rgba(53, 201, 193, 0.08);
}

.admin-answer strong {
  color: var(--cyan);
}

.reply-form {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.reply-form textarea {
  min-height: 86px;
}

.review-card p {
  color: #cbd6e6;
  line-height: 1.55;
}

.dynamic-fields {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.section-head {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head.compact {
  align-items: flex-end;
}

.compact-search {
  width: min(360px, 100%);
}

.report-list,
.law-result-list {
  display: grid;
  gap: 14px;
}

.report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 16px;
  align-items: start;
  padding: 20px;
}

.report-card p {
  margin: 12px 0 0;
  color: #cad4e4;
  line-height: 1.65;
}

.law-search-strip {
  height: 56px;
  margin-bottom: 24px;
  padding: 0 16px;
  font-size: 20px;
}

.law-result {
  display: grid;
  gap: 6px;
  padding: 14px;
  color: #dbe6f8;
  text-align: left;
  border-color: var(--line);
}

.law-result span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.law-result.active {
  border-color: rgba(53, 201, 193, 0.55);
  background: rgba(53, 201, 193, 0.1);
}

.law-result small {
  color: #aab8cf;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.search-fragment mark,
.law-result mark {
  padding: 0 0.18em;
  border-radius: 4px;
  color: #04120f;
  background: #75f0da;
}

.article-index {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.article-index-item {
  display: grid;
  gap: 5px;
  padding: 14px;
  color: #dce7f6;
  text-align: left;
  border-color: var(--line);
}

.article-index-item span {
  color: var(--blue);
  font-weight: 900;
}

.penalty-box {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid rgba(215, 164, 75, 0.4);
  border-radius: 12px;
  color: #f3d49b;
  background: rgba(215, 164, 75, 0.1);
}

.admin-grid {
  display: grid;
  grid-template-columns: 520px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.admin-create,
.admin-list-panel {
  padding: 24px;
}

.admin-create h2,
.admin-list-panel h2 {
  margin: 0 0 22px;
}

.stack-form,
.content-editor,
.admin-tab-panel.active {
  display: grid;
  gap: 16px;
}

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

.role-tabs button {
  min-width: 0;
  padding-inline: 8px;
  overflow: hidden;
  font-size: clamp(0.78rem, 0.45vw + 0.66rem, 0.95rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.check-row {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.muted-label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

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

.permission-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.permission-tile.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.admin-tabs {
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  overflow: visible;
}

.admin-tabs button {
  min-width: max-content;
  height: 38px;
  padding: 0 12px;
  color: var(--muted);
  border-color: var(--line);
  white-space: nowrap;
}

.admin-tabs button.active {
  color: #fff;
  background: var(--blue);
}

.admin-tab-panel {
  display: none;
}

.user-card,
.content-admin-card {
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 17, 24, 0.88);
}

.user-card {
  justify-content: space-between;
}

.user-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #cfe0ff;
  background: rgba(60, 130, 246, 0.18);
  font-weight: 900;
}

.user-card h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(60, 130, 246, 0.5);
  border-radius: 7px;
  color: #bcd2ff;
  background: rgba(60, 130, 246, 0.14);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.user-actions,
.content-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-button,
.danger-button {
  min-height: 36px;
  padding: 0 12px;
  border-color: var(--line);
  min-width: 72px;
  white-space: nowrap;
  word-break: normal;
}

.danger-button {
  color: #ff7f8b;
  border-color: rgba(239, 67, 84, 0.35);
  background: rgba(239, 67, 84, 0.1);
}

.content-admin-card {
  display: grid;
}

.content-card-head {
  justify-content: space-between;
  gap: 16px;
}

.content-editor {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(12, 17, 24, 0.88);
}

.floating-editor {
  border-color: rgba(60, 130, 246, 0.6);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr;
    padding: 14px 18px;
  }

  .brand,
  .top-actions {
    justify-content: center;
  }

  .settings-grid,
  .split-workspace,
  .report-builder,
  .law-workspace,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .section-menu,
  .law-documents,
  .builder-panel,
  .preview-panel,
  .law-results-panel,
  .reader-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 24px, 1692px);
    margin-top: 18px;
  }

  .employee-settings,
  .admin-create,
  .admin-list-panel,
  .law-documents,
  .builder-panel,
  .preview-panel,
  .law-results-panel,
  .reader-panel {
    padding: 18px;
  }

  .bind-grid,
  .two-fields,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .user-card,
  .section-head,
  .law-head {
    align-items: stretch;
    flex-direction: column;
  }

  .report-card {
    grid-template-columns: 1fr;
  }
}

/* Layout v2: side command panel */
body {
  background:
    radial-gradient(circle at 72% 8%, rgba(35, 96, 180, 0.14), transparent 420px),
    linear-gradient(135deg, #07090d 0%, #0a1118 48%, #071017 100%);
}

.topbar {
  position: fixed;
  inset: 18px auto 18px 18px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: 248px;
  min-height: auto;
  padding: 18px;
  border: 1px solid rgba(78, 101, 139, 0.38);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(18, 28, 40, 0.96), rgba(8, 13, 20, 0.96)),
    #0b1119;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.brand {
  align-items: flex-start;
  font-size: 20px;
}

.crest.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.main-nav {
  display: grid;
  align-content: start;
  gap: 10px;
  width: 100%;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.main-nav button {
  justify-content: flex-start;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #9cabc2;
  background: rgba(255, 255, 255, 0.035);
}

.main-nav button.active {
  color: #f8fbff;
  border-color: rgba(62, 144, 255, 0.55);
  background:
    linear-gradient(135deg, rgba(62, 144, 255, 0.94), rgba(43, 101, 204, 0.92)),
    var(--blue);
  box-shadow: 0 12px 34px rgba(61, 130, 246, 0.28);
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: end;
  width: 100%;
  gap: 8px;
  justify-content: stretch;
  margin: 0 0 10px;
}

.bottom-nav button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  height: 46px;
  padding: 0;
  color: #93a4bb;
  border-color: rgba(78, 101, 139, 0.24);
  background: rgba(255, 255, 255, 0.028);
  text-align: center;
}

.bottom-nav button.active {
  color: #eafdfb;
  border-color: rgba(53, 201, 193, 0.48);
  background: rgba(53, 201, 193, 0.12);
}

.top-actions {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  justify-content: stretch;
  align-items: stretch;
}

.user-pill {
  grid-column: 1 / -1;
  max-width: none;
  padding: 12px 14px;
  border: 1px solid rgba(78, 101, 139, 0.34);
  border-radius: 14px;
  color: #d5dfef;
  background: rgba(255, 255, 255, 0.04);
}

.top-icon,
.logout-button {
  height: 44px;
  border-radius: 13px;
}

.logout-button {
  grid-column: 1 / -1;
  width: 100%;
}

.top-icon {
  grid-column: 1;
}

.user-pill {
  grid-column: 2;
  display: flex;
  align-items: center;
}

#genderSwitcher [data-gender="female"].active {
  background: linear-gradient(135deg, #f05ca8, #c33e88);
  box-shadow: 0 10px 26px rgba(240, 92, 168, 0.26);
}

.key-capture {
  cursor: pointer;
  user-select: none;
}

.key-capture.waiting-key {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(53, 201, 193, 0.18);
}

.rich-storage {
  display: none;
}

.rich-editor-wrap {
  display: grid;
  gap: 10px;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(78, 101, 139, 0.32);
  border-radius: 14px;
  background: rgba(5, 10, 16, 0.58);
}

.rich-toolbar button,
.image-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font-weight: 850;
}

.rich-toolbar select {
  width: auto;
  height: 34px;
  min-width: 110px;
}

.rich-toolbar input[type="color"] {
  width: 42px;
  height: 34px;
  padding: 3px;
}

.image-file-button input {
  display: none;
}

.rich-editor {
  min-height: 190px;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  color: var(--text);
  background: var(--field);
  line-height: 1.65;
  overflow-wrap: anywhere;
  outline: none;
}

.rich-editor:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(60, 130, 246, 0.16);
}

.rich-output img,
.rich-editor img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 14px;
}

.rich-output b,
.rich-output strong {
  font-weight: 900;
  color: inherit;
}

.rich-output i,
.rich-output em {
  font-style: italic;
}

.rich-output u {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
}

.rich-output font[size="2"] {
  font-size: 0.9rem;
}

.rich-output font[size="4"] {
  font-size: 1.18rem;
}

.rich-output font[size="6"] {
  font-size: 1.55rem;
}

.rich-output h3 {
  margin: 22px 0 10px;
  color: #eef5ff;
  font-size: 1.22rem;
}

.rich-output p {
  margin: 0 0 10px;
}

.rich-output pre {
  max-width: 100%;
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid rgba(78, 101, 139, 0.3);
  border-radius: 12px;
  color: #00e19f;
  background: rgba(2, 7, 12, 0.58);
  font: 800 0.92rem/1.55 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.page {
  width: min(1520px, calc(100% - 314px));
  margin: 26px 28px 0 286px;
}

.page.active {
  display: block;
}

.employee-settings,
.admin-create,
.admin-list-panel,
.reader-panel,
.builder-panel,
.preview-panel,
.law-documents,
.law-results-panel,
.bind-card,
.report-card,
.update-item,
.review-card,
.contact-line,
.empty-state {
  border-color: rgba(78, 101, 139, 0.34);
  border-radius: 22px;
  background: rgba(10, 17, 25, 0.86);
  box-shadow: none;
}

.split-workspace {
  grid-template-columns: 310px minmax(0, 1fr);
}

.law-workspace {
  grid-template-columns: 330px minmax(0, 1fr);
}

.admin-grid {
  grid-template-columns: minmax(460px, 520px) minmax(0, 1fr);
}

.admin-list-panel,
.preview-panel,
.law-results-panel,
.reader-panel,
.content-editor,
.content-admin-card,
.reader-text,
.reader-lead,
.law-result,
.article-index-item,
.update-item,
.review-card,
.contact-line,
.command-code,
.hint {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-list-panel {
  overflow: hidden;
}

.content-card-head,
.user-card {
  align-items: flex-start;
}

.content-card-head > div,
.user-main > div {
  min-width: 0;
}

.reader-panel,
.law-results-panel {
  overflow: hidden;
}

#page-info .section-menu,
#page-info .reader-panel,
#page-lessons .section-menu,
#page-lessons .reader-panel,
#page-practices .section-menu,
#page-practices .reader-panel,
#page-reports .builder-panel,
#page-reports .preview-panel,
#page-laws .law-documents,
#page-laws .law-results-panel {
  overflow-y: auto;
}

.reader-text {
  padding: 18px;
  border: 1px solid rgba(78, 101, 139, 0.24);
  border-radius: 16px;
  background: rgba(3, 8, 13, 0.38);
}

.menu-item {
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
  overflow-wrap: anywhere;
}

.menu-item.active {
  background: rgba(53, 201, 193, 0.12);
  border-color: rgba(53, 201, 193, 0.48);
}

.bind-search,
.law-search-strip {
  border-radius: 18px;
  background: rgba(7, 13, 20, 0.74);
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    width: auto;
    margin: 12px;
  }

  .page {
    width: min(100% - 24px, 1520px);
    margin: 18px auto 0;
  }

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

  .top-actions {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .user-pill {
    grid-column: auto;
  }

  .split-workspace,
  .report-builder,
  .law-workspace,
  .developer-workspace,
  .orders-workspace,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  #page-info .split-workspace,
  #page-lessons .static-workspace,
  #page-practices .static-workspace,
  #page-reports .report-builder,
  #page-laws .law-workspace {
    height: auto;
  }

  .orders-workspace {
    height: auto;
  }

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

  .update-item {
    grid-template-columns: 1fr;
  }

  .static-section-grid {
    grid-template-columns: 1fr;
  }
}
