:root {
  --ink: #161412;
  --ink-soft: #24211e;
  --paper: #f4f0e9;
  --paper-2: #eae3d8;
  --white: #fffdf9;
  --wine: #7a2735;
  --wine-deep: #561924;
  --gold: #b8955e;
  --sage: #77806b;
  --line: rgba(22, 20, 18, 0.14);
  --muted: #726b63;
  --success: #4e725c;
  --warning: #9a6b25;
  --danger: #a43f42;
  --shadow: 0 24px 70px rgba(36, 28, 22, 0.12);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(circle at 20% 40%, #000 0.55px, transparent 0.7px);
  background-size: 5px 5px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 82px;
  padding: 0 clamp(20px, 4vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244, 240, 233, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: var(--paper);
  background: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  letter-spacing: 0.06em;
}
.brand-mark.large { width: 58px; height: 58px; font-size: 17px; margin-bottom: 20px; }
.brand b { display: block; font-size: 12px; letter-spacing: 0.2em; }
.brand small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.system-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.system-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(78, 114, 92, 0.12); }
.budget-chip, .avatar-button {
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.66);
  cursor: pointer;
}
.budget-chip { padding: 9px 14px; border-radius: 14px; text-align: left; }
.budget-chip span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.13em; }
.budget-chip strong { font-size: 13px; }
.avatar-button { width: 40px; height: 40px; border-radius: 50%; font-weight: 700; font-size: 11px; }

main { overflow: hidden; }
.studio-hero {
  min-height: 720px;
  padding: 76px clamp(20px, 6vw, 105px) 86px;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(520px, 1.1fr);
  gap: clamp(42px, 7vw, 120px);
  align-items: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(184, 149, 94, 0.16), transparent 32%),
    linear-gradient(135deg, #f6f2eb 0%, #eee6db 100%);
  position: relative;
}
.studio-hero::after {
  content: "MV";
  position: absolute;
  left: -40px;
  bottom: -100px;
  font: 420px/1 Georgia, serif;
  color: rgba(122, 39, 53, 0.025);
  pointer-events: none;
}
.hero-copy, .create-card { position: relative; z-index: 1; }
.eyebrow { display: block; color: var(--wine); font-size: 10px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; }
.hero-copy h1 {
  margin: 21px 0 26px;
  font: 500 clamp(48px, 5.2vw, 82px)/0.98 Georgia, "Times New Roman", serif;
  letter-spacing: -0.04em;
}
.hero-copy h1 em { color: var(--wine); font-weight: 400; }
.hero-copy > p { max-width: 560px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.promise-row { display: flex; flex-wrap: wrap; gap: 18px 24px; margin-top: 38px; }
.promise-row span { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.promise-row b { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--gold); border-radius: 50%; color: var(--wine); font: 13px Georgia, serif; }

.create-card {
  width: 100%;
  max-width: 710px;
  justify-self: end;
  padding: clamp(26px, 3vw, 42px);
  border-radius: 30px;
  background: rgba(255, 253, 249, 0.91);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.card-head.compact { align-items: center; }
.step-kicker { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: 0.18em; }
.card-head h2 { margin: 6px 0 0; font: 500 21px/1.2 Georgia, serif; }
.text-button { padding: 0; border: 0; background: none; color: var(--wine); font-size: 12px; font-weight: 700; cursor: pointer; }
.duration-badge { padding: 6px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 11px; }
.divider { height: 1px; margin: 26px 0; background: var(--line); }

.product-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; max-height: 142px; overflow: auto; }
.product-option { position: relative; min-height: 102px; padding: 10px; display: flex; align-items: end; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--ink-soft); color: white; cursor: pointer; text-align: left; }
.product-option img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.72; transition: transform 0.35s ease, opacity 0.35s ease; }
.product-option::after { content: ""; position: absolute; inset: 28% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }
.product-option span { position: relative; z-index: 1; font-size: 11px; font-weight: 700; line-height: 1.25; }
.product-option small { display: block; margin-top: 3px; opacity: 0.7; font-size: 9px; }
.product-option:hover img { transform: scale(1.04); }
.product-option.active { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(122, 39, 53, 0.2); }
.product-option.active::before { content: "✓"; position: absolute; z-index: 3; right: 8px; top: 8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--wine); font-size: 11px; }
.template-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 16px; }
.template-option { padding: 14px; min-height: 90px; border: 1px solid var(--line); border-radius: 14px; background: transparent; cursor: pointer; text-align: left; transition: 0.2s ease; }
.template-option b { display: block; font-size: 12px; }
.template-option span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.template-option:hover, .template-option.active { border-color: var(--wine); background: rgba(122, 39, 53, 0.055); }
.template-option:disabled { opacity: 0.45; cursor: not-allowed; border-style: dashed; }
.template-option:disabled:hover { border-color: var(--line); background: transparent; }
.prompt-field { display: block; margin-top: 17px; }
.prompt-field > span, .modal-card label > span, .login-card label > span { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 750; }
.prompt-field small { color: var(--muted); font-weight: 400; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(244, 240, 233, 0.55); padding: 12px 14px; color: var(--ink); outline: none; resize: vertical; }
input:focus, textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(122, 39, 53, 0.08); }
.provider-details { margin-top: 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.provider-details summary { padding: 13px 0; display: flex; justify-content: space-between; cursor: pointer; font-size: 11px; font-weight: 750; list-style: none; }
.provider-details summary::-webkit-details-marker { display: none; }
.provider-details summary span { color: var(--muted); font-weight: 500; }
.provider-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; padding-bottom: 10px; }
.provider-option { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.provider-option b { display: block; font-size: 10px; }
.provider-option small { color: var(--muted); font-size: 9px; }
.provider-option.active { border-color: var(--wine); background: rgba(122, 39, 53, 0.06); }
.provider-option:disabled { opacity: 0.38; cursor: not-allowed; }
.microcopy, .submit-note { color: var(--muted); font-size: 9px; }
.microcopy { margin: 0 0 10px; }
.primary-button, .secondary-button { border: 0; border-radius: 14px; cursor: pointer; font-weight: 750; }
.primary-button { width: 100%; margin-top: 18px; padding: 16px 19px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--wine); box-shadow: 0 10px 22px rgba(122, 39, 53, 0.2); }
.primary-button:hover { background: var(--wine-deep); }
.primary-button:disabled { opacity: 0.5; cursor: wait; }
.primary-button i { font-style: normal; font-size: 20px; }
.secondary-button { padding: 11px 15px; border: 1px solid var(--line); background: var(--white); }
.submit-note { margin: 9px 0 0; text-align: center; }
.empty-inline { margin-top: 16px; padding: 18px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.empty-inline p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }

