/* ==========================================================================
   SCALEWOVEN NAIL STUDIO — VENDOR PORTAL
   Editorial Parisian Nail Atelier Design System
   ========================================================================== */

:root {
  --paper: #f7f3ee;
  --paper-stone: #efe8df;
  --paper-deep: #e6ddd2;
  --white: #fffdf9;
  --ink: #201c1a;
  --ink-soft: #3b3430;
  --muted: #4d4540;
  --line: #dfd6cb;
  --line-strong: #c8bcb0;
  --line-soft: #ede5dc;
  --wine: #6e2037;
  --wine-dark: #511729;
  --wine-soft: rgba(110, 32, 55, 0.08);
  --blush: #f2e8e6;
  --gold: #b5894f;
  --gold-dark: #87602c;
  --gold-soft: rgba(181, 137, 79, 0.14);
  --sage: #3d634d;
  --sage-pale: #e7efe9;
  --danger: #9f1f34;
  --danger-bg: #fdf1f2;
  --serif: 'Playfair Display', Georgia, serif;
  --display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm: 0 2px 10px rgba(32, 28, 26, 0.04);
  --shadow-md: 0 12px 32px rgba(32, 28, 26, 0.08);
  --shadow-lg: 0 24px 64px rgba(32, 28, 26, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body.vendor-page {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 68% 48% at 96% 0%, rgba(181, 137, 79, 0.09) 0%, transparent 65%),
    radial-gradient(ellipse 52% 45% at 0% 100%, rgba(110, 32, 55, 0.05) 0%, transparent 65%);
  font: 400 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

:is(button, a, input, select, textarea, [tabindex="0"]):focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 3px;
}

/* Visually hidden utility (accessible skip links & live announcer) */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus-visible {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 1000;
  padding: 10px 18px;
  border: 1px solid var(--wine);
  background: var(--white);
  color: var(--wine);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

/* --------------------------------------------------------------------------
   Shell, Header & Footer
   -------------------------------------------------------------------------- */
.page-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

.site-header {
  width: min(1360px, calc(100% - 48px));
  min-height: 84px;
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.vendor-header-brand {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.wordmark,
.footer-wordmark,
.vendor-page .site-header.store-branded-header .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 700 24px/1 var(--display) !important;
  letter-spacing: -0.025em !important;
}

.wordmark > span,
.footer-wordmark > span {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 11px;
  border-radius: 50%;
  background: var(--wine);
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
}

/* Preserve store-branding.js injected logo layout inside vendor header */
.vendor-header-brand > .wordmark > .store-custom-brand-wrap {
  width: auto;
  height: auto;
  max-width: 100%;
  margin: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.vendor-header-brand .store-custom-brand-wrap .wordmark {
  display: block;
  max-width: 100%;
  font-size: 27px !important;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.vendor-header-brand .store-powered-by {
  display: none;
}

.brand-caption {
  padding-left: 18px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.header-user {
  display: none !important;
}

.back-link,
.text-button {
  min-height: 40px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.back-link:hover,
.text-button:hover {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine-dark);
  transform: translateY(-1px);
}

.vendor-page .sign-out {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.vendor-page .sign-out:hover {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--white);
}

.vendor-page .store-tenant-pill {
  min-width: 0;
  max-width: 300px;
  padding: 7px 12px;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3.6vw, 48px);
}

main:focus {
  outline: none;
}

.site-footer {
  width: min(1360px, calc(100% - 48px));
  min-height: 78px;
  margin: auto auto 0;
  padding: 20px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
  border-top: 1px solid var(--line-strong);
}

.footer-wordmark {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.footer-wordmark > span {
  width: 5px;
  height: 5px;
  margin-top: 11px;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.footer-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.footer-nav a:hover {
  color: var(--wine);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-caption {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* --------------------------------------------------------------------------
   Shared Typography, Eyebrows, Buttons & Notices
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font: 600 clamp(2.15rem, 1.5rem + 2.2vw, 3.25rem)/1.06 var(--display);
  letter-spacing: -0.03em;
}

h1 em {
  color: var(--wine);
  font-family: inherit;
  font-style: normal;
  font-weight: 700;
}

h2 {
  margin: 0;
  font: 600 clamp(1.35rem, 1.15rem + 0.7vw, 1.85rem)/1.18 var(--display);
  letter-spacing: -0.02em;
}

h3 {
  margin: 0;
  font: 600 1.15rem/1.3 var(--display);
  letter-spacing: -0.015em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--gold);
}

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

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--wine);
  color: var(--white);
}

.button.primary:hover:not(:disabled) {
  background: var(--wine-dark);
  box-shadow: 0 8px 20px rgba(81, 23, 41, 0.22);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--white);
  color: var(--ink);
}

.button.secondary:hover:not(:disabled) {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine-dark);
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--wine);
  background: var(--danger-bg);
  color: var(--wine-dark);
  font-size: 13px;
  line-height: 1.55;
}

.notice.success {
  border-color: var(--sage);
  background: var(--sage-pale);
  color: #244030;
}

/* --------------------------------------------------------------------------
   Boot State & Store Selector
   -------------------------------------------------------------------------- */
.boot-state {
  min-height: 62dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 16px;
}

.boot-state .eyebrow {
  margin: 20px 0 10px;
}

.boot-state h1 {
  font-size: clamp(2rem, 1.5rem + 1.8vw, 3rem);
}

.boot-state .muted {
  margin: 12px 0 0;
  font-size: 14px;
}

.boot-state .button {
  margin-top: 24px;
}

.loader-mark {
  width: 32px;
  height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: turn 0.95s linear infinite;
}

.loader-mark.small {
  width: 20px;
  height: 20px;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.vendor-store-list {
  max-width: 1080px;
  min-height: calc(100dvh - 180px);
  margin: 0 auto;
  padding: 56px 0 96px;
}

.vendor-store-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin: 8px 0 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.vendor-store-heading h1 {
  margin-bottom: 10px;
}

.vendor-store-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.vendor-store-heading span {
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--wine);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vendor-store-cards {
  container-type: inline-size;
  display: grid;
  gap: 14px;
}

.vendor-store-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 108px;
  padding: 24px 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--wine);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.vendor-store-card:hover {
  border-color: var(--gold);
  border-left-color: var(--wine);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.vendor-store-info {
  min-width: 0;
}

.vendor-store-info h2 {
  font-size: clamp(1.5rem, 1.3rem + 0.6vw, 1.9rem);
  margin: 0 0 6px;
}

.vendor-store-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.vendor-store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.vendor-store-card .button {
  min-width: 184px;
  white-space: nowrap;
}

.vendor-store-empty {
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

@container (max-width: 580px) {
  .vendor-store-card {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 16px;
  }

  .vendor-store-card .button {
    width: 100%;
  }
}

.vendor-back-stores {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 0;
  margin-bottom: 8px;
  border: 0;
  background: transparent;
  color: var(--wine);
  font-size: 13px;
  font-weight: 700;
}

.vendor-back-stores:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.vendor-active-store {
  margin: 0;
  color: var(--wine);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Sign In & Setup Views (Focused Editorial Auth)
   -------------------------------------------------------------------------- */
.sign-in-layout {
  min-height: calc(100dvh - 170px);
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 0 80px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 460px);
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
}

.sign-in-intro h1 {
  font-size: clamp(2.85rem, 2rem + 3vw, 4.75rem);
}

.intro-copy {
  max-width: 440px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.intro-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.note-mark {
  color: var(--gold-dark);
  font-size: 20px;
}

.login-panel {
  position: relative;
  padding: 36px 36px 30px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.login-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wine) 0%, var(--wine) 65%, var(--gold) 100%);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-index {
  flex: none;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-rule {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.login-panel h2 {
  font-size: clamp(1.85rem, 1.5rem + 1vw, 2.35rem);
}

.form-copy {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.form-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.field-help {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-panel input[type="text"],
.login-panel input[type="password"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-size: max(1rem, 1em);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrap input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
  color: var(--wine);
  background: var(--paper-stone);
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.login-panel input:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 3px var(--wine-soft);
  outline: none;
}

.login-panel input:is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--danger);
  background-color: var(--danger-bg);
}

.login-panel input:is(:user-valid, .user-valid-fallback) {
  border-color: var(--sage);
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.field-error::before {
  content: '⚠ ';
}

.login-panel .button {
  width: 100%;
  margin-top: 8px;
}

.login-panel .button span:last-child {
  margin-left: auto;
  font-size: 16px;
}

.privacy-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.lock-mark {
  color: var(--sage);
  font-size: 16px;
}

/* --------------------------------------------------------------------------
   Dashboard Hierarchy & Atelier Masthead
   -------------------------------------------------------------------------- */
.dashboard {
  container: dashboard / inline-size;
  padding: 28px 0 88px;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 18px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px 36px;
  padding-bottom: 28px;
}

.dashboard-heading h1 {
  font-size: clamp(2.6rem, 1.8rem + 2.8vw, 4.25rem);
  line-height: 0.94;
}

.atelier-summary-ribbon {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
}

.summary-chip {
  min-width: 128px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.summary-chip-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-chip-value {
  color: var(--ink);
  font: 600 20px/1.15 var(--display);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.summary-chip-sage {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--sage);
  margin-top: 3px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
}

/* --------------------------------------------------------------------------
   Tier 1: Primary Stage — AI Photo Extraction Workbench
   -------------------------------------------------------------------------- */
.upload-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 14px 34px;
  padding: 32px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.upload-copy {
  grid-column: 1;
  grid-row: 1 / span 6;
}

.upload-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--wine) 0%, var(--wine) 42%, var(--gold) 100%);
}

.upload-copy .panel-index {
  display: inline-block;
  margin-bottom: 10px;
}

.upload-copy h2 {
  font-size: clamp(1.65rem, 1.35rem + 0.9vw, 2.1rem);
  margin-bottom: 10px;
}

.upload-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.upload-copy .file-guidance {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 10px;
  background: var(--sage-pale);
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
}

.drop-zone {
  position: relative;
  min-height: 148px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 1.5px dashed #bba99c;
  background: #faf6f0;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.drop-zone:hover,
.drop-zone:focus-within {
  border-color: var(--wine);
  background: #f9f1ef;
}

.drop-zone.is-over {
  border-color: var(--wine);
  background: #f5e9e7;
  box-shadow: inset 0 0 0 1px var(--wine);
}

.drop-corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--gold);
  border-style: solid;
  pointer-events: none;
}

.drop-corner.tl { top: 7px; left: 7px; border-width: 1px 0 0 1px; }
.drop-corner.tr { top: 7px; right: 7px; border-width: 1px 1px 0 0; }
.drop-corner.bl { bottom: 7px; left: 7px; border-width: 0 0 1px 1px; }
.drop-corner.br { bottom: 7px; right: 7px; border-width: 0 1px 1px 0; }

.upload-icon {
  position: relative;
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--white);
  color: var(--wine);
}

.upload-icon i {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage);
  border: 1.5px solid var(--white);
}

.drop-zone-copy {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.drop-zone-copy strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.drop-zone-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.drop-zone .button {
  flex: none;
  min-width: 124px;
}

.selection-row {
  grid-column: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

.selected-file {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
}

.selected-preview {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  object-fit: contain;
  border: 1px solid var(--line);
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, #eee7de 25%, transparent 25%),
    linear-gradient(-45deg, #eee7de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee7de 75%),
    linear-gradient(-45deg, transparent 75%, #eee7de 75%);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
}

.selected-file-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.selected-file strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.icon-text-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.icon-text-button:hover {
  color: var(--wine);
}

.upload-button {
  flex: none;
  min-width: 148px;
}

.upload-progress-wrap {
  grid-column: 2;
}

.progress-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.progress-heading span:last-child {
  color: var(--wine);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

progress {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--paper-deep);
  appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--paper-deep);
}

progress::-webkit-progress-value {
  background: var(--wine);
  transition: width 0.2s ease;
}

progress::-moz-progress-bar {
  background: var(--wine);
}

progress.indeterminate {
  background: linear-gradient(90deg, var(--paper-deep) 15%, #cfa6af 50%, var(--paper-deep) 85%);
  background-size: 220% 100%;
  animation: progress-slide 1.2s ease-in-out infinite;
}

progress.indeterminate::-webkit-progress-bar,
progress.indeterminate::-moz-progress-bar {
  background: transparent;
}

@keyframes progress-slide {
  to {
    background-position: -220% 0;
  }
}

.upload-message {
  grid-column: 2;
  margin: 0;
  color: var(--wine);
  font-size: 13px;
  line-height: 1.5;
}

.upload-message.success {
  color: var(--sage);
}

/* Nail Source Picker & Mapping */
.nail-source-picker {
  grid-column: 2;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line-strong);
  background: #fbf8f3;
}

.nail-source-heading {
  display: grid;
  gap: 5px;
}

.nail-source-heading > span {
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.nail-source-heading > strong {
  color: var(--ink);
  font: 600 20px/1.2 var(--display);
  letter-spacing: -0.015em;
}

.nail-source-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.nail-source-options {
  display: flex;
  gap: 10px;
  margin: 14px 0 6px;
  padding: 3px 2px 8px;
  overflow-x: auto;
}

.nail-source-option {
  width: 96px;
  min-width: 96px;
  min-height: 126px;
  display: grid;
  grid-template-rows: 72px auto auto;
  justify-items: center;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--white);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.nail-source-option:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.nail-source-option[aria-pressed="true"] {
  border-color: var(--wine);
  box-shadow: 0 0 0 2px var(--wine-soft);
  color: var(--wine);
}

.nail-source-option.is-approved {
  border-color: rgba(34, 110, 74, 0.45);
}

.nail-source-option.is-rejected {
  opacity: 0.56;
  background: #f3efe9;
}

.nail-source-option.is-rejected > span:first-of-type {
  text-decoration: line-through;
}

.nail-source-status {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f2ece4;
  color: var(--muted);
}

.nail-source-status.approved {
  background: #e6f4ec;
  color: #1f6440;
}

.nail-source-status.rejected {
  background: #f5e5e5;
  color: #8f2d38;
}

.nail-approval-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--white);
}

.nail-approval-summary {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.nail-approval-summary.ready {
  color: #1f6440;
}

.approve-all-link {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid rgba(125, 28, 52, 0.35);
  background: transparent;
  color: var(--wine);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.approve-all-link:hover {
  border-bottom-color: var(--wine);
}

.nail-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 8px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--white);
}

.review-nail-label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.nail-review-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nail-approve-btn {
  min-height: 36px;
  padding: 0 14px;
  border-color: #1f6440;
  background: #1f6440;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.nail-approve-btn:hover {
  background: #185133;
  border-color: #185133;
}

.nail-approve-btn.is-approved {
  background: #e6f4ec;
  border-color: #1f6440;
  color: #1f6440;
}

.nail-reject-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.nail-source-option img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, #eee7de 25%, transparent 25%),
    linear-gradient(-45deg, #eee7de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee7de 75%),
    linear-gradient(-45deg, transparent 75%, #eee7de 75%);
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: 10px 10px;
}

.design-upload-types {
  min-width: 0;
  margin: 16px 0 12px;
  padding: 0;
  border: 0;
}

.design-upload-types legend {
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.design-upload-type-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.design-upload-type {
  min-width: 0;
  min-height: 108px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.design-upload-type:hover {
  border-color: var(--gold);
}

.design-upload-type:has(input:checked) {
  border-color: var(--wine);
  background: var(--blush);
  box-shadow: inset 0 0 0 1px var(--wine);
}

.design-upload-type:has(input:focus-visible) {
  outline: 3px solid var(--wine);
  outline-offset: 2px;
}

.design-upload-type:has(input:disabled) {
  opacity: 0.48;
  cursor: not-allowed;
}

.design-upload-type-number {
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.design-upload-type input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--wine);
  cursor: inherit;
}

.design-upload-type-copy {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
}

.design-upload-type-copy strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.design-upload-type-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.upload-type-hint {
  margin: 10px 1px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.one-hand-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--wine);
  background: var(--paper-stone);
}

.one-hand-source label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.one-hand-source select,
.finger-mapping select {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}

.finger-mapping {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.finger-mapping > span {
  flex-basis: 100%;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.finger-mapping label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.finger-mapping .button {
  min-height: 38px;
  padding: 0 14px;
  font-size: 12px;
}

.finger-mapping small {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
}

.nail-source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.manual-crop-trigger {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: var(--paper-stone);
  color: var(--wine);
  font-size: 12px;
  font-weight: 600;
}

.manual-crop-trigger:hover {
  border-color: var(--wine);
  background: var(--blush);
}

.nail-source-option.nail-source-add {
  border-style: dashed;
  border-color: rgba(125, 28, 52, 0.45);
  background: #fcf9f5;
  color: var(--wine);
  cursor: pointer;
}

.nail-source-option.nail-source-add:hover {
  border-color: var(--wine);
  background: var(--blush);
}

.nail-source-add-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(125, 28, 52, 0.28);
  background: var(--white);
  color: var(--wine);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.use-pattern {
  min-height: 40px;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.use-pattern:hover {
  border-color: var(--wine);
  color: var(--wine);
}

.design-analysis {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.selection-row[aria-busy="true"] .selected-preview {
  opacity: 0.55;
}

@container dashboard (max-width: 760px) {
  .upload-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 24px 18px;
  }

  .upload-copy,
  .selection-row,
  .nail-source-picker,
  .upload-progress-wrap,
  .upload-message,
  .design-analysis {
    grid-column: 1;
    grid-row: auto;
  }

  .drop-zone {
    flex-wrap: wrap;
    padding: 18px;
  }

  .drop-zone .button {
    width: 100%;
  }

  .design-upload-type-options {
    grid-template-columns: 1fr;
  }

  .design-upload-type {
    min-height: 0;
  }
}

/* --------------------------------------------------------------------------
   Tier 2: Secondary Studio Bento Row (Drawing Studio + Client Favorites)
   -------------------------------------------------------------------------- */
.studio-bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.drawing-entry,
.favorite-lookup-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.drawing-entry {
  background: linear-gradient(180deg, var(--white) 0%, #fbf7f2 100%);
  border-top: 3px solid var(--gold);
}

.favorite-lookup-section {
  background: linear-gradient(180deg, var(--white) 0%, var(--paper-stone) 100%);
  border-top: 3px solid var(--wine);
}

.drawing-entry h2,
.favorite-lookup-heading h2 {
  font-size: clamp(1.55rem, 1.35rem + 0.7vw, 2rem);
  margin-bottom: 8px;
}

.drawing-entry p:not(.eyebrow),
.favorite-lookup-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.drawing-entry-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.callout-pill {
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.drawing-entry > .button {
  align-self: flex-start;
}

.drawing-drafts {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.draw-draft-label {
  margin-top: 4px;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.draw-draft-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--white);
}

.draw-draft-card > div {
  display: grid;
  flex: 1;
  min-width: 0;
}

.draw-draft-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draw-draft-card span {
  color: var(--muted);
  font-size: 12px;
}

.draw-draft-card button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--wine);
  font-size: 12px;
  font-weight: 700;
  touch-action: manipulation;
}

.draw-draft-card button:hover {
  border-color: var(--wine);
  background: var(--blush);
}

.draw-draft-card .draw-draft-delete {
  color: var(--muted);
}

/* Client Favorites Form & Swatch Gallery */
.favorite-lookup-heading {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#favorite-lookup-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#favorite-lookup-form label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.lookup-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

#favorite-lookup-phone {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #ffffff;
  color: var(--ink);
  font-size: max(1rem, 1em);
}

#favorite-lookup-phone:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 3px var(--wine-soft);
  outline: none;
}

#favorite-lookup-form button {
  flex: none;
  white-space: nowrap;
}

#favorite-lookup-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.favorite-lookup-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
}

.favorite-client-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--white);
}

.favorite-client-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-height: 74px;
  background: var(--paper-stone);
  padding: 4px;
}

.favorite-client-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--white);
}

