:root {
  --ink: #342f35;
  --muted: #857782;
  --warm: #ff7d55;
  --warm-dark: #df5f3b;
  --cream: #fff7ef;
  --mint: #dff8ef;
  --tech: #69d8ff;
  --line: rgba(255, 177, 134, .28);
  --panel: rgba(255, 255, 255, .78);
  --shadow: 0 22px 60px rgba(145, 79, 54, .14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 193, 154, .52), transparent 28%),
    radial-gradient(circle at 90% 14%, rgba(105, 216, 255, .26), transparent 24%),
    linear-gradient(145deg, #fff8f1 0%, #f2fbf7 48%, #fff0e7 100%);
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: var(--warm-dark);
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.app-header {
  position: sticky;
  top: 12px;
  z-index: 20;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 22px;
  background: rgba(255, 255, 255, .66);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--warm), #ffb36f);
  box-shadow: 0 12px 28px rgba(255, 125, 85, .32);
}

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

.brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 0;
  border-radius: 14px;
  background: #fff3ea;
  color: var(--warm-dark);
  width: 42px;
  height: 42px;
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
}

.nav-chip,
.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #594f56;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-chip:hover {
  background: #fff3ea;
  color: var(--warm-dark);
  text-decoration: none;
}

.nav-chip-primary {
  background: linear-gradient(135deg, var(--warm), #ffb36f);
  color: #fff;
}

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

.user-chip {
  background: rgba(223, 248, 239, .78);
  color: #40735f;
}

.app-content {
  margin-top: 18px;
}

.mini-hero,
.auth-card,
.form-screen,
.empty-state,
.table-panel,
.panel-form,
.quick-panel {
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.mini-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px;
  margin-bottom: 18px;
}

.mini-hero h1,
.auth-copy h1,
.form-head h1,
.empty-state h1,
.empty-state h2 {
  margin: 6px 0 8px;
  font-size: 30px;
  font-weight: 800;
  color: #3b3339;
}

.mini-hero p,
.auth-copy p,
.form-head p,
.empty-state p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: #3e7f77;
  background: rgba(105, 216, 255, .16);
  border: 1px solid rgba(105, 216, 255, .24);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero-actions,
.card-actions,
.editor-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 15px;
  padding: 10px 18px;
  font-weight: 700;
  box-shadow: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-sm {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--warm), #ffae6b);
  color: #fff;
  box-shadow: 0 14px 28px rgba(255, 125, 85, .28);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--warm-dark), #ff9b5f);
  color: #fff;
}

.btn-soft,
.btn-glass {
  background: rgba(255, 255, 255, .86);
  color: #6a5650;
  border: 1px solid rgba(255, 177, 134, .32);
}

.btn-soft:hover,
.btn-glass:hover {
  color: var(--warm-dark);
  background: #fff7ef;
}

.btn-ai {
  color: #2f6f76;
  background: linear-gradient(135deg, rgba(105, 216, 255, .28), rgba(255, 255, 255, .9));
  border: 1px solid rgba(105, 216, 255, .34);
}

.btn-danger-soft {
  color: #b24a43;
  background: #fff0ee;
  border: 1px solid rgba(225, 91, 80, .18);
}

.btn-block {
  width: 100%;
}

.btn-link {
  color: var(--muted);
  background: transparent;
}

.auth-card {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  padding: 28px;
  min-height: 520px;
  align-items: center;
}

.auth-copy {
  min-height: 430px;
  border-radius: 24px;
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(255, 125, 85, .16), rgba(105, 216, 255, .18)),
    rgba(255, 255, 255, .5);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.panel-form {
  padding: 22px;
}

.panel-form.horizontal {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: #665960;
  font-size: 14px;
  font-weight: 700;
}

.form-control {
  min-height: 46px;
  border: 1px solid rgba(255, 177, 134, .36);
  border-radius: 15px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  padding: 10px 14px;
}

.form-control:focus {
  border-color: rgba(105, 216, 255, .78);
  box-shadow: 0 0 0 4px rgba(105, 216, 255, .16);
}

.diary-textarea {
  resize: vertical;
}

.split-fields,
.settings-grid,
.editor-grid {
  display: grid;
  gap: 16px;
}

.split-fields {
  grid-template-columns: 1fr 1fr;
}

.settings-grid {
  grid-template-columns: minmax(0, 1fr) 300px;
  margin-bottom: 18px;
}

.editor-grid {
  grid-template-columns: minmax(0, 1fr) 330px;
}