.metrics-strip { display: grid; grid-template-columns: repeat(3, 0.7fr) 1.6fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--ink); color: var(--paper); }
.metrics-strip article { min-height: 126px; padding: 28px clamp(22px, 4vw, 54px); border-right: 1px solid rgba(255,255,255,0.12); }
.metrics-strip article:last-child { border-right: 0; }
.metrics-strip span { display: block; color: rgba(255,255,255,0.5); font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; }
.metrics-strip strong { display: inline-block; margin-top: 10px; font: 30px Georgia, serif; }
.metrics-strip small { margin-left: 6px; color: rgba(255,255,255,0.5); font-size: 10px; }
.meter { position: relative; height: 4px; margin-top: 13px; border-radius: 4px; background: rgba(255,255,255,0.16); }
.meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--gold); transition: width 0.4s ease; }
.meter b { position: absolute; top: -3px; left: 50%; width: 1px; height: 10px; background: rgba(255,255,255,0.7); }

.workspace-section { padding: 88px clamp(20px, 6vw, 105px); }
.workspace-section + .workspace-section { padding-top: 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.section-heading h2 { margin: 8px 0 0; font: 500 42px Georgia, serif; letter-spacing: -0.02em; }
.filter-pills { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 99px; }
.filter-pills button { padding: 8px 12px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.filter-pills button.active { color: white; background: var(--ink); }
.jobs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.job-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--white); cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.job-card:hover { transform: translateY(-3px); box-shadow: 0 18px 46px rgba(36, 28, 22, 0.09); }
.job-card:focus-visible { outline: 3px solid rgba(122, 39, 53, 0.34); outline-offset: 4px; }
.job-cover { position: relative; height: 232px; display: grid; place-items: center; overflow: hidden; background: #24211e; }
.job-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0.74; }
.job-cover video { width: 100%; height: 100%; object-fit: cover; }
.job-cover::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, rgba(0,0,0,0.65)); pointer-events: none; }
.job-state { position: absolute; z-index: 2; top: 14px; left: 14px; padding: 7px 9px; border-radius: 99px; color: white; background: rgba(22,20,18,0.74); backdrop-filter: blur(8px); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; }
.job-state.approval { background: rgba(154,107,37,0.9); }
.job-state.approved { background: rgba(78,114,92,0.92); }
.job-state.failed { background: rgba(164,63,66,0.92); }
.job-body { padding: 18px; }
.job-body h3 { margin: 0; font: 500 18px Georgia, serif; }
.job-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.job-progress { display: flex; gap: 4px; margin-top: 14px; }
.job-progress i { flex: 1; height: 3px; border-radius: 4px; background: var(--paper-2); }
.job-progress i.done { background: var(--wine); }
.section-empty { padding: 70px 20px; border: 1px dashed var(--line); border-radius: 22px; text-align: center; }
.section-empty span { color: var(--gold); font: 28px Georgia, serif; }
.section-empty h3 { margin: 12px 0 4px; font: 500 22px Georgia, serif; }
.section-empty p { margin: 0; color: var(--muted); font-size: 12px; }

