:root {
  color-scheme: light;
  --ink: #171b31;
  --muted: #687084;
  --paper: #f5f2ec;
  --card: #fffdfa;
  --navy: #202744;
  --coral: #ef765f;
  --coral-dark: #d85e49;
  --yellow: #e5b84f;
  --line: rgba(32, 39, 68, .11);
  --shadow: 0 20px 60px rgba(44, 37, 29, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(239, 118, 95, .22);
  outline-offset: 2px;
}

.auth-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 34px 18px;
  background:
    radial-gradient(circle at 8% 12%, rgba(239, 118, 95, .14), transparent 26%),
    radial-gradient(circle at 91% 87%, rgba(229, 184, 79, .18), transparent 28%),
    linear-gradient(145deg, #f7f3eb, #f3f1f5);
}
.auth-card {
  width: min(470px, 100%);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 30px;
  background: rgba(255, 253, 250, .94);
  box-shadow: 0 30px 90px rgba(39, 32, 27, .13);
  backdrop-filter: blur(16px);
}
.auth-brand { display: inline-flex; padding: 8px 11px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.auth-brand img { display: block; width: 176px; height: auto; }
.eyebrow { margin: 29px 0 8px; color: var(--coral-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.auth-card h1 { margin: 0; font-size: clamp(30px, 7vw, 42px); letter-spacing: -.035em; line-height: 1.08; }
.auth-copy { margin: 13px 0 26px; color: var(--muted); font-size: 14px; }
.auth-form { display: grid; gap: 17px; }
.auth-form label, .field-grid label, .setting-copy label, .gallery-editor-card label { display: grid; gap: 7px; }
.auth-form label > span, .field-grid label > span, .setting-copy label > span, .gallery-editor-card label > span { font-size: 12px; font-weight: 750; }
.auth-form small, .field-grid small, .setting-copy small { color: var(--muted); font-size: 10px; }
input, textarea {
  width: 100%;
  border: 1px solid rgba(32, 39, 68, .14);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input { min-height: 46px; padding: 10px 13px; }
textarea { min-height: 96px; padding: 12px 13px; resize: vertical; }
input:hover, textarea:hover { border-color: rgba(32, 39, 68, .27); }
input:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(239, 118, 95, .09); outline: 0; }
.primary-button, .ghost-button, .upload-button, .text-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  transition: .2s ease;
}
.primary-button { padding: 11px 18px; border: 0; background: linear-gradient(135deg, var(--coral), #e96856); box-shadow: 0 11px 24px rgba(216, 94, 73, .21); color: #fff; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(216, 94, 73, .27); }
.primary-button:disabled { cursor: wait; filter: grayscale(.5); opacity: .65; transform: none; }
.primary-button.compact { min-height: 39px; padding: 8px 14px; font-size: 12px; }
.ghost-button { min-height: 39px; padding: 8px 13px; border: 1px solid var(--line); background: rgba(255,255,255,.72); color: var(--ink); font-size: 11px; }
.ghost-button:hover { border-color: rgba(239,118,95,.35); background: #fff; }
.form-message { margin: 16px 0 0; padding: 11px 13px; border-radius: 10px; background: #fff0ed; color: #a54231; font-size: 12px; font-weight: 650; }
.local-note { display: flex; gap: 11px; margin-top: 24px; padding: 13px; border: 1px solid rgba(32,39,68,.08); border-radius: 13px; background: #f7f5ef; }
.local-note > span { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border-radius: 9px; background: #fff; color: var(--coral-dark); }
.local-note p { margin: 0; color: var(--muted); font-size: 11px; }
.local-note strong { color: var(--ink); }
.back-link { display: inline-block; margin-top: 21px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--coral-dark); }

.admin-app { min-height: 100vh; }
.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 250, .92);
  backdrop-filter: blur(18px);
}
.admin-header-brand { display: flex; align-items: center; gap: 16px; }
.admin-header-brand img { display: block; width: 139px; height: auto; }
.admin-header-brand > div { display: grid; padding-left: 16px; border-left: 1px solid var(--line); }
.admin-header-brand strong { font-size: 13px; }
.admin-header-brand small { color: #348667; font-size: 10px; font-weight: 700; }
.admin-header-brand small.dirty { color: #b16a15; }
.admin-header-brand small.saving { color: #667087; }
.admin-actions { display: flex; align-items: center; gap: 9px; }
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.admin-nav {
  position: sticky;
  top: 70px;
  display: flex;
  height: calc(100vh - 70px);
  flex-direction: column;
  justify-content: space-between;
  padding: 30px 18px 22px;
  border-right: 1px solid var(--line);
  background: rgba(247, 244, 238, .78);
}
.admin-nav > div:first-child { display: grid; gap: 6px; }
.admin-nav > div:first-child > p { margin: 0 12px 10px; color: #9296a3; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.admin-nav a { display: flex; min-height: 43px; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: #62697b; font-size: 12px; font-weight: 650; text-decoration: none; transition: .18s; }
.admin-nav a span { width: 20px; color: #858b9a; font-size: 15px; text-align: center; }
.admin-nav a:hover, .admin-nav a.active { background: #fff; box-shadow: 0 7px 20px rgba(44,37,29,.06); color: var(--ink); }
.admin-nav a.active span { color: var(--coral); }
.storage-note { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.62); }
.storage-note strong { font-size: 11px; }
.storage-note p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.editor-main { width: min(1060px, 100%); margin: 0 auto; padding: 46px clamp(22px, 5vw, 64px) 80px; }
.editor-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.editor-intro .eyebrow { margin-top: 0; }
.editor-intro h1 { margin: 0; font-size: clamp(29px, 4vw, 42px); letter-spacing: -.035em; line-height: 1.1; }
.editor-intro > div > p:last-child { max-width: 680px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.revision-pill { flex: 0 0 auto; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.72); color: var(--muted); font-size: 10px; font-weight: 750; }
#content-form { display: grid; gap: 20px; }
.editor-card { scroll-margin-top: 94px; padding: clamp(24px, 4vw, 37px); border: 1px solid rgba(32,39,68,.09); border-radius: 24px; background: var(--card); box-shadow: 0 12px 40px rgba(44,37,29,.045); }
.card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 29px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.card-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.card-icon { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border-radius: 13px; font-size: 15px; font-weight: 850; }
.card-icon.coral { background: #ffebe7; color: #c95541; }
.card-icon.yellow { background: #fff1ca; color: #9b7119; }
.card-icon.navy { background: #e8eaf1; color: #28304f; }
.card-icon.lavender { background: #f0e9f7; color: #7b5d92; }
.card-icon.blue { background: #e4eff8; color: #4f7697; }
.card-icon.green { background: #e3f1eb; color: #4b7e68; }
.orders-heading { position: relative; padding-right: 105px; }
.orders-heading .ghost-button { position: absolute; top: 0; right: 0; }
.order-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 13px 15px; border-radius: 13px; background: #f3f8f5; color: #4e7966; font-size: 11px; }
.order-summary strong { font-size: 18px; }
.order-summary small { color: #718177; }
.orders-list { display: grid; gap: 9px; }
.orders-empty { margin: 0; padding: 28px 18px; border: 1px dashed rgba(32,39,68,.16); border-radius: 14px; color: var(--muted); font-size: 12px; text-align: center; }
.orders-empty.error { border-color: rgba(199,82,62,.25); color: #a54231; }
.order-row { display: grid; grid-template-columns: minmax(180px,1.2fr) minmax(170px,1fr) auto; align-items: center; gap: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.order-main,.order-customer { display: grid; gap: 3px; min-width: 0; }
.order-main>div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.order-main strong { font-size: 14px; letter-spacing: .03em; }
.order-main small,.order-customer small,.order-action small { overflow-wrap: anywhere; color: var(--muted); font-size: 9px; }
.order-customer>span { color: #9296a3; font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.order-customer strong { overflow-wrap: anywhere; font-size: 13px; }
.order-status { padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 850; }
.order-status.pending { background: #fff4d3; color: #8b6718; }
.order-status.paid { background: #e8f1ff; color: #356494; }
.order-status.waiting { background: #ffeadf; color: #a4512f; }
.order-status.completed { background: #e0f4e9; color: #347353; }
.order-status.expired { background: #eff0f3; color: #777c89; }
.order-action { display: flex; justify-content: flex-end; }
.field-grid { display: grid; gap: 20px; }
.field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid .wide { grid-column: 1 / -1; }
.field-grid label, .setting-copy label { align-content: start; }
.field-grid label > span, .setting-copy label > span { color: #31374e; }
.field-grid textarea { line-height: 1.6; }

.image-setting { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: center; gap: 34px; margin-top: 30px; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: #f8f6f1; }
.setting-copy h3, .gallery-heading h3 { margin: 0; font-size: 15px; }
.setting-copy > p, .gallery-heading p { margin: 5px 0 18px; color: var(--muted); font-size: 11px; }
.image-picker { display: grid; gap: 10px; }
.image-preview { position: relative; display: grid; min-height: 112px; overflow: hidden; place-items: center; border: 1px dashed rgba(32,39,68,.2); border-radius: 14px; background: #fff; }
.image-preview.portrait { min-height: 230px; }
.image-preview.square { min-height: 150px; aspect-ratio: 4 / 3; }
.image-preview img { display: block; width: 100%; height: 100%; max-height: 260px; object-fit: contain; }
.image-preview.portrait img { object-fit: contain; }
.image-preview.square img { position: absolute; inset: 0; max-height: none; object-fit: cover; }
.image-preview > div { display: grid; place-items: center; color: #959aa7; }
.image-preview > div span { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: #f5f1e9; color: var(--coral); font-size: 17px; font-weight: 850; }
.image-preview > div small { margin-top: 7px; font-size: 9px; }
.image-picker > div:not(.image-preview) { display: flex; gap: 8px; }
.upload-button, .text-button { min-height: 38px; padding: 7px 11px; font-size: 10px; }
.upload-button { flex: 1; border: 1px solid rgba(239,118,95,.24); background: #fff0ed; color: #b44e3c; }
.upload-button:hover { background: #ffe7e2; }
.text-button { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.text-button:hover { color: var(--ink); }
.image-picker > p { min-height: 15px; margin: 0; color: var(--muted); font-size: 9px; }
.image-picker > p.error { color: #b34837; }
.image-picker > p.success { color: #327b5e; }
.image-picker.uploading { opacity: .65; pointer-events: none; }
.showcase-setting { margin-bottom: 30px; }
.gallery-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 31px 0 16px; }
.gallery-heading span { padding: 5px 9px; border-radius: 999px; background: #f1eee7; color: var(--muted); font-size: 9px; font-weight: 750; }
.gallery-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gallery-editor-card { position: relative; display: grid; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: #faf8f4; }
.gallery-number { position: absolute; z-index: 2; top: 23px; left: 23px; display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: rgba(27,32,53,.82); box-shadow: 0 5px 15px rgba(0,0,0,.14); color: #fff; font-size: 9px; font-weight: 800; backdrop-filter: blur(5px); }
.gallery-editor-card label { gap: 5px; }
.gallery-editor-card input { min-height: 40px; font-size: 11px; }
.plan-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; padding: 17px 19px; border: 1px solid rgba(229,184,79,.2); border-radius: 15px; background: linear-gradient(135deg, #fff9e7, #f9f2e4); }
.plan-summary span { padding: 5px 8px; border-radius: 999px; background: #fff; color: #8b6921; font-size: 8px; font-weight: 850; letter-spacing: .08em; }
.plan-summary strong { margin-left: auto; font-size: 24px; letter-spacing: -.03em; }
.plan-summary small { color: #8b6921; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.save-bar { position: sticky; bottom: 18px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 18px; border: 1px solid rgba(32,39,68,.1); border-radius: 16px; background: rgba(255,253,250,.92); box-shadow: var(--shadow); backdrop-filter: blur(17px); }
.save-bar strong { font-size: 12px; }
.save-bar p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.admin-toast { position: fixed; z-index: 100; top: 85px; right: 22px; display: flex; max-width: min(390px, calc(100% - 44px)); align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.65); border-radius: 13px; background: rgba(28,32,52,.94); box-shadow: 0 18px 46px rgba(17,20,35,.22); color: #fff; backdrop-filter: blur(12px); }
.admin-toast > span { display: grid; width: 23px; height: 23px; flex: 0 0 23px; place-items: center; border-radius: 50%; background: #ffb6a8; color: #713126; font-size: 11px; }
.admin-toast p { margin: 2px 0 0; font-size: 11px; }
.admin-toast.error > span { background: #ffcfca; }

@media (max-width: 900px) {
  .admin-header { padding-inline: 17px; }
  .admin-header-brand > div { display: none; }
  .admin-header-brand img { width: 126px; }
  .admin-actions .ghost-button:first-child { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: sticky; top: 70px; z-index: 30; display: block; width: 100%; height: auto; overflow-x: auto; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(247,244,238,.94); backdrop-filter: blur(16px); }
  .admin-nav > div:first-child { display: flex; width: max-content; gap: 4px; }
  .admin-nav > div:first-child > p, .storage-note { display: none; }
  .admin-nav a { min-height: 38px; padding: 7px 10px; white-space: nowrap; }
  .editor-main { padding-top: 34px; }
  .order-row { grid-template-columns: 1fr 1fr; }
  .order-action { grid-column: 1/-1; justify-content: flex-start; }
}

@media (max-width: 680px) {
  .admin-header { min-height: 64px; }
  .admin-actions { gap: 6px; }
  .admin-actions #logout-button { display: none; }
  .admin-actions .primary-button { min-height: 38px; }
  .admin-nav { top: 64px; }
  .editor-main { padding: 29px 13px 70px; }
  .editor-intro { display: block; padding-inline: 7px; }
  .revision-pill { display: inline-flex; margin-top: 15px; }
  .editor-card { scroll-margin-top: 120px; padding: 22px 17px; border-radius: 20px; }
  .card-heading { align-items: flex-start; }
  .field-grid.two-columns { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .image-setting { grid-template-columns: 1fr; padding: 16px; }
  .gallery-editor-grid { grid-template-columns: 1fr; }
  .save-bar { bottom: 10px; }
  .save-bar > div { display: none; }
  .save-bar .primary-button { width: 100%; }
  .plan-summary { flex-wrap: wrap; }
  .plan-summary strong { margin-left: 0; }
  .orders-heading { padding-right: 0; }
  .orders-heading .ghost-button { position: static; margin-left: auto; }
  .order-summary { align-items: flex-start; flex-direction: column; gap: 3px; }
  .order-row { grid-template-columns: 1fr; }
  .order-action { grid-column: auto; justify-content: stretch; }
  .order-action .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
