:root {
  --ink: #0c0d0f;
  --panel: #151719;
  --panel-2: #1c2024;
  --line: rgba(225, 213, 188, 0.22);
  --line-strong: rgba(225, 213, 188, 0.42);
  --text: #f6f1e7;
  --muted: #b9b0a2;
  --gold: #c8a96a;
  --gold-soft: #ead8ad;
  --blue: #8da8bd;
  --danger: #dca078;
  --white: #fffaf0;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--ink);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.05), rgba(12, 13, 15, 0) 32%),
    linear-gradient(180deg, #0c0d0f 0%, #16191b 58%, #0f1113 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 42px) 42px;
}

.client-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 210px;
  padding: clamp(24px, 4vw, 52px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(12, 13, 15, 0.94), rgba(12, 13, 15, 0.58)),
    url("assets/AFP-20260621-001.webp") center 33% / cover no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(34px, 5vw, 72px);
  font-weight: 500;
  line-height: 1.04;
}

.hero-line {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
}

.hero-meta div,
.plan-strip,
.summary-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 23, 25, 0.86);
  backdrop-filter: blur(14px);
}

.hero-meta div {
  padding: 14px 16px;
}

.hero-meta span,
.hero-meta strong {
  display: block;
}

.hero-meta span {
  color: var(--muted);
  font-size: 13px;
}

.hero-meta strong {
  margin-top: 6px;
  color: var(--white);
  font-size: 16px;
}

.plan-strip {
  display: grid;
  grid-template-columns: auto minmax(220px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px 16px;
}

.field-label {
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 700;
}

.plan-select,
input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #101214;
  outline: none;
}

.plan-select:focus,
input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.16);
}

.plan-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.plan-metrics span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.04);
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.gallery-area {
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.search-wrap {
  display: grid;
  gap: 7px;
}

.segment {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.segment-button,
.ghost-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 250, 240, 0.04);
}

.segment-button.is-active,
.segment-button:hover,
.ghost-button:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(200, 169, 106, 0.12);
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

.photo-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.photo-card.is-selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(200, 169, 106, 0.18), 0 18px 34px rgba(0, 0, 0, 0.3);
}

.photo-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.photo-image {
  position: relative;
  aspect-ratio: 4 / 5;
  background-position: center;
  background-size: cover;
  overflow: hidden;
}

.photo-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 13, 15, 0) 58%, rgba(12, 13, 15, 0.64)),
    repeating-linear-gradient(-24deg, rgba(255, 250, 240, 0.12) 0 2px, transparent 2px 52px);
  pointer-events: none;
}

.photo-image::after {
  content: "AIRFEILLA PREVIEW";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 250, 240, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
  transform: rotate(-18deg);
  pointer-events: none;
}

.select-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 250, 240, 0.55);
  border-radius: 50%;
  color: transparent;
  background: rgba(12, 13, 15, 0.48);
}

.photo-card.is-selected .select-badge {
  border-color: var(--gold-soft);
  color: var(--ink);
  background: var(--gold-soft);
}

.photo-meta {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.photo-name {
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.photo-type {
  color: var(--muted);
  font-size: 13px;
}

.selection-cta {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--gold-soft);
  background: rgba(200, 169, 106, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.photo-card.is-selected .selection-cta {
  border-color: var(--gold);
  color: #12110e;
  background: linear-gradient(180deg, #ead8ad, #c8a96a);
}

.summary-panel {
  position: sticky;
  top: 18px;
  padding: 18px;
}

.summary-head h2,
.confirm-dialog h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.totals {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.totals div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid rgba(225, 213, 188, 0.14);
}

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

.totals dd {
  margin: 0;
  color: var(--white);
  font-weight: 800;
}

.totals .total-row {
  min-height: 52px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
}

.total-row dd {
  color: var(--gold-soft);
  font-size: 22px;
}

.selected-list-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.035);
  overflow: hidden;
}

.list-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--gold-soft);
  font-weight: 700;
}

.selected-list {
  display: grid;
  gap: 7px;
  max-height: 240px;
  margin: 0;
  padding: 12px 14px 12px 34px;
  overflow: auto;
  color: var(--text);
}

.selected-list li {
  padding-left: 4px;
  overflow-wrap: anywhere;
}

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

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: #12110e;
  font-weight: 800;
  background: linear-gradient(180deg, #ead8ad, #c8a96a);
}

.primary-button:hover {
  filter: brightness(1.04);
}

.primary-button:disabled,
.ghost-button:disabled,
.photo-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button.compact {
  width: auto;
  min-width: 150px;
  margin-top: 0;
  padding: 0 18px;
}