.library-section { padding-bottom: 110px; }
.library-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.library-card { min-height: 310px; position: relative; overflow: hidden; border-radius: 20px; background: var(--ink-soft); color: white; }
.library-card img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; opacity: 0.74; }
.library-card::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgba(0,0,0,0.9)); }
.library-info { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 18px; }
.library-info small { opacity: 0.62; font-size: 9px; letter-spacing: 0.1em; }
.library-info h3 { margin: 7px 0; font: 500 20px Georgia, serif; }
.library-info span { font-size: 10px; opacity: 0.75; }

.modal-layer, .login-layer { position: fixed; inset: 0; z-index: 50; padding: 28px; display: grid; place-items: center; background: rgba(20, 17, 15, 0.72); backdrop-filter: blur(14px); overflow: auto; }
.modal-card { position: relative; width: min(820px, 100%); max-height: calc(100vh - 56px); overflow: auto; padding: 42px; border-radius: 26px; background: var(--white); box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 20px; top: 17px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 22px; }
.modal-card h2 { margin: 10px 0 8px; font: 500 36px Georgia, serif; }
.modal-lead { margin: 0 0 27px; color: var(--muted); font-size: 13px; }
.modal-card form { display: grid; gap: 16px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload-box { position: relative; padding: 30px; border: 1px dashed var(--gold); border-radius: 16px; background: rgba(184,149,94,0.06); text-align: center; cursor: pointer; }
.upload-box input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-box b, .upload-box span { display: block; }
.upload-box b { font-size: 13px; }
.upload-box span { margin-top: 7px; color: var(--muted); font-size: 10px; }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-row input { position: absolute; opacity: 0; width: 0; }
.check-row i { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 5px; }
.check-row input:checked + i { background: var(--wine); border-color: var(--wine); }
.check-row input:checked + i::after { content: "✓"; color: white; font-size: 12px; }
.check-row span { font-size: 11px; }

.job-modal-card { width: min(1020px, 100%); padding: 0; display: grid; grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.08fr); overflow: hidden; }
.job-preview { min-height: 650px; position: relative; display: grid; place-items: center; background: #171513; }
.job-preview video, .job-preview img { width: 100%; height: 100%; max-height: 82vh; object-fit: cover; }
.job-preview-placeholder { color: rgba(255,255,255,0.64); text-align: center; }
.job-preview-placeholder i { display: block; width: 44px; height: 44px; margin: 0 auto 15px; border: 2px solid rgba(255,255,255,0.15); border-top-color: white; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.job-detail { padding: 42px; overflow: auto; max-height: calc(100vh - 56px); }
.job-detail h2 { margin: 10px 0 4px; font-size: 31px; }
.job-detail-meta { color: var(--muted); font-size: 11px; }
.storyboard-summary { margin: 0 0 14px; padding: 12px 14px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(184,149,94,0.07); }
.storyboard-summary b { font-size: 11px; }
.storyboard-summary span { color: var(--muted); font-size: 10px; }
.fidelity-review { margin: 16px 0; padding: 12px; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.fidelity-review.passed { border-color: rgba(78,114,92,0.35); }
.fidelity-review.pending { border-color: rgba(154,107,37,0.4); }
.fidelity-review.failed { border-color: rgba(164,63,66,0.42); background: rgba(164,63,66,0.06); }
.fidelity-review figure { margin: 0; overflow: hidden; border-radius: 9px; background: #ddd; }
.fidelity-review figure img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.fidelity-review figure figcaption { padding: 5px 7px; color: var(--muted); font-size: 9px; }
.fidelity-review > div { display: grid; gap: 5px; }
.fidelity-review > div > span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; }
.fidelity-review > div > b { font-size: 13px; }
.fidelity-review > div > small { color: var(--muted); font-size: 10px; }
.fidelity-review > div > p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

.frame-review { margin: 18px 0; }
.frame-review h3 { margin: 0 0 4px; font-size: 14px; }
.frame-review p { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.review-frame-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.review-frame { margin: 0; overflow: hidden; border-radius: 8px; background: #eee; }
.review-frame img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.review-frame figcaption { padding: 4px 6px; color: var(--muted); font-size: 11px; }
.detail-status { margin: 25px 0; padding: 15px; border-radius: 13px; background: var(--paper); font-size: 12px; }
.detail-status b { display: block; margin-bottom: 5px; }
.qa-panel { padding-top: 20px; border-top: 1px solid var(--line); }
.qa-panel h3 { margin: 0 0 15px; font: 500 19px Georgia, serif; }
.qa-list { display: grid; gap: 11px; }
.qa-list .check-row { padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.detail-actions .primary-button { margin: 0; }
.detail-actions .secondary-button { width: 100%; }
.download-link { display: block; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-align: center; text-decoration: none; font-size: 11px; font-weight: 750; }
.failure-box { padding: 13px; border-radius: 11px; color: var(--danger); background: rgba(164,63,66,0.08); font-size: 11px; line-height: 1.5; }

.login-layer { z-index: 80; background: var(--ink); }
.login-card { width: min(420px, 100%); padding: 46px; border-radius: 28px; background: var(--paper); }
.login-card h1 { margin: 10px 0; font: 500 34px Georgia, serif; }
.login-card > p { color: var(--muted); font-size: 12px; line-height: 1.55; margin-bottom: 25px; }
.login-card label { display: block; margin-top: 14px; }
.form-error { min-height: 18px; margin-top: 12px; color: var(--danger); font-size: 11px; text-align: center; }
.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { max-width: 350px; padding: 13px 16px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 11px; animation: toast-in 0.2s ease; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1050px) {
  .studio-hero { grid-template-columns: 1fr; }
  .create-card { justify-self: stretch; max-width: none; }
  .hero-copy { max-width: 700px; }
  .jobs-grid { grid-template-columns: repeat(2, 1fr); }
  .library-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .topbar { height: 70px; }
  .system-status, .budget-chip span, .brand small { display: none; }
  .studio-hero { padding-top: 48px; }
  .hero-copy h1 { font-size: 46px; }
  .product-picker, .template-grid { grid-template-columns: 1fr 1fr; }
  .metrics-strip { grid-template-columns: 1fr 1fr; }
  .metrics-strip article { min-height: 105px; }
  .section-heading { align-items: start; flex-direction: column; }
  .filter-pills { overflow-x: auto; max-width: 100%; }
  .jobs-grid, .library-grid { grid-template-columns: 1fr; }
  .two-columns { grid-template-columns: 1fr; }
  .modal-layer { padding: 0; align-items: end; }
  .modal-card { max-height: 94vh; border-radius: 24px 24px 0 0; padding: 30px 20px; }
  .job-modal-card { display: block; padding: 0; }
  .job-preview { min-height: 420px; max-height: 48vh; }
  .job-detail { padding: 28px 20px; max-height: none; }
}
