:root{
  --bg-app:#f4f7fb;
  --bg-app-2:#eef2ff;
  --surface:rgba(255,255,255,.82);
  --surface-2:#ffffff;
  --surface-soft:rgba(248,250,252,.92);
  --text:#0f172a;
  --text-soft:#475569;
  --text-muted:#64748b;
  --line:rgba(15,23,42,.10);
  --line-strong:rgba(15,23,42,.18);
  --accent:#2563eb;
  --accent-2:#7c3aed;
  --accent-soft:rgba(37,99,235,.12);
  --ok:#16a34a;
  --danger:#dc2626;
  --warning:#f59e0b;
  --shadow:0 20px 50px rgba(15,23,42,.08);
  --shadow-strong:0 24px 70px rgba(15,23,42,.14);
  --radius-sm:12px;
  --radius-md:16px;
  --radius-lg:20px;
  --radius-xl:26px;
  --topbar-h:72px;
  --sidebar-gap:16px;
}
html[data-theme="dark"]{
  --bg-app:#09111f;
  --bg-app-2:#0f172a;
  --surface:rgba(17,24,39,.78);
  --surface-2:#121b2d;
  --surface-soft:rgba(15,23,42,.92);
  --text:#edf2ff;
  --text-soft:#cbd5e1;
  --text-muted:#94a3b8;
  --line:rgba(255,255,255,.08);
  --line-strong:rgba(255,255,255,.16);
  --accent:#60a5fa;
  --accent-2:#a78bfa;
  --accent-soft:rgba(96,165,250,.16);
  --ok:#34d399;
  --danger:#fb7185;
  --warning:#fbbf24;
  --shadow:0 20px 50px rgba(2,6,23,.38);
  --shadow-strong:0 30px 80px rgba(2,6,23,.50);
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 680px at 10% -10%, rgba(96,165,250,.14), transparent 60%),
    radial-gradient(900px 560px at 100% 0%, rgba(167,139,250,.11), transparent 56%),
    linear-gradient(180deg, var(--bg-app), var(--bg-app-2));
}
body.ui-lock{overflow:hidden}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:none}
img{max-width:100%;display:block}
code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:rgba(148,163,184,.14);padding:2px 6px;border-radius:8px}

.container{max-width:1180px;margin:0 auto;padding:0}
.stack{display:flex;flex-direction:column;gap:12px}
.stack-xl{display:flex;flex-direction:column;gap:18px}
.small{font-size:12px;color:var(--text-muted)}
.hint,.muted{font-size:13px;line-height:1.55;color:var(--text-muted)}
.nowrap{white-space:nowrap}
.space-top{margin-top:14px}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.grid-gap-lg{gap:18px}
@media(max-width:980px){.grid-2{grid-template-columns:1fr}}

.card,
.widget,
.side-card,
.ui-modal-card,
.ui-panel-card,
.modal-card,
.msg-list,
.msg-panel,
.role-item,
.action-card,
.metric-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow);
  backdrop-filter:blur(14px);
}
.card{padding:18px;margin-top:16px}
.glass-card{background:linear-gradient(180deg,var(--surface),rgba(255,255,255,.55))}
html[data-theme="dark"] .glass-card{background:linear-gradient(180deg,var(--surface),rgba(15,23,42,.74))}

label{display:block;margin:0 0 8px;color:var(--text-soft);font-weight:600}
input,textarea,select,.input,.ui-input{
  width:100%;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface-2);
  color:var(--text);
  outline:none;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
input:focus,textarea:focus,select:focus,.input:focus,.ui-input:focus{
  border-color:rgba(37,99,235,.55);
  box-shadow:0 0 0 4px rgba(37,99,235,.12);
}
textarea{min-height:120px;resize:vertical}
input::placeholder,textarea::placeholder{color:var(--text-muted)}
.input-sm{padding:9px 12px;border-radius:12px}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:42px;
  padding:10px 16px;
  border-radius:14px;
  border:1px solid rgba(37,99,235,.22);
  background:linear-gradient(180deg, rgba(37,99,235,.16), rgba(37,99,235,.12));
  color:var(--text);
  cursor:pointer;
  font-weight:700;
  transition:transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.btn:hover{transform:translateY(-1px);box-shadow:0 12px 28px rgba(37,99,235,.14)}
