:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --text: #101820;
  --muted: #657386;
  --line: #d5dde7;
  --accent: #0772b8;
  --accent-strong: #005c98;
  --accent-soft: #e7f4fd;
  --sellomatic-black: #050608;
  --sellomatic-gray: #a8adb3;
  --cyan: #00a8df;
  --magenta: #e83f95;
  --print-yellow: #f4dc18;
  --blue: #0772b8;
  --red: #dc2626;
  --yellow: #d97706;
  --green: #16a34a;
  --ink: #0a0f16;
  --shadow: 0 18px 40px rgba(10, 15, 22, 0.12);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

body.theme-dark {
  --bg: #0f172a;
  --panel: #172033;
  --text: #f8fafc;
  --muted: #aab6c8;
  --line: #2b3a50;
  --accent: #0ea5e9;
  --accent-strong: #38bdf8;
  --accent-soft: #12314a;
  --sellomatic-black: #f8fafc;
  --sellomatic-gray: #8ea0b6;
  --ink: #f8fafc;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  color-scheme: dark;
}

body.theme-dark .login-view {
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.18), transparent 38%),
    linear-gradient(315deg, rgba(232, 63, 149, 0.12), transparent 42%),
    var(--bg);
}

body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea,
body.theme-dark dialog,
body.theme-dark .multi-filter summary,
body.theme-dark .ghost-button,
body.theme-dark .icon-button {
  border-color: var(--line);
  background: #101827;
  color: var(--text);
}

body.theme-dark .ghost-button:hover,
body.theme-dark .icon-button:hover {
  border-color: var(--accent);
}

