:root {
  --ink: #18213f;
  --muted: #68708a;
  --soft: #f3f5fb;
  --line: #e4e8f2;
  --white: #fff;
  --navy: #192146;
  --navy-2: #273263;
  --primary: #6d52ed;
  --primary-soft: #eeeaff;
  --cyan: #2fb9c5;
  --orange: #ff9b42;
  --yellow: #ffc857;
  --green: #1fa971;
  --red: #e64d63;
  --shadow: 0 16px 45px rgba(28, 38, 75, .09);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--soft); }
body { min-height: 100vh; margin: 0; background: var(--soft); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-weight: 800; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.25fr) minmax(390px, .75fr); background: var(--white); }
.login-art { position: relative; overflow: hidden; min-height: 100vh; padding: 42px 6vw; color: white; background: radial-gradient(circle at 80% 15%, #34417a 0, var(--navy) 42%, #121831 100%); }
.login-art::after { content: ""; position: absolute; inset: auto -14% -32% 26%; height: 62%; background: linear-gradient(135deg, rgba(109,82,237,.8), rgba(47,185,197,.55)); border-radius: 50% 50% 0 0; transform: rotate(-8deg); filter: blur(1px); }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; }
.orbit-a { width: 520px; height: 520px; right: -210px; top: -160px; }
.orbit-b { width: 780px; height: 780px; right: -320px; top: -280px; }
.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 13px; position: relative; z-index: 1; }
.login-brand div, .sidebar-brand div { display: grid; line-height: 1.05; font-size: 18px; }
.login-brand span:not(.brand-mark), .sidebar-brand span:not(.brand-mark) { opacity: .7; font-size: 13px; }
.brand-mark { display: grid; place-items: center; width: 49px; height: 49px; border-radius: 17px; color: white; font-size: 25px; font-weight: 900; background: linear-gradient(135deg, var(--primary), var(--cyan)); box-shadow: 0 10px 24px rgba(78,72,211,.35); }
.brand-mark.small { width: 42px; height: 42px; font-size: 21px; border-radius: 14px; }
.login-copy { position: absolute; z-index: 2; left: 6vw; bottom: 15vh; max-width: 640px; }
.login-copy .eyebrow { color: var(--yellow); }
.login-copy h1 { margin: 10px 0 18px; font-size: clamp(42px, 5vw, 76px); line-height: .98; letter-spacing: -.045em; }
.login-copy > p:last-child { max-width: 480px; color: rgba(255,255,255,.72); font-size: 20px; line-height: 1.5; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-form { width: min(100%, 390px); }
.login-form h2 { margin: 8px 0; font-size: 31px; letter-spacing: -.03em; }
.login-form > .muted { margin: 0 0 28px; line-height: 1.45; }
.mobile-logo { display: none; align-items: center; gap: 12px; margin-bottom: 36px; }
label { display: grid; gap: 8px; margin: 17px 0; font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: var(--white); padding: 12px 13px; color: var(--ink); outline: none; transition: .18s border, .18s box-shadow; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(109,82,237,.1); }
textarea { resize: vertical; min-height: 100px; }
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 44px; }
.password-field button { position: absolute; right: 6px; top: 6px; border: 0; background: transparent; width: 34px; height: 34px; cursor: pointer; color: var(--muted); }
.button { border: 0; border-radius: 13px; padding: 11px 16px; font-weight: 800; cursor: pointer; transition: transform .16s, box-shadow .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { background: linear-gradient(135deg, var(--primary), #8169f1); color: white; box-shadow: 0 9px 24px rgba(109,82,237,.23); }
.button.secondary { background: var(--primary-soft); color: var(--primary); }
.button.ghost { background: var(--soft); color: var(--ink); }
.button.danger { background: #fff0f2; color: var(--red); }
.button.small { padding: 8px 11px; border-radius: 10px; font-size: 12px; }
.button.wide { width: 100%; margin-top: 12px; padding: 14px; }
.form-error { min-height: 20px; color: var(--red); font-size: 13px; }
.test-login-note { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f0c26d; border-radius: 13px; color: #7b4c00; background: #fff5dc; font-size: 12px; font-weight: 800; }

.app { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 20px; color: white; background: var(--navy); }
.sidebar-brand { padding: 0 8px 28px; }
.desktop-nav { display: grid; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; border: 0; border-radius: 13px; background: transparent; color: rgba(255,255,255,.67); text-align: left; font-weight: 700; cursor: pointer; }
.nav-button span:first-child { width: 25px; text-align: center; font-size: 18px; }
.nav-button.active, .nav-button:hover { color: white; background: rgba(255,255,255,.1); }
.sidebar-profile { margin-top: auto; padding: 14px; border-radius: 15px; background: rgba(255,255,255,.08); }
.profile-name { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { margin-top: 3px; color: rgba(255,255,255,.58); font-size: 11px; }
.app-column { min-width: 0; }
.topbar { position: sticky; z-index: 10; top: 0; height: 92px; display: flex; align-items: center; justify-content: space-between; padding: 15px clamp(22px, 4vw, 56px); background: rgba(244,246,251,.89); backdrop-filter: blur(18px); }
.topbar h1 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.test-mode-label { padding: 8px 10px; border: 1px solid #efbd5d; border-radius: 999px; color: #714400; background: #fff1c9; font-size: 11px; font-weight: 900; letter-spacing: .05em; }
body.test-mode .topbar { box-shadow: inset 0 3px 0 #f0aa27; }
.connection { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; color: var(--muted); background: white; font-size: 12px; font-weight: 700; }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.connection.offline i { background: var(--red); }
.icon-button { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 13px; background: white; box-shadow: 0 3px 14px rgba(36,47,84,.06); cursor: pointer; }
.badge { position: absolute; min-width: 17px; height: 17px; display: grid; place-items: center; right: -4px; top: -4px; border-radius: 9px; color: white; background: var(--red); font-size: 10px; font-weight: 900; }
.content { width: min(100%, 1440px); margin: 0 auto; padding: 10px clamp(22px, 4vw, 56px) 60px; outline: none; }
.content.chat-content { height: calc(var(--app-height, 100dvh) - 92px); display: flex; min-height: 0; padding-bottom: 22px; }
.mobile-nav { display: none; }

.page-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 22px; align-items: start; }
.stack { display: grid; gap: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 3px 0 12px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card { border: 1px solid rgba(227,231,241,.75); border-radius: var(--radius); background: var(--white); box-shadow: 0 7px 26px rgba(27,39,76,.045); }
.card-pad { padding: 20px; }
.urgent-card { position: relative; overflow: hidden; padding: 21px 22px 21px 71px; border: 0; color: white; background: linear-gradient(120deg, #df4660, #ff765d); box-shadow: 0 13px 32px rgba(220,68,95,.2); }
.urgent-card.important { background: linear-gradient(120deg, #6b50e9, #8b6ef1); box-shadow: 0 13px 32px rgba(107,80,233,.2); }
.urgent-card.normal { color: var(--ink); border: 1px solid var(--line); background: white; box-shadow: none; }
.urgent-icon { position: absolute; left: 22px; top: 22px; font-size: 29px; }
.urgent-card h3 { margin: 0 0 6px; font-size: 17px; }
.urgent-card p { margin: 0; opacity: .86; line-height: 1.48; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 11px; opacity: .7; font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat { padding: 17px; }
.stat-icon { display: grid; place-items: center; width: 37px; height: 37px; margin-bottom: 13px; border-radius: 12px; background: var(--primary-soft); font-size: 18px; }
.stat strong { display: block; font-size: 25px; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 12px; }
.activity-card { display: grid; grid-template-columns: 75px minmax(0,1fr) auto; gap: 15px; align-items: center; padding: 17px; cursor: pointer; transition: .18s transform, .18s border; }
.activity-card:hover { transform: translateY(-2px); border-color: #cbc3f7; }
.activity-time { display: grid; justify-items: center; padding: 10px 6px; border-radius: 14px; color: var(--primary); background: var(--primary-soft); font-size: 11px; }
.activity-time b { font-size: 17px; }
.activity-main h3 { margin: 0 0 6px; font-size: 15px; }
.activity-main p { margin: 0; color: var(--muted); font-size: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: #58617b; background: var(--soft); font-size: 10px; font-weight: 750; }
.pill.status-active { color: #087856; background: #e5f8f0; }
.pill.status-ready { color: #2667a9; background: #e8f3ff; }
.pill.status-completed { color: #647087; background: #eef1f5; }
.pill.status-changed { color: #b25912; background: #fff0df; }
.arrow { color: #9da4b7; font-size: 22px; }
.empty { padding: 32px 22px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; display: block; margin-bottom: 8px; }
.quick-list { display: grid; gap: 9px; }
.quick-row { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: 13px; background: var(--soft); }
.quick-row .avatar { flex: 0 0 auto; }
.quick-row-main { min-width: 0; flex: 1; }
.quick-row-main b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-row-main span { color: var(--muted); font-size: 10px; }

.toolbar { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; padding: 14px; }
.toolbar label { min-width: 150px; flex: 1; margin: 0; }
.toolbar .button { margin-left: auto; }
.date-heading { display: flex; align-items: center; gap: 10px; margin: 22px 0 11px; }
.date-heading span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 12px; font-weight: 900; }
.date-heading h2 { margin: 0; font-size: 18px; }

.ranking-hero { overflow: hidden; position: relative; padding: 24px; color: white; background: linear-gradient(135deg, var(--navy), #34417a); }
.ranking-hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -100px; top: -100px; background: rgba(109,82,237,.35); }
.podium { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; margin-top: 18px; }
.podium-place { padding: 14px 9px; border-radius: 16px; text-align: center; background: rgba(255,255,255,.1); }
.podium-place.first { padding-top: 25px; background: linear-gradient(160deg, rgba(255,200,87,.35), rgba(255,255,255,.12)); }
.podium-rank { font-size: 23px; }
.podium-place strong { display: block; margin: 5px 0; font-size: 17px; }
.podium-place small { color: rgba(255,255,255,.65); }
.ranking-list { overflow: hidden; }
.ranking-row { display: grid; grid-template-columns: 42px minmax(0,1fr) 110px; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ranking-row:last-child { border-bottom: 0; }
.rank-number { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); font-size: 12px; font-weight: 900; }
.group-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.group-dot { width: 10px; height: 10px; border-radius: 50%; }
.score { text-align: right; font-weight: 900; }
.score small { color: var(--muted); font-weight: 500; }
.transaction { display: grid; grid-template-columns: 45px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.transaction:last-child { border-bottom: 0; }
.transaction-amount { font-weight: 900; color: var(--green); }
.transaction-amount.negative { color: var(--red); }

.tabs { display: flex; gap: 5px; padding: 5px; width: fit-content; border-radius: 14px; background: #e9ecf4; margin-bottom: 18px; }
.tab { border: 0; border-radius: 10px; padding: 9px 14px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 3px 10px rgba(30,41,78,.08); }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.task-card { padding: 18px; cursor: pointer; }
.task-card h3 { margin: 9px 0 7px; font-size: 16px; }
.task-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.task-top { display: flex; justify-content: space-between; gap: 10px; }
.task-number { color: var(--primary); font-weight: 900; font-size: 12px; }
.deadline { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.leader-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 11px; margin-bottom: 22px; }
.leader-card { min-height: 132px; padding: 15px; cursor: pointer; }
.leader-card h3 { margin: 10px 0 4px; font-size: 14px; }
.leader-card p { margin: 0; color: var(--muted); font-size: 11px; }
.leader-score { float: right; color: var(--primary); font-size: 17px; font-weight: 900; }

.chat-layout { width: 100%; height: auto; min-height: 0; flex: 1; display: grid; grid-template-columns: 300px minmax(0,1fr); overflow: hidden; }
.chat-sidebar { min-height: 0; border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
.chat-sidebar-head { position: sticky; top: 0; z-index: 2; padding: 17px; background: white; border-bottom: 1px solid var(--line); }
.chat-sidebar-head h2 { margin: 0; font-size: 17px; }
.thread-list { padding: 8px; }
.thread-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.thread-item:hover, .thread-item.active { background: var(--primary-soft); }
.thread-item b { display: block; font-size: 12px; }
.thread-item span { color: var(--muted); font-size: 10px; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(135deg, var(--primary), var(--cyan)); font-size: 12px; font-weight: 900; }
.chat-main { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; background: #f8f9fc; }
.chat-head { display: flex; align-items: center; gap: 11px; min-height: 64px; padding: 12px 17px; background: white; border-bottom: 1px solid var(--line); }
.chat-head h3 { margin: 0; font-size: 14px; }
.chat-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 18px; }
.message { display: flex; gap: 9px; margin-bottom: 13px; max-width: 78%; }
.message.mine { margin-left: auto; flex-direction: row-reverse; }
.message-body { padding: 10px 12px; border-radius: 4px 15px 15px 15px; background: white; box-shadow: 0 2px 10px rgba(30,40,75,.05); }
.message.mine .message-body { color: white; background: var(--primary); border-radius: 15px 4px 15px 15px; }
.message-author { margin-bottom: 4px; color: var(--primary); font-size: 10px; font-weight: 800; }
.message.mine .message-author { color: rgba(255,255,255,.75); }
.message-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.42; }
.message-time { margin-top: 4px; text-align: right; opacity: .6; font-size: 9px; }
.message-form { position: sticky; z-index: 3; bottom: 0; display: flex; flex: 0 0 auto; gap: 9px; padding: 12px; background: white; border-top: 1px solid var(--line); }
.message-form textarea { min-width: 0; min-height: 44px; max-height: 110px; flex: 1; margin: 0; resize: none; }
.message-form .button { align-self: end; }

.people-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.person-card { padding: 15px; }
.person-head { display: flex; gap: 11px; align-items: center; }
.person-head h3 { margin: 0; font-size: 13px; }
.person-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.person-meta { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.menu-card { min-height: 130px; padding: 18px; cursor: pointer; }
.menu-card .menu-icon { font-size: 26px; }
.menu-card h3 { margin: 12px 0 5px; font-size: 15px; }
.menu-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.test-warning { display: grid; gap: 4px; margin: 16px 0; padding: 14px; border: 1px solid #efc66f; border-radius: 14px; color: #704600; background: #fff6df; }
.test-warning span { font-size: 11px; }
.test-accounts { display: grid; gap: 5px; margin: -4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.test-accounts b { font-size: 12px; }
.test-accounts span, .test-accounts small { color: var(--muted); font-size: 10px; }
.test-accounts code { padding: 2px 5px; border-radius: 6px; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.test-device { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border-radius: 15px; color: white; background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
.test-device small, .test-device b { display: block; }
.test-device small { margin-bottom: 4px; color: rgba(255,255,255,.65); }
.test-device > span { display: grid; place-items: center; min-width: 58px; height: 42px; border-radius: 13px; background: rgba(255,255,255,.12); font-weight: 900; }
.test-diagnostics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 12px 0 18px; }
.test-diagnostic { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px; border-radius: 12px; background: var(--soft); }
.test-diagnostic > span { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 auto; border-radius: 9px; color: white; background: var(--green); font-weight: 900; }
.test-diagnostic.note > span { background: var(--orange); }
.test-diagnostic b, .test-diagnostic small { display: block; }
.test-diagnostic b { font-size: 11px; }
.test-diagnostic small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.tester-checks { display: grid; gap: 7px; }
.tester-check { display: flex; align-items: flex-start; gap: 9px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: white; font-size: 11px; cursor: pointer; }
.tester-check input { width: 16px; height: 16px; margin: 1px 0 0; padding: 0; flex: 0 0 auto; box-shadow: none; }
.tester-check input:focus { box-shadow: 0 0 0 3px rgba(109,82,237,.12); }
.test-actions { flex-wrap: wrap; }

.modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(13,18,40,.58); backdrop-filter: blur(6px); }
.modal-card { position: relative; width: min(720px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; border-radius: 24px; background: white; box-shadow: 0 30px 100px rgba(9,13,34,.3); }
.modal-close { position: sticky; z-index: 2; float: right; top: 13px; right: 13px; width: 36px; height: 36px; margin: 13px; border: 0; border-radius: 12px; background: var(--soft); font-size: 22px; cursor: pointer; }
#modal-content { padding: 28px; }
.modal-title { margin: 0 45px 5px 0; font-size: 24px; letter-spacing: -.03em; }
.modal-lead { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.detail { padding: 12px; border-radius: 13px; background: var(--soft); }
.detail small { display: block; margin-bottom: 4px; color: var(--muted); }
.detail b { font-size: 13px; }
.detail-section { margin-top: 21px; }
.detail-section h3 { margin: 0 0 10px; font-size: 14px; }
.detail-section p, .detail-section li { color: #4f5872; font-size: 13px; line-height: 1.55; }
.detail-section ol, .detail-section ul { padding-left: 21px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 170px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 13px; }
.check-item { display: flex; align-items: center; gap: 5px; margin: 0; padding: 7px; border-radius: 8px; background: var(--soft); font-size: 11px; }
.check-item input { width: auto; margin: 0; }
.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { min-width: 250px; max-width: 370px; padding: 13px 16px; border-radius: 14px; color: white; background: var(--navy); box-shadow: var(--shadow); animation: toast-in .22s ease-out; font-size: 13px; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.attachments.compact { grid-template-columns: repeat(2, minmax(0, 190px)); gap: 7px; margin: 9px 0 3px; }
.attachment { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--white); text-decoration: none; }
.attachment.image img, .attachment.video video { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #11152a; }
.attachment.image > span, .attachment.video > span { display: block; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 750; }
.attachment.audio { grid-column: 1 / -1; padding: 11px; }
.attachment.audio > div { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.attachment.audio b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.attachment.audio small, .attachment.document small { display: block; color: var(--muted); font-size: 9px; }
.attachment audio { width: 100%; height: 34px; }
.attachment.document { display: flex; align-items: center; gap: 10px; padding: 11px; }
.file-symbol { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-size: 19px; }
.attachment.document b { display: block; font-size: 11px; overflow-wrap: anywhere; }
.urgent-card .attachment { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.94); }
.message.mine .attachment { border-color: rgba(255,255,255,.23); }
.message-body .attachments { max-width: 420px; }

.upload-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; padding: 13px; border: 1px dashed #c8c2ee; border-radius: 15px; background: #faf9ff; }
.upload-panel b, .upload-panel span { display: block; }
.upload-panel b { font-size: 12px; }
.upload-panel span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.file-picker { display: inline-flex; margin: 0; padding: 9px 11px; border-radius: 11px; color: var(--primary); background: var(--primary-soft); cursor: pointer; white-space: nowrap; }
.file-picker input, .chat-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.media-checks { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; max-height: 180px; overflow-y: auto; padding: 7px; border: 1px solid var(--line); border-radius: 13px; }
.media-check { display: flex; align-items: center; gap: 7px; min-width: 0; margin: 0; padding: 8px; border-radius: 9px; background: var(--soft); font-size: 10px; cursor: pointer; }
.media-check input { width: auto; flex: 0 0 auto; margin: 0; }
.media-check span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.empty.mini { padding: 14px; font-size: 11px; }
.drop-zone { position: relative; min-height: 130px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 22px; border: 2px dashed #c9c4ed; border-radius: 18px; color: var(--primary); background: #faf9ff; text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone span { color: var(--muted); font-size: 10px; }

.storage-card { display: grid; grid-template-columns: minmax(250px, .35fr) 1fr; align-items: center; gap: 25px; margin-bottom: 17px; padding: 18px 20px; }
.storage-card b, .storage-card span { display: block; }
.storage-card b { font-size: 14px; }
.storage-card span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.storage-bar { height: 10px; overflow: hidden; border-radius: 999px; background: #e9ecf4; }
.storage-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.media-tabs { max-width: 100%; overflow-x: auto; }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.media-card { min-width: 0; overflow: hidden; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.media-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.media-preview { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(145deg, #242e5b, #131934); }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-cover { font-size: 55px; color: #b8abff; }
.media-cover.document { color: #68d0d7; }
.media-type-icon { position: absolute; display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; color: white; background: rgba(16,22,49,.72); }
.disco-mark { position: absolute; left: 9px; top: 9px; padding: 5px 8px; border-radius: 999px; color: #694c00; background: var(--yellow); font-size: 9px; font-weight: 900; }
.media-info { padding: 14px; }
.media-info h3 { margin: 8px 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.media-info p { margin: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.disco-list { display: grid; gap: 10px; }
.disco-track { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px; }
.track-number { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: var(--primary); background: var(--primary-soft); font-weight: 900; }
.track-main { min-width: 0; }
.track-main b, .track-main span { display: block; }
.track-main b { font-size: 12px; }
.track-main span { margin: 3px 0 8px; color: var(--muted); font-size: 9px; }
.track-main audio, .track-main video { width: min(100%, 560px); max-height: 180px; }
.leader-photo { width: 105px; height: 105px; float: right; margin: 0 0 15px 15px; border-radius: 22px; object-fit: cover; }
.chat-file { display: grid; place-items: center; align-self: end; width: 44px; height: 44px; flex: 0 0 auto; margin: 0; border-radius: 13px; color: var(--primary); background: var(--primary-soft); cursor: pointer; font-size: 22px; }
.template-link { display: block; margin: 15px 0; padding: 13px 15px; border-radius: 13px; color: var(--primary); background: var(--primary-soft); text-decoration: none; font-weight: 800; }
.import-alert { display: grid; gap: 5px; margin: 12px 0; padding: 13px; border-radius: 13px; font-size: 11px; }
.import-alert.error { color: #a62f44; background: #fff0f3; }
.import-alert.warning { color: #9b561a; background: #fff4e7; }
.import-alert.success { color: #087856; background: #e8f8f1; }
.import-table-wrap { max-height: 340px; overflow: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; }
.import-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.import-table th { position: sticky; top: 0; z-index: 1; padding: 9px; color: white; background: var(--navy); text-align: left; }
.import-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 88px minmax(0,1fr); }
  .sidebar { padding-inline: 14px; }
  .sidebar-brand div, .desktop-nav .nav-label, .sidebar-profile { display: none; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .nav-button { justify-content: center; padding: 13px 8px; }
  .nav-button span:first-child { width: auto; }
  .leader-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .people-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .media-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .login-screen { display: block; min-height: 100svh; }
  .login-art { display: none; }
  .login-panel { min-height: 100svh; padding: 28px 22px; }
  .mobile-logo { display: flex; }
  .app { display: block; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .topbar { height: 76px; padding: 12px 17px; }
  .topbar h1 { font-size: 21px; }
  .topbar .eyebrow { font-size: 9px; }
  .connection span { display: none; }
  .test-mode-label { padding: 7px 8px; font-size: 9px; }
  .content { padding: 6px 14px 30px; }
  .content.chat-content { height: calc(var(--app-height, 100dvh) - 148px - env(safe-area-inset-bottom)); padding-bottom: 6px; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6,1fr); padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
  .mobile-nav .nav-button { display: grid; justify-items: center; gap: 2px; padding: 4px 1px; color: #848ba0; background: transparent; font-size: 9px; }
  .mobile-nav .nav-button span:first-child { font-size: 18px; }
  .mobile-nav .nav-button.active { color: var(--primary); }
  .page-grid { display: block; }
  .page-grid > * + * { margin-top: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .activity-card { grid-template-columns: 66px minmax(0,1fr); }
  .activity-card .arrow { display: none; }
  .task-grid, .more-grid, .people-grid { grid-template-columns: 1fr; }
  .leader-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .media-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .storage-card { grid-template-columns: 1fr; gap: 11px; }
  .attachments { grid-template-columns: 1fr; }
  .media-checks { grid-template-columns: 1fr; }
  .disco-track { grid-template-columns: 35px minmax(0,1fr); }
  .disco-track > .button { grid-column: 2; justify-self: start; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .toolbar label { min-width: 0; }
  .toolbar .button { margin: 0; }
  .ranking-row { grid-template-columns: 38px minmax(0,1fr) 85px; }
  .chat-layout { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .chat-sidebar { display: none; border: 0; }
  .chat-layout.show-list .chat-sidebar { display: block; }
  .chat-layout.show-list .chat-main { display: none; }
  .chat-back { display: grid !important; }
  .message { max-width: 90%; }
  .modal { padding: 0; align-items: end; }
  .modal-card { width: 100%; max-height: 94svh; border-radius: 24px 24px 0 0; }
  #modal-content { padding: 23px 18px 30px; }
  .form-grid { display: block; }
  .detail-grid { grid-template-columns: 1fr; }
  .test-diagnostics { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .toast-region { left: 12px; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}
