:root {
  color-scheme: light;
  --brand: #12c97d;
  --brand-dark: #0b8f5f;
  --brand-light: #e8fbf2;
  --orange: #ff8d1d;
  --red: #f23232;
  --ink: #182329;
  --muted: #68767e;
  --line: #dbe4e8;
  --bg: #f4f7f8;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

.hidden { display: none !important; }

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

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 15px;
  cursor: pointer;
  white-space: nowrap;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover { background: var(--brand-dark); }

.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn.ghost:hover { border-color: var(--brand); color: var(--brand-dark); }

.btn.danger {
  background: #fff4f4;
  color: var(--red);
  border-color: #f8c8c8;
}

.btn.small { padding: 6px 10px; font-size: 13px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #12c97d, #0b8f5f);
}

.login-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 18px 45px rgba(11, 72, 50, 0.2);
}

.login-mark {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.login-sub {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 15px;
}

.login-card label span,
.project-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

input[type="text"], input[type="password"], input[type="search"],
input[type="url"], input[type="number"], textarea, select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

textarea {
  line-height: 1.6;
  resize: vertical;
}

.file-input {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 5px 0;
  color: var(--muted);
  font-size: 13px;
}

.file-input::-webkit-file-upload-button,
.file-input::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--brand-dark);
  padding: 8px 12px;
  cursor: pointer;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(18, 201, 125, 0.25);
  border-color: var(--brand);
}

.wide { width: 100%; margin-top: 5px; }

.form-message {
  min-height: 20px;
  margin-top: 10px;
}

.form-message.error { color: var(--red); }

.topbar {
  min-height: 66px;
  background: var(--brand-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
}

.topbar strong { font-size: 17px; }

.topbar-slogan {
  display: inline-block;
  margin-left: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

#session-name {
  display: inline-block;
  margin-left: 10px;
  color: #c8f7e0;
  font-size: 13px;
}

.topbar .btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
  font-weight: 700;
}

.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 20px 50px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 17px;
}

.stat-card span {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--brand-dark);
}

.stat-card p { margin: 5px 0 0; color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.toolbar input[type="search"] { max-width: 390px; }

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

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

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: #f8fbfa;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

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

.project-name {
  font-weight: 700;
  color: var(--ink);
}

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

.tag {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 12px;
}

.state {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: #f1f4f5;
  color: var(--muted);
}

.state.on { background: #e8fbf2; color: var(--brand-dark); }
.state.off { background: #fff2e8; color: #b45800; }
.state.new { background: #fff4f4; color: var(--red); }

.row-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

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

.form-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.form-heading h2 { margin: 0; font-size: 20px; }

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

.project-form > label {
  display: block;
  margin-top: 15px;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--brand);
  margin-right: 8px;
}

.checkbox-row span { margin: 0 !important; color: var(--ink) !important; }

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

.form-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.section-heading h3,
.feature-head h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.section-heading p,
.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.gallery-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.gallery-item,
.support-card,
.plan-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery-item {
  overflow: hidden;
}

.image-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f3f6f5;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item-copy {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  font-size: 13px;
  color: var(--muted);
}

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

.empty-state {
  border: 1px dashed #c9d6d0;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.support-card,
.plan-card {
  padding: 14px;
}

.support-card-head,
.plan-card-head,
.feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.support-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.support-item {
  display: grid;
  grid-template-columns: minmax(160px, 230px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e6edea;
  border-radius: 6px;
  background: #fbfdfc;
}

.support-name-field,
.support-note-field {
  min-width: 0;
}

.support-note {
  display: block;
}

.char-count {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.upload-box {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
}

.upload-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
  text-align: center;
  overflow: hidden;
}

.upload-button:hover {
  background: var(--brand-light);
}

.upload-button input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.plan-preview img {
  object-fit: contain;
  background: #fff;
}

.image-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.plan-grid .field,
.plan-card > label {
  min-width: 0;
}

.plan-card > label {
  display: block;
  margin-top: 4px;
}

.feature-block {
  border: 1px solid #e6edea;
  border-radius: 6px;
  background: #fbfdfc;
  padding: 12px;
  margin-bottom: 12px;
}

.feature-head {
  margin-bottom: 10px;
}

.feature-list {
  display: grid;
  gap: 8px;
}

.feature-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.visitor-stats span {
  color: var(--brand-dark);
}

.visitor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.visitor-live {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(18, 201, 125, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(18, 201, 125, 0); }
}

.visitor-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.visitor-tools input[type="search"] {
  width: min(390px, 100%);
}

.visitor-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.visitor-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.visitor-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 320px);
  min-height: 260px;
  overflow-y: auto;
  padding-right: 3px;
}

.visitor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.visitor-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 201, 125, 0.12);
}

.visitor-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.visitor-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.visitor-count {
  flex: none;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 3px 8px;
  font-size: 12px;
}

.visitor-action-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
}

.action-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f1f4f5;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.action-badge.phone_click {
  background: #fff4f4;
  color: var(--red);
}

.action-badge.form_submit,
.action-badge.appointment_click {
  background: #fff4e8;
  color: #b45800;
}

.action-badge.project_view,
.action-badge.floor_plan_view {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.visitor-latest {
  margin: 8px 0 11px;
  color: var(--ink);
  font-size: 13px;
}

.visitor-detail {
  min-height: 300px;
}

.visitor-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.visitor-detail-head h2 {
  margin: 0;
  font-size: 18px;
}

.visitor-detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-left: 2px solid #e3ebe7;
  margin-left: 3px;
  padding-left: 15px;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
}

.timeline-item.phone_click::before { border-color: var(--red); }
.timeline-item.form_submit::before,
.timeline-item.appointment_click::before { border-color: var(--orange); }

.timeline-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.timeline-body strong {
  display: block;
  font-size: 14px;
}

