:root {
  --bg: #09111a;
  --bg-2: #0d1824;
  --panel: rgba(18, 31, 45, 0.86);
  --panel-strong: #132333;
  --panel-hover: #182b3d;
  --line: rgba(203, 225, 238, 0.11);
  --line-strong: rgba(203, 225, 238, 0.2);
  --text: #edf6fb;
  --muted: #91a8b8;
  --muted-2: #647c8e;
  --gold: #d9bb78;
  --gold-2: #f0d89d;
  --cyan: #77c9d4;
  --danger: #ef8e88;
  --success: #80d5a5;
  --shadow: 0 24px 80px rgba(0,0,0,.28);
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, rgba(119, 201, 212, .10), transparent 34%),
    radial-gradient(circle at 92% 10%, rgba(217, 187, 120, .09), transparent 30%),
    linear-gradient(180deg, #081019 0%, #0a1420 45%, #071018 100%);
  font-family: "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: var(--gold-2); }

.ambient { position: fixed; pointer-events: none; filter: blur(80px); opacity: .3; z-index: -1; border-radius: 999px; }
.ambient-a { width: 340px; height: 340px; background: #1d7481; top: 18%; left: -180px; }
.ambient-b { width: 300px; height: 300px; background: #8b6a31; top: 55%; right: -170px; }

.shell { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(217,187,120,.35); border-radius: 50%; color: var(--gold-2); background: rgba(217,187,120,.08); box-shadow: inset 0 0 18px rgba(217,187,120,.05); }
.brand strong { display: block; font-family: "Marcellus", serif; font-size: 22px; font-weight: 400; letter-spacing: .02em; }
.brand small { color: var(--muted); display: block; margin-top: 1px; font-size: 12px; }
.top-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.button, .icon-button {
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: .18s ease;
}
.button { min-height: 40px; padding: 0 15px; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button.primary { color: #11202b; background: linear-gradient(180deg, #f1dca6, #d7b970); box-shadow: 0 8px 24px rgba(217,187,120,.12); }
.button.primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.button.ghost { border-color: var(--line-strong); background: rgba(255,255,255,.025); color: #dbe8ef; }
.button.ghost:hover { background: rgba(255,255,255,.06); border-color: rgba(203,225,238,.3); }
.button.danger { color: var(--danger); }
.file-button { position: relative; overflow: hidden; }
.icon-button { width: 37px; height: 37px; display: grid; place-items: center; background: transparent; border-color: var(--line); color: var(--muted); font-size: 18px; }
.icon-button:hover { background: rgba(255,255,255,.05); color: var(--text); }
.danger-icon:hover { color: var(--danger); border-color: rgba(239,142,136,.28); background: rgba(239,142,136,.06); }

.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b7a065; box-shadow: 0 0 0 4px rgba(183,160,101,.08); }
.status-pill.online .status-dot { background: var(--success); box-shadow: 0 0 0 4px rgba(128,213,165,.08); }
.status-pill.offline .status-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(239,142,136,.08); }

.app-shell { padding-bottom: 52px; }
.panel { background: linear-gradient(180deg, rgba(20,35,50,.88), rgba(14,27,40,.88)); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.hero { min-height: 190px; display: flex; align-items: center; justify-content: space-between; gap: 36px; padding: 32px 36px; overflow: hidden; position: relative; }
.hero::after { content: "✦"; position: absolute; right: 31%; top: -70px; font-size: 250px; color: rgba(217,187,120,.025); transform: rotate(18deg); pointer-events: none; }
.eyebrow { display: block; color: var(--gold); font-size: 10px; letter-spacing: .17em; font-weight: 800; margin-bottom: 8px; }
.hero h1, .section-heading h2 { font-family: "Marcellus", serif; font-weight: 400; margin: 0; }
.hero h1 { font-size: clamp(31px, 4vw, 50px); line-height: 1.05; }
.hero p { margin: 12px 0 0; color: var(--muted); max-width: 560px; line-height: 1.55; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); gap: 10px; min-width: min(510px, 48%); }
.stat { padding: 17px 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.stat > span, .stat small { display: block; color: var(--muted); }
.stat > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { display: block; font-size: 27px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11px; }
.cap-stat input { width: 82px; color: var(--text); background: transparent; border: 0; outline: 0; padding: 0; font-size: 27px; font-weight: 700; }

.day-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin: 14px 0; }
.day-tab { min-height: 72px; border: 1px solid var(--line); border-radius: 15px; background: rgba(17,31,45,.66); color: var(--muted); cursor: pointer; padding: 10px 12px; text-align: left; transition: .18s ease; }
.day-tab:hover { background: rgba(24,43,61,.88); border-color: var(--line-strong); }
.day-tab.active { background: linear-gradient(180deg, rgba(217,187,120,.13), rgba(217,187,120,.055)); border-color: rgba(217,187,120,.35); color: var(--text); }
.day-tab.today .day-name::after { content: " •"; color: var(--cyan); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.day-name { display: block; font-weight: 800; font-size: 12px; }
.day-resin { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 11px; }
.day-resin strong { color: var(--gold-2); font-weight: 700; }
.day-mini-track { height: 3px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; margin-top: 8px; }
.day-mini-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--gold)); width: 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr); gap: 14px; align-items: start; }
.planner-column, .library-column, .week-overview { padding: 25px; }
.planner-column { min-height: 610px; }
.library-column { min-height: 610px; position: static; margin-top: 0; align-self: start; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { font-size: 26px; }
.day-budget { width: min(220px, 44%); text-align: right; color: var(--muted); font-size: 11px; padding-top: 4px; }
.budget-track { margin-top: 9px; width: 100%; height: 7px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.budget-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gold)); border-radius: inherit; transition: width .2s ease; }
.budget-track span.over { background: linear-gradient(90deg, #dc8d6f, #e56f72); }

.task-list { display: grid; gap: 10px; margin-top: 22px; }
.task-card { display: grid; grid-template-columns: 74px minmax(0,1fr) auto; gap: 15px; align-items: center; min-height: 103px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); transition: .18s ease; }
.task-card:hover { transform: translateY(-1px); background: rgba(255,255,255,.04); border-color: var(--line-strong); }
.task-card.dragging { opacity: .45; }
.task-image-wrap, .dialog-image-wrap { overflow: hidden; position: relative; display: grid; place-items: center; background: radial-gradient(circle at 50% 22%, rgba(217,187,120,.24), rgba(54,73,91,.36) 65%); }
.task-image-wrap { width: 74px; height: 74px; border-radius: 14px; border: 1px solid rgba(255,255,255,.07); }
.task-image, .dialog-image { width: 100%; height: 100%; object-fit: contain; }
.task-image-fallback { color: var(--gold-2); opacity: .55; }
.task-main { min-width: 0; }
.task-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-category { color: var(--cyan); text-transform: uppercase; font-size: 9px; letter-spacing: .12em; font-weight: 800; }
.task-total { color: var(--gold-2); font-size: 11px; font-weight: 800; }
.task-title { margin: 5px 0 3px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-note { margin: 0; color: var(--muted); font-size: 11px; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-actions { display: flex; flex-direction: column; gap: 4px; }
.task-actions .icon-button { width: 29px; height: 27px; font-size: 13px; }
.run-controls { margin-top: 11px; display: flex; gap: 5px; flex-wrap: wrap; }
.run-dot { width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255,255,255,.025); color: transparent; cursor: pointer; position: relative; }
.run-dot:hover { border-color: rgba(119,201,212,.38); }
.run-dot.done { background: rgba(128,213,165,.12); border-color: rgba(128,213,165,.35); color: var(--success); }
.run-dot.done::after { content: "✓"; color: var(--success); position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.run-count { color: var(--muted); font-size: 10px; align-self: center; margin-left: 4px; }

.empty-state { padding: 86px 20px; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-icon { width: 62px; height: 62px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(217,187,120,.22); color: var(--gold); background: rgba(217,187,120,.05); font-size: 25px; }
.empty-state h3 { margin: 0 0 6px; font-family: "Marcellus", serif; font-size: 22px; font-weight: 400; }
.empty-state p { color: var(--muted); margin: 0 auto 18px; max-width: 360px; font-size: 13px; }

.library-heading { align-items: center; }
.library-tabs { display: flex; gap: 6px; margin-top: 20px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.library-tab { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 10px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; white-space: nowrap; }
.library-tab.active { color: #17232d; background: var(--gold-2); border-color: transparent; }
.search-box { margin-top: 13px; height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7,16,25,.38); color: var(--muted); }
.search-box:focus-within { border-color: rgba(119,201,212,.34); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 13px; }
.search-box input::placeholder { color: var(--muted-2); }
.library-meta { display: flex; justify-content: space-between; gap: 14px; color: var(--muted-2); font-size: 10px; margin: 10px 2px 9px; }
.library-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; max-height: 445px; overflow: auto; padding-right: 3px; scrollbar-width: thin; }
.entity-card { border: 1px solid var(--line); border-radius: 13px; padding: 7px; background: rgba(255,255,255,.022); cursor: pointer; min-width: 0; transition: .16s ease; }
.entity-card:hover { background: var(--panel-hover); transform: translateY(-2px); border-color: rgba(217,187,120,.22); }
.entity-thumb { aspect-ratio: 1 / 1; width: 100%; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 50% 25%, rgba(217,187,120,.17), rgba(55,73,91,.28) 70%); }
.entity-thumb img { width: 100%; height: 100%; object-fit: contain; }
.entity-card strong { display: block; margin-top: 7px; font-size: 10px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-card small { display: block; color: var(--muted-2); margin-top: 2px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-card .thumb-fallback { color: rgba(240,216,157,.55); font-size: 20px; }
.spinner { width: 27px; height: 27px; border: 2px solid rgba(255,255,255,.08); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.week-overview { margin-top: 14px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-top: 22px; }
.week-bar-card { border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: rgba(255,255,255,.018); }
.week-bar-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; }
.week-bar-card header strong { font-size: 12px; }
.vertical-bar { height: 78px; display: flex; align-items: flex-end; margin-top: 11px; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.035); }
.vertical-bar span { width: 100%; min-height: 2px; background: linear-gradient(180deg, var(--gold), rgba(119,201,212,.65)); border-radius: 8px 8px 0 0; transition: height .25s ease; }
.week-bar-card small { color: var(--muted-2); display: block; margin-top: 8px; font-size: 9px; }
.footer { display: flex; justify-content: space-between; gap: 30px; color: var(--muted-2); font-size: 10px; line-height: 1.55; padding: 24px 4px 0; }
.footer p { margin: 0; }

.task-dialog { width: min(660px, calc(100% - 24px)); border: 0; padding: 0; background: transparent; color: var(--text); }
.task-dialog::backdrop { background: rgba(2,8,13,.72); backdrop-filter: blur(9px); }
.dialog-card { position: relative; border: 1px solid var(--line-strong); border-radius: 22px; background: linear-gradient(180deg, #16283a, #101f2d); box-shadow: 0 34px 110px rgba(0,0,0,.55); padding: 24px; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.02); color: var(--muted); font-size: 21px; cursor: pointer; }
.dialog-entity { display: flex; align-items: center; gap: 16px; padding-right: 38px; }
.dialog-image-wrap { width: 80px; height: 80px; flex: 0 0 80px; border-radius: 16px; border: 1px solid var(--line); }
.entity-fallback { color: var(--gold-2); font-size: 24px; opacity: .65; }
.entity-type { color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.dialog-entity h2 { font-family: "Marcellus", serif; font-weight: 400; margin: 4px 0; font-size: 25px; }
.dialog-entity p { margin: 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field > span { color: #b7c9d4; font-size: 10px; font-weight: 700; }
.field small { color: var(--muted-2); font-weight: 500; }
.field input, .field select { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: rgba(5,13,21,.38); color: var(--text); padding: 0 11px; font-size: 12px; }
.field input:focus, .field select:focus { border-color: rgba(119,201,212,.35); }
.field select option { color: #111; }
.resin-presets { display: flex; gap: 7px; margin-top: 12px; }
.resin-presets button { min-width: 51px; height: 31px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.resin-presets button:hover { color: var(--gold-2); border-color: rgba(217,187,120,.3); }
.dialog-summary { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; padding: 13px 14px; border: 1px solid rgba(217,187,120,.17); background: rgba(217,187,120,.055); border-radius: 12px; color: var(--muted); font-size: 11px; }
.dialog-summary strong { color: var(--gold-2); font-size: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); background: #1b2c3d; border: 1px solid var(--line-strong); color: var(--text); border-radius: 999px; padding: 10px 15px; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; z-index: 50; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Miniaturas do seletor: o <img> fica renderizado durante o carregamento para evitar
   o bloqueio de lazy-loading que ocorria quando ele começava com hidden/display:none. */
.entity-thumb { position: relative; }
.entity-thumb img,
.entity-thumb .thumb-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.entity-thumb img { object-fit: contain; transition: opacity .16s ease; }
.entity-thumb .thumb-fallback { display: grid; place-items: center; }
.entity-thumb .thumb-fallback[hidden] { display: none; }

@media (max-width: 1100px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-stats { min-width: 100%; width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .library-column { position: static; }
  .library-grid { grid-template-columns: repeat(6, 1fr); max-height: 410px; }
  .week-bars { grid-template-columns: repeat(7, minmax(110px,1fr)); overflow-x: auto; padding-bottom: 5px; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1440px); }
  .topbar { height: auto; padding: 15px 0; align-items: flex-start; }
  .top-actions { max-width: 58%; }
  .status-pill { display: none; }
  .hero { padding: 24px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-stats .cap-stat { grid-column: span 2; }
  .day-tabs { grid-template-columns: repeat(7, minmax(95px,1fr)); overflow-x: auto; padding-bottom: 4px; }
  .workspace { display: block; }
  .library-column { margin-top: 14px; }
  .planner-column, .library-column, .week-overview { padding: 18px; }
  .library-grid { grid-template-columns: repeat(4, 1fr); }
  .task-card { grid-template-columns: 62px minmax(0,1fr); }
  .task-image-wrap { width: 62px; height: 62px; }
  .task-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .footer { flex-direction: column; gap: 8px; }
}

@media (max-width: 470px) {
  .brand small { display: none; }
  .top-actions .button { min-height: 36px; padding: 0 11px; font-size: 11px; }
  .hero-stats { grid-template-columns: 1fr; }
  .hero-stats .cap-stat { grid-column: auto; }
  .hero h1 { font-size: 34px; }
  .library-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
}

/* ===== Genshin-inspired visual pass ===== */
:root {
  --bg: #102136;
  --bg-2: #172d46;
  --panel: rgba(246, 242, 231, .96);
  --panel-strong: #f7f2e5;
  --panel-hover: #eef4f7;
  --line: rgba(62, 78, 100, .17);
  --line-strong: rgba(62, 78, 100, .3);
  --text: #3d4b5e;
  --muted: #718197;
  --muted-2: #93a0b0;
  --gold: #b89b63;
  --gold-2: #d8bd7a;
  --cyan: #5d9fbe;
  --danger: #c96f6a;
  --success: #65a980;
  --shadow: 0 22px 60px rgba(8, 28, 51, .22);
}
body {
  color: var(--text);
  background:
    radial-gradient(circle at 14% 5%, rgba(126, 208, 232, .30), transparent 22%),
    radial-gradient(circle at 84% 8%, rgba(255, 225, 158, .18), transparent 20%),
    linear-gradient(145deg, #193c62 0%, #244f72 36%, #17314d 69%, #102238 100%);
  background-attachment: fixed;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(30deg, transparent 48%, rgba(255,255,255,.12) 49%, transparent 51%),
    linear-gradient(150deg, transparent 48%, rgba(255,255,255,.07) 49%, transparent 51%);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
  z-index: -2;
}
.ambient-a { background: #73d7ef; opacity: .22; }
.ambient-b { background: #f1c876; opacity: .2; }
.topbar {
  margin-top: 14px;
  padding: 10px 16px;
  height: auto;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15,39,64,.88), rgba(13,31,52,.82));
  box-shadow: 0 14px 40px rgba(4,20,38,.22);
  backdrop-filter: blur(16px);
}
.brand, .topbar .button { color: #f7f2e8; }
.brand-mark {
  border-color: rgba(228,201,139,.55);
  color: #f1dba6;
  background: radial-gradient(circle, rgba(225,197,130,.2), rgba(225,197,130,.04));
}
.brand small { color: #adc0d0; }
.status-pill { border-color: rgba(255,255,255,.13); color: #c6d5df; background: rgba(255,255,255,.035); }
.button.ghost { border-color: rgba(255,255,255,.17); background: rgba(255,255,255,.05); color: #edf5f8; }
.button.ghost:hover { background: rgba(255,255,255,.1); }
.button.primary {
  color: #3f4a59;
  background: linear-gradient(180deg, #f3e7c8, #d8bd7a);
  border-color: rgba(255,255,255,.4);
  box-shadow: inset 0 1px rgba(255,255,255,.65), 0 7px 18px rgba(10,25,45,.18);
}
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(251,248,239,.97), rgba(239,236,225,.97));
  border: 1px solid rgba(255,255,255,.55);
  outline: 1px solid rgba(75,91,113,.14);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
}
.panel::before, .panel::after {
  content: "✦";
  position: absolute;
  color: rgba(183,154,95,.42);
  font-size: 13px;
  pointer-events: none;
}
.panel::before { top: 9px; left: 12px; }
.panel::after { right: 12px; bottom: 9px; transform: rotate(45deg); }
.hero {
  margin-top: 14px;
  background:
    linear-gradient(90deg, rgba(248,244,232,.98) 0 57%, rgba(228,239,243,.95) 100%),
    var(--panel);
  border-radius: 24px;
}
.hero::after { color: rgba(97,140,166,.08); }
.hero h1, .section-heading h2, .empty-state h3, .dialog-entity h2 { color: #3b4656; letter-spacing: .01em; }
.hero p, .stat > span, .stat small, .day-budget, .task-note, .library-meta, .footer, .dialog-entity p { color: var(--muted); }
.eyebrow { color: #a98c53; }
.stat {
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(232,237,238,.7));
  border-color: rgba(88,110,130,.13);
  box-shadow: inset 0 1px rgba(255,255,255,.9);
}
.stat strong, .cap-stat input { color: #47566a; }
.day-tab {
  color: #dce7ed;
  background: linear-gradient(180deg, rgba(27,58,87,.9), rgba(19,42,66,.9));
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: inset 0 1px rgba(255,255,255,.06);
}
.day-tab:hover { background: linear-gradient(180deg, #2b607e, #214965); }
.day-tab.active {
  color: #3c495a;
  background: linear-gradient(180deg, #f6edda, #e5d4ad);
  border-color: rgba(255,231,174,.8);
  box-shadow: 0 8px 20px rgba(8,28,49,.15), inset 0 1px white;
}
.day-tab.active .day-resin strong { color: #937640; }
.day-tab.today .day-name::after { color: #78bfd4; }
.day-mini-track { background: rgba(255,255,255,.12); }
.day-tab.active .day-mini-track { background: rgba(89,105,123,.13); }
.day-mini-track span, .budget-track span { background: linear-gradient(90deg, #76bad1, #d4b86f); }
.planner-column, .library-column, .week-overview { overflow: hidden; }
.task-card, .entity-card, .week-bar-card {
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(237,238,234,.76));
  border-color: rgba(72,91,111,.14);
  box-shadow: inset 0 1px rgba(255,255,255,.9);
}
.task-card:hover, .entity-card:hover {
  background: linear-gradient(180deg, #fff, #edf3f4);
  border-color: rgba(177,146,86,.4);
}
.task-image-wrap, .dialog-image-wrap, .entity-thumb {
  background:
    radial-gradient(circle at 50% 30%, rgba(139,205,227,.44), transparent 45%),
    linear-gradient(180deg, #d7e7ec, #b8ced9);
  border-color: rgba(101,126,143,.17);
}
.task-category, .entity-type { color: #4c91af; }
.task-total, .dialog-summary strong { color: #9c7f47; }
.task-title, .entity-card strong { color: #425064; }
.icon-button { color: #73859b; border-color: rgba(79,99,121,.16); background: rgba(255,255,255,.4); }
.icon-button:hover { background: white; color: #4b5c70; }
.run-dot { background: #eef1ef; border-color: rgba(83,103,122,.2); }
.empty-icon { background: #eef3f3; color: #af925a; }
.library-tab { color: #6d7c8e; border-color: rgba(76,95,115,.16); background: rgba(255,255,255,.45); }
.library-tab.active { color: #3d4a5a; background: linear-gradient(180deg,#f0e2bd,#d9bd79); box-shadow: inset 0 1px rgba(255,255,255,.7); }
.search-box {
  background: rgba(255,255,255,.64);
  border-color: rgba(79,99,119,.16);
  color: #77879a;
}
.search-box input { color: #435267; }
.search-box input::placeholder { color: #98a4b2; }
.spinner { border-color: rgba(58,76,97,.12); border-top-color: #b1945c; }
.vertical-bar { background: rgba(80,100,119,.08); }
.vertical-bar span { background: linear-gradient(180deg, #d5ba73, #6fa9c1); }
.footer a { color: #e8cf98; }
.task-dialog::backdrop { background: rgba(7,23,40,.7); }
.dialog-card {
  color: var(--text);
  background: linear-gradient(180deg, #f8f4e8, #e9e7de);
  border-color: rgba(255,255,255,.75);
  outline: 1px solid rgba(64,82,103,.25);
}
.dialog-close { color: #708095; background: rgba(255,255,255,.5); border-color: rgba(74,94,113,.16); }
.field > span { color: #637388; }
.field input, .field select {
  color: #3f4e62;
  background: rgba(255,255,255,.72);
  border-color: rgba(77,97,119,.17);
}
.resin-presets button { background: rgba(255,255,255,.62); color: #6f7f91; border-color: rgba(74,94,115,.15); }
.dialog-summary { background: rgba(216,189,122,.14); border-color: rgba(183,154,96,.28); color: #6f7d8e; }
.toast { background: #eff0e9; color: #405064; border-color: rgba(70,90,110,.2); }

@media (max-width: 760px) {
  .topbar { margin-top: 8px; }
  .hero { margin-top: 10px; }
}


/* v4: bilingual controls, misc routes, strongbox integration, and softer progress UI */
.language-control { display:flex; align-items:center; gap:7px; min-height:40px; padding:0 9px 0 11px; border:1px solid var(--line-strong); border-radius:11px; background:rgba(255,255,255,.38); color:#637388; }
.language-control span { font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.language-control select { border:0; outline:0; background:transparent; color:#455568; font-weight:800; font-size:12px; cursor:pointer; }
.language-control select option { color:#111; }
.budget-track { height:2px !important; background:rgba(76,95,115,.10) !important; }
.budget-track span { background:#b89b60 !important; }
.budget-track span.over { background:#bf6d61 !important; }
.day-mini-track { opacity:.58; height:2px !important; }
.entity-card.misc-card .entity-thumb { background:linear-gradient(145deg, rgba(76,145,175,.12), rgba(216,189,122,.18)); }
.entity-card.misc-card .thumb-fallback { font-size:28px; opacity:.9; color:#887047; }
.entity-card strong { min-height:25px; white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.entity-thumb img { z-index:2; }
.entity-thumb .thumb-fallback { z-index:1; }
.dialog-image { z-index:2; }
.entity-fallback { z-index:1; }
.artifact-method-note { color:var(--muted); font-size:10px; margin-top:3px; }
.strongbox-dialog { width:min(900px, calc(100% - 24px)); border:0; padding:0; background:transparent; color:var(--text); }
.strongbox-dialog::backdrop { background:rgba(7,23,40,.72); backdrop-filter:blur(9px); }
.strongbox-card { position:relative; border:1px solid var(--line-strong); border-radius:22px; background:linear-gradient(180deg,#fbf8ee,#eef2f1); box-shadow:0 34px 110px rgba(0,0,0,.42); padding:24px; color:#435268; max-height:min(86vh,850px); overflow:hidden; }
.strongbox-card .dialog-close { z-index:5; }
.strongbox-header h2 { margin:4px 0 6px; font-family:"Marcellus",serif; font-weight:400; font-size:28px; color:#3b4656; }
.strongbox-header p { margin:0; color:#718194; font-size:12px; max-width:700px; line-height:1.5; }
.strongbox-search { margin-top:18px; }
.strongbox-grid { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:9px; margin-top:12px; max-height:56vh; overflow:auto; padding:2px 4px 8px 1px; }
.strongbox-grid .entity-card { color:#435268; background:rgba(255,255,255,.66); border-color:rgba(76,95,115,.14); }
.strongbox-grid .entity-card:hover { background:#fffdf7; border-color:rgba(183,154,96,.42); }
.strongbox-empty { grid-column:1/-1; padding:55px 20px; text-align:center; color:#718194; font-size:12px; }
.method-badge { display:inline-flex; align-items:center; gap:5px; margin-top:5px; padding:3px 7px; border-radius:999px; background:rgba(216,189,122,.16); color:#8c7140; font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
@media (max-width:900px){ .strongbox-grid{grid-template-columns:repeat(4,1fr)} }
@media (max-width:600px){ .language-control span{display:none}.strongbox-grid{grid-template-columns:repeat(3,1fr)} .strongbox-card{padding:18px} }


/* v5: cleaner planner, face-focused portraits, character material mode, guaranteed misc imagery */
.budget-track, .day-mini-track { display:none !important; }
.day-budget { width:auto; min-width:120px; padding-top:0; }
.entity-card[data-entity-type="characters"] .entity-thumb img,
.character-portrait img { object-fit:contain; object-position:center 18%; }
.character-farm-field { border:1px solid rgba(184,155,96,.18); border-radius:13px; padding:12px; background:rgba(255,255,255,.34); }
.character-material-preview { display:flex; gap:7px; flex-wrap:wrap; margin-top:9px; }
.material-preview-loading { color:var(--muted); font-size:10px; }
.material-chip { display:flex; align-items:center; gap:6px; max-width:210px; padding:5px 8px 5px 5px; border:1px solid rgba(76,95,115,.13); background:rgba(255,255,255,.58); border-radius:10px; color:#5c6b7c; font-size:9px; font-weight:700; }
.material-chip-image { width:28px; height:28px; flex:0 0 28px; border-radius:7px; overflow:hidden; position:relative; background:rgba(106,145,169,.12); }
.material-chip-image img,.material-chip-image .thumb-fallback{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:grid;place-items:center;}
.material-chip-image .thumb-fallback[hidden]{display:none;}
.top-actions { flex-wrap:wrap; justify-content:flex-end; }
@media(max-width:760px){.day-budget{min-width:auto}.character-material-preview{max-height:122px;overflow:auto}.top-actions{max-width:70%}}

/* v6: domain relations, modal portrait containment, availability feedback */
.dialog-image-wrap img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; object-position:center; box-sizing:border-box; }
.dialog-image-wrap.character-portrait img { object-fit:contain; object-position:center; padding:4px; transform:none !important; }
.domain-relation-hint { display:block; margin-top:5px; color:#8a7143; font-size:8px; line-height:1.3; font-weight:700; }
.domain-kind-filters { display:flex; gap:6px; margin:10px 0 2px; }
.domain-kind-filters[hidden] { display:none !important; }
.field[hidden] { display:none !important; }
.domain-kind-filter { border:1px solid rgba(76,95,115,.14); background:rgba(255,255,255,.42); color:#6b7b8d; border-radius:999px; padding:6px 10px; font-size:9px; font-weight:800; cursor:pointer; }
.domain-kind-filter.active { background:#516f87; color:#fffaf0; border-color:#516f87; box-shadow:0 4px 14px rgba(50,78,101,.16); }
.entity-card[data-entity-type="domains"] .entity-thumb { background:linear-gradient(145deg, rgba(94,151,175,.14), rgba(216,189,122,.16)); }
.availability-note { margin-top:7px; padding:7px 9px; border-radius:9px; background:rgba(190,109,88,.10); border:1px solid rgba(190,109,88,.18); color:#9a5d52; font-size:9px; font-weight:700; }


/* v7: domain drop icons, weapon farming days, weekly boss visual fallbacks */
/* v8: contextual dialogs + domain-filter containment */
.domain-drop-line { display:flex; align-items:center; gap:6px; margin-top:6px; min-width:0; color:#75623c; font-size:9px; font-weight:800; line-height:1.25; }
.domain-drop-icon { width:26px; height:26px; flex:0 0 26px; border-radius:7px; border:1px solid rgba(158,129,72,.18); background:rgba(229,214,168,.20); display:grid; place-items:center; overflow:hidden; position:relative; }
.domain-drop-icon img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.domain-drop-icon .thumb-fallback { position:absolute; inset:0; display:grid; place-items:center; font-size:12px; }
.domain-drop-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.weapon-farm-info { display:flex; align-items:center; gap:5px; flex-wrap:wrap; margin-top:6px; }
.farm-day-badge { display:inline-flex; align-items:center; min-height:19px; padding:3px 6px; border-radius:999px; background:rgba(81,111,135,.10); border:1px solid rgba(81,111,135,.14); color:#5f7181; font-size:8px; font-weight:900; letter-spacing:.02em; }
.weapon-domain-name { max-width:100%; color:#8b7140; font-size:8px; font-weight:800; line-height:1.25; }
.entity-card[data-entity-type="domains"] .entity-thumb { background:radial-gradient(circle at 50% 42%, rgba(255,249,228,.96), rgba(209,224,228,.78)); }
.entity-card[data-entity-type="domains"] .entity-thumb img { padding:5px; box-sizing:border-box; }
.entity-card[data-entity-type="boss"] .entity-thumb img { object-fit:contain; padding:2px; box-sizing:border-box; }


/* v11: backup uses a modal so it can never be hidden behind the weekly summary. */
.task-dialog .dialog-actions .dialog-cancel { color:#536372; background:rgba(81,111,135,.08); border-color:rgba(81,111,135,.22); box-shadow:none; }
.task-dialog .dialog-actions .dialog-cancel:hover { color:#2f4658; background:rgba(81,111,135,.15); border-color:rgba(81,111,135,.34); }
.backup-dialog { width:min(470px,calc(100% - 24px)); border:0; padding:0; background:transparent; color:#435268; z-index:9999; }
.backup-dialog::backdrop { background:rgba(2,8,13,.72); backdrop-filter:blur(9px); }
.backup-card { position:relative; border:1px solid rgba(158,129,72,.28); border-radius:22px; background:linear-gradient(180deg,#fbf8ee,#edf1ef); box-shadow:0 34px 110px rgba(0,0,0,.5); padding:26px; color:#435268; }
.backup-card h2 { margin:5px 42px 8px 0; color:#3b4656; font-family:"Marcellus",serif; font-weight:400; font-size:27px; }
.backup-card > p { margin:0; color:#718091; font-size:12px; line-height:1.55; }
.backup-card .dialog-close { z-index:2; color:#647589; border-color:rgba(79,99,121,.18); background:rgba(255,255,255,.52); }
.backup-dialog-actions { display:grid; gap:8px; margin-top:20px; }
.backup-action { width:100%; min-height:46px; display:flex; align-items:center; gap:11px; padding:0 13px; border:1px solid rgba(76,95,115,.13); border-radius:11px; background:rgba(255,255,255,.52); color:#536372; font:inherit; font-size:12px; font-weight:800; cursor:pointer; text-align:left; transition:.16s ease; }
.backup-action:hover { background:#fff; color:#31495b; border-color:rgba(158,129,72,.28); transform:translateY(-1px); }
.backup-action.backup-primary { background:linear-gradient(180deg,#f1e4c5,#dfc98f); color:#445163; border-color:rgba(158,129,72,.28); }
.backup-action > span:first-child { width:26px; height:26px; flex:0 0 26px; display:grid; place-items:center; border-radius:7px; background:rgba(81,111,135,.10); color:#6e8294; font-size:15px; }
.backup-card > small { display:block; margin-top:13px; padding-top:12px; border-top:1px solid rgba(76,95,115,.10); color:#87919a; font-size:10px; line-height:1.45; }

/* Optional account controls; retain the existing planner layout. */
.cloud-status { font-size:11px; color:var(--muted); max-width:210px; }
.cloud-status[data-status="conflict"], .cloud-status[data-status="offline"], .cloud-status[data-status="storage-error"] { color:var(--gold); }
.cloud-dialog { width:min(480px, calc(100% - 24px)); }
.cloud-dialog .backup-card { position:relative; }
.cloud-dialog .field { margin-block:14px; }
.cloud-dialog input { width:100%; }
.cloud-dialog p { overflow-wrap:anywhere; }
.cloud-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
#cloudConflict { border-top:1px solid var(--line); margin-top:20px; }
@media(max-width:760px) { .topbar { height:auto; min-height:86px; flex-wrap:wrap; padding-block:16px; } .cloud-status { max-width:100%; } }
