/* ===================== Easy Desk — Design System ===================== */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, "SF Mono", Menlo, monospace;

  --bg: #0b0d12;
  --bg-2: #10131a;
  --panel: rgba(22, 26, 35, 0.72);
  --panel-solid: #161a23;
  --panel-2: #1c212c;
  --line: rgba(255,255,255,0.07);
  --line-2: rgba(255,255,255,0.12);
  --text: #e8ebf3;
  --text-2: #a4acbd;
  --text-3: #6d7688;
  --accent: #7c8cff;
  --accent-2: #4fd1ff;
  --accent-grad: #7c8cff;
  --accent-soft: rgba(124,140,255,0.16);
  --ok: #3ddc97; --warn: #ffb74d; --danger: #ff6b7a;
  --shadow: 0 10px 40px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.04) inset;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.3);
  --r: 14px; --r-sm: 10px; --r-xs: 7px;
  --rail-w: 236px;
  --ease: cubic-bezier(.22,1,.36,1);
}
[data-theme="light"] {
  --bg: #f3f5fa; --bg-2: #ffffff;
  --panel: rgba(255,255,255,0.78); --panel-solid: #ffffff; --panel-2: #f1f3f8;
  --line: rgba(15,20,40,0.08); --line-2: rgba(15,20,40,0.14);
  --text: #12151f; --text-2: #4b5468; --text-3: #8790a3;
  --accent: #5b6cff; --accent-2: #0ea5e9;
  --accent-grad: #5b6cff;
  --accent-soft: rgba(91,108,255,0.12);
  --shadow: 0 10px 40px rgba(20,30,60,0.12), 0 1px 0 rgba(255,255,255,0.6) inset;
  --shadow-sm: 0 2px 10px rgba(20,30,60,0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow: hidden; font-size: 14.5px; line-height: 1.5;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; flex: none; }
::selection { background: rgba(124,140,255,0.35); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); border: 3px solid transparent; background-clip: content-box; }
[hidden] { display: none !important; }
kbd { font: 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text-2); }