body.theme-dark .sidebar {
  border-right-color: var(--line);
  background: linear-gradient(180deg, #131d2b 0%, #101827 100%);
}

body.theme-dark .module-item.active,
body.theme-dark tbody tr:hover,
body.theme-dark tbody tr.selected {
  background: #122b40;
}

body.theme-dark .module-item.planned {
  color: #8da0b8;
}

body.theme-dark .filters,
body.theme-dark .permission-toolbar,
body.theme-dark .forms-list-panel,
body.theme-dark .branch-admin {
  background: #101827;
}

body.theme-dark .permission-section-title,
body.theme-dark .permission-resource {
  background: #142033;
  color: var(--text);
}

body.theme-dark .permission-row,
body.theme-dark th,
body.theme-dark td {
  border-color: var(--line);
}

body.theme-dark .detail-panel {
  background: #0f172a;
}

body.theme-dark .pill {
  background: #243247;
  color: #e5eefb;
}

body.theme-dark .field-value,
body.theme-dark .field-builder-row,
body.theme-dark .form-list-item,
body.theme-dark .branch-item,
body.theme-dark .choice-field,
body.theme-dark .selected-form-note,
body.theme-dark .validation-panel {
  border-color: var(--line);
  background: #111c2e;
}

body.theme-dark .form-list-item.archived,
body.theme-dark .branch-item.archived {
  background: #101827;
}

body.theme-dark .private-field {
  border-color: rgba(232, 63, 149, 0.38);
  background: rgba(232, 63, 149, 0.14);
}

body.theme-dark .file-download {
  border-color: rgba(14, 165, 233, 0.42);
  background: #12314a;
  color: #7dd3fc;
}

body.theme-dark .private-chip {
  color: #f9a8d4;
}

body.theme-dark .toast {
  background: #e5eefb;
  color: #0f172a;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(7, 114, 184, 0.16), transparent 38%),
    linear-gradient(315deg, rgba(0, 168, 223, 0.12), transparent 42%),
    #f8fafc;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin: 0 0 22px;
  object-fit: contain;
}

.login-panel h1,
.topbar h1,
.workbench h2,
.dialog-form h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  margin-bottom: 24px;
  font-size: 30px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

label {
  display: block;
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(7, 114, 184, 0.16);
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 0 16px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  padding: 0 14px;
}

.ghost-button:hover {
  border-color: #94a3b8;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}

.login-panel .primary-button {
  width: 100%;
  margin-top: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.app-shell.sidebar-hidden {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 280px;
  border-right: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
  padding: 20px 16px;
  overflow: visible;
  transform: translateX(calc(-100% + 4px));
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.sidebar::after {
  content: "\2630";
  position: absolute;
  top: 24px;
  right: -38px;
  width: 34px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  opacity: 0.9;
  pointer-events: auto;
  box-shadow: 8px 0 18px rgba(10, 15, 22, 0.16);
}

.sidebar:hover,
.sidebar:focus-within {
  overflow-y: auto;
  transform: translateX(0);
  box-shadow: 18px 0 40px rgba(10, 15, 22, 0.18);
}

.sidebar:hover::after,
.sidebar:focus-within::after {
  opacity: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

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

.brand strong,
.brand span {
  display: block;
}

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

.nav-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-nav {
  display: grid;
  gap: 6px;
}

.module-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.module-item strong,
.module-item span {
  display: block;
}

.module-item strong {
  font-size: 14px;
}

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

.module-item.active {
  border-color: rgba(7, 114, 184, 0.26);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.module-item:disabled {
  cursor: not-allowed;
}

.module-item.planned {
  color: #697586;
  opacity: 0.72;
}

.main {
  min-width: 0;
  padding: 22px 22px 22px 58px;
}

.topbar,
.workbench-header,
.dialog-header,
.session-bar {
  display: flex;
  align-items: center;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sidebar-toggle {
  display: none;
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
}

.theme-toggle {
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
}

.app-shell.sidebar-hidden .sidebar-toggle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.topbar,
.workbench-header,
.dialog-header {
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  font-size: 28px;
}

.session-bar {
  gap: 10px;
}

.session-password-button {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  text-decoration: none;
}

.session-password-button:hover {
  text-decoration: underline;
}

.session-user {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.session-user strong {
  display: block;
  color: var(--text);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.metric {
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: inset 0 3px 0 var(--accent);
}

.metric:nth-child(2) {
  box-shadow: inset 0 3px 0 var(--magenta);
}

.metric:nth-child(3) {
  box-shadow: inset 0 3px 0 #e0bd00;
}

.metric:nth-child(4) {
  box-shadow: inset 0 3px 0 var(--cyan);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

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

.workbench {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.permissions-workbench {
  overflow: visible;
}

.workbench-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--accent);
}

.workbench.release-mode .workbench-header {
  box-shadow: inset 0 3px 0 var(--magenta);
}

.workbench-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.filters input,
.filters select,
.filters .multi-filter {
  min-width: 0;
}

.filter-field {
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.filter-field input,
.filter-field select,
.filter-field .multi-filter summary {
  min-height: 46px;
}

.filter-field .multi-filter {
  width: 100%;
}

#searchInput {
  min-width: min(100%, 240px);
}

#requesterFilter {
  min-width: min(100%, 210px);
}

#dateFromFilter,
#dateToFilter {
  min-width: min(100%, 170px);
}

.multi-filter {
  position: relative;
  min-height: 46px;
}

.multi-filter summary {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 32px 10px 11px;
  list-style: none;
  cursor: pointer;
}

.multi-filter summary::-webkit-details-marker {
  display: none;
}

.multi-filter summary::after {
  content: "⌄";
  position: absolute;
  right: 12px;
  top: 12px;
  color: var(--muted);
}

.multi-filter[open] summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(7, 114, 184, 0.16);
}

.multi-filter-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  width: max(100%, 220px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 8px;
  box-shadow: var(--shadow);
}

.table-wrap {
  overflow: auto;
}

.permission-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(280px, 1fr);
  gap: 16px;
  align-items: end;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.permission-toolbar label {
  margin-top: 0;
}

.selected-user-editor {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(140px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.selected-user-meta {
  color: var(--muted);
  font-size: 13px;
}

.selected-user-meta strong,
.selected-user-meta span {
  display: block;
}

.selected-user-meta strong {
  color: var(--text);
  font-size: 14px;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.status-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.permission-matrix {
  display: grid;
  gap: 0;
}

.permission-section {
  border-bottom: 1px solid var(--line);
}

.permission-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f2f7fb;
  color: var(--ink);
  font-weight: 900;
}

.permission-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.permission-section-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.permission-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 52px;
  border-top: 1px solid #edf0f5;
}

.permission-resource {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.permission-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px 16px;
  align-items: center;
  padding: 10px 14px;
}

.permission-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.permission-check input {
  width: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid #edf0f5;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.sort-header:hover,
.sort-header.active {
  color: var(--accent);
}

.sort-icon {
  min-width: 12px;
  color: var(--accent);
  font-size: 12px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #eff8ff;
}

.title-cell strong,
.title-cell span {
  display: block;
}

.title-cell span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FFFF00;
  box-shadow: 0 0 0 1px #000;
}

.dot.red {
  background: var(--red);
}

.dot.none {
  background: #FFFF00;
}

.dot.yellow {
  background: #FF9900;
}

.dot.green,
.dot.done {
  background: #11734B;
}

.dot.closed {
  background: #B10202;
}

.detail-panel {
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 20px;
  overflow-y: auto;
}

.detail-empty {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 8px;
  color: var(--muted);
}

.detail-panel h2 {
  margin: 0;
  font-size: 22px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.detail-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
}

.detail-section p {
  margin: 0;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-grid.single-control {
  grid-template-columns: 1fr;
}

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

.field-value {
  border: 1px solid #e5eaf1;
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.field-value strong,
.field-value p {
  display: block;
  margin: 0;
}

.field-help {
  display: block;
  margin: -2px 0 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field-value p {
  margin-top: 4px;
  color: var(--text);
  line-height: 1.4;
}

.private-field {
  border-color: rgba(232, 63, 149, 0.28);
  background: rgba(232, 63, 149, 0.06);
}

.file-download {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(7, 114, 184, 0.28);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 10px;
  font-weight: 800;
  text-decoration: none;
}

.file-download:hover {
  border-color: var(--accent);
}

.dynamic-fields {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.selected-form-note {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(7, 114, 184, 0.22);
  border-radius: 6px;
  background: var(--accent-soft);
  padding: 10px;
}

.selected-form-note span {
  color: var(--muted);
  font-size: 13px;
}

.private-chip {
  display: inline-flex;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(232, 63, 149, 0.12);
  color: #9d1e61;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
}

.choice-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.choice-field legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px 14px 6px 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.inline-check input {
  width: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--accent);
}

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

.builder-panel,
.forms-list-panel {
  padding: 16px;
}

.forms-list-panel {
  border-left: 1px solid var(--line);
  background: #fbfcfd;
}

.forms-list-panel h3,
.builder-header h3 {
  margin: 0;
  font-size: 15px;
}

.builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 10px;
}

.fields-builder {
  display: grid;
  gap: 12px;
}

.field-builder-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.validation-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px;
}

.validation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.validation-title strong {
  font-size: 13px;
}

.validation-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.validation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px;
}

.validation-wide {
  grid-column: 1 / -1;
}

.field-builder-row.dragging {
  opacity: 0.58;
  border-style: dashed;
}

.field-builder-row.drag-over-before {
  box-shadow: inset 0 3px 0 var(--accent);
}

.field-builder-row.drag-over-after {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.field-builder-top,
.field-order-actions {
  display: flex;
  align-items: center;
}

.field-builder-top {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.field-order-actions {
  gap: 6px;
}

.drag-handle {
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.field-order-actions .icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.field-builder-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

.forms-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.forms-list-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 800;
  text-decoration: underline;
}

.form-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.form-list-item.archived {
  opacity: 0.68;
  background: #f8fafc;
}

.form-list-main {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.form-list-main:hover strong {
  color: var(--accent);
}

.form-list-item strong,
.form-list-item span,
.form-list-item small,
.form-list-main strong,
.form-list-main span,
.form-list-main small {
  display: block;
}

.form-list-item span,
.form-list-item small,
.form-list-main span,
.form-list-main small {
  color: var(--muted);
}

.form-list-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.danger-button {
  color: #b42318;
  border-color: #f1b8b2;
}

.branch-admin {
  border-top: 1px solid var(--line);
  padding: 16px;
  background: #fbfcfd;
}

.branch-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.branch-header h3,
.branch-header p {
  margin: 0;
}

.branch-header p {
  margin-top: 4px;
  color: var(--muted);
}

.branch-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto auto;
  gap: 8px;
}

.branches-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.branch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.branch-item.archived {
  opacity: 0.64;
  background: #f8fafc;
}

.branch-item strong,
.branch-item span {
  display: block;
}

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

.branch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.comment-form {
  display: grid;
  gap: 10px;
}

dialog {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.dialog-form {
  padding: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .app-shell,
  .app-shell.sidebar-hidden {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: auto;
  }

  .detail-empty {
    min-height: 180px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar-toggle {
    display: inline-block;
  }

  .app-shell.sidebar-hidden .sidebar {
    display: none;
  }

  .sidebar {
    position: static;
    width: auto;
    transform: none;
    transition: none;
    box-shadow: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 22px;
  }

  .sidebar::after {
    display: none;
  }

  .metrics-grid,
  .filters,
  .permission-row,
  .permission-actions,
  .form-admin-grid,
  .form-row,
  .validation-grid {
    grid-template-columns: 1fr;
  }

  .forms-list-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .permission-resource {
    justify-content: flex-start;
    text-align: left;
    background: #fbfcfd;
  }

  .topbar,
  .workbench-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-title {
    width: 100%;
  }

  .session-bar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}
