/* Семантические токены и палитра: ninox-tokens.css */

body {
  margin: 0;
  color: var(--ink);
  background: var(--ninox-app-bg);
  min-height: 100vh;
  overflow: hidden;
}

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

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  overflow: hidden;
}

.sidebar {
  padding: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--ninox-sidebar);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-dock {
  flex-shrink: 0;
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workspace {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ninox-workspace-bg);
}

.workspace-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, 40%);
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.workspace-body.tables-focus {
  grid-template-columns: 1fr;
}

/* Таблица слева занимает основное пространство, панель записи справа ~40% (как в Ninox) */
.workspace-body.tables-with-detail {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 42%);
}

.workspace-body.tables-with-detail .main-stage {
  border-right: 1px solid #d6dbe7;
  min-width: 0;
  overflow: hidden;
}

.main-stage {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: white;
}

.brand-block {
  padding: 4px 6px 8px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
}

.brand-block h1,
.workspace-top h2,
.data-panel-head h3,
.detail-panel-head h3,
.dialog-head h3 {
  margin: 6px 0;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-block h1 {
  font-size: 17px;
  line-height: 1.1;
  color: white;
  font-weight: 600;
}

.brand-copy,
.eyebrow,
.panel small,
.summary-pill span:last-child,
.record-meta,
.status-row,
.stack-field span,
.filter-box span {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  font-weight: 700;
}

.sidebar-eyebrow {
  color: rgba(255, 255, 255, 0.7);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-icon-button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.data-panel,
.detail-panel {
  background: white;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.data-panel {
  overflow: hidden;
}

.detail-panel {
  padding: 0;
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
}

.panel-head,
.dialog-head,
.workspace-top,
.status-row,
.data-panel-head,
.detail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sidebar .panel-head h2,
.sidebar .status-row,
.sidebar .sidebar-search .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.sidebar .panel-head h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.table-list,
.record-grid,
.field-draft-list,
.record-form-fields {
  display: grid;
  gap: 2px;
}

.compact-head {
  align-items: center;
}

.report-workspace {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: white;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.record-grid-table {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.mode-button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 500;
  text-align: left;
  min-height: 36px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.mode-button.active {
  background: rgba(31, 47, 96, 0.28);
  color: white;
  border-color: transparent;
}

.mode-button.active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 2px;
  height: calc(100% - 18px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.sidebar-search {
  display: flex;
  align-items: center;
  position: relative;
  padding: 4px 0 10px;
}

.sidebar-search input {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 8px 12px 8px 34px;
  min-height: 36px;
  width: 100%;
}

.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.68);
}

.sidebar-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-section {
  display: grid;
  gap: 5px;
}

.sidebar-section.collapsed .table-list {
  display: none;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.sidebar-add-button {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  line-height: 1;
}

.table-button,
.record-card,
.summary-pill,
.field-draft-card,
.photo-chip {
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.table-button {
  text-align: left;
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  color: white;
  background: transparent;
  border-color: transparent;
  display: grid;
  gap: 0;
  position: relative;
  padding-left: 28px;
  min-height: 34px;
}

.table-button::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 13px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.44);
}

.nav-entry-child {
  margin-left: 14px;
}

.nav-entry-table::before {
  background: rgba(243, 249, 255, 0.7);
}

.nav-entry-form::before {
  background: rgba(201, 223, 255, 0.95);
  border-radius: 999px;
}

.nav-entry-report::before {
  background: rgba(175, 197, 236, 0.95);
}

.nav-entry-child::before {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  top: 14px;
}

.table-button:hover,
.table-button.active {
  transform: none;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(33, 50, 98, 0.3);
  box-shadow: none;
}

.table-button.active::after {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 2px;
  height: calc(100% - 14px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.table-button small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
}

.table-button strong,
.record-card h3 {
  display: block;
  margin-bottom: 6px;
}

.status-panel {
  margin-top: auto;
  padding-top: 10px;
}

.compact-status-row {
  justify-content: flex-start;
  gap: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.sidebar-footer-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar-footer-button {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
  word-break: break-word;
}

.sidebar-footer-button-danger {
  background: rgba(34, 49, 90, 0.42);
}

.workspace-top {
  align-items: center;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.workspace-title-block {
  display: grid;
  gap: 1px;
}

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #d6dbe7;
  background: white;
  min-height: 52px;
  min-width: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.toolbar-search {
  flex: 1 1 200px;
  min-width: 0;
  max-width: min(420px, 100%);
  display: flex;
  align-items: center;
}

.toolbar-separator {
  flex-shrink: 0;
  width: 1px;
  height: 20px;
  background: #e6ebf4;
  margin: 0 4px;
}

.toolbar-group.align-end {
  justify-content: flex-end;
  margin-left: auto;
  flex-wrap: wrap;
}

.toolbar-icon-button {
  height: var(--control-h);
  width: var(--control-h);
  padding: 0;
  border-radius: 6px;
  border: 1px solid #eef2f8;
  background: #fbfcff;
  color: #7b88a7;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: inline-grid;
  place-items: center;
}

.toolbar-icon-button:hover {
  background: #f3f6fc;
}

.toolbar-icon-button.active {
  background: #edf2ff;
  border-color: #d7e1f6;
  color: #5a72b8;
}

.toolbar-icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar-icon-button svg,
.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
}

.toolbar-search input {
  width: 100%;
  height: var(--control-h);
  border-radius: 5px;
  border: 1px solid #d9deea;
  background: #f2f4f9;
  padding: 0 14px;
}

.toolbar-nav-button {
  color: #92a0bf;
}

.toolbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d8e0f5, #c7d2ef);
  color: #415488;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-left: 6px;
}

.workspace-view-tabs {
  display: flex;
  gap: 8px;
  padding: 0 14px;
  min-height: 46px;
  border-bottom: 1px solid rgba(73, 92, 149, 0.45);
  background: #5f73b3;
  align-items: center;
  overflow: auto;
}

.workspace-db-label {
  color: rgba(243, 247, 255, 0.92);
  font-weight: 600;
  font-size: 26px;
  margin-right: 12px;
}

.view-tab {
  height: 38px;
  min-width: 72px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, 0.18);
  color: rgba(247, 250, 255, 0.95);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  position: relative;
  white-space: nowrap;
}

.view-tab.active {
  color: #375fc1;
  border-color: rgba(255, 255, 255, 0.4);
  background: #f3f6ff;
}

.workspace-top.hidden,
.summary-strip.hidden {
  display: none !important;
}

.view-tab.add-tab {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.breadcrumbs {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.workspace-top h2 {
  font-size: 18px;
  line-height: 1.1;
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
}

.filter-box {
  display: grid;
  gap: 4px;
}

.filter-box span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-box input,
.filter-box select,
.stack-field input,
.stack-field select,
.stack-field textarea,
.field-draft-card input,
.field-draft-card select {
  min-width: 150px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  padding: 8px 10px;
  min-height: var(--control-h);
}

.stack-field select[multiple] {
  min-height: 124px;
  padding: 8px;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: white;
  overflow: auto;
}

.summary-pill strong {
  font-weight: 700;
  color: var(--ink);
}

.summary-pill {
  border-radius: 0;
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  white-space: nowrap;
  color: #6d7892;
}

.summary-pill:hover {
  background: #f7f9fd;
}

.record-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.record-card {
  padding: 20px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.record-card h3 {
  margin: 0;
  font-size: 22px;
}

.record-meta {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.record-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.record-actions,
.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-panel-head {
  display: none;
}

.data-panel-head .eyebrow,
.report-preview-head .eyebrow {
  font-size: 10px;
}

.data-panel,
.report-workspace {
  min-height: 0;
  height: 100%;
  border-top: 1px solid #d6dbe7;
}

.grid-meta {
  font-size: 12px;
  color: var(--muted);
}

.grid-header,
.grid-row {
  display: grid;
  grid-template-columns: 46px minmax(220px, 1.45fr) repeat(3, minmax(112px, 1fr));
  gap: 0;
}

.grid-header {
  background: #eceff4;
  color: #6d7893;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  box-shadow: inset 0 -1px 0 #d6dbe7;
  font-weight: 700;
  border-top: 1px solid #d6dbe7;
}

.grid-cell {
  padding: 11px 14px;
  border-bottom: 1px solid #d8dde9;
  border-right: 1px solid #d8dde9;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.grid-header .grid-cell {
  padding-top: 12px;
  padding-bottom: 12px;
}

.row-index-cell {
  color: #8e99b1;
  text-align: center;
}

.grid-row {
  background: #eef1f6;
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.grid-row:nth-of-type(odd) {
  background: #f5f7fb;
}

.grid-row:hover {
  background: #e9eef9;
}

.grid-row.active {
  background: #dde5f8;
  box-shadow: inset 0 0 0 1px rgba(111, 134, 207, 0.72);
}

.grid-row.active .grid-cell {
  border-bottom-color: rgba(110, 133, 199, 0.28);
}

.grid-row-new {
  color: #5973ab;
  background: #edf2fd !important;
}

.grid-row-new .grid-cell {
  border-bottom-color: #e8edf6;
}

.grid-row-new:hover {
  background: #dfe9fb !important;
}

.detail-panel-head {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.grid-status-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: #c6d2f8;
  color: #2f456d;
  font-size: 13px;
  font-weight: 600;
}

.detail-panel-head h3 {
  font-size: 17px;
  font-weight: 600;
}

.detail-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  min-height: 0;
  padding: 0;
}

.detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.detail-tab {
  height: 42px;
  min-width: 40px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #7583a2;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-tab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent);
}

.detail-tab-icon {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
}

.detail-tab-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
}

.inspector-sheet {
  display: grid;
  gap: 12px;
  padding: 10px 14px 14px;
}

.inspector-main-grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.inspector-section-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #7a86a1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.inspector-photo-panel {
  display: grid;
  gap: 8px;
}

.inspector-photo-frame {
  border: 1px solid #e9eef6;
  background: #f4f1d8;
  min-height: 258px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.inspector-photo-large {
  width: 100%;
  height: 258px;
  object-fit: cover;
}

.inspector-video-large {
  background: #131b2e;
  object-fit: contain;
}

.inspector-photo-placeholder {
  color: #8793ae;
  font-weight: 600;
}

.inspector-photo-caption {
  color: #6f7c98;
  font-size: 12px;
}

.inspector-form-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
}

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

.inspector-form-grid-hero {
  align-items: start;
}

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

.inspector-field-shell {
  display: grid;
  gap: 5px;
}

.inspector-field-shell span {
  color: #7a86a1;
  font-size: 11px;
  font-weight: 600;
}

.inspector-field-value {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #e8edf5;
  border-radius: 2px;
  background: #fdfdff;
  color: #2e3956;
  display: flex;
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.inspector-detail-grid {
  display: grid;
  gap: 10px;
}

.inspector-detail-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inspector-field-shell-empty {
  visibility: hidden;
}

.inspector-subtable {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.inspector-subtable-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #72809e;
  font-size: 12px;
}

.subtable-head-actions {
  display: inline-flex;
  gap: 6px;
}

.subtable-head-button {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #e2e8f3;
  background: #f8fbff;
  color: #6f7f9f;
  line-height: 1;
  cursor: pointer;
}

.inspector-subtable-grid {
  border: 1px solid #e8edf5;
  background: white;
}

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

.subtable-row span {
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
}

.subtable-row:last-child span {
  border-bottom: 0;
}

.subtable-head {
  background: #f7f9fd;
  color: #7583a2;
  font-size: 12px;
  font-weight: 700;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chip-new {
  background: #edf2ff;
  color: #5972bd;
}

.chip-draft {
  background: #f4f6fb;
  color: #6c7b97;
}

.chip-sent {
  background: #e8f6ec;
  color: #2d9460;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: currentColor;
}

.grid-footer {
  display: flex;
  justify-content: end;
  padding: 10px 18px;
  border-top: 1px solid #e8edf5;
  background: #fbfcff;
}

#new-record-button {
  display: none !important;
}

.grid-footer-meta {
  color: #6f7c9c;
  font-weight: 700;
  font-size: 13px;
}

.detail-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #edf1f8;
  background: #fbfcff;
}

.detail-item strong {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.detail-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-photo-card {
  display: grid;
  gap: 6px;
  width: 110px;
}

.detail-photo-card img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.detail-photo-card video {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #131b2e;
}

.report-preview-head {
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.report-preview-sheet {
  margin: 0;
  padding: 16px 20px;
  min-height: 0;
  border-radius: 0;
  background: #ffffff;
  border: 0;
  box-shadow: none;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
}

.report-sheet-head {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.report-sheet-head h1,
.report-group h4 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.report-sheet-head h1 {
  font-size: 28px;
}

.report-sheet-subtitle {
  color: var(--muted);
  font-size: 14px;
}

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

.report-section {
  display: grid;
  gap: 10px;
}

.report-section-head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.report-section-head h3 {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: 700;
  font-size: 20px;
}

.report-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.report-layout-block {
  min-width: 0;
}

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

.span-half {
  grid-column: span 1;
}

.column-left {
  grid-column: 1;
}

.column-right {
  grid-column: 2;
}

.report-group-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.report-group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-total-card {
  display: inline-grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
}

.report-total-card strong {
  font-size: 20px;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  min-height: var(--control-h);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #5f79bf);
  color: white;
  box-shadow: none;
}

.ghost-button {
  background: #f8faff;
  color: #6d7c9b;
  border: 1px solid #e7ebf5;
}

.danger-button,
.ghost-button.danger-button {
  background: rgba(231, 76, 60, 0.10);
  color: #b53c2e;
}

.wide-button {
  width: 100%;
}

.status-panel {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(24, 168, 114, 0.12);
}

.dialog-shell {
  border: 0;
  padding: 0;
  background: transparent;
  max-height: min(90vh, 920px);
  margin: auto;
}

.dialog-shell::backdrop {
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(3px);
}

.dialog-card {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 880px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  background: rgba(255, 255, 255, 0.99);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--spacing-md);
}

.dialog-card .dialog-head {
  align-items: flex-start;
  gap: var(--spacing-md);
}

.record-dialog-card {
  width: min(920px, calc(100vw - 32px));
}

.stack-field {
  display: grid;
  gap: var(--spacing-md);
}

.field-draft-card {
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.report-block-card {
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,251,255,0.95));
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.report-block-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: var(--accent);
}

.report-block-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.report-block-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 12px;
}

.report-block-settings {
  display: grid;
  gap: 10px;
}

.report-block-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report-block-metric-settings {
  padding: 12px;
  background: rgba(243, 244, 246, 0.6);
  border-radius: 6px;
  display: grid;
  gap: 8px;
}

.inline-field {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.inline-field select {
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 8px;
  font-size: 13px;
}

.block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.block-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.report-kpi-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(45, 109, 246, 0.08), rgba(99, 122, 255, 0.10));
}

.report-kpi-card strong {
  font-size: 22px;
}

.report-note-block {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(247, 250, 254, 0.96);
}

.hidden {
  display: none;
}

.photo-chip {
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.photo-chip.media-chip {
  border-radius: 14px;
  align-items: start;
}

.photo-preview {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.media-video-preview {
  background: #131b2e;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(247, 250, 254, 0.96);
}

.form-card {
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.field-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.96);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-top {
    align-items: start;
    flex-direction: column;
  }

  .workspace-toolbar {
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }

  .workspace-view-tabs,
  .summary-strip,
  .workspace-top,
  .data-panel-head,
  .report-preview-head,
  .detail-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .workspace-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .grid-header,
  .grid-row {
    grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(110px, 1fr));
  }

  .report-preview-sheet {
    margin: 0;
    padding: 16px;
  }

  .report-section-grid,
  .block-grid,
  .inspector-main-grid,
  .inspector-form-grid,
  .subtable-row {
    grid-template-columns: 1fr;
  }

  .column-left,
  .column-right,
  .span-half,
  .span-full {
    grid-column: 1;
  }

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

  .detail-tabs,
  .detail-panel-head {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .workspace-top,
  .summary-strip,
  .detail-panel {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .workspace-body,
  .main-stage {
    display: block;
    padding: 0;
    margin: 0;
  }

  .report-workspace,
  .report-preview-sheet {
    border: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
    background: white;
  }
}
