/* MESALY — shared styles (dark glassmorphism, Electric Blue / Cyan) */
:root {
  --blue: #3D7AFF; --cyan: #05D0D0; --amber: #FFB020; --red: #FF5C6C; --green: #2EE6A6;
  --bg: #070B16; --bg2: #0C1324; --glass: rgba(255,255,255,.055); --glass-2: rgba(255,255,255,.09);
  --line: rgba(255,255,255,.12); --text: #EAF0FF; --muted: #93A0BF; --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --grad: linear-gradient(135deg, var(--blue), var(--cyan));
  --font-h: 'Syne', system-ui, sans-serif; --font-b: 'DM Sans', system-ui, sans-serif; --font-m: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F3F6FD; --bg2: #FFFFFF; --glass: rgba(255,255,255,.75); --glass-2: rgba(255,255,255,.95);
  --line: rgba(20,40,90,.14); --text: #0E1730; --muted: #5B6786; --shadow: 0 10px 30px rgba(30,60,120,.14);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-b); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.55; overflow-x: hidden; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 500px at 12% -10%, rgba(61,122,255,.28), transparent 60%),
              radial-gradient(800px 500px at 100% 0%, rgba(5,208,208,.18), transparent 55%); }
h1, h2, h3, h4 { font-family: var(--font-h); letter-spacing: -.02em; line-height: 1.15; }
a { color: var(--cyan); text-decoration: none; } a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--font-m); }
.container { width: min(1120px, 92vw); margin-inline: auto; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; } .grow { flex: 1; min-width: 0; }

.glass { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); box-shadow: var(--shadow); }
.card { padding: 20px; }

/* buttons & forms */
.btn { font: 600 .92rem var(--font-b); color: var(--text); background: var(--glass-2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  transition: transform .15s, border-color .15s, background .15s; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: var(--cyan); transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); color: #04101F; border: 0; }
.btn.danger { border-color: rgba(255,92,108,.5); color: var(--red); }
.btn.sm { padding: 6px 11px; min-height: 32px; font-size: .82rem; border-radius: 10px; }
.btn.ghost { background: transparent; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
input, select, textarea { font: 1rem var(--font-b); color: var(--text); background: rgba(0,0,0,.22); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; width: 100%; outline: none; }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: #fff; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(61,122,255,.25); }
textarea { resize: vertical; min-height: 90px; font-family: var(--font-m); font-size: .9rem; }
.err { color: var(--red); font-size: .85rem; min-height: 1.2em; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

.badge { display: inline-block; font: 600 .72rem var(--font-b); padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--glass); text-transform: uppercase; letter-spacing: .04em; }
.badge.ok { color: var(--green); border-color: rgba(46,230,166,.4); } .badge.warn { color: var(--amber); border-color: rgba(255,176,32,.45); }
.badge.bad { color: var(--red); border-color: rgba(255,92,108,.45); } .badge.info { color: var(--cyan); border-color: rgba(5,208,208,.45); }

/* toast / modal / loaders */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 999; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, 92vw); }
.toast { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); box-shadow: var(--shadow); animation: pop .25s ease; }
.toast.error { border-color: var(--red); } .toast.success { border-color: var(--green); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-back { position: fixed; inset: 0; background: rgba(2,6,14,.62); backdrop-filter: blur(4px); z-index: 900; display: grid; place-items: center; padding: 14px; animation: pop .2s; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.modal.wide { width: min(980px, 100%); } .modal h3 { margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--cyan); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.notice { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); font-size: .9rem; }
.notice.warn { border-color: rgba(255,176,32,.5); } .notice.bad { border-color: rgba(255,92,108,.5); } .notice.info { border-color: rgba(5,208,208,.4); }

/* code blocks */
.codeblock { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #050912; }
.codeblock .bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; font: .75rem var(--font-m); color: var(--muted); background: rgba(255,255,255,.05); }
.codeblock pre { padding: 12px 14px; overflow-x: auto; font-size: .85rem; line-height: 1.5; color: #D6E2FF; }
.codeblock button { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; }
p code, li code { background: rgba(61,122,255,.18); padding: 1px 6px; border-radius: 6px; font-size: .88em; }

/* landing */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.logo { font: 800 1.25rem var(--font-h); display: flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #04101F; font-style: normal; font-size: .95rem; }
.hero { padding: 70px 0 40px; text-align: center; } .hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); max-width: 16ch; margin: 0 auto 18px; }
.hero p { max-width: 62ch; margin: 0 auto 26px; color: var(--muted); font-size: 1.08rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 30px 0; }
.features .card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; } .auth-card { width: min(430px, 100%); padding: 28px; }
footer.site { text-align: center; padding: 30px 0 40px; color: var(--muted); font-size: .85rem; }

/* generated-file cards + attachment chips (chat and studio) */
.file-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.file-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--glass); }
.file-card .fi { font-size: 1.4rem; } .file-card .grow b { word-break: break-all; }
.file-prev pre { margin-top: 8px; max-height: 260px; overflow: auto; font-size: .78rem; background: #050912; color: #D6E2FF; padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: .78rem; background: var(--glass-2); max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; } .chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 6px; }
.dropzone-on { outline: 2px dashed var(--cyan); outline-offset: -6px; }
