/* Craft Dreams Studio: shared look for Home, Ideas, All tools and Settings,
   and the header bar added to the top of every tool. Every class starts
   with "sx-" so it can't clash with a tool's own styles. */

html[data-look="ocean"], html:not([data-look]) {
  --sx-d: #073F59; --sx-m: #007F98; --sx-l: #5AD9DF; --sx-pale: #EAF7F9; --sx-ond: #5AD9DF;
}
html[data-look="seaglass"] {
  --sx-d: #166C76; --sx-m: #80CFC6; --sx-l: #E5F4ED; --sx-pale: #F1F9F5; --sx-ond: #E5F4ED;
}
html[data-look="tropical"] {
  --sx-d: #006D73; --sx-m: #43D6C5; --sx-l: #B7F1E2; --sx-pale: #EEFBF7; --sx-ond: #B7F1E2;
}
:root {
  --sx-ink: #2D2D2D; --sx-soft: #5B6573; --sx-line: #D5E0E3; --sx-rule: #E3EBED; --sx-grey: #8A96A3;
  --sx-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --sx-body: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
}

/* ---------- Pages built for the Studio (Home, Ideas, All tools, Settings) ---------- */
body.sx-page { margin: 0; background: var(--sx-pale); color: var(--sx-ink); font-family: var(--sx-body); font-size: 17px; line-height: 1.45; }
.sx-page *, .sx-page *::before, .sx-page *::after { box-sizing: border-box; }
.sx-page a { color: inherit; }
.sx-page button, .sx-page input, .sx-page select, .sx-page textarea { font: inherit; }
.sx-page h1, .sx-page h2, .sx-page h3 { font-family: var(--sx-display); font-weight: 800; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
.sx-main { max-width: 1180px; margin: 0 auto; padding: 32px 20px 64px; }
.sx-title { font-size: 2.2rem; color: var(--sx-d); letter-spacing: -0.02em; }
.sx-lede { margin: 6px 0 0; color: var(--sx-soft); font-size: 1.05rem; }
.sx-hidden { display: none !important; }
.sx-page [hidden] { display: none !important; }

/* ---------- Header (also added to the top of every tool) ---------- */
.sx-testnote { background: var(--sx-ink); color: #fff; font: 700 14px/1.3 var(--sx-body); padding: 8px 20px; text-align: center; }
.sx-header { background: var(--sx-d); color: #fff; font-family: var(--sx-body); }
.sx-header-in { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.sx-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff !important; }
.sx-brand-logo { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sx-brand-logo img { width: 46px; height: 46px; object-fit: contain; display: block; }
.sx-brand-name { font: 800 21px/1.1 var(--sx-display); letter-spacing: -0.01em; }
.sx-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.sx-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; color: #fff !important; font: 700 16px/1 var(--sx-body); text-decoration: none; box-shadow: inset 0 0 0 2px var(--sx-ond); }
.sx-nav a[aria-current="page"] { background: #fff; color: var(--sx-d) !important; box-shadow: none; }
.sx-nav a.sx-nav-plain { box-shadow: none; }
.sx-nav a:focus-visible, .sx-brand:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sx-stripes { height: 10px; display: flex; }
.sx-stripes span { flex: 1; }
.sx-stripes span:nth-child(odd) { background: var(--sx-m); }
.sx-stripes span:nth-child(even) { background: var(--sx-l); }

/* The bar on top of a tool: same header, a little slimmer. */
.sx-toolbar .sx-header-in { padding: 8px 16px; }
.sx-toolbar .sx-brand-logo { width: 40px; height: 40px; }
.sx-toolbar .sx-brand-logo img { width: 36px; height: 36px; }
.sx-toolbar .sx-brand-name { font-size: 17px; }
.sx-toolbar .sx-nav a { min-height: 40px; font-size: 15px; padding: 0 14px; }
.sx-toolbar .sx-stripes { height: 6px; }
@media print { .sx-toolbar, .sx-testnote { display: none !important; } }

/* ---------- Cards, buttons, fields ---------- */
.sx-card { background: #fff; border-radius: 18px; box-shadow: 0 0 0 1px var(--sx-line); }
.sx-pad { padding: 18px 20px; }
.sx-btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; border-radius: 14px; border: 2px solid var(--sx-d); background: var(--sx-d); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.sx-btn.sx-ghost { background: #fff; color: var(--sx-d); }
.sx-page a.sx-btn { color: #fff; }
.sx-page a.sx-btn.sx-ghost { color: var(--sx-d); }
.sx-btn.sx-small { min-height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
.sx-btn[disabled] { opacity: .5; cursor: default; }
.sx-btn:focus-visible, .sx-tile:focus-visible, .sx-look:focus-visible { outline: 3px solid var(--sx-m); outline-offset: 2px; }
.sx-linkbtn { background: none; border: none; padding: 0; color: var(--sx-d); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.sx-field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 15px; }
.sx-field input, .sx-field select, .sx-field textarea { min-height: 48px; border-radius: 12px; border: 2px solid #C9D3D6; padding: 8px 12px; font-weight: 400; background: #fff; color: var(--sx-ink); width: 100%; }
.sx-field textarea { min-height: 96px; resize: vertical; }
.sx-field input:focus, .sx-field select:focus, .sx-field textarea:focus { outline: none; border-color: var(--sx-d); }
.sx-msg { font-size: 15px; color: var(--sx-soft); margin: 0; }
.sx-msg.sx-err { color: #B3261E; font-weight: 700; }
.sx-msg.sx-ok { color: var(--sx-d); font-weight: 700; }

/* ---------- Home ---------- */
.sx-home { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 22px; }
.sx-home-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.sx-home-side { flex: 1 1 300px; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 900px) { .sx-home-side { max-width: none; } }
.sx-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sx-tile { min-height: 128px; background: #fff; border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; box-shadow: 0 0 0 1px var(--sx-line); }
.sx-tile:hover { box-shadow: 0 0 0 2px var(--sx-d); }
.sx-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--sx-d); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sx-icon svg { width: 24px; height: 24px; }
.sx-tile-name { font: 800 19px/1.2 var(--sx-display); color: var(--sx-ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sx-tile-line { font-size: 15px; color: var(--sx-soft); }
.sx-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sx-section-head h2 { font-size: 1.25rem; }
.sx-section-head a { font-weight: 700; color: var(--sx-d); }
.sx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 0; border-top: 1px solid var(--sx-rule); }
.sx-row:first-of-type { border-top: none; }
.sx-row-title { flex: 1 1 200px; font-weight: 700; overflow-wrap: anywhere; }
.sx-row-when { font-size: 15px; color: var(--sx-soft); }
.sx-tag { min-width: 112px; text-align: center; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--sx-d); color: #fff; }
.sx-order { padding: 12px 0; border-top: 1px solid var(--sx-rule); display: flex; flex-direction: column; gap: 6px; }
.sx-order:first-of-type { border-top: none; }
.sx-order-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.sx-order-top span:last-child { color: var(--sx-d); white-space: nowrap; }
.sx-order-names { font-size: 14px; color: var(--sx-soft); }
.sx-order-btns { display: flex; gap: 8px; }
.sx-order-btns .sx-btn { flex: 1; min-height: 44px; font-size: 15px; padding: 0 8px; white-space: nowrap; }
.sx-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sx-count { min-height: 76px; border-radius: 12px; background: var(--sx-pale); display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; }
.sx-count b { font: 800 26px/1 var(--sx-display); color: var(--sx-d); }
.sx-count span { font-size: 14px; font-weight: 700; }
.sx-unlock { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.sx-unlock .sx-field { flex: 1 1 180px; }

/* ---------- Ideas board ---------- */
.sx-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; align-items: start; margin-top: 22px; }
.sx-col { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sx-col-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--sx-d); color: #fff; font: 800 18px/1.1 var(--sx-display); }
.sx-col[data-stage="shelved"] .sx-col-head { background: var(--sx-soft); }
.sx-col-hint { margin: 0; font-size: 14px; color: var(--sx-soft); }
.sx-idea { border-radius: 14px; padding: 14px; background: var(--sx-pale); display: flex; flex-direction: column; gap: 8px; }
.sx-idea h3 { font: 700 17px/1.3 var(--sx-body); letter-spacing: 0; overflow-wrap: anywhere; }
.sx-idea p { margin: 0; font-size: 14px; color: var(--sx-soft); overflow-wrap: anywhere; white-space: pre-line; }
.sx-idea-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-idea-btns .sx-btn { min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.sx-empty { font-size: 14px; color: var(--sx-soft); padding: 8px 2px; }
.sx-dialog { border: none; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(7, 63, 89, .3); }
.sx-dialog::backdrop { background: rgba(45, 45, 45, .55); }
.sx-dialog form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.sx-dialog-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- All tools ---------- */
.sx-group { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; scroll-margin-top: 16px; }
.sx-group-head { display: flex; align-items: center; gap: 12px; }
.sx-group-head::before { content: ''; width: 28px; height: 8px; border-radius: 4px; background: var(--sx-m); }
.sx-group-head h2 { font-size: 1.3rem; }
.sx-tool { min-height: 104px; flex-direction: row; align-items: flex-start; gap: 14px; }
.sx-new { padding: 2px 8px; border-radius: 999px; background: var(--sx-d); color: #fff; font: 700 12px/1.5 var(--sx-body); }
.sx-paused .sx-tile { box-shadow: 0 0 0 1px var(--sx-line); }
.sx-paused .sx-icon { background: var(--sx-soft); }

/* ---------- Settings ---------- */
.sx-settings { display: flex; flex-direction: column; gap: 20px; margin-top: 22px; max-width: 860px; }
.sx-settings h2 { font-size: 1.3rem; }
.sx-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.sx-look { text-align: left; background: #fff; border: 3px solid var(--sx-line); border-radius: 16px; padding: 0; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.sx-look[aria-pressed="true"] { border-color: var(--sx-ink); }
.sx-look-bar { height: 54px; display: flex; align-items: center; gap: 8px; padding: 0 12px; color: #fff; font: 800 15px/1 var(--sx-display); }
.sx-look-bar i { width: 26px; height: 26px; border-radius: 50%; background: #fff; flex-shrink: 0; }
.sx-look-stripes { height: 8px; display: flex; }
.sx-look-stripes span { flex: 1; }
.sx-look-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sx-look-btn { align-self: flex-start; padding: 6px 12px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 14px; }
.sx-look-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--sx-ink); }
.sx-look-check { font-size: 14px; color: var(--sx-ink); }
.sx-setrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; }
.sx-setrow .sx-field { flex: 1 1 220px; }

/* ---------- Sign-in ---------- */
.sx-login { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.sx-login-card { width: min(420px, 100%); padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.sx-login-logo { width: 120px; height: 120px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px var(--sx-l); display: flex; align-items: center; justify-content: center; }
.sx-login-logo img { width: 112px; height: 112px; object-fit: contain; }
.sx-login-card h1 { font-size: 1.6rem; color: var(--sx-d); }
.sx-login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.sx-pwform { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; align-items: end; margin-top: 12px; }

/* ---------- Tools: the sign-in replaces the old studio key box ---------- */
#studioKey, #forgetKeyRow, label[for="studioKey"] { display: none !important; }