/* Ambient background */
.bg-orbs { display: none; }
.bg-orbs i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.bg-orbs i:nth-child(1) { width: 520px; height: 520px; background: #4d5bff; top: -180px; left: -120px; }
.bg-orbs i:nth-child(2) { width: 460px; height: 460px; background: #1eb8ff; bottom: -200px; right: -100px; opacity: .22; }
.bg-orbs i:nth-child(3) { width: 380px; height: 380px; background: #b26bff; top: 40%; left: 55%; opacity: .14; }
[data-theme="light"] .bg-orbs i { opacity: .18; }

/* Shell */
.shell.bare { grid-template-columns: 1fr; } .shell.bare .rail, .shell.bare .topbar { display: none; }
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100%; transition: grid-template-columns .35s var(--ease); }
.shell.collapsed { --rail-w: 72px; }

.rail { display: flex; flex-direction: column; padding: 14px 12px; border-right: 1px solid var(--line); background: var(--bg-2); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: white; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.rail-section-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 6px 12px 8px; font-weight: 600; white-space: nowrap; }
.rail-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; flex: 1; }
.rail-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 8px; }
.rail-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; white-space: nowrap; width: 100%; text-align: left; transition: background .15s, color .15s; position: relative; }
.rail-item:hover { background: var(--accent-soft); color: var(--text); }
.rail-item.active { background: var(--accent-soft); color: var(--text); }
.rail-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ri-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--text-2); }
.rail-item.active .ri-icon { color: var(--accent); }
.ri-label { overflow: hidden; text-overflow: ellipsis; }
.collapsed .brand-text, .collapsed .ri-label, .collapsed .rail-section-label { opacity: 0; width: 0; padding: 0; }
.collapsed .rail { padding: 14px 10px; }
.collapsed .rail-item { justify-content: center; padding: 9px 0; }
.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.ic-moon { display: none; } [data-theme="light"] .ic-moon { display: block; } [data-theme="light"] .ic-sun { display: none; }
.rail-scrim { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.crumb { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-width: 0; }
.crumb .dim { color: var(--text-3); font-weight: 500; }
.crumb svg { color: var(--accent); }
.cmd-trigger { margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text-3); font-size: 13px; min-width: 240px; transition: border-color .15s, color .15s; }
.cmd-trigger:hover { border-color: var(--line-2); color: var(--text-2); }
.cmd-trigger kbd { margin-left: auto; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.stage { flex: 1; min-height: 0; position: relative; }
.stage > .view { position: absolute; inset: 0; overflow: auto; animation: viewIn .35s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); font-weight: 600; font-size: 13.5px; color: var(--text); transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: color-mix(in srgb, var(--panel-2) 80%, var(--text) 6%); border-color: var(--text-3); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(255,107,122,0.12); border-color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn.danger:hover { background: rgba(255,107,122,0.15); color: var(--danger); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); gap: 2px; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button.active { background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.chip.muted { background: var(--panel-2); color: var(--text-2); }

/* Inputs */
.input, textarea.input, select.input { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 100px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search-wrap .input { padding-left: 34px; }
input[type=range] { accent-color: var(--accent); }
input[type=color] { width: 40px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; background: var(--panel-2); cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Cards & layout */
.page { padding: 26px 28px 40px; max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r); }
.card.pad { padding: 18px; }
.card-title { font-weight: 700; font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-title svg { color: var(--accent); }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.muted { color: var(--text-2); } .dim { color: var(--text-3); } .small { font-size: 12.5px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.mono { font-family: var(--mono); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 24px; color: var(--text-2); gap: 10px; }
.empty-state .big-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); margin-bottom: 6px; }
.empty-state .big-icon svg { width: 30px; height: 30px; }
.empty-state h2 { margin: 0; color: var(--text); font-size: 20px; }
.empty-state p { margin: 0; max-width: 460px; }

/* App tiles (home) */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 34px 34px 30px; background: var(--panel-solid); border: 1px solid var(--line); margin-bottom: 22px; }
.hero h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -.03em; font-weight: 800; }
.hero p { margin: 0 0 20px; color: var(--text-2); font-size: 15.5px; max-width: 560px; }
.hero .row { position: relative; z-index: 1; }
.tile { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); text-align: left; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; position: relative; overflow: hidden; }
.tile:hover { transform: translateY(-2px); border-color: var(--text-3); }
.tile-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--tile-color, var(--accent)); background: color-mix(in srgb, var(--tile-color, var(--accent)) 14%, transparent); }
.tile-icon svg { width: 20px; height: 20px; }
.tile h3 { margin: 0; font-size: 15px; }
.tile p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.45; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.stat b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stat span { color: var(--text-2); font-size: 12.5px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; width: 100%; text-align: left; transition: background .15s; }
.list-row:hover { background: var(--accent-soft); }
.list-row .li-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.list-row .li-main { flex: 1; min-width: 0; } .list-row .li-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .li-main span { color: var(--text-3); font-size: 12px; }

/* Split workspace (sidebar + content) used by Files/Notes/Studio */
.split { display: grid; grid-template-columns: 290px 1fr; height: 100%; }
.split .side { border-right: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 60%, transparent); display: flex; flex-direction: column; min-height: 0; }
.split .content { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.side-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.side-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.side-foot { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; width: 100%; text-align: left; color: var(--text-2); position: relative; }
.item:hover { background: var(--accent-soft); color: var(--text); }
.item.active { background: var(--accent-soft); color: var(--text); }
.item .it-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); color: var(--text-2); flex: none; }
.item.active .it-icon { color: var(--accent); }
.item .it-main { flex: 1; min-width: 0; }
.item .it-main b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.item .it-main span { font-size: 11.5px; color: var(--text-3); }
.item .it-del { opacity: 0; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--text-3); }
.item:hover .it-del { opacity: 1; } .item .it-del:hover { background: rgba(255,107,122,0.15); color: var(--danger); }
.item .it-del svg { width: 14px; height: 14px; }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 55%, transparent); flex-wrap: wrap; min-height: 50px; }
.toolbar .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.toolbar .meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 10px 10px 0 0; color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 220px; border: 1px solid transparent; border-bottom: 0; }
.tab:hover { color: var(--text); background: var(--accent-soft); }
.tab.active { background: var(--bg); color: var(--text); border-color: var(--line); position: relative; }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--bg); }
.tab span { overflow: hidden; text-overflow: ellipsis; }
.tab .tab-x { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); }
.tab .tab-x:hover { background: rgba(255,107,122,0.15); color: var(--danger); }
.tab .tab-x svg { width: 12px; height: 12px; }
.tab.dirty .tab-x::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tab.dirty .tab-x svg { display: none; }
.tab.dirty:hover .tab-x::before { display: none; } .tab.dirty:hover .tab-x svg { display: block; }
.viewer { flex: 1; min-height: 0; position: relative; overflow: auto; }
.viewer.center { display: grid; place-items: center; }