.btn:disabled{opacity:.65;cursor:not-allowed;transform:none}
.btn.btn-ghost{
  background:var(--surface-soft);
  border-color:var(--line);
}
.btn.danger{background:rgba(220,38,38,.12);border-color:rgba(220,38,38,.26)}
.btn.primary{background:linear-gradient(180deg, rgba(37,99,235,.18), rgba(124,58,237,.14));border-color:rgba(37,99,235,.28)}
.btn-sm{min-height:34px;padding:8px 12px;border-radius:12px;font-size:13px}
.btn-block{width:100%}

.flash{border-radius:16px;padding:12px 14px;margin:0 0 14px;border:1px solid var(--line)}
.flash.ok{background:rgba(22,163,74,.10);border-color:rgba(22,163,74,.22)}
.flash.err{background:rgba(220,38,38,.10);border-color:rgba(220,38,38,.22)}

.app-body{min-height:100vh}
.topbar{
  position:sticky;top:0;z-index:60;
  display:flex;align-items:center;gap:16px;
  min-height:var(--topbar-h);
  padding:14px 18px;
  background:rgba(255,255,255,.72);
  border-bottom:1px solid var(--line);
  backdrop-filter:blur(18px);
}
html[data-theme="dark"] .topbar{background:rgba(9,17,31,.72)}
.brand{display:flex;align-items:center;gap:10px;color:var(--text);font-weight:800}
.brand-mark{
  width:34px;height:34px;border-radius:12px;
  display:inline-grid;place-items:center;
  color:var(--accent);
  background:rgba(37,99,235,.10);
  border:1px solid rgba(37,99,235,.18)
}
.brand-name{font-size:1.05rem;letter-spacing:.2px}
.topnav{display:flex;align-items:center;justify-content:center;gap:18px;flex:1;min-width:0}
.topnav-link{padding:8px 10px;border-radius:12px;color:var(--text-soft);font-weight:700}
.topnav-link:hover,.topnav-link.active{background:var(--accent-soft);color:var(--text)}
.top-actions{display:flex;align-items:center;gap:10px}
.icon-btn{
  appearance:none;border:1px solid var(--line);background:var(--surface-soft);color:var(--text);
  width:42px;height:42px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;
  box-shadow:0 8px 22px rgba(15,23,42,.08);font-size:16px;line-height:1
}
.icon-btn:hover{background:rgba(255,255,255,.92)}
html[data-theme="dark"] .icon-btn:hover{background:rgba(15,23,42,.94)}
.avatar,.avatar-sm,.avatar-lg{
  border-radius:999px;border:1px solid var(--line-strong);
  background:linear-gradient(135deg, rgba(37,99,235,.22), rgba(124,58,237,.18));
  display:grid;place-items:center;font-weight:800;color:var(--text)
}
.avatar{width:42px;height:42px;overflow:hidden}
.avatar-sm{width:42px;height:42px;flex:0 0 42px;overflow:hidden}
.avatar-lg{width:64px;height:64px;flex:0 0 64px;overflow:hidden;font-size:1.25rem}
.avatar-sm span,.avatar-lg span{opacity:.95}
.top-login{white-space:nowrap}