.favorite-client-card strong {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-client-card span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.favorite-client-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
}

@container dashboard (max-width: 820px) {
  .studio-bento {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
}

@container dashboard (max-width: 480px) {
  .drawing-entry,
  .favorite-lookup-section {
    padding: 22px 18px;
  }

  .drawing-entry > .button {
    width: 100%;
  }

  .lookup-input-row {
    flex-direction: column;
  }

  #favorite-lookup-form button {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Tier 3: Curated Saved Designs Gallery
   -------------------------------------------------------------------------- */
.library-section {
  container: library / inline-size;
  margin-top: 52px;
}

.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.library-eyebrow {
  margin-bottom: 10px;
}

.library-heading h2 {
  font-size: clamp(1.85rem, 1.5rem + 1.2vw, 2.5rem);
}

.library-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

#design-count {
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--wine);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.meta-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.library-state {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.library-error {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 26px 30px;
  border: 1px solid #dfb9c0;
  background: var(--danger-bg);
}

.library-error > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.library-error strong {
  color: var(--wine-dark);
  font: 600 20px/1.2 var(--display);
  letter-spacing: -0.015em;
}

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

.empty-state {
  min-height: 256px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 68px);
  padding: 36px 24px;
  border: 1px solid var(--line-strong);
  background: var(--white);
}

.empty-state > div:last-child {
  max-width: 400px;
}

.empty-state h3 {
  margin: 0 0 8px;
  font: 600 24px/1.2 var(--display);
  letter-spacing: -0.02em;
}

.empty-state p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.empty-art {
  position: relative;
  width: 136px;
  height: 128px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--paper-stone);
}

