:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --text: #18211e;
  --muted: #68746f;
  --line: #dce4e0;
  --line-strong: #c4d0ca;
  --green: #176b53;
  --green-dark: #104d3c;
  --green-soft: #e5f2ec;
  --blue: #286c9f;
  --blue-soft: #e7f0f7;
  --amber: #9b5c18;
  --amber-soft: #faeddc;
  --red: #a6404a;
  --red-soft: #f8e9eb;
  --nav: #1c2723;
  --shadow: 0 7px 22px rgba(24, 42, 34, 0.07);
  --sidebar-width: 232px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

img,
video {
  display: block;
  max-width: 100%;
}

svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.9;
  flex: 0 0 auto;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 22px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 5px;
  font-size: 17px;
  line-height: 1.35;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.4;
}

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

.environment-bar {
  position: relative;
  z-index: 90;
  min-height: 24px;
  display: grid;
  place-items: center;
  padding: 3px 12px;
  background: #553b1e;
  color: #fff4df;
  font-size: 11px;
  font-weight: 700;
}

.app-frame {
  min-height: calc(100vh - 24px);
}

.app-header {
  position: sticky;
  z-index: 40;
  top: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand > span:last-child,
.sidebar-brand > span:last-child,
.backend-header > div {
  min-width: 0;
}

.brand b,
.brand small,
.sidebar-brand b,
.sidebar-brand small,
.backend-header b,
.backend-header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand b,
.sidebar-brand b {
  font-size: 16px;
}

.brand small,
.sidebar-brand small,
.backend-header small {
  font-size: 11px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

.page-content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px calc(88px + env(safe-area-inset-bottom));
}

.mobile-nav {
  position: fixed;
  z-index: 60;
  inset: auto 0 0;
  min-height: calc(62px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 5px 4px env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  box-shadow: 0 -5px 18px rgba(27, 43, 36, 0.07);
}

.owner-mobile-nav,
.admin-mobile-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.mobile-nav a {
  min-width: 0;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #69756f;
  font-size: 11px;
  font-weight: 700;
}

.mobile-nav a.active {
  color: var(--green);
}

.mobile-nav a.active svg {
  stroke-width: 2.4;
}

.sidebar {
  display: none;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-actions,
.button-row,
.filter-row,
.segmented {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented > * {
  flex: 0 0 auto;
}

.panel,
.list-card,
.metric,
.task-row,
.weather-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.badge-stack {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.panel {
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header p {
  margin-bottom: 0;
}

.panel-body {
  padding: 14px;
}

.panel-footer {
  padding: 11px 14px;
  border-top: 1px solid var(--line);
}

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.notice.success {
  background: var(--green-soft);
  border-color: #bbdcca;
  color: var(--green-dark);
}

.notice.warning {
  background: var(--amber-soft);
  border-color: #e8cca9;
  color: #72410f;
}

.notice.danger {
  background: var(--red-soft);
  border-color: #e5bbc0;
  color: #7f3038;
}

.ad-strip {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid #d8c59f;
  border-radius: 8px;
  background: #fff9ec;
  color: #65441d;
}

.ad-strip > span {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
}

.ad-strip > div {
  min-width: 0;
  display: flex;
  gap: 16px;
  overflow-x: auto;
}

.ad-strip a {
  flex: 0 0 auto;
  white-space: nowrap;
}

.amap-results {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.amap-result {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  text-align: left;
}

.amap-result span {
  color: var(--muted);
  font-size: 11px;
}

.weather-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  background: #fffaf0;
  border-color: #eadcc0;
}

.weather-strip > div {
  min-width: 0;
  padding: 11px 9px;
  border-right: 1px solid #eadcc0;
}

.weather-strip > div:last-child {
  border-right: 0;
}

.weather-strip span,
.weather-strip b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-strip span {
  color: #84633b;
  font-size: 10px;
}

.weather-strip b {
  margin-top: 3px;
  color: #4e3315;
  font-size: 15px;
}

.weather-condition {
  grid-column: 1 / -1;
  padding: 7px 10px !important;
  border-top: 1px solid #eadcc0;
  border-right: 0 !important;
  color: #765022;
  font-size: 11px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.metric {
  min-width: 0;
  padding: 12px;
  border-top: 3px solid var(--green);
}

.metric.blue { border-top-color: var(--blue); }
.metric.amber { border-top-color: var(--amber); }
.metric.red { border-top-color: var(--red); }

.metric span,
.metric strong,
.metric small {
  display: block;
}

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

.metric strong {
  margin: 6px 0 2px;
  font-size: 22px;
  line-height: 1;
}

.task-list,
.card-list,
.settings-list {
  display: grid;
  gap: 9px;
}

.task-row,
.list-card {
  min-width: 0;
  padding: 12px;
}

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

.task-main,
.card-main,
.entity {
  min-width: 0;
}

.task-main b,
.task-main span,
.card-main b,
.card-main span {
  display: block;
  overflow-wrap: anywhere;
}

.task-main span,
.card-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green { background: var(--green-soft); border-color: #bfdece; color: var(--green-dark); }
.badge.blue { background: var(--blue-soft); border-color: #c6daea; color: #1f557c; }
.badge.amber { background: var(--amber-soft); border-color: #e9cfaf; color: #74430f; }
.badge.red { background: var(--red-soft); border-color: #e8c0c4; color: #83353d; }

.button,
.button-secondary,
.button-danger,
.button-quiet,
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.button {
  background: var(--green);
  color: white;
}

.btn {
  width: 100%;
  margin-top: 12px;
  background: var(--blue);
  color: white;
}

.button-secondary {
  background: var(--blue);
  color: white;
}

.button-danger {
  background: white;
  border-color: #dfb4ba;
  color: var(--red);
}

.button-quiet {
  background: white;
  border-color: var(--line-strong);
  color: var(--text);
}

.button.small,
.button-secondary.small,
.button-danger.small,
.button-quiet.small {
  min-height: 36px;
  padding: 5px 10px;
  font-size: 12px;
}

.button.block,
.button-secondary.block,
.button-danger.block,
.button-quiet.block {
  width: 100%;
}

.button[disabled],
button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.form-grid {
  display: grid;
  gap: 13px;
}

.field {
  min-width: 0;
}

.field > label,
.field > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: #37433e;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: white;
  color: var(--text);
  font-size: 16px;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 83, 0.11);
}

.field-help {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.checkbox-row,
.switch-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row input,
.switch-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.segmented {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.segmented a,
.segmented button {
  min-height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.segmented a.active,
.segmented button.active {
  background: var(--green-soft);
  border-color: #b7d8c7;
  color: var(--green-dark);
}

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

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

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

.data-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
}

.media-cover {
  width: 88px;
  height: 68px;
  border-radius: 7px;
  object-fit: cover;
  background: #dfe6e2;
}

.news-card,
.ground-card,
.order-card {
  display: grid;
  gap: 11px;
}

.news-card-header,
.ground-card-header,
.order-card-header,
.card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.price {
  color: var(--red);
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
}

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

.info-item {
  min-width: 0;
  padding: 8px;
  background: var(--surface-soft);
  border-radius: 7px;
}

.info-item span,
.info-item b {
  display: block;
  overflow-wrap: anywhere;
}

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

.info-item b {
  margin-top: 2px;
  font-size: 13px;
}

.sticky-actions {
  position: sticky;
  z-index: 30;
  bottom: calc(67px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px -12px -14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
}

.location-request[hidden] {
  display: none;
}

.location-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 12px;
  background: var(--blue-soft);
  border: 1px solid #c4d9e8;
  border-radius: 8px;
}

.location-request p {
  margin: 0;
  color: #234f6d;
  font-size: 12px;
}

.scan-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: #101512;
}

.scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.menu-item {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.menu-item svg {
  color: var(--green);
}

details {
  border-radius: 8px;
}

details > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}

details > summary::-webkit-details-marker {
  display: none;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 13px;
}

.wizard-step {
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 7px;
  background: #e7ece9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.wizard-step.active {
  background: var(--green);
  color: white;
}

.commercial-builder,
.builder-list {
  display: grid;
  gap: 9px;
}

.builder-pond,
.builder-block,
.advanced-settings {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.builder-pond > summary {
  background: var(--green-soft);
  color: var(--green-dark);
}

.play-block > summary {
  background: var(--blue-soft);
  color: #235879;
}

.session-block > summary {
  background: var(--amber-soft);
  color: #71420f;
}

.ticket-block > summary,
.advanced-settings > summary {
  background: white;
}

.builder-fields {
  display: grid;
  gap: 11px;
  padding: 11px;
  border-top: 1px solid var(--line);
}

.builder-delete {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 20px;
  line-height: 1;
}

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

.seat-button {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #a9cfbd;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.seat-button.disabled {
  border-color: #e4bdc1;
  background: var(--red-soft);
  color: var(--red);
}

@media (max-width: 719px) {
  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    display: block;
    width: 100%;
  }

  .mobile-card-table tr {
    margin-bottom: 9px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .mobile-card-table td {
    min-height: 34px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #edf1ef;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .mobile-card-table td:last-child {
    border-bottom: 0;
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    flex: 0 0 86px;
    color: var(--muted);
    text-align: left;
    font-size: 11px;
    font-weight: 800;
  }
}

@media (min-width: 720px) {
  .page-content {
    padding: 20px 22px 40px;
  }

  .mobile-nav {
    display: none;
  }

  .sidebar {
    position: fixed;
    z-index: 70;
    inset: 24px auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--nav);
    color: #d9e4df;
  }

  .sidebar-brand {
    min-height: 68px;
    padding: 0 17px;
    border-bottom: 1px solid #34403b;
  }

  .sidebar-brand small {
    color: #93a39c;
  }

  .sidebar nav {
    display: grid;
    gap: 3px;
    padding: 13px 10px;
  }

  .sidebar nav a,
  .sidebar-footer a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
  }

  .sidebar nav a.active {
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 900;
  }

  .sidebar-footer {
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid #34403b;
  }

  .app-frame.with-sidebar {
    margin-left: var(--sidebar-width);
  }

  .with-sidebar .app-header {
    padding-right: 22px;
    padding-left: 22px;
  }

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

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

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

  .sticky-actions {
    position: static;
    grid-template-columns: repeat(2, minmax(0, max-content));
    justify-content: end;
    margin: 16px 0 0;
    padding: 0;
    background: transparent;
    border: 0;
  }
}

@media (min-width: 980px) {
  .content-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
    gap: 14px;
    align-items: start;
  }
}