.timeline-body p {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  background: #20302a;
  color: #fff;
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.toast.error { background: var(--red); }

.admin-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 29, 23, 0.58);
}

.admin-preview-dialog {
  width: min(430px, 100%);
  max-height: min(880px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: #f4f7f8;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.admin-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--brand-dark);
  color: #fff;
}

.admin-preview-header strong {
  display: block;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.admin-preview-header span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.admin-preview-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 0;
}

.admin-preview-carousel {
  display: flex;
  gap: 0;
  height: 228px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: #dce5e8;
}

.admin-preview-carousel img,
.admin-preview-empty {
  scroll-snap-align: center;
}

.admin-preview-cover {
  width: 100%;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-preview-card {
  margin: 12px;
  padding: 13px;
  border: 1px solid #e2ebe6;
  border-radius: 8px;
  background: #fff;
}

.admin-preview-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.admin-preview-project-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-preview-project-head strong {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  line-height: 1.35;
}

.admin-preview-status {
  flex-shrink: 0;
  border-radius: 4px;
  background: #eaf9f2;
  color: var(--brand-dark);
  padding: 4px 7px;
  font-size: 12px;
}

.admin-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.admin-preview-tags span {
  border-radius: 4px;
  background: #f3f7f5;
  color: var(--muted);
  padding: 4px 7px;
  font-size: 12px;
}

.admin-preview-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.admin-preview-price strong {
  color: var(--red);
  font-size: 20px;
}

.admin-preview-price span,
.admin-preview-address,
.admin-preview-plan span {
  color: var(--muted);
  font-size: 12px;
}

.admin-preview-address {
  margin: 8px 0 0;
  line-height: 1.6;
}

.admin-preview-highlights {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.8;
}

.admin-preview-plans {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 78%);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.admin-preview-plan {
  min-width: 0;
  border: 1px solid #e5eeea;
  border-radius: 7px;
  background: #fbfdfc;
  padding: 8px;
}

.admin-preview-plan img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
}

.admin-preview-plan strong {
  display: block;
  margin-top: 8px;
  font-size: 13px;
}

.admin-preview-plan span {
  display: block;
  margin-top: 4px;
  line-height: 1.5;
}

.admin-preview-base-info {
  display: grid;
  margin: 0;
}

.admin-preview-base-info > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #edf2f0;
}

.admin-preview-base-info > div:last-child { border-bottom: 0; }

.admin-preview-base-info dt {
  color: var(--muted);
}

.admin-preview-base-info dd {
  margin: 0;
  color: var(--ink);
  word-break: break-word;
}

.admin-preview-support-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.admin-preview-support-tabs span {
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: 6px 11px;
  white-space: nowrap;
  font-size: 12px;
}

.admin-preview-support-group + .admin-preview-support-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf2f0;
}

.admin-preview-support-group strong {
  font-size: 13px;
}

.admin-preview-support-group p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.admin-preview-support-group b {
  margin-right: 7px;
  color: var(--ink);
  font-weight: 600;
}

.admin-preview-empty {
  display: grid;
  place-items: center;
  min-height: 86px;
  width: 100%;
  border-radius: 6px;
  border: 1px dashed #cfdad4;
  color: var(--muted);
  background: #f8fbfa;
}

.admin-preview-carousel .admin-preview-empty {
  border: 0;
  border-radius: 0;
  background: #dce5e8;
}

.admin-preview-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e2ebe6;
}

.admin-preview-footer > span,
.admin-preview-footer div {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-radius: 6px;
  font-size: 13px;
}

.admin-preview-footer > span {
  flex: 0 0 96px;
  background: var(--red);
  color: #fff;
}

.admin-preview-footer div {
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-preview-footer div span:first-child {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--orange);
  color: #fff;
}

.admin-preview-footer div span:last-child {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid var(--brand);
  color: var(--brand-dark);
  background: #fff;
}

@media (max-width: 820px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar input[type="search"] { max-width: none; }
  .visitor-toolbar { align-items: stretch; flex-direction: column; }
  .visitor-live { width: 100%; }
  .visitor-tools { align-items: stretch; flex-direction: column; }
  .visitor-tools input[type="search"] { width: 100%; }
  .visitor-tools .btn { width: 100%; }
  .visitor-layout { grid-template-columns: minmax(0, 1fr); }
  .visitor-list { max-height: 420px; }
  .form-grid { grid-template-columns: 1fr; }
  .gallery-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { flex-direction: column; align-items: stretch; }
  .section-heading .btn { width: 100%; }
  .entry-row,
  .support-item,
  .upload-box,
  .plan-grid { grid-template-columns: 1fr; }
  .support-card-head { grid-template-columns: 1fr; }
  .support-card-head .row-actions,
  .plan-card-head,
  .feature-head { align-items: stretch; flex-direction: column; }
  .plan-card-head .btn,
  .feature-head .btn { width: 100%; }
  .row-actions .btn { flex: 1 1 100%; }
  .feature-row { grid-template-columns: minmax(0, 1fr); }
  .visitor-detail-head { align-items: flex-start; flex-direction: column; }
  .visitor-action-line { align-items: flex-start; flex-wrap: wrap; }
  .timeline-item { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .timeline-time { white-space: normal; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 12px 40px; }
  .tabs { padding: 0 8px; }
  .tab { padding: 13px 11px; }
  .project-form { padding: 16px; }
  .admin-preview-modal { padding: 0; align-items: stretch; }
  .admin-preview-dialog {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }
  .admin-preview-header strong { max-width: calc(100vw - 100px); }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px; }
  .gallery-list { grid-template-columns: 1fr; }
  .row-actions { align-items: stretch; }
  .row-actions .btn { min-height: 38px; }
  .char-count { text-align: left; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}