/* Code editor */
.editor { display: grid; grid-template-columns: auto 1fr; height: 100%; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; background: var(--bg-2); overflow: hidden; }
.editor .gutter { padding: 14px 10px 14px 16px; text-align: right; color: var(--text-3); user-select: none; overflow: hidden; white-space: pre; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 60%, transparent); }
.editor textarea { border: 0; outline: 0; resize: none; padding: 14px 16px; background: transparent; color: var(--text); white-space: pre; overflow: auto; tab-size: 2; font: inherit; line-height: inherit; width: 100%; height: 100%; }
.editor textarea::placeholder { color: var(--text-3); }

/* PDF */
.pdf-scroll { padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pdf-page { position: relative; box-shadow: 0 6px 30px rgba(0,0,0,0.35); background: white; }
.pdf-page canvas { display: block; }
.textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(80,120,255,0.35); }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }

/* Image viewer */
.img-stage { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; cursor: grab; background: repeating-conic-gradient(var(--panel-2) 0 25%, transparent 0 50%) 0 0/24px 24px; }
[data-theme="dark"] .img-stage { background: repeating-conic-gradient(rgba(255,255,255,0.03) 0 25%, transparent 0 50%) 0 0/24px 24px; }
.img-stage img { max-width: 100%; max-height: 100%; user-select: none; -webkit-user-drag: none; transition: transform .05s linear; }

/* HTML runner */
.runner { width: 100%; height: 100%; border: 0; background: white; display: block; }

/* Command palette */
.cmd-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.45); backdrop-filter: blur(6px); display: grid; place-items: start center; padding-top: 12vh; animation: fadeIn .15s; }
.cmd { width: min(640px, 92vw); background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: popIn .2s var(--ease); }
.cmd-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmd-input svg { color: var(--text-3); } .cmd-input input { flex: 1; background: none; border: 0; outline: 0; font-size: 16px; }
.cmd-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmd-group { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); padding: 8px 10px 4px; font-weight: 700; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; width: 100%; text-align: left; color: var(--text-2); }
.cmd-item.active, .cmd-item:hover { background: var(--accent-soft); color: var(--text); }
.cmd-item .ci-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; color: var(--accent); }
.cmd-item b { font-weight: 600; } .cmd-item small { color: var(--text-3); margin-left: auto; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.98) } to { opacity: 1; transform: none } }

/* Modal */
.modal-host:empty { display: none; }
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); display: grid; place-items: center; animation: fadeIn .15s; padding: 20px; }
.modal { width: min(520px, 100%); background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; animation: popIn .22s var(--ease); }
.modal h3 { margin: 0 0 8px; font-size: 18px; } .modal p { margin: 0 0 16px; color: var(--text-2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Toast / drop */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; animation: popIn .25s var(--ease); }
.toast svg { color: var(--accent); width: 16px; height: 16px; } .toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: .2s; }
.drop-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(11,13,18,0.6); backdrop-filter: blur(6px); display: none; place-items: center; }
.drop-overlay.show { display: grid; }
.drop-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 60px; border: 2px dashed var(--accent); border-radius: 22px; background: var(--panel-solid); color: var(--text); font-weight: 700; font-size: 18px; }
.drop-card svg { width: 40px; height: 40px; color: var(--accent); }