.shell{display:grid;grid-template-columns:280px minmax(0,1fr);gap:18px;padding:18px}
.main{min-width:0}
.sidebar{align-self:flex-start;position:sticky;top:calc(var(--topbar-h) + 8px);min-width:0;max-height:calc(100dvh - var(--topbar-h) - 24px)}
.side-card{padding:16px;max-height:inherit;overflow:auto;overscroll-behavior:contain}
.sidebar-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.sidebar-title{font-size:1.1rem;font-weight:900;margin-bottom:8px}
.sidebar-hint{font-size:13px;line-height:1.5;color:var(--text-muted)}
.role-pill{display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border-radius:999px;font-weight:800;border:1px solid var(--line);background:var(--surface-soft);color:var(--text)}
.role-admin{color:#c2410c;background:rgba(251,146,60,.10);border-color:rgba(251,146,60,.22)}
.role-teacher{color:#0f766e;background:rgba(45,212,191,.10);border-color:rgba(45,212,191,.22)}
.role-user{color:#6d28d9;background:rgba(139,92,246,.10);border-color:rgba(139,92,246,.22)}
.side-group{padding-top:14px;margin-top:14px;border-top:1px solid var(--line)}
.side-group-title{margin:0 0 10px 10px;font-size:12px;letter-spacing:.08em;text-transform:uppercase;font-weight:900;color:#556987}
.side-menu{display:flex;flex-direction:column;gap:6px}
.side-link{display:flex;align-items:center;padding:11px 12px;border-radius:14px;color:var(--text);transition:background .16s ease, transform .16s ease}
.side-link:hover,.side-link.active{background:var(--accent-soft);transform:translateX(1px)}
.side-footer{padding-top:16px;margin-top:16px;border-top:1px solid var(--line)}
.sidebar-overlay{position:fixed;inset:0;background:rgba(2,6,23,.42);backdrop-filter:blur(2px);opacity:0;transition:opacity .18s ease;z-index:70}
.sidebar-overlay.show{opacity:1}

.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.page-head.compact{margin-bottom:18px}
.page-title{margin:0;font-size:clamp(1.9rem,3vw,2.75rem);line-height:1.08;font-weight:900}
.page-subtitle{margin-top:6px;color:var(--text-muted);line-height:1.55;max-width:860px}
.page-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;flex-wrap:wrap}
.section-head.compact{align-items:flex-start}
.section-title{margin:0;font-size:1.15rem;font-weight:900}
.section-sub{margin-top:4px;color:var(--text-muted);font-size:13px;line-height:1.45}

.hub-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap;margin-top:0}
.hero-user{display:flex;align-items:flex-start;gap:14px;max-width:720px}
.hero-eyebrow{font-size:12px;letter-spacing:.08em;text-transform:uppercase;font-weight:900;color:var(--accent)}
.hero-title{font-size:1.5rem;font-weight:900;margin-top:2px}
.hero-sub{color:var(--text-soft);line-height:1.58;margin-top:6px}
.hero-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;min-width:min(100%,420px)}
.mini-stat{padding:14px;border:1px solid var(--line);border-radius:16px;background:var(--surface-soft)}
.mini-stat-k{font-size:12px;color:var(--text-muted);margin-bottom:4px}
.mini-stat-v{font-size:1.35rem;font-weight:900}
.action-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:18px 0}
.compact-grid{margin-top:0}
.action-card{padding:18px;color:var(--text);transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}
.action-card:hover{transform:translateY(-2px);border-color:rgba(37,99,235,.26);box-shadow:var(--shadow-strong)}
.action-title{font-weight:900;font-size:1.03rem}
.action-text{margin-top:8px;color:var(--text-muted);line-height:1.56}
.hub-layout{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:18px;align-items:start}
.quick-panel{margin-top:0}
.agenda-list{display:flex;flex-direction:column;gap:10px}
.agenda-item{padding:12px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line)}
.agenda-title{font-weight:800}
.agenda-sub{font-size:13px;color:var(--text-muted);margin-top:3px}

.feed{display:flex;flex-direction:column;gap:14px}
.tweet{display:flex;gap:12px;padding:16px;border:1px solid var(--line);border-radius:18px;background:var(--surface);box-shadow:var(--shadow)}
.tweet-main{min-width:0;flex:1}
.tweet-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tweet-author{font-weight:900}
.tweet-meta{font-size:12px;color:var(--text-muted)}
.tweet-title{display:inline-block;margin-top:6px;font-size:1.15rem;font-weight:900;color:var(--text)}
.tweet-text,.tweet-body,.post-content{margin-top:10px;color:var(--text-soft);line-height:1.72;white-space:pre-wrap}
.small-body{font-size:.95rem}
.tweet-cover{display:block;margin-top:12px;border-radius:18px;overflow:hidden;border:1px solid var(--line);background:rgba(148,163,184,.10)}
.tweet-cover img{width:100%;max-height:420px;object-fit:cover}
.tweet-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.link-card{margin-top:0;color:var(--text)}
.link-card-title{font-weight:900;margin-bottom:6px}
.link-card-body{color:var(--text-muted);line-height:1.55}
.comment-card{padding:12px 14px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line)}
.post-card-single{margin-top:0}

