:root {
  --ink: #e9f5fb;
  --muted: #8ba4b8;
  --line: rgba(133, 178, 208, .18);
  --paper: #06131f;
  --surface: rgba(13, 34, 52, .88);
  --blue: #4aa8ff;
  --blue-soft: rgba(74, 168, 255, .12);
  --teal: #32e1bd;
  --orange: #ff805b;
  --nav: #07131f;
  --nav-2: #12364f;
  --shadow: 0 22px 55px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255,255,255,.025);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(80, 158, 210, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 158, 210, .045) 1px, transparent 1px);
  background-size: 30px 30px;
  font-family: Inter, ui-sans-serif, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}
button, textarea, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px;
  color: #eaf4fb; background:
    radial-gradient(circle at 15% 82%, rgba(0, 165, 137, .2), transparent 26%),
    linear-gradient(160deg, #081b2b, #04101a 72%);
  display: flex; flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 10px 28px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(135deg, #36d3b4, #1289e9); color: #fff; font-weight: 800; font-size: 1.15rem;
  box-shadow: 0 10px 24px rgba(18, 137, 233, .28);
}
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: inherit; background: #fff; }
.brand b, .brand small { display: block; }
.brand b { letter-spacing: .14em; font-size: 1.08rem; }
.brand small { margin-top: 2px; color: #86a1b5; font-size: .75rem; }
.side-nav { display: grid; gap: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 13px; min-height: 48px; padding: 0 14px;
  border-radius: 12px; color: #9db1c1; font-weight: 650; transition: .2s ease;
}
.nav-item span { color: #5f7b91; font: 700 .74rem/1 ui-monospace, monospace; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(50,225,189,.15), rgba(74,168,255,.08)); color: #f3fbff; border: 1px solid rgba(50,225,189,.22); box-shadow: inset 3px 0 0 var(--teal); }
.nav-item.active span { color: var(--teal); }
.sidebar-note {
  margin-top: auto; padding: 14px; display: flex; gap: 10px; align-items: center;
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(255,255,255,.04);
}
.sidebar-note b, .sidebar-note small { display: block; }
.sidebar-note b { font-size: .82rem; }
.sidebar-note small { color: #829caf; font-size: .7rem; margin-top: 2px; }
.sidebar-workspace-link {
  width: 100%; color: inherit; text-align: left; cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.sidebar-workspace-link > span:nth-child(2) { min-width: 0; flex: 1; }
.sidebar-workspace-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-workspace-link:hover { border-color: rgba(50,225,189,.4); background: rgba(50,225,189,.08); transform: translateY(-1px); }
.sidebar-workspace-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.workspace-open-icon { margin-left: auto; color: var(--teal); font-size: .9rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3de0a9; box-shadow: 0 0 0 5px rgba(61,224,169,.12); }

.main-content { min-width: 0; padding: 34px clamp(20px, 4vw, 58px) 64px; background: radial-gradient(circle at 82% 0, rgba(42,133,203,.12), transparent 30%); }
.topbar { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 28px; }
.eyebrow, .step-kicker { margin: 0 0 4px; color: var(--teal); font: 750 .72rem/1.4 ui-monospace, monospace; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.7rem); line-height: 1.1; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 1.05rem; letter-spacing: -.015em; }
.batch-strip { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; }
.batch-name { border: 0; background: transparent; color: var(--ink); font-weight: 700; }
.folder-chip { padding: 7px 11px; color: var(--teal); background: rgba(50,225,189,.1); border: 1px solid rgba(50,225,189,.16); border-radius: 999px; font-weight: 700; }

.work-grid { display: grid; gap: 18px; }
.collect-grid { grid-template-columns: minmax(0, 1.65fr) minmax(310px, .8fr); }
.panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.panel::before { content: ""; position: absolute; top: -1px; left: 24px; width: 62px; height: 2px; background: linear-gradient(90deg, var(--teal), transparent); }
.input-panel { padding: 24px; }
.queue-panel { padding: 24px; background: linear-gradient(155deg, rgba(16,42,62,.94), rgba(8,29,45,.94)); }
.panel-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading.compact { align-items: center; }
.safe-badge, .count-pill { padding: 6px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(74,168,255,.14); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.count-pill { color: #b9cbda; background: rgba(255,255,255,.045); }
.helper { margin: 11px 0 20px; max-width: 700px; color: var(--muted); font-size: .88rem; }
.field-label { display: block; margin: 0 0 8px; font-weight: 700; font-size: .84rem; }
.url-input {
  width: 100%; min-height: 142px; resize: vertical; padding: 14px 16px; border: 1px solid #cfd8df;
  border-radius: 12px; color: var(--ink); background: rgba(3,16,27,.58); outline: none; transition: .2s;
}
.url-input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(74,168,255,.1); background: rgba(3,16,27,.82); }
.input-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.btn { min-height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 750; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--blue); box-shadow: 0 9px 20px rgba(22,104,227,.2); }
.btn.ghost { background: rgba(255,255,255,.04); border-color: var(--line); color: #c7d9e7; }
.btn.dark { color: #07131f; background: linear-gradient(90deg, var(--teal), #72ebd2); box-shadow: 0 10px 22px rgba(50,225,189,.14); }
.btn.full { width: 100%; margin-top: 16px; }
.notice-card { margin-top: 18px; display: flex; gap: 11px; padding: 12px 14px; background: rgba(255,128,91,.07); border: 1px solid rgba(255,128,91,.2); border-radius: 12px; }
.notice-icon { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #ffb766; color: #563313; font-weight: 800; }
.notice-card b { font-size: .8rem; }
.notice-card p { margin: 2px 0 0; color: #c6a797; font-size: .75rem; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0 18px; }
.metric-row > div { min-width: 0; padding: 12px 8px; border-radius: 12px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.04); text-align: center; }
.metric-row small, .metric-row span { display: block; color: var(--muted); font-size: .68rem; }
.metric-row strong { display: block; font-size: 1.55rem; line-height: 1.2; }
.folder-preview { display: flex; align-items: center; gap: 11px; padding: 13px; background: rgba(2,14,24,.5); border: 1px dashed rgba(118,169,203,.35); border-radius: 12px; }
.folder-preview > div { min-width: 0; flex: 1; }
.folder-preview small, .folder-preview b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-preview small { color: var(--muted); font-size: .68rem; }
.folder-preview b { font-size: .76rem; }
.folder-icon { color: var(--blue); font-size: 1.3rem; }
.icon-btn { border: 0; color: var(--ink); background: transparent; font-size: 1rem; }
.microcopy { margin: 9px 0 0; color: var(--muted); font-size: .69rem; text-align: center; }

.results-section { margin-top: 32px; }
.section-heading { align-items: flex-end; margin-bottom: 16px; }
.section-heading h2 { font-size: 1.2rem; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter, .text-btn { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.035); color: #9bb1c2; font-size: .76rem; }
.filter.active { color: #06131f; border-color: var(--teal); background: var(--teal); }
.text-btn { border: 0; color: var(--blue); background: transparent; font-weight: 700; }
.material-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.material-card { position: relative; overflow: hidden; min-height: 316px; border-radius: 16px; background: #dfe9ef; box-shadow: var(--shadow); isolation: isolate; }
.material-card img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; transition: .35s ease; }
.material-card:hover img { transform: scale(1.035); }
.material-card::after { content: ""; position: absolute; inset: 35% 0 0; z-index: 1; background: linear-gradient(transparent, rgba(8,22,35,.92)); }
.card-check { position: absolute; top: 14px; left: 14px; z-index: 3; width: 22px; height: 22px; accent-color: var(--blue); }
.orientation { position: absolute; top: 14px; right: 14px; z-index: 3; padding: 5px 9px; border-radius: 999px; color: #fff; background: rgba(10,27,42,.76); backdrop-filter: blur(8px); font-size: .72rem; font-weight: 750; }
.orientation.vertical { background: rgba(0,145,119,.82); }
.orientation.horizontal { background: rgba(22,104,227,.82); }
.card-copy { position: absolute; inset: auto 0 0; z-index: 2; padding: 48px 16px 16px; color: #fff; }
.card-copy h3 { margin: 0 0 6px; font-size: 1rem; }
.card-copy p { margin: 0; color: #c5d2db; font-size: .73rem; }
.card-meta { display: flex; justify-content: space-between; margin-top: 11px; color: #e0eaf0; font-size: .7rem; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 360px; padding: 12px 16px; border-radius: 11px; color: #fff; background: #10273d; box-shadow: 0 16px 45px rgba(0,0,0,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* shared form controls */
.tech-input, .form-grid textarea, .generation-bar select, .mini-input, .mini-select {
  width: 100%; color: var(--ink); background: rgba(3,16,27,.66); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.tech-input, .mini-input, .mini-select, .generation-bar select { min-height: 40px; padding: 0 12px; }
.tech-input:focus, .form-grid textarea:focus, .generation-bar select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }
.link-btn { display: inline-flex; align-items: center; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.status-dot.warning { background: #ffc35b; box-shadow: 0 0 0 5px rgba(255,195,91,.11); }

/* collage */
.collage-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.control-rail { padding: 22px; position: sticky; top: 24px; }
.signal-bars { display: flex; gap: 3px; align-items: flex-end; height: 20px; }
.signal-bars i { display: block; width: 3px; background: var(--teal); border-radius: 3px; box-shadow: 0 0 8px rgba(50,225,189,.4); }
.signal-bars i:nth-child(1) { height: 7px; opacity: .45; }.signal-bars i:nth-child(2) { height: 12px; opacity: .7; }.signal-bars i:nth-child(3) { height: 18px; }
.drop-zone {
  margin-top: 20px; min-height: 152px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed rgba(74,168,255,.38); border-radius: 14px; background: linear-gradient(145deg, rgba(74,168,255,.06), rgba(50,225,189,.035)); text-align: center; cursor: pointer;
}
.drop-zone:hover { border-color: var(--teal); }
.drop-zone b, .drop-zone small { display: block; }.drop-zone b { margin-top: 10px; font-size: .85rem; }.drop-zone small { color: var(--muted); font-size: .72rem; }
.recent-material-button { width: 100%; margin-top: 10px; }
.upload-glyph { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--teal); background: rgba(50,225,189,.09); border: 1px solid rgba(50,225,189,.2); font-size: 1.5rem; }
.file-status { display: flex; justify-content: space-between; align-items: center; padding: 9px 2px 0; color: var(--muted); font-size: .72rem; }
.control-group { margin-top: 22px; padding-top: 19px; border-top: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 11px; background: rgba(1,13,22,.6); }
.segmented button { min-height: 38px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.segmented button.active { color: #06131f; background: var(--teal); font-weight: 800; }
.template-list { display: grid; gap: 8px; }
.template-option { min-height: 62px; display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 11px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,.025); text-align: left; }
.template-option b { align-self: end; font-size: .8rem; }.template-option small { grid-column: 2; align-self: start; color: var(--muted); font-size: .68rem; }
.template-option.active { border-color: rgba(74,168,255,.52); background: rgba(74,168,255,.08); box-shadow: inset 2px 0 0 var(--blue); }
.template-icon { grid-row: 1 / span 2; width: 38px; height: 38px; border: 1px solid rgba(146,191,220,.35); border-radius: 6px; background-color: rgba(3,15,25,.7); }
.vertical-layout { background-image: linear-gradient(transparent 48%, var(--blue) 49%, var(--blue) 51%, transparent 52%); }
.horizontal-layout { background-image: linear-gradient(90deg, transparent 48%, var(--teal) 49%, var(--teal) 51%, transparent 52%); }
.auto-layout { background-image: linear-gradient(90deg, transparent 65%, var(--blue) 66%, var(--blue) 69%, transparent 70%), linear-gradient(transparent 48%, var(--teal) 49%, var(--teal) 52%, transparent 53%); }
.inline-actions { display: grid; grid-template-columns: .9fr 1.1fr; gap: 8px; margin-top: 10px; }.inline-actions .btn { padding: 0 10px; font-size: .74rem; }
.compact-notice { padding: 10px; }.compact-notice p { font-size: .69rem; }
.canvas-zone { min-width: 0; }.canvas-heading { margin-bottom: 16px; }
.collage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.collage-option { position: relative; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: rgba(13,34,52,.72); transition: .2s; }
.collage-option:hover { transform: translateY(-2px); border-color: rgba(74,168,255,.36); }
.collage-option.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(50,225,189,.12), 0 20px 45px rgba(0,0,0,.22); }
.collage-option canvas { display: block; width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; background: #0b1d2b; }
.collage-caption { display: flex; justify-content: space-between; align-items: center; padding: 9px 3px 2px; font-size: .75rem; }.collage-caption span { color: var(--muted); }
.cover-flag { position: absolute; top: 18px; left: 18px; z-index: 2; padding: 5px 8px; border-radius: 7px; color: #06131f; background: var(--teal); font-size: .67rem; font-weight: 850; letter-spacing: .05em; }

/* copywriting */
.copy-layout { display: grid; gap: 18px; }.prompt-panel { padding: 24px; }
.form-grid { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label > span, .generation-bar label { display: block; margin-bottom: 7px; color: #c8d8e4; font-size: .78rem; font-weight: 700; }
.form-grid textarea { min-height: 96px; padding: 12px; resize: vertical; line-height: 1.55; }
.generation-bar { display: grid; grid-template-columns: 180px 190px 1fr; gap: 12px; align-items: end; margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(3,16,27,.42); }
.generation-bar label { margin: 0; }.generation-bar label select { margin-top: 7px; }
.generation-bar .btn { justify-self: end; min-width: 190px; }
.copy-results { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.copy-card { min-width: 0; padding: 20px; }
.copy-card header, .copy-card header > div, .copy-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.copy-card header h2 { font-size: .95rem; }.copy-card header small { color: var(--muted); font-size: .68rem; }
.draft-number { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(50,225,189,.3); border-radius: 10px; color: var(--teal); background: rgba(50,225,189,.08); font: 850 1rem/1 ui-monospace, monospace; }
.draft-number.alt { color: var(--blue); border-color: rgba(74,168,255,.3); background: rgba(74,168,255,.08); }
.draft-status { padding: 5px 8px; border-radius: 999px; color: #a9bfd0; background: rgba(255,255,255,.04); font-size: .67rem; }
.draft-title-field { display: block; margin-top: 16px; }
.draft-title-field span { display: block; margin-bottom: 7px; color: #9fb6c6; font-size: .72rem; font-weight: 700; }
.draft-title-field input { width: 100%; min-height: 44px; padding: 0 13px; color: #f4f8fb; background: rgba(2,14,23,.72); border: 1px solid rgba(74,168,255,.22); border-radius: 10px; outline: none; font-size: .95rem; font-weight: 750; }
.draft-title-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }
.draft-editor { width: 100%; height: 350px; margin-top: 16px; padding: 16px; resize: vertical; color: #dceaf3; background: rgba(2,14,23,.62); border: 1px solid var(--line); border-radius: 12px; outline: none; line-height: 1.8; }
.draft-editor:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(50,225,189,.08); }
.copy-card footer { margin-top: 8px; color: var(--muted); font-size: .72rem; }
.download-dock { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid rgba(50,225,189,.16); border-radius: 14px; background: linear-gradient(90deg, rgba(50,225,189,.08), rgba(74,168,255,.05)); }
.download-dock > div, .download-dock > div > span:last-child { display: flex; align-items: center; gap: 10px; }.download-dock small, .download-dock b { display: block; }.download-dock small { color: var(--muted); font-size: .68rem; }.download-dock b { font-size: .78rem; }

.mini-select { width: 112px; font-size: .7rem; }

@media (max-width: 1080px) {
  .collect-grid { grid-template-columns: 1fr; }
  .material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collage-layout { grid-template-columns: 290px minmax(0, 1fr); }
  .collage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
  .brand { padding: 2px 4px 14px; }
  .side-nav { grid-template-columns: repeat(4, minmax(112px, 1fr)); overflow-x: auto; }
  .nav-item { min-width: 118px; justify-content: center; padding: 0 9px; font-size: .82rem; }
  .sidebar-note { display: none; }
  .main-content { padding: 22px 16px 48px; }
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .batch-strip { align-items: flex-start; flex-wrap: wrap; }
  .material-grid { grid-template-columns: 1fr; }
  .material-card { min-height: 350px; }
  .collage-layout { grid-template-columns: 1fr; }
  .control-rail { position: static; }
  .collage-grid, .copy-results, .form-grid { grid-template-columns: 1fr; }
  .generation-bar { grid-template-columns: 1fr; }
  .generation-bar .btn { justify-self: stretch; }
  .download-dock { align-items: stretch; flex-direction: column; }
  .top-actions { flex-wrap: wrap; }
}

/* V0.2: blogger-style material intake */
.blogger-import-panel { padding: 24px; margin-bottom: 20px; }
.batch-input-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 14px; align-items: stretch; margin-top: 18px; }
.batch-input-row .url-input { min-height: 118px; }
.import-button { min-height: 118px; font-size: 1rem; }
.import-button span { font-size: 1.2rem; }
.btn:disabled, .text-btn:disabled { opacity: .42; cursor: not-allowed; filter: saturate(.45); box-shadow: none; }
.input-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.input-foot p { margin: 0; color: var(--muted); font-size: .82rem; }
.material-library-panel { overflow: hidden; }
.library-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px 16px; }
.library-tools { display: flex; align-items: center; gap: 10px; }
.search-input { width: 250px; }
.library-tools .mini-select { width: 132px; }
.route-banner { margin: 0 24px 14px; padding: 11px 14px; color: #b9dbef; background: linear-gradient(90deg, rgba(74,168,255,.12), rgba(50,225,189,.04)); border: 1px solid rgba(74,168,255,.25); border-radius: 10px; font-size: .84rem; }
.route-banner b { color: var(--blue); }
.table-toolbar { min-height: 56px; display: flex; align-items: center; gap: 16px; padding: 8px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(3,16,27,.26); }
.select-all-label { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 700; }
.select-all-label input, .material-row-check { width: 18px; height: 18px; accent-color: var(--teal); }
#materialSelectionSummary { color: var(--muted); font-size: .84rem; }
.bulk-actions { display: flex; gap: 8px; margin-left: auto; }
.material-table-wrap { overflow-x: auto; }
.material-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.material-table th, .material-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .84rem; }
.material-table th { color: #7fa0b6; background: rgba(255,255,255,.018); font: 700 .78rem/1.3 ui-monospace, monospace; letter-spacing: .04em; }
.material-table td { color: #c9d9e5; }
.material-table td > b, .material-table td > strong, .material-table td > small { display: block; }
.material-table td > strong { max-width: 300px; color: #eef9ff; }
.material-table td > small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.material-table td:last-child { white-space: nowrap; }
.thumbnail-button { position: relative; width: 82px; height: 58px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #0b1d2b; }
.thumbnail-button img { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-button span { position: absolute; inset: auto 0 0; padding: 2px; color: #fff; background: rgba(2,13,22,.72); font-size: .68rem; opacity: 0; transition: .2s; }
.thumbnail-button:hover span, .thumbnail-button:focus-visible span { opacity: 1; }
.orientation-tag { display: inline-flex; min-width: 54px; justify-content: center; padding: 5px 9px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.orientation-tag.vertical { color: var(--teal); background: rgba(50,225,189,.1); border: 1px solid rgba(50,225,189,.24); }
.orientation-tag.horizontal { color: #81bcff; background: rgba(74,168,255,.1); border: 1px solid rgba(74,168,255,.24); }
.ready-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px rgba(50,225,189,.45); }
.source-link { display: inline-flex; align-items: center; }
.empty-cell { padding: 40px !important; text-align: center !important; color: var(--muted) !important; }
.thumbnail-empty { width: 76px; height: 52px; display: grid; place-items: center; color: #6f8798; border: 1px dashed var(--line); border-radius: 9px; font-size: .72rem; }
.material-row-error { background: rgba(255, 117, 117, .025); }
.material-error-text { max-width: 320px; color: #ffab78 !important; line-height: 1.45; }
.ready-dot.failed { background: #ff8b67; box-shadow: 0 0 8px rgba(255,139,103,.35); }
.collage-empty-state { grid-column: 1 / -1; min-height: 430px; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; background: rgba(8,28,43,.45); }
.collage-empty-state b { color: #d9eaf4; font-size: 1rem; }
.collage-empty-state span { max-width: 420px; }
.archive-strip { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: rgba(50,225,189,.04); }
.archive-strip small, .archive-strip b { display: block; }
.archive-strip small { color: var(--muted); font-size: .74rem; }
.archive-strip b { color: var(--teal); }
.archive-strip > span:last-child { margin-left: auto; color: var(--muted); font-size: .78rem; }
.preview-dialog { width: min(760px, calc(100vw - 28px)); padding: 0; color: var(--ink); background: #0d2234; border: 1px solid rgba(74,168,255,.3); border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.62); }
.preview-dialog::backdrop { background: rgba(0,8,14,.82); backdrop-filter: blur(7px); }
.preview-dialog form { position: relative; padding: 16px; }
.preview-dialog img { width: 100%; max-height: 68vh; display: block; object-fit: contain; border-radius: 12px; background: #06131f; }
.preview-dialog form > div { padding: 16px 6px 4px; }
.preview-dialog h2 { margin-top: 3px; font-size: 1.1rem; }
.preview-dialog p { margin: 5px 0 0; color: var(--muted); }
.dialog-close { position: absolute; top: 25px; right: 25px; z-index: 2; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; color: #fff; background: rgba(2,13,22,.72); font-size: 1.4rem; }

/* V0.2: eight selectable collages and movable cover type */
.cover-controls { display: grid; gap: 8px; }
.font-settings { display: grid; grid-template-columns: 1.5fr .75fr 54px; gap: 8px; }
.font-settings label { min-width: 0; }
.font-settings label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .72rem; }
.font-settings select, .font-settings input[type="number"] { width: 100%; min-height: 38px; padding: 0 9px; color: var(--ink); background: rgba(3,16,27,.66); border: 1px solid var(--line); border-radius: 9px; }
.font-settings input[type="color"] { width: 54px; height: 38px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: rgba(3,16,27,.66); }
.drag-hint { margin: 1px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }
.canvas-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.collage-check { position: absolute; top: 17px; right: 17px; z-index: 3; display: flex; align-items: center; gap: 5px; padding: 5px 8px; color: #fff; background: rgba(3,16,27,.78); border: 1px solid rgba(255,255,255,.14); border-radius: 8px; font-size: .72rem; }
.collage-check input { width: 16px; height: 16px; accent-color: var(--teal); }
.collage-option canvas.draggable-text { cursor: grab; touch-action: none; }
.collage-option canvas.draggable-text:active { cursor: grabbing; }

/* V0.2: URL-aware copy brief */
.source-form-grid { align-items: stretch; }
.source-form-grid .wide-field { grid-column: 1 / -1; }
.form-grid label > span em, .prompt-editor-label em { color: var(--teal); font-style: normal; font-weight: 500; }
.url-context-card { padding: 15px; border: 1px dashed rgba(74,168,255,.33); border-radius: 12px; background: linear-gradient(145deg, rgba(74,168,255,.06), rgba(50,225,189,.03)); }
.url-context-card h3 { margin: 4px 0 7px; font-size: .96rem; }
.url-context-card p { min-height: 48px; margin: 0 0 10px; color: #b6cad8; font-size: .82rem; }
.url-context-card small { display: block; margin-top: 9px; color: var(--muted); font-size: .74rem; }
.prompt-editor-label { display: block; margin-top: 18px; }
.prompt-editor-label span { color: #c8d8e4; font-size: .84rem; font-weight: 700; }
.prompt-long-editor { width: 100%; min-height: 260px; margin-top: 8px; padding: 14px; resize: vertical; color: var(--ink); background: rgba(3,16,27,.66); border: 1px solid var(--line); border-radius: 12px; outline: none; line-height: 1.72; }
.prompt-long-editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }

/* V0.3: local settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-card { min-height: 440px; padding: 24px; }
.settings-index { color: rgba(74,168,255,.58); font: 800 1rem/1 ui-monospace, monospace; }
.settings-field { display: block; margin-top: 26px; }
.settings-field > span { display: block; margin-bottom: 8px; color: #c8d8e4; font-size: .78rem; font-weight: 700; }
.settings-field > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.settings-field input { width: 100%; min-height: 44px; padding: 0 12px; color: var(--ink); background: rgba(3,16,27,.66); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.settings-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }
.path-preview { margin: 14px 0 22px; padding: 14px; border: 1px solid rgba(50,225,189,.16); border-radius: 11px; background: rgba(50,225,189,.045); }
.path-preview small, .path-preview code { display: block; }
.path-preview small { margin-bottom: 6px; color: var(--muted); font-size: .7rem; }
.path-preview code { color: var(--teal); overflow-wrap: anywhere; }
.logo-config-row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; margin-top: 26px; }
.logo-preview { width: 132px; height: 132px; display: grid; place-items: center; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--teal), var(--blue)); border: 1px solid rgba(255,255,255,.16); border-radius: 24px; box-shadow: 0 15px 34px rgba(74,168,255,.22); font-size: 3rem; font-weight: 900; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logo-drop { min-width: 0; min-height: 132px; display: flex; flex-direction: column; justify-content: center; padding: 18px; border: 1px dashed rgba(74,168,255,.35); border-radius: 13px; background: rgba(74,168,255,.045); cursor: pointer; }
.logo-drop b { color: #dceaf3; font-size: .9rem; }
.logo-drop small { margin-top: 6px; color: var(--muted); overflow-wrap: anywhere; }
.settings-actions { margin-top: 20px; }
.compact-settings-card { min-height: 360px; }
.secret-status { margin: 12px 0 0; color: var(--muted); font-size: .75rem; }
.secret-status.configured { color: var(--teal); }
.danger-text { color: #ff8b83; }
.delay-settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 26px 0 22px; }
.delay-settings-row label span { display: block; margin-bottom: 8px; color: #c8d8e4; font-size: .78rem; font-weight: 700; }
.delay-settings-row input { width: 100%; min-height: 44px; padding: 0 12px; color: var(--ink); background: rgba(3,16,27,.66); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.delay-settings-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }
.config-note { margin-top: 18px; padding: 22px 24px; }
.config-note h2 { margin: 4px 0 10px; }
.config-note > div { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.config-note p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.7; }
.config-note code { color: #9ed4ff; }

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

@media (max-width: 760px) {
  .source-form-grid .wide-field { grid-column: auto; }
  .settings-field > div, .logo-config-row, .config-note > div, .delay-settings-row { grid-template-columns: 1fr; }
  .logo-preview { width: 104px; height: 104px; }
}

/* Web account shell */
[hidden] { display: none !important; }
.brand-button { width: 100%; border: 0; color: inherit; background: transparent; text-align: left; }
.nav-item { width: 100%; border: 1px solid transparent; background: transparent; text-align: left; }
.logout-button { align-self: flex-start; margin: 12px 0 0 10px; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 420px); padding: 30px; }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.auth-brand b, .auth-brand small { display: block; }
.auth-brand b { font-size: 1.18rem; }
.auth-brand small { color: var(--muted); font-size: .78rem; }
.auth-card h1 { font-size: 1.7rem; }
.auth-card .helper { margin-bottom: 22px; }
.auth-field { display: grid; gap: 7px; margin: 15px 0; color: #c8d8e4; font-size: .84rem; font-weight: 700; }
.auth-field input { width: 100%; min-height: 46px; padding: 0 12px; color: var(--ink); background: rgba(3,16,27,.7); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.auth-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74,168,255,.1); }
.auth-error { padding: 10px 12px; color: #ffc1ac; background: rgba(255,128,91,.1); border: 1px solid rgba(255,128,91,.25); border-radius: 8px; font-size: .78rem; }
.auth-rules { margin: 5px 0 12px; color: var(--muted); font-size: .76rem; }
.auth-submit { width: 100%; margin-top: 10px; }
.auth-switch { display: block; margin: 18px auto 0; }



