:root {
  --bg: #f5f6f8;
  --bg-soft: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --line: #e3e6ea;
  --line-strong: #d3d9e1;
  --text: #10131a;
  --muted: #667085;
  --accent: #0a84ff;
  --accent-strong: #0063d1;
  --success: #14864a;
  --danger: #d92d20;
  --shadow: 0 10px 28px rgba(16, 19, 26, 0.05);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -20%, #ffffff 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, #f8f9fb 0%, #f3f5f8 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: light;
}

.page {
  width: min(1360px, 96vw);
  margin: 24px auto;
  padding-bottom: 36px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 18px;
  font-weight: 650;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 8px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.compact-panel {
  padding: 14px 18px;
}

.panel-small {
  max-width: 460px;
  margin: 72px auto;
  padding: 22px;
}

.subpanel {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-top: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

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

.span-3 {
  grid-column: span 3;
}

label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

input,
textarea,
select,
button {
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input,
textarea,
select {
  font-size: 14px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
  outline: none;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  border-radius: 6px;
}

textarea {
  resize: vertical;
}

button {
  cursor: pointer;
  border: 0;
  background: linear-gradient(180deg, #1692ff 0%, #0a84ff 100%);
  color: #fff;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}

button:hover {
  background: linear-gradient(180deg, #0f8eff 0%, #0475e3 100%);
}

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

.button-secondary {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #243041;
}

.button-secondary:hover {
  background: #f6f8fb;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 10px;
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 14px;
}

.tab {
  border: 0;
  background: transparent;
  color: #4a5667;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
}

.tab:hover {
  background: #e8edf4;
}

.tab.active {
  background: #fff;
  color: #10131a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.subtabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
}

.subtab {
  border: 0;
  background: transparent;
  color: #4d5a6c;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 600;
}

.subtab:hover {
  background: #e8edf4;
}

.subtab.active {
  background: #fff;
  color: #10131a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}

.subtab-content {
  display: none;
}

.subtab-content.active {
  display: block;
}

.properties-header {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: #dbe5f4;
}

.properties-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.properties-header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

.stat-chip {
  min-width: 90px;
  border: 1px solid #dce7f7;
  background: #ffffff;
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}

.stat-chip span {
  color: #65748a;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.stat-chip strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.properties-list-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 12px;
}

.properties-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.properties-sidebar h3 {
  margin-bottom: 12px;
}

.properties-main {
  min-height: 420px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.properties-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 12px;
}

.properties-create-sidebar {
  align-self: start;
  position: sticky;
  top: 88px;
}

.properties-create-sidebar h3 {
  margin-bottom: 6px;
}

.properties-sections-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
}

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

.metric {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dce7f7;
  border-radius: 16px;
  padding: 14px;
}

.metric p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.metric h2 {
  margin-top: 5px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

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

th {
  color: #4f5d71;
  font-weight: 650;
  background: #f8fafd;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}

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

.notice,
.error {
  margin-top: 8px;
  min-height: 20px;
  font-size: 13px;
  font-weight: 600;
}

.notice {
  color: var(--success);
}

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

.pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 13px;
  color: #465467;
  background: #fff;
  font-weight: 600;
  font-size: 13px;
}

.row {
  display: flex;
  align-items: center;
}

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

.wrap {
  flex-wrap: wrap;
}

.gap {
  gap: 10px;
}

.mt-12 {
  margin-top: 12px;
}

.editor {
  height: 220px;
  background: #fff;
  color: #10131a;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
}

.ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #f8fafd;
}

.ql-container.ql-snow {
  border: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1c2430;
}

.checkbox-wrap {
  margin-top: 6px;
}

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  color: #4f5f72;
}

.code-pill {
  background: #ecf5ff;
  color: #0a66c2;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #cde3fb;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.pill-ok {
  color: #0b6b3a;
  background: #e8f7ef;
  border-color: #bfe9d1;
}

.pill-warn {
  color: #854d0e;
  background: #fff4df;
  border-color: #f4d9aa;
}

.pill-info {
  color: #0b5ea8;
  background: #e8f2fe;
  border-color: #bed9fb;
}

.pill-muted {
  color: #4b5565;
  background: #f1f4f8;
  border-color: #d7dde5;
}

.property-actions-cell {
  min-width: 370px;
}

.property-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.property-actions > button,
.row-action-menu > summary,
.row-action-menu-list > button {
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
}

.row-action-menu {
  position: relative;
}

.row-action-menu > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #243041;
  font-weight: 650;
  user-select: none;
}

.row-action-menu > summary::-webkit-details-marker {
  display: none;
}

.row-action-menu[open] > summary {
  background: #f6f8fb;
}

.row-action-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  min-width: 150px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 19, 26, 0.12);
}

.row-action-menu-list > button {
  text-align: left;
}

.danger-button {
  color: #9b1c1c;
  border-color: #efc1c1;
  background: #fff6f6;
}

.danger-button:hover {
  background: #feeceb;
}

.hidden-file-input {
  display: none;
}

@media (max-width: 1150px) {
  .inline-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid.two,
  .metrics {
    grid-template-columns: 1fr;
  }

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

  .properties-header-top,
  .properties-header-bottom,
  .properties-list-grid,
  .properties-edit-grid,
  .properties-sections-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .properties-sidebar,
  .properties-create-sidebar {
    position: static;
  }

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 780px) {
  .grid.compact,
  .grid.compact.three-col,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    gap: 10px;
  }

  .tabs,
  .subtabs {
    display: grid;
    width: 100%;
  }
}