.chat-list{display:flex;flex-direction:column;gap:10px}
.chat-item{display:flex;align-items:center;gap:10px;padding:12px;border-radius:16px;background:var(--surface-soft);border:1px solid var(--line);color:var(--text)}
.chat-body{min-width:0}
.chat-title{font-weight:800}
.chat-last{font-size:12px;color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}

.messenger{display:grid;grid-template-columns:320px minmax(0,1fr);gap:18px;align-items:stretch}
.messenger-shell{min-height:calc(100dvh - var(--topbar-h) - 84px)}
.msg-list,.msg-panel{margin-top:0;padding:0;overflow:hidden}
.msg-list{display:flex;flex-direction:column;min-height:0}
.msg-list-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px;border-bottom:1px solid var(--line)}
.msg-list-title{font-size:1.1rem;font-weight:900}
.msg-list-sub{font-size:13px;color:var(--text-muted);margin-top:4px}
.msg-items{display:flex;flex-direction:column;padding:8px;overflow:auto;min-height:0}
.msg-item{display:flex;align-items:center;gap:10px;padding:12px;border-radius:16px;color:var(--text)}
.msg-item:hover,.msg-item.active{background:var(--accent-soft)}
.msg-item-main{min-width:0;flex:1}
.msg-item-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.msg-item-title{font-weight:900;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.msg-item-time{font-size:11px;color:var(--text-muted);white-space:nowrap}
.msg-item-sub{margin-top:4px;color:var(--text-muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.unread-pill{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;padding:0 8px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px;font-weight:800}
.msg-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:16px;border-bottom:1px solid var(--line)}
.msg-title{font-weight:900;font-size:1.08rem}
.msg-sub{margin-top:4px;font-size:13px;color:var(--text-muted);line-height:1.45}
.msg-body{flex:1;min-height:360px;max-height:calc(100dvh - 320px);overflow:auto;padding:16px;background:rgba(148,163,184,.04)}
.msg-compose{padding:14px;border-top:1px solid var(--line)}
.compose-form{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:end}
.compose-stack{display:flex;flex-direction:column;gap:10px;min-width:0}
.msg-textarea{min-height:88px}
.emoji-row{display:flex;gap:8px;flex-wrap:wrap}
.emoji-btn{display:inline-flex;align-items:center;justify-content:center;min-width:34px;height:34px;border-radius:10px;border:1px solid var(--line);background:var(--surface-soft);cursor:pointer}
.compact-file{margin:0}
.bubble-row{display:flex;margin:8px 0}
.bubble-row.me{justify-content:flex-end}
.bubble{max-width:min(78%,720px);padding:12px 14px;border-radius:18px;border:1px solid var(--line);background:var(--surface-2);box-shadow:0 10px 24px rgba(15,23,42,.06)}
.bubble.me{background:linear-gradient(135deg, rgba(37,99,235,.18), rgba(124,58,237,.12))}
.bubble-author{font-size:12px;font-weight:900;color:var(--text-muted);margin-bottom:4px}
.bubble-text{white-space:pre-wrap;line-height:1.65}
.bubble-time{margin-top:8px;font-size:11px;color:var(--text-muted);text-align:right}
.bubble-tools{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap;margin-top:8px}
.message-attachments{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.media-thumb{display:block;width:116px;height:116px;border-radius:14px;overflow:hidden;border:1px solid var(--line);background:var(--surface-soft)}
.media-thumb img{width:100%;height:100%;object-fit:cover}
.attachment-chip{display:inline-flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--surface-soft);color:var(--text)}
.reactions-row{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.reaction-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;background:rgba(148,163,184,.14);font-size:12px}

.files-grid{display:grid;grid-template-columns:420px minmax(0,1fr);gap:16px;align-items:start}
@media(max-width:1100px){.files-grid,.hub-layout,.action-grid,.hero-stats{grid-template-columns:1fr}.messenger{grid-template-columns:1fr}.compose-form{grid-template-columns:1fr}.msg-body{max-height:none}.topnav{display:none}.shell{grid-template-columns:1fr}}
.file-control{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px;border-radius:14px;border:1px dashed var(--line-strong);background:var(--surface-soft)}
.file-control input[type="file"]{display:none}
.file-btn{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:10px 14px;border-radius:12px;border:1px solid var(--line);background:var(--surface-2);font-weight:700;cursor:pointer}
.file-name{font-size:13px;color:var(--text-muted);min-width:160px}
.file-upload,.file-list{margin-top:0}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:18px}
.table{width:100%;border-collapse:separate;border-spacing:0;min-width:720px}
.table thead th{position:sticky;top:0;background:rgba(248,250,252,.92);z-index:1}
html[data-theme="dark"] .table thead th{background:rgba(15,23,42,.94)}
.table th,.table td{padding:12px 14px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
.table th{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted)}
.table-zebra tbody tr:nth-child(2n){background:rgba(148,163,184,.06)}
.user-row-card{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line)}
.user-row-name{font-weight:900}
.user-row-sub{font-size:13px;color:var(--text-muted);margin-top:4px}
.role-badge{display:inline-flex;align-items:center;justify-content:center;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.05em;border:1px solid var(--line)}
.role-badge.role-admin{background:rgba(251,146,60,.12);border-color:rgba(251,146,60,.22);color:#c2410c}
.role-badge.role-teacher{background:rgba(16,185,129,.12);border-color:rgba(16,185,129,.22);color:#047857}
.role-badge.role-user{background:rgba(139,92,246,.12);border-color:rgba(139,92,246,.22);color:#6d28d9}
.inline-form{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px}
.metric-card{padding:18px}
.metric-k{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted)}
.metric-v{margin-top:8px;font-size:2rem;font-weight:900}
.check-list{display:flex;flex-direction:column;gap:12px}
.check-item{display:flex;gap:12px;align-items:flex-start;padding:12px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line)}
.check-item span{font-size:1.1rem;line-height:1.4}

.empty{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:18px;border:1px dashed var(--line-strong);border-radius:18px;background:rgba(148,163,184,.05)}
.empty.compact{padding:14px}
.empty.tall{min-height:320px;align-items:center;text-align:center}
.empty-title{font-size:1rem;font-weight:900}
.empty-text{margin-top:6px;color:var(--text-muted);line-height:1.6}
.empty-actions{margin-top:12px}
.badge{display:inline-flex;align-items:center;padding:5px 10px;border-radius:999px;font-size:12px;font-weight:800;border:1px solid var(--line);background:var(--surface-soft)}
.public-hero{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr);gap:16px;align-items:stretch}
.public-title{font-size:clamp(2rem,4vw,3.2rem);line-height:1.02;margin:0}
.public-sub{margin-top:8px;color:var(--text-soft);font-size:1.05rem;line-height:1.65;max-width:820px}
.public-actions{display:flex;gap:10px;flex-wrap:wrap}
.public-card{margin-top:0}