.form-screen {
  padding: 24px;
}

.form-screen.wide {
  max-width: none;
}

.form-head {
  margin-bottom: 18px;
}

.upload-panel,
.quick-panel {
  padding: 18px;
}

.quick-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.upload-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 22px;
  border: 1px dashed rgba(255, 125, 85, .5);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 247, 239, .92), rgba(240, 253, 250, .9));
  color: #6a5650;
  text-align: center;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.upload-card.large {
  min-height: 240px;
}

.upload-card.compact {
  min-height: 120px;
}

.upload-card:hover {
  transform: translateY(-2px);
  border-color: var(--warm);
  box-shadow: 0 18px 42px rgba(255, 125, 85, .16);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 20px;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  background: linear-gradient(135deg, var(--warm), var(--tech));
}

.upload-card strong,
.upload-card small {
  display: block;
}

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

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.family-grid,
.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.product-card {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 16px 44px rgba(109, 71, 50, .1);
  padding: 20px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--warm), var(--tech));
  margin-bottom: 14px;
  font-weight: 800;
}

.product-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.product-card p {
  color: var(--muted);
}

.meta-line,
.diary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.meta-line span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 247, 239, .9);
}

.diary-content {
  white-space: pre-line;
}

.tag-row,
.notice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row {
  margin: 12px 0;
}

.tag-row span,
.notice-pill {
  border-radius: 999px;
  padding: 5px 10px;
  color: #317069;
  background: rgba(223, 248, 239, .8);
  font-size: 13px;
}

.notice-row {
  margin-bottom: 16px;
}

.smart-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  max-width: 520px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.media-grid img,
.media-grid video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  background: #f8efe8;
}

.existing-media {
  margin-top: 16px;
}

.diary-detail {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 16px 44px rgba(109, 71, 50, .1);
  padding: 24px;
}

.diary-detail-hero h1 {
  max-width: 760px;
}

.detail-tags {
  margin-bottom: 18px;
}

.detail-content {
  color: #4b4148;
  font-size: 17px;
  line-height: 1.9;
  white-space: pre-line;
}

.detail-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.detail-media-grid img,
.detail-media-grid video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 18px;
  background: #f8efe8;
}

.draft-status {
  color: var(--muted);
  align-self: center;
}

.empty-state {
  padding: 36px;
  text-align: center;
}

.table-panel {
  padding: 18px;
  overflow-x: auto;
}

.table {
  margin-bottom: 0;
  color: var(--ink);
}

.table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 13px;
}

.table td,
.table th {
  border-color: rgba(255, 177, 134, .22);
  vertical-align: middle;
}

.download-link-cell {
  max-width: 360px;
  word-break: break-all;
}

.inline-form {
  display: inline-block;
  margin: 0 4px 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-grid div {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 22px;
  background: rgba(255, 255, 255, .76);
  padding: 18px;
  box-shadow: 0 12px 36px rgba(109, 71, 50, .08);
}

.stat-grid strong {
  display: block;
  color: var(--warm-dark);
  font-size: 30px;
}

.stat-grid span,
.text-muted {
  color: var(--muted) !important;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  color: #665960;
}

.switch-field input {
  width: 18px;
  height: 18px;
}

.app-modal .modal-content {
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 70px rgba(109, 71, 50, .18);
}

.app-modal .modal-header,
.app-modal .modal-footer {
  border: 0;
}

.app-modal .modal-title {
  color: #3b3339;
  font-weight: 800;
}

.app-modal .modal-body {
  color: #665960;
  line-height: 1.7;
  padding-top: 0;
}

@media (max-width: 800px) {
  .app-shell {
    width: min(430px, calc(100% - 20px));
    padding-top: 10px;
  }

  .app-nav {
    align-items: flex-start;
    flex-wrap: wrap;
    border-radius: 20px;
  }

  .nav-toggle {
    display: grid;
    place-items: center;
  }

  .nav-menu {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-menu.collapse:not(.show) {
    display: none;
  }

  .nav-chip,
  .user-chip {
    width: 100%;
  }

  .mini-hero,
  .auth-card,
  .panel-form.horizontal {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .auth-card {
    display: grid;
    min-height: 0;
    padding: 18px;
  }

  .auth-copy {
    min-height: 220px;
    padding: 24px;
  }

  .settings-grid,
  .editor-grid,
  .split-fields {
    grid-template-columns: 1fr;
  }

  .mini-hero h1,
  .auth-copy h1,
  .form-head h1 {
    font-size: 26px;
  }
}