/* Color picker */
.cp { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.cp-square { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; cursor: crosshair; touch-action: none; border: 1px solid var(--line-2); }
.cp.compact .cp-square { aspect-ratio: 1.3; }
.cp-sq-white { position: absolute; inset: 0; background: linear-gradient(90deg, #fff, rgba(255,255,255,0)); }
.cp-sq-black { position: absolute; inset: 0; background: linear-gradient(0deg, #000, rgba(0,0,0,0)); }
.cp-cursor { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.4); transform: translate(-50%, -50%); pointer-events: none; }
.cp-hue { position: relative; height: 16px; border-radius: 8px; cursor: pointer; touch-action: none; border: 1px solid var(--line-2); background: linear-gradient(90deg, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%); }
.cp-hue-cursor { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: transparent; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); transform: translate(-50%, -50%); pointer-events: none; }
.cp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-preview { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2); flex: none; }
.cp-hex { width: 110px; padding: 7px 10px; }
.cp-fields { display: flex; gap: 6px; margin-left: auto; }
.cp-field { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-3); } .cp-field input { width: 58px; padding: 6px 6px; font-size: 12px; }
.cp-swatch { border-radius: 8px; border: 2px solid var(--line-2); cursor: pointer; flex: none; }
.cp-swatch:hover { border-color: var(--text-3); }
.cp-pop { position: fixed; z-index: 130; width: 250px; padding: 12px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: popIn .15s var(--ease); }

/* Pins + context menu */
.rail-item.pinned .ri-icon { color: var(--accent); }
.ri-pin { margin-left: auto; color: var(--text-3); } .ri-pin svg { width: 12px; height: 12px; }
.collapsed .ri-pin { display: none; }
.tile.pinned { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tile.pinned::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.tile-pin { position: absolute; top: 12px; right: 12px; color: var(--accent); } .tile-pin svg { width: 14px; height: 14px; }
.inline-ic { width: 14px; height: 14px; vertical-align: -2px; color: var(--accent); }
.ctx-menu { position: fixed; z-index: 120; min-width: 190px; padding: 6px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: popIn .15s var(--ease); }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; text-align: left; }
.ctx-item:hover { background: var(--accent-soft); } .ctx-item svg { width: 15px; height: 15px; color: var(--text-2); }

/* Aura promo */
.aura-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 8px 0 2px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-solid); color: var(--text); transition: border-color .15s, background .15s; }
.aura-card:hover { border-color: #c65a3c; background: color-mix(in srgb, #c65a3c 8%, var(--panel-solid)); }
.aura-mark { width: 32px; height: 32px; border-radius: 9px; background: #c65a3c; color: #fff; display: grid; place-items: center; flex: none; }
.aura-mark svg { width: 18px; height: 18px; }
.aura-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.aura-text b { font-size: 13px; } .aura-text span { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aura-arrow { width: 14px; height: 14px; color: var(--text-3); margin-left: auto; flex: none; }
.collapsed .aura-card { padding: 6px; justify-content: center; } .collapsed .aura-text, .collapsed .aura-arrow { display: none; }
.aura-nudge { position: fixed; right: 20px; bottom: 20px; z-index: 85; width: 320px; padding: 16px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); animation: popIn .3s var(--ease); }
.aura-nudge h4 { margin: 0 0 4px; font-size: 14px; } .aura-nudge p { margin: 0 0 12px; font-size: 13px; color: var(--text-2); }

/* Writer */
.doc-page-wrap { flex: 1; overflow: auto; padding: 28px 20px 60px; }
.doc-page { max-width: 820px; margin: 0 auto; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 48px 64px 72px; min-height: 900px; }
.doc-title { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; }
.doc-editor { outline: none; font-size: 16px; line-height: 1.7; min-height: 600px; }
.doc-editor h1 { font-size: 26px; margin: 1em 0 .4em; } .doc-editor h2 { font-size: 21px; margin: 1em 0 .4em; } .doc-editor h3 { font-size: 17px; margin: 1em 0 .4em; }
.doc-editor p { margin: 0 0 .7em; } .doc-editor blockquote { border-left: 3px solid var(--accent); margin: .8em 0; padding: 4px 16px; color: var(--text-2); }
.doc-editor pre { background: var(--panel-2); padding: 12px 14px; border-radius: 8px; font-family: var(--mono); font-size: 13.5px; overflow: auto; }
.doc-editor table { border-collapse: collapse; margin: .8em 0; } .doc-editor td, .doc-editor th { border: 1px solid var(--line-2); padding: 6px 12px; min-width: 60px; } .doc-editor th { background: var(--panel-2); }
.doc-editor img { max-width: 100%; border-radius: 8px; } .doc-editor a { color: var(--accent); text-decoration: underline; } .doc-editor hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.2em 0; }
.doc-editor ul, .doc-editor ol { padding-left: 1.6em; }
@media (max-width: 900px) { .doc-page { padding: 28px 22px 48px; } }

/* Misc app widgets */
.md-preview { padding: 26px 32px; max-width: 820px; line-height: 1.7; }
.md-preview h1, .md-preview h2, .md-preview h3 { letter-spacing: -.01em; margin: 1.2em 0 .5em; } .md-preview h1 { font-size: 28px; } .md-preview h2 { font-size: 22px; } .md-preview h3 { font-size: 17px; }
.md-preview p { margin: .6em 0; } .md-preview code { font-family: var(--mono); font-size: .9em; background: var(--panel-2); padding: 2px 6px; border-radius: 5px; }
.md-preview pre { background: var(--panel-2); padding: 14px 16px; border-radius: 10px; overflow: auto; border: 1px solid var(--line); } .md-preview pre code { background: none; padding: 0; }
.md-preview blockquote { margin: .8em 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--text-2); }
.md-preview table { border-collapse: collapse; margin: 1em 0; } .md-preview th, .md-preview td { border: 1px solid var(--line-2); padding: 6px 12px; text-align: left; } .md-preview th { background: var(--panel-2); }
.md-preview a { color: var(--accent); text-decoration: underline; } .md-preview hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.4em 0; }
.md-preview ul, .md-preview ol { padding-left: 1.5em; } .md-preview img { max-width: 100%; border-radius: 8px; }
.md-preview input[type=checkbox] { margin-right: 6px; }
.data-table { border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { border: 1px solid var(--line-2); padding: 6px 12px; text-align: left; white-space: nowrap; }
.data-table th { background: var(--panel-2); position: sticky; top: 0; font-weight: 700; }
.data-table tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 40%, transparent); }