.ui-modal,.ui-panel{position:fixed;inset:0;z-index:90;display:grid;place-items:center;padding:20px;background:rgba(2,6,23,.36);backdrop-filter:blur(4px)}
.ui-modal[hidden],.ui-panel[hidden],.modal[aria-hidden="true"]{display:none}
.ui-modal-card{width:min(760px,100%);max-height:min(84vh,780px);overflow:hidden;display:flex;flex-direction:column}
.ui-modal-head,.ui-panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;border-bottom:1px solid var(--line)}
.ui-modal-title{font-size:1.08rem;font-weight:900}
.ui-modal-body,.ui-panel-body{padding:16px 18px;overflow:auto;display:flex;flex-direction:column;gap:12px}
.ui-results{display:flex;flex-direction:column;gap:10px;min-height:120px}
.ui-item,.ui-note{display:flex;gap:12px;align-items:flex-start;padding:12px;border-radius:14px;background:var(--surface-soft);border:1px solid var(--line);color:var(--text)}
.ui-item-badge{display:inline-flex;align-items:center;justify-content:center;min-width:56px;height:28px;border-radius:999px;background:var(--accent-soft);font-size:12px;font-weight:900}
.ui-item-main{min-width:0;flex:1}
.ui-item-title,.ui-note-title{font-weight:900}
.ui-item-sub,.ui-note-sub,.ui-empty{font-size:13px;color:var(--text-muted);line-height:1.5}
.ui-panel{place-items:stretch;justify-items:end}
.ui-panel-card{width:min(420px,100%);height:100%;border-radius:0;display:flex;flex-direction:column}

