:root {
  --red: #b5121b;
  --red-dark: #7a0c12;
  --blue: #2358c8;
  --blue-light: #4d95ec;
  --paper: #fffdf5;
  --panel: #ece9d8;
  --line: #c9c4b4;
  --ink: #2a2a2a;
  --muted: #68645c;
  --gold: #f2b705;
  --green: #2f8f46;
  --shadow: 0 14px 34px rgba(20, 30, 50, .28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: Tahoma, Verdana, "Segoe UI", Geneva, sans-serif;
  background:
    linear-gradient(180deg, #fdeeb0 0%, #fff6da 22%, #fbf7ec 46%, #e9eff6 74%, #dbe6f2 100%);
}

button,
input,
select {
  font: inherit;
}

button,
input,
select,
a {
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
}

.desktop-shell {
  min-height: 100vh;
  padding-bottom: 62px;
}

.brand-header {
  padding: 24px 16px 12px;
  text-align: center;
}

.brand-script {
  margin: 0;
  color: var(--red);
  font-family: "Lobster", "Brush Script MT", Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 72px);
  font-style: italic;
  font-weight: 700;
  line-height: .95;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .85), 0 5px 14px rgba(122, 12, 18, .2);
}

.brand-subtitle {
  margin: 6px 0 0;
  color: #75684f;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.workspace {
  width: min(1100px, calc(100% - 28px));
  margin: 0 auto 24px;
}

.screen {
  width: 100%;
}

.window {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--red-dark);
  border-radius: 8px 8px 3px 3px;
  box-shadow: var(--shadow);
}

.wide-window {
  width: 100%;
}

.login-window {
  width: min(430px, 100%);
  margin: 20px auto 56px;
}

