/* SRM SHARE — light theme */
:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e4e7ef;
  --border-strong: #d3d8e4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --success: #059669;
  --success-50: #ecfdf5;
  --danger: #dc2626;
  --danger-50: #fef2f2;
  --amber: #d97706;
  --amber-50: #fffbeb;
  --sky: #0284c7;
  --sky-50: #e0f2fe;
  --emerald: #059669;
  --emerald-50: #d1fae5;
  --violet: #7c3aed;
  --violet-50: #ede9fe;
  --rose: #e11d48;
  --rose-50: #ffe4e6;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .25);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.clip-helper { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

/* ---------- typography & helpers ---------- */
.h1 { font-size: 28px; line-height: 1.2; font-weight: 750; letter-spacing: -.02em; margin: 18px 0 6px; }
.h2 { font-size: 21px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.h3 { font-size: 17px; font-weight: 650; margin: 0 0 6px; }
.h4 { font-size: 15px; font-weight: 650; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.break { overflow-wrap: anywhere; }
.grow { flex: 1; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.kbd { display: inline-block; font: 11px/1 var(--mono); padding: 3px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--text-2); }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; color: var(--text); font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #7c3aed 100%);
  box-shadow: 0 4px 10px rgba(79, 70, 229, .3);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-lg { font-size: 18px; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.brand-lg .brand-mark svg { width: 21px; height: 21px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-600); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: #c3c9d8; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef0f5; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-soft { background: var(--danger-50); color: var(--danger); }
.btn-danger-soft:hover { background: #fee2e2; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-lg { height: 50px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .i { width: 17px; height: 17px; }
.btn.is-done { background: var(--success); color: #fff; border-color: transparent; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-2); flex: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: #eef0f5; color: var(--text); }
.icon-btn.is-on { color: var(--amber); }
.icon-btn.is-on .i { fill: currentColor; }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s; font-size: 16px; /* 16px stops iOS zoom */
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.input::placeholder { color: #94a3b8; }
.input-sm { height: 36px; font-size: 14px; padding: 0 10px; }
.select { width: auto; min-width: 200px; cursor: pointer; }
.input-xl { height: 60px; font-size: 26px; letter-spacing: .3em; }
.textarea { height: auto; min-height: 150px; padding: 12px 14px; line-height: 1.55; resize: vertical; display: block; }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 46px; }
.input-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 36px; border: 0; background: none; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.input-btn:hover { color: var(--text); background: #f1f3f8; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; flex: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 42px; height: 24px; border-radius: 99px; background: #cbd2e0; position: relative; transition: background .2s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.alert-error { background: var(--danger-50); color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: var(--success-50); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--primary-50); color: #3730a3; border: 1px solid var(--primary-100); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.card.narrow { max-width: 420px; margin: 0 auto; width: 100%; }
.state-icon { width: 60px; height: 60px; border-radius: 18px; margin: 4px auto 16px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.state-icon .i { width: 28px; height: 28px; }
.state-icon.ok { background: var(--success-50); color: var(--success); }
.state-icon.bad { background: var(--danger-50); color: var(--danger); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--primary-50); color: var(--primary-600); font-size: 12.5px; font-weight: 600; }
.pill .i { width: 14px; height: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 18px 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1320px; margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; gap: 16px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.search {
  flex: 1; min-width: 0; max-width: 520px; margin: 0 auto; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: #f1f3f8; border: 1px solid transparent; border-radius: 12px; color: var(--muted); transition: background .15s, border-color .15s, box-shadow .15s;
}
.search:focus-within { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; font-size: 15px; color: var(--text); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--success); padding: 4px 9px; border-radius: 99px; background: var(--success-50); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 rgba(5,150,105,.5); animation: pulse 2.4s infinite; }
.sync.is-off { color: var(--muted); background: #eef0f5; }
.sync.is-off .sync-dot { animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(5,150,105,.45); } 70% { box-shadow: 0 0 0 7px rgba(5,150,105,0); } 100% { box-shadow: 0 0 0 0 rgba(5,150,105,0); } }

/* ---------- app layout ---------- */
.app { max-width: 1320px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: grid; gap: 20px; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.library { min-width: 0; }
@media (min-width: 960px) {
  .app { grid-template-columns: 380px minmax(0, 1fr); align-items: start; gap: 28px; padding-top: 28px; }
  .side { position: sticky; top: calc(var(--topbar-h) + 28px); }
}
@media (min-width: 1200px) { .app { grid-template-columns: 420px minmax(0, 1fr); } }

/* ---------- composer ---------- */
.composer { padding: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #f1f3f8; border-radius: 12px; margin-bottom: 14px; }
.seg-btn { height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, color .15s, box-shadow .15s; }
.seg-btn .i { width: 16px; height: 16px; }
.seg-btn.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.title-input { margin-bottom: 10px; height: 42px; font-weight: 600; }
.composer .textarea { min-height: 140px; max-height: 50vh; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 200px; padding: 24px; border: 2px dashed var(--border-strong); border-radius: 14px;
  background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-50); }
.dropzone-icon { width: 52px; height: 52px; border-radius: 16px; background: #fff; display: grid; place-items: center; color: var(--primary); box-shadow: var(--shadow-sm); }
.dropzone-icon .i { width: 24px; height: 24px; }
.dropzone-title { font-weight: 650; font-size: 15.5px; }
.upload-queue { display: flex; flex-direction: column; gap: 8px; }
.upload-queue:not(:empty) { margin-top: 12px; }
.upload { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.upload-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #e5e8f0; overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #4f46e5); border-radius: inherit; transition: width .2s; }
.upload.is-done .upload-bar span { background: var(--success); }
.upload.is-error { border-color: #fecaca; background: var(--danger-50); }
.upload.is-error .upload-bar span { background: var(--danger); }
.upload-status { font-size: 12.5px; color: var(--muted); grid-column: 1 / -1; }

.tip { display: flex; gap: 14px; padding: 16px; }
.tip-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.tip p { margin: 0 0 10px; }

/* ---------- library ---------- */
.library-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -2px; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: all .15s; }
.chip .i { width: 15px; height: 15px; }
.chip:hover { border-color: #b9c0d0; }
.chip.is-active { background: var(--text); border-color: var(--text); color: #fff; }

.item-grid { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 640px) { .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) and (max-width: 1199px) { .item-grid { grid-template-columns: 1fr; } }
@media (min-width: 1200px) { .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.item {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 14px 10px; min-width: 0;
  transition: box-shadow .2s, border-color .2s, transform .2s;
  animation: rise .25s ease-out;
}
.item:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.item.is-pinned { border-color: #fcd34d; box-shadow: 0 0 0 1px #fde68a inset, var(--shadow-sm); }
.item.is-new { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100), var(--shadow); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.item-head { display: flex; align-items: flex-start; gap: 12px; }
.type-badge { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--primary-50); color: var(--primary); }
.type-badge .i { width: 19px; height: 19px; }
.type-file { background: var(--sky-50); color: var(--sky); }
.type-image { background: var(--emerald-50); color: var(--emerald); }
.type-video { background: var(--violet-50); color: var(--violet); }
.type-audio { background: var(--amber-50); color: var(--amber); }
.type-pdf { background: var(--rose-50); color: var(--rose); }
.item-titles { flex: 1; min-width: 0; }
.item-title { font-size: 15px; font-weight: 650; margin: 0; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.item-meta span { display: inline-flex; align-items: center; gap: 4px; }
.item-meta .i { width: 13px; height: 13px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px; }
.tag-new { background: var(--primary); color: #fff; }
.tag-off { background: #eef0f5; color: var(--muted); }
.item-body { margin: 12px 0 6px; cursor: pointer; min-width: 0; }
.item-text {
  margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.item-text.lead { color: var(--text); font-size: 15px; }
.thumb { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; background: #eef0f5; border: 1px solid var(--border); }
.file-chip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.file-ext { min-width: 46px; height: 46px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; font: 700 11.5px var(--mono); text-transform: uppercase; background: #fff; border: 1px solid var(--border); color: var(--text-2); }
.file-chip-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; line-height: 1.35; }
.item-actions { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 8px; border-top: 1px solid #f0f2f7; }
.item-actions .btn { height: 36px; padding: 0 12px; font-size: 13.5px; }
.item-actions .spacer { flex: 1; }

.skeletons { display: grid; gap: 14px; }
.skeleton { height: 150px; border-radius: var(--radius); background: linear-gradient(90deg, #eceff5 25%, #f6f7fb 50%, #eceff5 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--border); border-radius: var(--radius); background: rgba(255,255,255,.6); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.empty-icon .i { width: 26px; height: 26px; }
#load-more { margin-top: 18px; }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 230px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .12s ease-out;
}
.menu-head { padding: 8px 12px 10px; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 14.5px; font-weight: 500; color: var(--text); }
.menu button:hover, .menu button:focus-visible { background: #f1f3f8; outline: none; }
.menu button .i { color: var(--muted); }
.menu button.danger { color: var(--danger); }
.menu button.danger .i { color: var(--danger); }
.menu form { margin: 0; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal.wide { width: min(820px, calc(100vw - 24px)); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head .h2 { margin: 2px 0 0; font-size: 18px; overflow-wrap: anywhere; }
.modal-head .grow { min-width: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@media (max-width: 639px) {
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh; }
  .modal-foot .btn { flex: 1; }
}

.section-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: 14px; height: 44px; background: var(--surface-2); min-width: 0; }
.passcode-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.passcode { font: 700 28px/1 var(--mono); letter-spacing: .18em; padding: 12px 16px; border-radius: 12px; background: var(--primary-50); color: var(--primary-600); border: 1px solid var(--primary-100); }
.share-grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .share-grid { grid-template-columns: minmax(0, 1fr) 200px; align-items: start; } }
.qr-panel { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.qr { width: 172px; height: 172px; background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--border); }
.qr svg { width: 100%; height: 100%; display: block; }
.share-off { opacity: .45; pointer-events: none; }
.viewer-text { margin: 0; padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font: 15px/1.6 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 55vh; overflow-y: auto; user-select: text; -webkit-user-select: text; }
.viewer-edit { min-height: 260px; }
.viewer-media { border-radius: 12px; border: 1px solid var(--border); background: #0f172a; max-height: 60vh; margin: 0 auto; }
.viewer-media.img { background: var(--surface-2); object-fit: contain; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; margin: 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.code-input { font: 700 26px var(--mono); letter-spacing: .3em; text-align: center; text-transform: uppercase; height: 60px; }

/* ---------- lock screen ---------- */
.lock-btn .i { width: 16px; height: 16px; }
.lockscreen {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 10%, #ede9fe 0%, transparent 55%),
    #f4f6fb;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lock-card { width: 100%; max-width: 380px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lock-card .brand { margin-bottom: 18px; }
.lock-clock { font-size: 64px; font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.lock-date { font-size: 16px; margin-bottom: 18px; }
.lock-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--border); font-weight: 650; font-size: 14px; box-shadow: var(--shadow-sm); }
.lock-badge .i { width: 15px; height: 15px; color: var(--primary); }
.lock-card form { width: 100%; }
.lock-card .stack { margin-top: 8px; }
.lock-card .input { height: 50px; }
.lock-signout { margin-top: 10px; }
.lock-card .stack > p { margin: 0; }
.lock-card .pin-input { height: 60px; font: 700 30px var(--mono); letter-spacing: .5em; text-align: center; padding-left: calc(14px + .5em); }
body.is-locked { overflow: hidden; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 14px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .2s ease-out; }
.toast .i { color: #a5b4fc; }
.toast.ok .i { color: #6ee7b7; }
.toast.err { background: #7f1d1d; }
.toast.err .i { color: #fca5a5; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast button { border: 0; background: rgba(255,255,255,.14); color: #fff; font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 9px; white-space: nowrap; }
.toast button:hover { background: rgba(255,255,255,.24); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.drop-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(79, 70, 229, .12); backdrop-filter: blur(2px); border: 3px dashed var(--primary); pointer-events: none; }
.drop-overlay div { display: flex; align-items: center; gap: 12px; padding: 18px 26px; background: #fff; border-radius: 16px; font-weight: 700; font-size: 18px; color: var(--primary); box-shadow: var(--shadow-lg); }
.drop-overlay .i { width: 26px; height: 26px; }

/* ---------- login ---------- */
.page-login, .page-center, .page-share {
  background:
    radial-gradient(1200px 500px at 10% -10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #ede9fe 0%, transparent 55%),
    var(--bg);
}
.login-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.login-card { width: 100%; max-width: 920px; display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; }
.login-main { padding: 32px 28px; }
.login-main > p { margin: 0 0 22px; }
.login-main .alert { margin-bottom: 16px; }
.login-side { padding: 28px; background: linear-gradient(180deg, #f8f9ff, #f3f4fb); border-top: 1px solid var(--border); }
.steps { margin: 10px 0 18px; padding-left: 20px; color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.pair-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px; background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.pair-box .qr { width: 188px; height: 188px; }
.pair-code { font-size: 26px; font-weight: 800; letter-spacing: .28em; color: var(--text); padding-left: .28em; }
.pair-box p { margin: 0; }
.open-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 14px; }
.open-code .input { width: 150px; }
@media (min-width: 820px) {
  .login-card { grid-template-columns: 1.1fr 1fr; }
  .login-main { padding: 48px 44px; }
  .login-side { border-top: 0; border-left: 1px solid var(--border); padding: 40px 36px; }
}

/* ---------- centered pages & public share ---------- */
.center-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.center-wrap .card { padding: 28px 24px; }
.center-wrap .brand { margin: 0 auto 18px; display: flex; justify-content: center; }
.share-wrap { max-width: 760px; margin: 0 auto; min-height: 100dvh; padding: calc(16px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
.share-top { display: flex; justify-content: center; padding: 8px 0; }
.share-wrap > .card { padding: 28px 24px; }
.share-card { display: flex; flex-direction: column; gap: 18px; }
.share-head { display: flex; gap: 14px; align-items: flex-start; }
.share-head .type-badge { width: 46px; height: 46px; border-radius: 14px; }
.share-meta { min-width: 0; }
.share-meta p { margin: 2px 0 0; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.share-meta .i { width: 14px; height: 14px; }
.text-body { margin: 0; padding: 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font: 15.5px/1.65 var(--font); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto; }
.preview { border-radius: 14px; border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); }
.preview img { margin: 0 auto; max-height: 60vh; object-fit: contain; }
video.preview { width: 100%; max-height: 60vh; background: #0f172a; }
.preview-audio { width: 100%; }
.file-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.share-foot { margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 6px; }
.share-foot .i { width: 15px; height: 15px; }

/* ---------- installer ---------- */
.install-wrap { max-width: 640px; margin: 0 auto; padding: 40px 16px; }
.install-wrap .card { padding: 28px; }
.install-wrap h1 { margin-top: 18px; }
.checklist { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.checklist .ok { color: var(--success); }
.checklist .bad { color: var(--danger); }
.codebox { font: 12.5px/1.5 var(--mono); background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 12px; overflow-x: auto; white-space: pre; }

/* ---------- device-specific ---------- */
.touch-only { display: none; }
@media (hover: none) and (pointer: coarse) {
  .desktop-only { display: none !important; }
  .touch-only { display: inline; }
  .item-actions .btn { height: 40px; }
  .icon-btn { width: 42px; height: 42px; }
}
@media (max-width: 639px) {
  .desktop-only { display: none !important; }
  .topbar-inner { gap: 10px; }
  .sync-label { display: none; }
  .lock-label { display: none; }
  .lock-btn { width: 38px; padding: 0; }
  .sync { padding: 6px; }
  .h1 { font-size: 25px; }
  .composer-actions .btn-primary { flex: 1; }
  .login-main { padding: 28px 22px; }
  .login-side { padding: 24px 22px; }
}
@media (max-width: 479px) { .brand span:last-child { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