.modal{position:fixed;inset:0;z-index:100}
.modal.open{display:block}
.modal-backdrop{position:absolute;inset:0;background:rgba(2,6,23,.46)}
.modal-card{position:relative;max-width:980px;margin:6vh auto;overflow:hidden}
.modal-head,.modal-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;border-bottom:1px solid var(--line)}
.modal-foot{border-top:1px solid var(--line);border-bottom:none}
.modal-body{padding:16px 18px;background:var(--surface-soft)}
.modal-frame{width:100%;height:70vh;border:0;border-radius:16px;background:var(--surface-2)}
.modal-img{width:100%;height:auto;border-radius:16px;border:1px solid var(--line)}
.modal-media{width:100%;border-radius:16px}

.check-row{display:flex;align-items:center;gap:10px;margin-top:14px}
.check-row input{width:auto}
.form-card{max-width:760px}
.table-card{margin-top:0}
.btn-row{display:flex;gap:8px;flex-wrap:wrap}

@media(max-width:860px){
  .shell{padding:14px}
  .sidebar{position:fixed;left:var(--sidebar-gap);right:var(--sidebar-gap);top:calc(var(--topbar-h) + 8px);bottom:var(--sidebar-gap);width:auto;max-height:none;z-index:80;transform:translateX(-16px);opacity:0;pointer-events:none;transition:transform .18s ease,opacity .18s ease}
  body.sidebar-open .sidebar{transform:none;opacity:1;pointer-events:auto}
  .side-card{height:100%;max-height:none}
  .hero-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .public-hero{grid-template-columns:1fr}
  .ui-panel{padding:0;justify-items:stretch}
  .ui-panel-card{width:100%;border-radius:0}
}


.form-grid{display:grid;gap:14px}
.form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.media-grid{display:grid;gap:10px}
.media-grid.compact{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}
.file-chip{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;border:1px solid var(--line);background:var(--surface-soft);color:var(--text);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.file-chip:hover{border-color:var(--line-strong);background:var(--surface-2)}
@media(max-width:860px){.form-grid.two{grid-template-columns:1fr}}

/* --- Modal/panel regression hotfix --- */
[hidden],
#ui-search[hidden],
#ui-notify[hidden],
.sidebar-overlay[hidden] {
  display: none !important;
}

/* Ensure notification/search overlays never appear on load */
#ui-search,
#ui-notify {
  isolation: isolate;
}