.empty-art::before,
.empty-art::after {
  position: absolute;
  width: 1px;
  height: 100%;
  top: 0;
  background: var(--line);
  content: '';
}

.empty-art::before { left: 34px; }
.empty-art::after { right: 34px; }

.empty-nail {
  position: absolute;
  z-index: 1;
  bottom: 28px;
  width: 20px;
  height: 44px;
  border: 1px solid #c9aaa4;
  border-radius: 13px 13px 6px 6px;
  background: #f4dfd7;
  transform: rotate(-17deg);
}

.nail-one { left: 27px; bottom: 21px; }
.nail-two { left: 58px; bottom: 38px; width: 22px; height: 50px; background: var(--wine); border-color: var(--wine); transform: rotate(1deg); }
.nail-three { right: 23px; bottom: 22px; background: #d9bdb0; transform: rotate(17deg); }

.empty-spark {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--gold-dark);
  font-size: 16px;
}

.design-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.design-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  animation: enter 0.32s ease both;
}

.design-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Compact default-proportioned checkerboard specimen box + object-fit: contain so isolated nail art never clips or stretches */
.design-visual {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 1.08;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background-color: #faf7f2;
  background-image:
    linear-gradient(45deg, #efe8df 25%, transparent 25%),
    linear-gradient(-45deg, #efe8df 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #efe8df 75%),
    linear-gradient(-45deg, transparent 75%, #efe8df 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.design-visual img {
  position: absolute;
  inset: 14px;
  display: block;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  transition: transform 0.32s ease;
}

.design-card:hover .design-visual img {
  transform: scale(1.03);
}

.preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font: 500 15px/1.3 var(--display);
}

.preview-fallback::before {
  width: 28px;
  height: 44px;
  border: 1px solid #c9aaa4;
  border-radius: 16px 16px 7px 7px;
  background: linear-gradient(160deg, #f8eee4 20%, #ddc4b4 100%);
  content: '';
  transform: rotate(-12deg);
}

.preview-fallback span {
  font: 500 12px var(--sans);
}

.design-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
}

.design-name-row {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.design-name {
  width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.design-type {
  flex: none;
  max-width: 100%;
  padding: 3px 8px;
  background: var(--paper-stone);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.design-details {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.design-details span + span::before {
  content: '·';
  margin-right: 9px;
  color: var(--line-strong);
}

.design-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
}

.delete-trigger {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.delete-trigger:hover {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
}

.delete-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dfb9c0;
  background: var(--danger-bg);
}

.delete-confirm p {
  margin: 0;
  color: var(--wine-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.delete-confirm-actions {
  display: flex;
  gap: 8px;
}

.delete-confirm button {
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.delete-confirm button:last-child {
  border-color: var(--wine);
  background: var(--wine);
  color: var(--white);
}

.delete-confirm button:last-child:hover {
  background: var(--wine-dark);
}

.design-card.is-deleting {
  opacity: 0.5;
}

@container library (max-width: 1020px) {
  .design-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container library (max-width: 720px) {
  .design-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@container library (max-width: 440px) {
  .design-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100dvw - 32px));
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.toast.success {
  background: var(--sage);
}

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

/* --------------------------------------------------------------------------
   Native Modal Dialogs — Scroll-Lock & Shared Controls
   -------------------------------------------------------------------------- */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.manual-crop-dialog,
.draw-studio-dialog {
  max-width: none;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 96px rgba(25, 18, 15, 0.55);
}

.manual-crop-dialog {
  width: min(1140px, calc(100dvw - 24px));
  max-height: calc(100dvh - 24px);
}

.draw-studio-dialog {
  width: min(1340px, calc(100dvw - 20px));
  max-height: calc(100dvh - 20px);
  border-radius: 6px;
}

.manual-crop-dialog::backdrop {
  background: rgba(32, 24, 22, 0.72);
  backdrop-filter: blur(4px);
}

.draw-studio-dialog::backdrop {
  background: rgba(24, 18, 16, 0.78);
  backdrop-filter: blur(8px);
}

.manual-crop-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--wine);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.manual-crop-close {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.manual-crop-close:hover {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
}

/* --------------------------------------------------------------------------
   Precision Nail Extractor Dialog (#manual-crop-dialog)
   -------------------------------------------------------------------------- */
.manual-crop-sheet {
  padding: 24px clamp(18px, 3vw, 34px);
}

.manual-crop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.manual-crop-header h2 {
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 2rem);
}

.manual-crop-instruction {
  max-width: 700px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.crop-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--paper-stone);
  border: 1px solid var(--line);
}

.crop-mode-group {
  display: inline-flex;
  background: var(--paper-deep);
  padding: 3px;
  border-radius: 4px;
}

.crop-mode-btn {
  min-height: 34px;
  padding: 5px 12px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.crop-mode-btn:hover {
  color: var(--ink);
}

.crop-mode-btn.active {
  background: var(--wine);
  color: var(--white);
}

.crop-shape-wrap,
.crop-target-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.crop-shape-wrap select,
.crop-target-group select {
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}

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

.crop-editor {
  min-width: 0;
}

.crop-stage {
  position: relative;
  width: 100%;
  height: clamp(300px, 50dvh, 540px);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, #eee7de 25%, transparent 25%),
    linear-gradient(-45deg, #eee7de 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee7de 75%),
    linear-gradient(-45deg, transparent 75%, #eee7de 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid var(--line-strong);
}

.crop-stage img {
  position: absolute;
  display: block;
  max-width: none;
  max-height: none;
  pointer-events: none;
  user-select: none;
}

.crop-edit-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.crop-window {
  position: absolute;
  z-index: 1;
  border: 2px solid var(--white);
  box-shadow: 0 0 0 1px var(--wine), 0 0 0 999px rgba(32, 24, 22, 0.48);
  cursor: move;
  touch-action: none;
}

.crop-stage.is-painting,
.crop-stage.is-painting .crop-window {
  cursor: crosshair;
}

.crop-stage.is-painting .crop-window {
  pointer-events: none;
}

.crop-window::before,
.crop-window::after {
  position: absolute;
  content: '';
  pointer-events: none;
}

.crop-window::before {
  inset: 33.333% 0;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

.crop-window::after {
  inset: 0 33.333%;
  border-right: 1px solid rgba(255, 255, 255, 0.55);
  border-left: 1px solid rgba(255, 255, 255, 0.55);
}

.crop-handle {
  position: absolute;
  z-index: 2;
  width: 20px;
  height: 20px;
  border: 2px solid var(--wine);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 7px rgba(32, 17, 15, 0.45);
}

.crop-handle-nw { left: -11px; top: -11px; cursor: nwse-resize; }
.crop-handle-ne { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-handle-sw { left: -11px; bottom: -11px; cursor: nesw-resize; }
.crop-handle-se { right: -11px; bottom: -11px; cursor: nwse-resize; }

.crop-orientation-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 9px;
  background: rgba(30, 22, 20, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  pointer-events: none;
}

.crop-orientation-badge .badge-tip {
  color: #88eed8;
  font-size: 11px;
  font-weight: 700;
}

.crop-orientation-badge .badge-cuticle {
  color: #f9c0b2;
  font-size: 11px;
  font-weight: 600;
}

.crop-loupe-wrap {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -125%);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.crop-loupe {
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1.5px var(--wine);
  background: #ffffff;
}

.crop-loupe-tag {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  background: var(--wine);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  white-space: nowrap;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.crop-zoom-row label {
  font-weight: 700;
  color: var(--ink);
}

.crop-zoom-row input {
  flex: 1;
  min-width: 60px;
  accent-color: var(--wine);
}

.crop-zoom-row output {
  min-width: 34px;
  color: var(--wine);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.crop-zoom-row button {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--wine);
  font-size: 12px;
  font-weight: 600;
}

.crop-zoom-row button:hover {
  border-color: var(--wine);
}

.crop-brush-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.crop-brush-row > span {
  margin-right: 2px;
  font-weight: 700;
  color: var(--ink);
}

.crop-tool {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
}

.crop-tool:hover {
  border-color: var(--wine);
  color: var(--wine);
}

.crop-tool.active {
  border-color: var(--wine);
  background: var(--wine);
  color: var(--white);
}

.crop-tool-erase {
  border-color: #e2b4bd;
  color: #8a2036;
}

.crop-tool-erase.active {
  background: #8a2036;
  border-color: #8a2036;
  color: var(--white);
}

.crop-tool-restore {
  border-color: #add3cb;
  color: #195f55;
}

.crop-tool-restore.active {
  background: #195f55;
  border-color: #195f55;
  color: var(--white);
}

.crop-tool-magic {
  border-color: #cbbbe2;
  background: #faf6ff;
  color: #4f2a82;
}

.crop-tool-magic:hover {
  border-color: #794ec1;
  background: #f1e9fe;
  color: #3f1b6f;
}

.crop-brush-row label {
  margin-left: auto;
  font-weight: 600;
  color: var(--ink);
}

.crop-brush-row input {
  width: 80px;
  accent-color: var(--wine);
}

.crop-tool-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.crop-align-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--paper-stone);
  border: 1px solid var(--line);
}

.crop-straighten {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 180px;
}

.crop-straighten > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.crop-straighten label {
  font-weight: 600;
  color: var(--ink);
}

.crop-straighten output {
  min-width: 40px;
  color: var(--wine);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.crop-straighten input {
  width: 100%;
  accent-color: var(--wine);
}

.crop-orient-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.crop-quick-btn {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.crop-quick-btn:hover {
  border-color: var(--wine);
  color: var(--wine);
}

.crop-flip-btn {
  border-color: #d4a679;
  color: #6f3b08;
  font-weight: 700;
  background: #fff9f2;
}

.crop-preview-panel {
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: var(--white);
}

.crop-preview-panel > strong {
  display: block;
  margin: 2px 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.crop-preview-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.crop-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.crop-preview-checker {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 10px;
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, #ebe4dd 25%, transparent 25%),
    linear-gradient(-45deg, #ebe4dd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ebe4dd 75%),
    linear-gradient(-45deg, transparent 75%, #ebe4dd 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  border: 1px solid var(--line);
}

.crop-preview-checker img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
}

.crop-preview-checker span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.crop-preview-dims {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--wine);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.crop-finger-wrap {
  display: grid;
  place-items: center;
  padding: 8px;
  background: #191214;
  border: 1px solid #332327;
}

.crop-finger-preview {
  display: block;
  max-width: 100%;
  height: auto;
}

.crop-preview-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.manual-crop-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.manual-crop-status.error {
  color: var(--danger);
}

.manual-crop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.manual-crop-actions .button {
  min-width: 112px;
}

#crop-save-next {
  border-color: var(--wine);
  color: var(--wine);
}

.crop-nail-queue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
}

.crop-queue-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.crop-queue-pill:hover {
  border-color: var(--gold);
  color: var(--ink);
}

.crop-queue-pill.active {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
  font-weight: 700;
}

.crop-queue-pill.approved::after {
  content: '✓';
  color: #1f6440;
  font-weight: 700;
}

.crop-queue-pill.rejected {
  opacity: 0.6;
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   Tablet-First Drawing Studio Dialog (#draw-studio-dialog)
   -------------------------------------------------------------------------- */
.draw-studio-dialog[open] {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 20px);
  overflow: hidden;
}

.draw-studio-sheet {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 16px clamp(16px, 2.5vw, 28px);
  overflow: hidden;
}

.draw-header {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.draw-header h2 {
  margin: 0;
  font: 600 24px/1.1 var(--display);
  letter-spacing: -0.02em;
}

.draw-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.draw-quick-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.draw-pill-btn {
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.draw-pill-btn:hover {
  border-color: var(--wine);
  background: var(--blush);
}

.draw-pill-btn[aria-pressed="true"] {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--white);
}

.draw-topline {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--white);
}

.draw-title-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.draw-topline input {
  width: min(320px, 40dvw);
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  font-size: 14px;
}

.draw-topline-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.draw-zoom-bar {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: var(--white);
}

.draw-zoom-bar button {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.draw-zoom-bar button:last-child {
  border-right: 0;
}

.draw-zoom-bar button:hover {
  background: var(--blush);
  color: var(--wine);
}

.draw-topline #draw-save-state {
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.draw-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.draw-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--white);
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
}

.draw-control-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}

.draw-control-group:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.draw-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.draw-shapes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.draw-shapes button {
  min-height: 40px;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.draw-shapes button:hover {
  border-color: var(--wine);
}

.draw-shapes button[aria-pressed="true"] {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--wine);
}

.draw-mode-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.draw-mode-options button,
.draw-hand-tabs button,
.draw-fingers button {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  touch-action: manipulation;
}

.draw-mode-options button[aria-pressed="true"],
.draw-hand-tabs button[aria-pressed="true"],
.draw-fingers button[aria-pressed="true"] {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
  box-shadow: inset 3px 0 var(--wine);
}

.draw-hand-tabs {
  display: flex;
  gap: 6px;
}

.draw-hand-tabs button {
  flex: 1;
  text-align: center;
}

.draw-fingers {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.draw-fingers button {
  min-height: 40px;
  padding: 4px 2px;
  text-align: center;
  font-size: 11px;
}

.draw-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.draw-tools-grid button {
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draw-tools-grid button:hover {
  border-color: var(--wine);
}

.draw-tools-grid button[aria-pressed="true"] {
  border-color: var(--wine);
  background: var(--wine);
  color: var(--white);
}

.draw-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.draw-size-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.draw-size-label output {
  color: var(--wine);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#draw-size,
#draw-opacity {
  width: 100%;
  accent-color: var(--wine);
}

.draw-actions-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.draw-actions-row button {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.draw-actions-row button:hover {
  border-color: var(--wine);
  background: var(--blush);
  color: var(--wine);
}

.draw-color-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.draw-eyedropper-btn {
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
  color: var(--wine);
}

.draw-eyedropper-btn[aria-pressed="true"] {
  background: var(--wine);
  color: var(--white);
  border-color: var(--wine);
}

.draw-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.draw-colors button,
.draw-custom-color {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--swatch);
  touch-action: manipulation;
  transition: transform 0.12s ease;
}

.draw-colors button:hover {
  transform: scale(1.08);
}

.draw-colors button[aria-pressed="true"] {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
  transform: scale(1.08);
}

.draw-custom-color {
  overflow: hidden;
}

.draw-custom-color input {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.draw-tool-row {
  display: flex;
  gap: 7px;
}

.draw-tool-row button {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.draw-history button:disabled {
  opacity: 0.45;
  cursor: default;
}

.draw-tip {
  margin: auto 0 0;
  padding-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.draw-canvas-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper-stone);
}

.draw-canvas-heading {
  display: flex;
  width: min(100%, 540px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.draw-canvas-heading > div {
  display: grid;
}

.draw-canvas-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.draw-canvas-heading strong {
  font: 600 18px/1.15 var(--display);
  letter-spacing: -0.015em;
  color: var(--ink);
}

.draw-canvas-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.draw-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--paper-deep);
  color: var(--ink-soft);
  text-transform: uppercase;
}

.draw-badge.highlight {
  background: var(--sage-pale);
  color: var(--sage);
}

.draw-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: min(100%, 540px);
  height: auto;
  min-height: 240px;
  overflow: hidden;
  background: #241f1d;
  border: 1px solid #4a3e37;
  border-radius: 6px;
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.5);
}

.draw-orientation-indicator {
  color: #c5b6ac;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  z-index: 2;
  user-select: none;
}

.draw-orientation-indicator.top {
  margin-top: 6px;
  margin-bottom: 2px;
}

.draw-orientation-indicator.bottom {
  margin-top: 2px;
  margin-bottom: 6px;
}

.draw-canvas-wrap {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  width: min(100%, 420px);
  height: auto;
  min-height: 200px;
  overflow: hidden;
  background-color: var(--white);
  background-image:
    linear-gradient(45deg, #eee8e1 25%, transparent 25%),
    linear-gradient(-45deg, #eee8e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee8e1 75%),
    linear-gradient(-45deg, transparent 75%, #eee8e1 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transform-origin: center center;
}

.draw-canvas-wrap canvas {
  position: absolute;
  width: auto;
  height: 94%;
  max-width: 96%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
}

.draw-canvas-wrap #draw-guide {
  filter: drop-shadow(0 8px 18px rgba(25, 15, 12, 0.28));
  pointer-events: none;
}

.draw-canvas-wrap #draw-canvas {
  touch-action: none;
  cursor: crosshair;
}

.draw-live-preview-box {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 112px;
  padding: 6px;
  background: rgba(30, 26, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10;
  pointer-events: none;
}

.draw-live-preview-header span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #dfc08d;
  text-align: center;
  margin-bottom: 4px;
}

#draw-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 160 / 220;
  border-radius: 4px;
  background: #1a1614;
}

.draw-canvas-footer-hints {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.draw-footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
}

.draw-footer > span {
  color: var(--muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Global Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .site-header {
    width: calc(100% - 36px);
    flex-wrap: wrap;
    gap: 12px 20px;
  }

  .header-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .sign-in-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 580px;
    padding: 40px 0 64px;
  }

  .intro-note {
    display: none;
  }

  .draw-layout {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }

  .draw-shapes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 800px) {
  .draw-studio-dialog {
    width: calc(100dvw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .draw-studio-dialog[open] {
    display: block;
    height: auto;
    overflow-y: auto;
  }

  .draw-studio-sheet {
    display: block;
    overflow: visible;
    padding: 16px 12px;
  }

  .draw-header {
    flex-wrap: wrap;
  }

  .draw-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .draw-layout {
    grid-template-columns: 1fr;
  }

  .draw-canvas-panel {
    order: -1;
  }

  .draw-controls {
    max-height: none;
  }

  .draw-shapes {
    grid-template-columns: repeat(4, 1fr);
  }

  .draw-mode-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .draw-mode-options button {
    text-align: center;
  }

  .draw-viewport {
    width: 100%;
    flex: none;
    height: min(46dvh, 480px);
    min-height: 280px;
  }

  .draw-canvas-wrap {
    width: min(100%, 400px);
    flex: none;
    height: min(39dvh, 420px);
    min-height: 230px;
  }

  .manual-crop-workspace {
    grid-template-columns: 1fr;
  }

  .crop-stage {
    height: min(46dvh, 420px);
  }

  .crop-brush-row label {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .vendor-header-brand {
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .brand-caption {
    padding-left: 0;
    border-left: 0;
  }

  .login-panel {
    padding: 28px 22px 24px;
  }

  .dashboard-heading {
    align-items: flex-start;
  }

  .atelier-summary-ribbon {
    width: 100%;
  }

  .summary-chip {
    flex: 1 1 120px;
  }

  .selection-row {
    flex-wrap: wrap;
  }

  .selected-file {
    flex-basis: 100%;
  }

  .upload-button {
    margin-left: auto;
  }

  .lookup-input-row {
    flex-direction: column;
  }

  .empty-state {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 20px;
  }

  .site-footer {
    width: calc(100% - 36px);
  }

  .footer-caption {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .draw-topline {
    flex-wrap: wrap;
  }

  .draw-topline input {
    order: 2;
    width: 100%;
  }

  .draw-topline-right {
    width: 100%;
    justify-content: space-between;
  }

  .draw-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .draw-footer .button {
    justify-content: center;
  }

  .manual-crop-actions {
    justify-content: stretch;
  }

  .manual-crop-actions .button {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