.editor-window {
  width: min(940px, 100%);
  margin: 0 auto;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 5px 6px 5px 8px;
  background: linear-gradient(180deg, #f0776a 0%, #d8342c 12%, var(--red) 48%, #8f0f14 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}

.titlebar h1 {
  flex: 1;
  margin: 0;
  color: white;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-icon {
  display: grid;
  width: 18px;
  height: 16px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--red);
  background: linear-gradient(180deg, #fff6da, var(--gold));
  border: 1px solid #8f0f14;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
}

.window-button,
.title-action {
  display: grid;
  min-width: 22px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--red-dark);
  border-radius: 2px;
  color: white;
  background: linear-gradient(180deg, #f88f7f, #e0392f 55%, #a81118);
  font-size: 11px;
  font-weight: 700;
}

.title-action {
  width: auto;
  padding: 0 10px;
  cursor: pointer;
}

.window-body {
  padding: 18px;
  background: white;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.identity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.identity-badge {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  color: var(--red);
  background: linear-gradient(180deg, #f4ecdc, #d9cfb8);
  border: 1px solid #b5a887;
  border-radius: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
}

.section-label,
.field span {
  margin: 0 0 4px;
  color: #555;
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.muted {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.notice {
  margin-bottom: 14px;
  padding: 11px 12px;
  color: #4a3e20;
  background: #fff8e2;
  border: 1px solid #d7be72;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field input,
.field select {
  min-height: 36px;
  width: 100%;
  padding: 8px 10px;
  color: #1a1a1a;
  background: white;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, .16);
}

.field input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--red);
  box-shadow: none;
}

.field input[type="color"] {
  min-height: 38px;
  padding: 4px;
}

.primary-button,
.secondary-button {
  min-height: 36px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: linear-gradient(180deg, #ff8f7a 0%, #e8443b 45%, var(--red) 100%);
  border: 1px solid var(--red-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 1px 2px rgba(0, 0, 0, .25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
}

.secondary-button {
  color: #2a2a2a;
  background: linear-gradient(180deg, #fefefe, #e3e3e3 45%, #c6c6c6);
  border: 1px solid #8a8a8a;
}

.primary-button:hover,
.secondary-button:hover,
.title-action:hover {
  filter: brightness(1.06);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.qr-panel {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.qr-panel img {
  width: 130px;
  height: 130px;
  border: 1px solid var(--line);
  background: white;
}

.manual-key {
  display: block;
  overflow-wrap: anywhere;
  padding: 7px;
  background: #f5f2e8;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: #333;
  font-size: 11px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(220px, 280px);
  justify-content: center;
  align-items: start;
  gap: 20px;
}

.info-panel {
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(20, 20, 20, .12);
}

.info-panel h2 {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.info-panel p {
  margin: 0;
  color: #4a4a4a;
  font-size: 12px;
  line-height: 1.6;
}

.drop-time {
  color: var(--red) !important;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px !important;
  font-style: italic;
  font-weight: 700;
  line-height: 1.1 !important;
}

.drop-zone {
  display: grid;
  min-height: 210px;
  align-content: center;
  justify-items: center;
  gap: 9px;
  padding: 16px;
  background: #f7f7f7;
  border: 2px dashed #7f9db9;
  border-radius: 4px;
  color: #444;
  cursor: pointer;
  text-align: center;
}

.drop-hint {
  color: var(--muted);
  font-size: 12px;
}

.drop-zone:hover {
  border-color: var(--red);
  background: #fffaf0;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.preview-item {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.preview-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: #ddd;
}

.preview-item span {
  overflow: hidden;
  color: #4b4b4b;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-list {
  display: grid;
  gap: 6px;
  margin: -4px 0 0;
  padding: 0;
  list-style: none;
}

.selected-file-list li {
  overflow: hidden;
  padding: 7px 9px;
  color: #353535;
  background: #f8f6ef;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  font-size: 12px;
  cursor: pointer;
}

.check-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--red);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #f5f2e8;
  border-bottom: 1px solid var(--line);
  color: #4a4a4a;
  font-size: 12px;
}

.admin-toolbar {
  flex-wrap: wrap;
}

.instagram-detail {
  padding: 8px 12px;
  color: #584b2d;
  background: #fff8e2;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
}

.instagram-detail:empty {
  display: none;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(47, 143, 70, .2);
}

.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.seg-button {
  min-height: 30px;
  padding: 5px 10px;
  color: #444;
  background: white;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.seg-button.is-active {
  color: white;
  background: var(--red);
  border-color: var(--red-dark);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  padding: 12px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.summary-card {
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.summary-card strong {
  display: block;
  color: var(--red);
  font-size: 22px;
}

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

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.photo-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 8px 8px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 3px 10px rgba(20, 20, 20, .18);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #d9d9d9;
}

.photo-title {
  margin: 9px 0 2px;
  color: #222;
  font-size: 12px;
  font-weight: 700;
}

.photo-meta {
  margin: 0;
  color: #777;
  font-size: 11px;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.small-button {
  min-height: 28px;
  padding: 4px 9px;
  color: #333;
  background: white;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}

.small-button.primary-small {
  color: white;
  background: #16110f;
  border-color: #16110f;
}

.small-button.danger-small {
  color: var(--red);
  border-color: var(--red);
}

.small-button:hover {
  background: #f5f2e8;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.editor-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.editor-controls {
  align-self: start;
}

.button-row {
  display: flex;
  gap: 8px;
}

.button-row .primary-button {
  flex: 1;
}

.link-button {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.canvas-frame {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 10px;
  background: #f5f2e8;
  border: 1px solid var(--line);
}

canvas {
  display: block;
  width: min(100%, 540px);
  aspect-ratio: 1;
  background: repeating-linear-gradient(115deg, #6d7a86 0 30px, #5a6772 30px 60px);
  border: 1px solid #7f9db9;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .25);
}

.taskbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 46px;
  padding: 6px 10px 6px 118px;
  overflow: hidden;
  background: linear-gradient(180deg, #3168d5 0%, #4993e6 8%, #2b5dc4 40%, #2358c8 88%, #1941a5 100%);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, .35), 0 -4px 12px rgba(0, 0, 0, .25);
}

.taskbar::before {
  content: "start";
  position: fixed;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: 106px;
  height: 46px;
  padding-left: 16px;
  color: white;
  background: linear-gradient(180deg, #d8342c 0%, var(--red) 45%, var(--red-dark) 100%);
  border-radius: 0 12px 12px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
  font-size: 14px;
  font-style: italic;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.task-button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 32px;
  padding: 6px 12px;
  color: white;
  background: linear-gradient(180deg, #5a9ceb, #3a76d8 55%, #2a5cc0);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .4);
  white-space: nowrap;
}

.task-label-short {
  display: none;
}

.task-button.is-active {
  background: linear-gradient(180deg, #1c4fa8, #2a63c4 55%, #1e4fa0);
  border-color: rgba(0, 0, 0, .35);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 60px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  color: #322812;
  background: #fff8e2;
  border: 1px solid #d7be72;
  border-radius: 5px;
  box-shadow: 0 10px 26px rgba(20, 30, 50, .28);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .desktop-shell {
    padding-bottom: 58px;
  }

  .brand-header {
    padding: 18px 10px 10px;
  }

  .workspace {
    width: min(100% - 18px, 1100px);
    margin-bottom: 16px;
  }

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

  .info-panel {
    padding: 12px 14px;
  }

  .drop-time {
    font-size: 26px !important;
  }

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

  .qr-panel {
    grid-template-columns: 1fr;
  }

  .qr-panel img {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 520px) {
  .brand-script {
    font-size: 38px;
  }

  .brand-subtitle {
    letter-spacing: .12em;
    line-height: 1.45;
  }

  .window-body {
    padding: 12px;
  }

  .drop-zone {
    min-height: 168px;
    padding: 12px;
  }

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

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

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .taskbar {
    gap: 4px;
    padding: 6px;
  }

  .taskbar::before {
    display: none;
  }

  .task-button {
    min-height: 38px;
    padding: 5px 3px;
    font-size: 11px;
    line-height: 1.1;
    white-space: normal;
  }

  .task-label-full {
    display: none;
  }

  .task-label-short {
    display: inline;
  }
}