/* -------------------------
   Music studio page
-------------------------- */
.music-page{display:flex;flex-direction:column;gap:18px;padding-bottom:24px}
.music-stage{
  display:grid;
  grid-template-columns:minmax(0,1.6fr) minmax(260px,.9fr);
  gap:18px;
  background:
    radial-gradient(520px 220px at 10% 10%, rgba(184,134,70,.18), transparent 62%),
    radial-gradient(460px 240px at 82% 18%, rgba(37,99,235,.08), transparent 60%),
    linear-gradient(145deg, rgba(255,255,255,.86), rgba(255,255,255,.64));
}
.music-kicker,.music-panel-label{
  display:inline-flex;align-items:center;gap:8px;
  padding:6px 12px;border-radius:999px;
  border:1px solid rgba(184,134,70,.24);
  background:rgba(184,134,70,.10);
  color:#8a5a18;text-transform:uppercase;letter-spacing:.16em;font-size:11px;font-weight:700;
}
.music-title{font-size:clamp(2rem,3vw,3.4rem);line-height:1.04;margin:12px 0;color:#1b120a}
.music-subtitle{max-width:64ch;color:#5e524a;font-size:15px;line-height:1.6}
.music-stage-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:18px}
.music-stage-metrics{display:grid;grid-template-columns:1fr;gap:12px;align-content:start}
.music-metric{padding:16px 18px;border-radius:18px;border:1px solid rgba(184,134,70,.18);background:rgba(255,255,255,.58);box-shadow:0 14px 34px rgba(28,15,5,.06)}
.music-metric span{display:block;color:#7d6b5e;font-size:12px;text-transform:uppercase;letter-spacing:.12em;margin-bottom:8px}
.music-metric strong{font-size:20px;color:#20140b}
.music-grid{display:grid;grid-template-columns:minmax(320px,420px) minmax(0,1fr);gap:18px;align-items:start}
.music-upload,.music-player,.music-library{border-radius:22px}
.music-panel-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:18px}
.music-panel-head h2{margin:8px 0 0;font-size:26px}
.music-form{display:flex;flex-direction:column;gap:12px}
.music-file-row input[type="file"]{padding:14px 12px;background:rgba(255,255,255,.75)}
.music-upload-preview{display:flex;gap:14px;align-items:center;padding:14px;border-radius:18px;background:rgba(255,255,255,.58);border:1px solid rgba(226,232,240,.88)}
.music-cover-preview{width:96px;height:96px;flex:0 0 96px;border-radius:20px;overflow:hidden;background:linear-gradient(135deg, rgba(184,134,70,.24), rgba(15,23,42,.10));border:1px solid rgba(184,134,70,.18);display:flex;align-items:center;justify-content:center;color:#6a4a1d;font-weight:700;letter-spacing:.08em}
.music-cover-preview img{width:100%;height:100%;object-fit:cover}
.music-upload-meta{display:flex;flex-direction:column;gap:6px;min-width:0}
.music-upload-meta strong,.music-upload-meta span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.music-form-actions{margin-top:6px}
.music-player-stage{display:grid;grid-template-columns:minmax(250px,340px) minmax(0,1fr);gap:22px;align-items:center}
.vinyl-rig{position:relative;aspect-ratio:1/1;display:flex;align-items:center;justify-content:center}
.album-sleeve{
  position:absolute;inset:10% 28% 10% 0;
  border-radius:26px;background:linear-gradient(150deg, rgba(255,255,255,.95), rgba(237,230,223,.86));
  border:1px solid rgba(196,177,162,.32);box-shadow:0 24px 54px rgba(27,18,10,.12);overflow:hidden;z-index:2;
}
.album-sleeve img,.album-fallback{width:100%;height:100%}
.album-fallback{display:flex;align-items:center;justify-content:center;background:
  radial-gradient(circle at 50% 30%, rgba(242,214,175,.66), transparent 50%),
  linear-gradient(135deg, #1f140d, #3b281d 62%, #8a5a18);color:#f7efe6;font-size:64px;font-weight:900;letter-spacing:.08em}
.vinyl-disc{
  position:absolute;right:0;top:50%;transform:translateY(-50%);
  width:72%;aspect-ratio:1/1;border-radius:999px;
  background:
    radial-gradient(circle at 50% 50%, #e4d2ba 0 8%, #2b211a 8.5% 11%, #0b0b0b 11.5% 45%, #1d1d1d 45.5% 48%, #0b0b0b 48.5% 53%, #1d1d1d 53.5% 56%, #0a0a0a 56.5% 100%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.055) 0 1px, rgba(0,0,0,0) 1px 6px);
  box-shadow:0 28px 52px rgba(0,0,0,.18);z-index:1;
}
.vinyl-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:18%;aspect-ratio:1/1;border-radius:999px;background:#ceb896;border:5px solid #2c1f18;box-shadow:0 0 0 12px rgba(255,255,255,.06)}
.music-player-copy h3{font-size:clamp(1.5rem,2vw,2.6rem);line-height:1.06;margin:0 0 8px;color:#1f140c}
.music-player-copy p{margin:0;color:#6c5c52;font-size:15px}
.music-player-kicker{font-size:11px;text-transform:uppercase;letter-spacing:.16em;color:#9a7a52;font-weight:700;margin-bottom:10px}
.music-player-album{margin-top:12px;display:inline-flex;padding:7px 12px;border-radius:999px;background:rgba(184,134,70,.10);border:1px solid rgba(184,134,70,.2);color:#7b5722;font-weight:700}
.music-audio-element{width:100%;margin-top:18px}
.music-player-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.music-player.is-empty .music-empty-state{min-height:260px;display:grid;place-content:center;text-align:center;color:#6c5c52}
.music-library-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.music-track-card{padding:14px;border-radius:20px;border:1px solid rgba(226,232,240,.92);background:linear-gradient(155deg, rgba(255,255,255,.84), rgba(255,255,255,.62));box-shadow:0 16px 34px rgba(20,14,10,.05)}
.music-track-select{appearance:none;width:100%;border:0;background:transparent;padding:0;display:flex;gap:14px;align-items:center;cursor:pointer;text-align:left}
.music-track-art{width:84px;height:84px;flex:0 0 84px;border-radius:18px;overflow:hidden;background:linear-gradient(135deg, rgba(184,134,70,.78), rgba(15,23,42,.16));border:1px solid rgba(184,134,70,.18);display:grid;place-items:center}
.music-track-art img{width:100%;height:100%;object-fit:cover}
.music-track-art-fallback{font-weight:800;font-size:32px;color:#fff;text-shadow:0 4px 18px rgba(0,0,0,.28)}
.music-track-meta{display:flex;flex-direction:column;gap:6px;min-width:0}
.music-track-meta strong,.music-track-meta span,.music-track-meta em{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.music-track-meta strong{font-size:18px;color:#1e140b}
.music-track-meta span{color:#6b5b50;font-size:14px}
.music-track-meta em{font-style:normal;color:#8b724a;font-size:13px}
.music-track-footer{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:14px;padding-top:12px;border-top:1px solid rgba(226,232,240,.9)}
.music-empty-list{padding:18px;border-radius:18px;border:1px dashed rgba(184,134,70,.25);color:#6a5b50;background:rgba(255,255,255,.46)}
.music-page.is-playing .vinyl-disc{animation:vinylSpin 2.8s linear infinite}
.music-page.is-playing .album-sleeve{box-shadow:0 28px 58px rgba(184,134,70,.16), 0 18px 42px rgba(27,18,10,.12)}
@keyframes vinylSpin{from{transform:translateY(-50%) rotate(0deg)}to{transform:translateY(-50%) rotate(360deg)}}
@media (max-width: 1024px){
  .music-grid{grid-template-columns:1fr}
  .music-player-stage{grid-template-columns:1fr}
  .vinyl-rig{max-width:360px;margin:0 auto}
}
@media (max-width: 720px){
  .music-stage{grid-template-columns:1fr}
  .music-library-grid{grid-template-columns:1fr}
  .music-upload-preview{align-items:flex-start;flex-direction:column}
  .music-player-actions,.music-stage-actions,.row{flex-direction:column}
  .row > *{width:100%}
}

.music-feed-card{margin-top:14px;padding:14px;border-radius:20px;border:1px solid var(--line);background:linear-gradient(135deg,rgba(255,255,255,.05),rgba(255,255,255,.02));box-shadow:var(--shadow);position:relative;overflow:hidden}
.music-feed-card::before{content:"";position:absolute;inset:auto -40px -40px auto;width:160px;height:160px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--music-accent,#b88646) 28%, transparent),transparent 70%);opacity:.55;pointer-events:none}
.music-feed-card__media{width:120px;min-width:120px;height:120px;border-radius:18px;overflow:hidden;border:1px solid var(--line);background:rgba(255,255,255,.04);box-shadow:0 12px 28px rgba(15,23,42,.12)}
.music-feed-card__media img,.music-feed-card__fallback{display:block;width:100%;height:100%}
.music-feed-card__fallback{display:grid;place-items:center;font-size:40px;font-weight:900;background:linear-gradient(135deg, color-mix(in srgb,var(--music-accent,#b88646) 32%, rgba(255,255,255,.06)), rgba(15,23,42,.18));color:#fff}
.music-feed-card__body{min-width:0;display:flex;flex-direction:column;gap:10px;position:relative;z-index:1}
.music-feed-card__kicker{display:inline-flex;align-items:center;align-self:flex-start;padding:6px 10px;border-radius:999px;border:1px solid color-mix(in srgb,var(--music-accent,#b88646) 44%, var(--line));background:color-mix(in srgb,var(--music-accent,#b88646) 16%, rgba(255,255,255,.04));font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:var(--accent-ivory,#f7efe6)}
.music-feed-card__title{font-size:1.15rem;font-weight:800;color:var(--text)}
.music-feed-card__meta{color:var(--text-soft);font-size:.95rem}
.music-feed-card__audio{width:100%}
.music-feed-card__actions{display:flex;gap:10px;flex-wrap:wrap}
.tweet .music-feed-card,.story-card .music-feed-card{display:grid;grid-template-columns:120px minmax(0,1fr);gap:16px;align-items:center}
@media (max-width:760px){.tweet .music-feed-card,.story-card .music-feed-card{grid-template-columns:1fr}.music-feed-card__media{width:100%;max-width:220px;height:auto;aspect-ratio:1/1}}