.only-mobile { display: none !important; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: 260px; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .rail.open { transform: none; }
  .rail-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: .2s; }
  .rail-scrim.show { opacity: 1; pointer-events: auto; }
  .only-mobile { display: inline-grid !important; }
  #btn-collapse { display: none; }
  .cmd-trigger span, .cmd-trigger kbd { display: none; } .cmd-trigger { min-width: 0; }
  .split { grid-template-columns: 1fr; } .split .side { display: none; }
  .split.show-side .side { display: flex; position: absolute; inset: 0; z-index: 5; }
  .page { padding: 18px 16px 30px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; } .hero h1 { font-size: 24px; }
}

/* Colors responsive */
@media (max-width: 820px) {
  .pal-grid { grid-template-columns: 1fr !important; }
  .pal-strip { grid-template-columns: repeat(5, 1fr) !important; height: 130px !important; }
  .pal-strip button { padding: 10px 6px !important; }
  .pal-strip span { font-size: 11px !important; }
}
/* Calculator responsive */
@media (max-width: 900px) { .calc-wrap { grid-template-columns: 1fr !important; } }
@media (max-width: 560px) {
  .calc-pad { gap: 6px !important; padding: 10px !important; }
  .calc-pad .btn { padding: 12px 0 !important; font-size: 15px !important; }
}
/* ---- Mobile refinements ---- */
@media (max-width: 900px) {
  .page { padding: 16px 14px 40px; }
  .page-head h1 { font-size: 22px; }
  .toolbar { gap: 4px; padding: 8px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar .name { max-width: 40vw; }
  .grid[style*="minmax(0, 1.4fr)"], .grid[style*="minmax(0, 1.3fr)"], .grid[style*="minmax(0, 1fr) minmax(0, 1.4fr)"],
  .grid[style*="minmax(0, 2fr)"], .grid[style*="1fr auto 1fr"], .grid[style*="repeat(5, 1fr)"] { grid-template-columns: 1fr !important; }
  .card[style*="maxHeight"], .card[style*="max-height"] { max-height: 360px; }
  .split .side { width: 100%; }
  .doc-page { padding: 22px 18px 40px; min-height: auto; }
  .doc-title { font-size: 24px; }
  .modal { padding: 18px; }
  .cp-fields { margin-left: 0; width: 100%; }
  .cp-field input { width: 100%; }
  .aura-nudge { right: 12px; left: 12px; width: auto; }
  .cmd { width: min(560px, 94vw); }
}
@media (max-width: 620px) {
  .toolbar .seg button { padding: 6px 8px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn.lg { padding: 11px 16px; font-size: 14.5px; }
  .empty-state { padding: 40px 16px; }
  .empty-state h2 { font-size: 18px; }
  .tabs { padding: 6px 8px 0; }
  .tab { max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