.plan-title {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  color: var(--white);
  font-weight: 800;
}

.security-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.confirm-dialog {
  width: min(560px, calc(100% - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.dialog-body {
  padding: 22px;
}

.dialog-summary {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.dialog-summary strong {
  color: var(--white);
}

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

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.dialog-actions .primary-button,
.dialog-actions .ghost-button {
  width: 100%;
  margin-top: 0;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }

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

@media (max-width: 780px) {
  .app-shell {
    padding: 16px 12px 28px;
  }

  .client-hero,
  .plan-strip,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .client-hero {
    min-height: 360px;
    align-items: end;
    padding: 24px;
    background:
      linear-gradient(180deg, rgba(12, 13, 15, 0.18), rgba(12, 13, 15, 0.94)),
      url("assets/AFP-20260621-001.webp") center top / cover no-repeat;
  }

  .hero-meta {
    grid-template-columns: 1fr 1fr;
  }

  .plan-metrics,
  .toolbar-actions {
    justify-content: flex-start;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 34px;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .segment,
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .segment-button,
  .ghost-button {
    padding: 0 10px;
  }
}

.admin-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 36px) 42px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  min-height: 126px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(12, 13, 15, 0.98), rgba(28, 32, 36, 0.82)),
    url("assets/AFP-20260621-003.webp") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.admin-topbar h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 500;
}

.admin-actions,
.button-row,
.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.notice {
  min-height: 44px;
  display: flex;
  align-items: center;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.035);
}

.notice[data-type="success"] {
  border-color: rgba(141, 168, 189, 0.72);
  color: #c8d8e2;
}

.notice[data-type="error"] {
  border-color: rgba(220, 160, 120, 0.72);
  color: #f0c2a4;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.album-sidebar,
.admin-panel,
.upload-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 23, 25, 0.88);
}

.album-sidebar {
  position: sticky;
  top: 16px;
  padding: 14px;
}

.admin-panel {
  display: grid;
  gap: 16px;
  border: 0;
  background: transparent;
}

.admin-form,
.upload-panel,
.history-panel {
  padding: 18px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 21px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

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

.album-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: rgba(255, 250, 240, 0.035);
  text-align: left;
}

.album-item strong {
  color: var(--white);
  overflow-wrap: anywhere;
}

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

.album-item.is-active,
.album-item:hover {
  border-color: var(--gold);
  background: rgba(200, 169, 106, 0.1);
}

.admin-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 23, 25, 0.88);
}

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

.form-grid > label,
.expiry-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.form-grid > label > span,
.expiry-field > span {
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #101214;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
}

.checkbox-field span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

textarea,
.form-grid input:not([type="checkbox"]),
.form-grid select,
.readonly-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #101214;
  outline: none;
}

textarea:focus,
.form-grid input:not([type="checkbox"]):focus,
.form-grid select:focus,
.readonly-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 169, 106, 0.16);
}

input:disabled {
  cursor: not-allowed;
  color: rgba(246, 241, 231, 0.46);
  background: rgba(255, 250, 240, 0.035);
}

.wide-field {
  grid-column: 1 / -1;
}

.button-row {
  margin-top: 14px;
}

.ghost-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 250, 240, 0.04);
  text-decoration: none;
}

.ghost-link:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
  background: rgba(200, 169, 106, 0.12);
}

.readonly-input {
  margin-top: 12px;
  color: var(--muted);
  resize: vertical;
  overflow-wrap: anywhere;
}

.panel-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.upload-row input[type="file"] {
  min-height: 42px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.035);
}

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

.admin-photo-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 250, 240, 0.035);
}

.admin-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #0e1011;
}

.admin-photo-card strong,
.admin-photo-card span {
  display: block;
  overflow-wrap: anywhere;
}

.admin-photo-card span {
  color: var(--muted);
  font-size: 13px;
}

.ghost-button.danger {
  color: #f0c2a4;
}

.selection-history {
  display: grid;
  gap: 10px;
}

.selection-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 250, 240, 0.035);
}

.selection-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.selection-card strong {
  color: var(--white);
}

.selection-card span,
.selection-card p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .album-sidebar {
    position: static;
  }

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

@media (max-width: 720px) {
  .admin-shell {
    padding: 14px 12px 28px;
  }

  .admin-topbar {
    display: grid;
    min-height: 190px;
    align-items: end;
  }

  .form-grid,
  .admin-photo-grid {
    grid-template-columns: 1fr;
  }

  .selection-card > div {
    display: grid;
  }
}
