/* Shared surfaces and system theme. This file also owns phone layouts. */
:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-soft: #f3f5fa;
  --input: #ffffff;
  --accent-soft: #edf1ff;
  --muted: #647187;
  --line: #e5e9f0;
  --blue: #3158e5;
  --ink: #222f42;
  --bg: #f7f8fa;
}
.sidebar,.topbar,.panel,.stat,.idea-card,.gate,dialog,.btn,.search {
  background: var(--surface);
}
.btn.primary {background: var(--blue);color:#fff}
.field input,.field textarea,.field select,.skill-row select {
  background:var(--input);color:var(--ink);border-color:var(--line);
}
.search {color:var(--ink)}
.sub,.meta,.stat-top,.stat-note,.field,.panel-foot,.event-card p,.idea-card p,
.profile-card p,.gate p,.footer,.breadcrumb,.eyebrow,.side-caption,.nav button,
.tabs button,.rank-num,.rank-points small,.table th,.date-box small,.skill-row .check {
  color:var(--muted);
}
.quarter,.date-box,.table th,.mini-count {background:var(--surface-soft)}
.nav button.active,.tabs button.active,.rank-row.me,.table tr.current {background:var(--accent-soft);color:var(--blue)}
.nav button:hover {background:var(--surface-soft)}
.idea-row,.table td,.skill-row,.modal-header,.panel-foot,.rank-divider,.divider {border-color:var(--line)}
.access-gate {max-width:400px;padding:28px;box-shadow:none}
.access-gate h1 {font-size:22px;font-weight:600;line-height:1.4;margin:0}
.gate-wrap {min-height:100svh;background:var(--bg)}
button,a,input,select,textarea {-webkit-tap-highlight-color:transparent}
:focus-visible {outline:2px solid var(--blue);outline-offset:3px}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg:#10141d;
    --surface:#1a202c;
    --surface-soft:#232c3b;
    --input:#141b27;
    --ink:#edf1f8;
    --muted:#a5b0c4;
    --line:#303b4e;
    --blue:#8faaff;
    --accent-soft:#283658;
    --green:#7dd6b3;
  }
  .btn {border-color:var(--line)}
  .btn.primary {background:#476de5;color:#fff;box-shadow:none}
  .hero {background:linear-gradient(110deg,#232943,#29243a);border-color:#3b3d59}
  .hero p {color:#bbc1d6}
  .hero .eyebrow {color:#b4acd6}
  .orb {background:linear-gradient(145deg,#4c416b,#2c304b);border-color:#655a83;box-shadow:8px 12px 24px #05091140}
  .orbit {border-color:#655a83}
  .hero-pill {background:#343b51;color:#d4d8ec}
  .spark {color:#b5a3eb}
  .avatar,.stat-icon {background:#2b3553;color:#b0c0f9}
  .avatar.orange {background:#49372e;color:#ffc08f}
  .idea-icon {background:#362d4c;color:#c0a9ec}
  .badge {background:#303a4c;color:#c0cada}
  .badge.blue {background:#293a59;color:#b0c9ff}
  .badge.green {background:#213e36;color:#8bdfba}
  .badge.red {background:#482e36;color:#ffb0ad}
  .badge.orange {background:#453a2c;color:#efc487}
  .badge.purple {background:#39304f;color:#cbb3f4}
  .community-box {background:#252a40;border-color:var(--line)}
  .quarter,.mini-count,.breadcrumb b {color:var(--muted);border-color:var(--line)}
  .info-note {background:#24304a;color:#bac9ed;border-color:#3b4c6c}
  .demo-bar {background:#322b22;border-color:#4f4434;color:#e5c492}
  .demo-bar select {background:#28241e;border-color:#665239;color:#edcf9a}
  .event-card,.events-list .event-card {background:var(--surface);border-color:var(--line)}
  .gate details {color:var(--muted);border-color:var(--line)}
  .form-error {color:#ffafaf}
  .idea-card:hover {border-color:#738ac3}
  dialog {border-color:var(--line)}
  dialog::backdrop {background:#050810b3}
  #toast {background:#e3eaf7;color:#192234}
  #toast.error {background:#f2b1b1;color:#431d24}
}
@media (max-width:760px) {
  :root {--bottom-nav-height:76px}
  body {font-size:15px}
  .topbar {height:64px;position:sticky;top:0;z-index:10;padding:0 18px}
  .top-right {gap:16px}
  .notification {min-width:44px;min-height:44px;align-items:center;justify-content:center}
  .notification i {top:10px;right:10px}
  .content {padding:22px 16px calc(var(--bottom-nav-height) + 30px + env(safe-area-inset-bottom))}
  .page-head {display:flex;flex-direction:column;align-items:stretch;gap:16px;margin-bottom:20px}
  .page-head h1 {font-size:27px;letter-spacing:-.8px;line-height:1.2;margin:0 0 9px;overflow-wrap:anywhere}
  .page-head .eyebrow {display:none}
  .page-head .sub {font-size:14px;max-width:none;line-height:1.6}
  .page-head>.btn {width:100%;min-height:48px;font-size:14px;border-radius:12px}
  .btn {min-height:44px;font-size:14px;padding:11px 16px;border-radius:10px}
  .text-btn {min-height:44px;font-size:13px}
  .hero {padding:22px;min-height:0;border-radius:16px}
  .hero>div:first-child {max-width:100%;width:100%}
  .hero h2 {font-size:23px;line-height:1.25;max-width:100%}
  .hero p {font-size:14px;line-height:1.6;max-width:100%;padding:0}
  .hero br {display:none}
  .hero-art {display:none}
  .hero .eyebrow {font-size:10px}
  .stats {gap:12px}
  .stat {padding:16px;border-radius:14px;min-width:0}
  .stat-top {font-size:12px;line-height:1.4;gap:6px}
  .stat-icon {width:26px;height:26px;flex-shrink:0}
  .stat-value {font-size:30px}
  .stat-note {font-size:11px;line-height:1.5}
  .dashboard-grid {gap:18px}
  .panel {border-radius:16px}
  .panel h3 {font-size:15px;line-height:1.4}
  .panel-head {padding:16px;min-height:64px}
  .panel-head .text-btn {font-size:12px;flex-shrink:0}
  .idea-row {padding:17px 16px;display:grid;grid-template-columns:32px minmax(0,1fr);gap:8px 12px}
  .idea-info h4 {font-size:14px;line-height:1.5;margin-bottom:10px;overflow-wrap:anywhere}
  .idea-row .status-side {grid-column:2;max-width:none;justify-self:start;white-space:normal}
  .meta {font-size:12px;line-height:1.5}
  .badge {font-size:11px;line-height:1.4;padding:5px 8px;white-space:normal}
  .rank-row {min-height:60px;padding:12px 16px}
  .rank-name {font-size:14px}
  .rank-points {font-size:15px}
  .panel-foot {font-size:12px;line-height:1.6;padding:16px}
  .sidebar {padding:6px 4px calc(8px + env(safe-area-inset-bottom));background:var(--surface)}
  .nav {width:100%;align-items:stretch;gap:2px}
  .nav button {min-width:0;flex:1;min-height:54px;gap:5px;padding:7px 0;font-size:10px;line-height:1.2;border-radius:10px}
  .nav button span {max-width:100%;white-space:nowrap}
  .nav button.active {font-weight:650}
  .nav button svg {height:22px;width:22px}
  .nav .badge {font-size:9px;padding:1px 4px;min-width:15px;right:3px;top:0}
  .toolbar {gap:14px;margin-bottom:18px}
  .toolbar .tabs {flex:1;min-width:0;flex-wrap:nowrap;overflow-x:auto;gap:6px;scrollbar-width:none}
  .tabs button {min-height:44px;padding:10px 14px;flex-shrink:0;font-size:13px;white-space:nowrap}
  .search {min-width:0;width:100%;min-height:48px;font-size:16px;border-radius:12px}
  .idea-cards,.events-list {gap:14px}
  .idea-card {padding:19px;gap:16px;border-radius:16px}
  .idea-card h3 {font-size:17px;line-height:1.4;overflow-wrap:anywhere}
  .idea-card p {font-size:14px;line-height:1.6}
  .card-bottom {flex-wrap:wrap}
  .event-card,.events-list .event-card {padding:18px;gap:15px;border-radius:14px}
  .event-card h4,.events-list .event-card h4 {font-size:15px;line-height:1.5}
  .event-card p {font-size:13px;line-height:1.5}
  .events-list .event-card .btn {font-size:13px;min-height:44px;margin-top:12px}
  .date-box {min-width:48px;padding:10px}
  .date-box small {font-size:11px}
  .date-box strong {font-size:22px}
  .form-panel {padding:20px 16px}
  .field {font-size:13px;gap:9px}
  .field input,.field textarea,.field select,.skill-row select {font-size:16px;min-height:48px;border-radius:10px;padding:12px;line-height:1.5}
  .field textarea {min-height:110px}
  .check {min-height:44px;font-size:14px;gap:12px}
  .check input {width:20px;height:20px}
  .check-grid {gap:6px}
  .skill-row {padding:20px 0;gap:12px}
  .skill-row b {font-size:15px;line-height:1.5}
  .skill-row .check {font-size:13px}
  #profile-form>.btn {width:100%;min-height:48px}
  .info-note {font-size:13px;line-height:1.7;border-radius:12px}
  .demo-bar {font-size:10px;gap:10px;padding:8px 12px}
  .demo-bar select {font-size:12px;min-height:36px;max-width:145px}
  dialog {width:100%;max-width:none;margin:auto 0 0;border-radius:22px 22px 0 0;max-height:calc(100dvh - 20px);padding-bottom:env(safe-area-inset-bottom)}
  .modal-header {position:sticky;top:0;background:var(--surface);z-index:1;padding:15px 20px}
  .modal-header h2 {font-size:19px;line-height:1.4}
  .modal-header button {min-height:44px;min-width:44px}
  .modal-body {padding:20px}
  .modal-actions {display:grid;grid-template-columns:1fr 2fr;gap:10px}
  .modal-actions .btn {white-space:normal;min-height:48px;font-size:14px}
  .detail-title {font-size:23px}
  .detail-section p {font-size:15px}
  .detail-section h4 {font-size:12px}
  #toast {bottom:calc(var(--bottom-nav-height) + 14px + env(safe-area-inset-bottom));font-size:14px;line-height:1.5;width:max-content;max-width:calc(100vw - 32px)}
  .access-gate {padding:24px;width:100%;border-radius:16px}
  .access-gate h1 {font-size:22px;text-align:center}
  .access-gate summary {font-size:14px;min-height:44px;align-content:center}
  .gate .btn {min-height:48px;font-size:15px}
  .rating-table .table {table-layout:fixed;white-space:normal}
  .rating-table th,.rating-table td {padding:14px 10px;font-size:14px}
  .rating-table th:first-child,.rating-table td:first-child {width:54px;text-align:center}
  .rating-table th:nth-child(3),.rating-table td:nth-child(3) {width:70px;text-align:right;padding-right:16px}
  .rating-table th:nth-child(n+4),.rating-table td:nth-child(n+4) {display:none}
  .rating-table .person {flex-wrap:wrap;gap:8px;overflow-wrap:anywhere}
  .rating-table .avatar {width:28px;height:28px;font-size:10px}
  .users-table,.activity-table {overflow:hidden}
  .users-table .table,.activity-table .table {white-space:normal}
  .users-table thead,.activity-table thead {display:none}
  .users-table tbody,.activity-table tbody {display:grid}
  .users-table tr,.activity-table tr {display:grid;padding:16px;gap:12px;border-bottom:1px solid var(--line)}
  .users-table td,.activity-table td {padding:0;border:0;font-size:14px;overflow-wrap:anywhere}
  .users-table td::before,.activity-table td::before {content:attr(data-label);display:block;color:var(--muted);font-size:11px;margin-bottom:5px}
  .users-table td:first-child::before {display:none}
  .users-table .person {align-items:flex-start;font-size:15px}
  .users-table .meta {margin-top:6px;word-break:break-word}
  .users-table td:last-child .btn {width:100%;min-height:44px;font-size:14px}
}
@media (max-width:359px) {
  .content {padding-left:12px;padding-right:12px}
  .topbar {padding:0 12px}
  .top-right {gap:5px}
  .quarter {font-size:10px}
  .stat {padding:13px}
  .stat-top {font-size:11px}
  .stat-icon {display:none}
  .panel-head {gap:8px}
  .panel h3 {font-size:14px}
  .nav button {font-size:9px}
}

@media(max-width:760px) {
  :root {--safe-bottom:max(env(safe-area-inset-bottom),var(--tg-content-safe-area-inset-bottom,0px));--safe-top:max(env(safe-area-inset-top),var(--tg-content-safe-area-inset-top,0px))}
  .topbar {height:calc(64px + var(--safe-top));padding-top:var(--safe-top)}
  .sidebar {padding-bottom:calc(8px + var(--safe-bottom))}
  .content {padding-bottom:calc(var(--bottom-nav-height) + 30px + var(--safe-bottom))}
  dialog {padding-bottom:var(--safe-bottom)}
  #toast {bottom:calc(var(--bottom-nav-height) + 14px + var(--safe-bottom))}
}

.nav-mobile-label{display:none}
@media(max-width:760px){.nav .nav-label{display:none}.nav .nav-mobile-label{display:inline}.nav{gap:4px}}

.activity-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.activity-item{padding:20px;display:grid;gap:15px}.activity-item h3{line-height:1.5;overflow-wrap:anywhere}.activity-comment{margin:0;color:var(--muted);font-size:13px;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:760px){.activity-cards{grid-template-columns:1fr}.activity-item{padding:18px}.activity-item>.btn{width:100%}.activity-comment{font-size:14px}}

.activity-view{margin-bottom:20px;gap:8px}
.activity-view button{border:1px solid var(--line);min-height:44px;font-size:13px}
.activity-people{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.activity-person{display:flex;align-items:center;gap:12px;padding:18px;text-align:left;min-width:0}
.activity-person:hover{border-color:var(--blue)}
.activity-person-info{flex:1;min-width:0}
.activity-person b{font-size:14px;line-height:1.5;overflow-wrap:anywhere}
.activity-person>svg{width:18px;color:var(--muted)}
.activity-counts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.activity-counts .badge{font-size:11px}
.participant-heading{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:20px}
.participant-heading h2{font-size:19px;line-height:1.5;margin:0}
.event-info{min-width:0;flex:1}
.event-info h4,.event-info p{overflow-wrap:anywhere;white-space:pre-wrap}
.event-info .btn:disabled{opacity:1;cursor:default;color:var(--green);border-color:var(--line)}
@media(max-width:760px){
  .activity-people{grid-template-columns:1fr}
  .activity-person{padding:16px;gap:10px}
  .activity-person>.avatar{width:32px;height:32px;font-size:10px}
  .activity-counts .badge{font-size:11px;padding:5px 6px}
  .activity-view{flex-wrap:wrap;gap:6px}
  .activity-view button{flex:1;padding:10px;font-size:13px}
  .activity-filters .tabs button{font-size:12px;padding:10px}
  .event-tabs button{padding:10px 12px}
  .event-info>.btn{width:100%;white-space:normal}
}


/* Use orange/blue on light surfaces and the supplied orange/white artwork on dark. */
.brand{padding:0 8px;gap:9px;letter-spacing:0}
.brand-logo{display:grid;place-items:center;flex-shrink:0;width:44px;height:44px;border-radius:12px;background:transparent}
.brand-logo img{display:block;width:34px;height:32px;object-fit:contain}
.brand-title{font-size:25px;font-weight:800;letter-spacing:-1px;white-space:nowrap}

@media(max-width:760px){.mobile-brand{padding:0}.mobile-brand .brand-logo{width:40px;height:40px;border-radius:11px}.mobile-brand .brand-title{font-size:23px}}


.participant-name{display:inline-flex;align-items:center;gap:6px;max-width:100%;vertical-align:middle}
.participant-name>span:first-child{min-width:0;overflow-wrap:anywhere}
.telegram-badge{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex:0 0 20px;border-radius:50%;background:#2aabee;color:#fff;vertical-align:middle}
.telegram-badge svg{display:block;width:12px;height:12px;fill:currentColor;stroke:none}


.audit-entry{display:block;min-width:0;padding:18px 22px;border-top:1px solid var(--line)}
.audit-entry .meta{overflow-wrap:anywhere;word-break:break-word}
@media(max-width:760px){.audit-entry{padding:17px 16px}}


.avatar{overflow:hidden}.avatar img{display:block;width:100%;height:100%;object-fit:cover}
.record-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}.record-actions .btn{flex:1;min-height:44px}
.btn.danger{color:#bd4848;border-color:currentColor}.photo-editor{display:flex;align-items:center;gap:20px}
.avatar.profile-photo{width:88px;height:88px;font-size:28px;flex-shrink:0}
.photo-controls{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.photo-controls p{flex-basis:100%}
.photo-upload{cursor:pointer;position:relative}.photo-file{position:absolute;opacity:0;width:1px;height:1px;overflow:hidden}
@media(prefers-color-scheme:dark){.btn.danger{color:#f2a4a4}}
@media(max-width:760px){.photo-editor{align-items:flex-start;gap:16px}.photo-controls .btn{font-size:13px;flex:1}.photo-controls{min-width:0}.record-actions .btn{white-space:normal}.activity-item .card-top{align-items:flex-start;gap:8px;flex-wrap:wrap}.activity-item .card-top .meta{overflow-wrap:anywhere}}


.photo-crop-editor{display:grid;gap:16px}
.photo-crop-frame{position:relative;width:100%;max-width:340px;aspect-ratio:1;margin:auto;overflow:hidden;border:1px solid var(--line);border-radius:10px;background:#18202f}
#photo-crop-canvas{display:block;width:100%;height:100%;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none}
#photo-crop-canvas:active{cursor:grabbing}
.photo-crop-grid{position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 0 2px #ffffffa0}
.photo-crop-grid::before,.photo-crop-grid::after{content:'';position:absolute;box-sizing:border-box}
.photo-crop-grid::before{left:33.333%;top:0;width:33.333%;height:100%;border-left:1px solid #ffffff80;border-right:1px solid #ffffff80}
.photo-crop-grid::after{left:0;top:33.333%;width:100%;height:33.333%;border-top:1px solid #ffffff80;border-bottom:1px solid #ffffff80}
.photo-crop-tools{display:flex;align-items:center;justify-content:space-between;gap:16px}
#photo-crop-avatar{display:block;width:52px;height:52px;border-radius:50%;border:1px solid var(--line)}
.photo-crop-scale>span{display:flex;align-items:center;justify-content:space-between}
.photo-crop-scale input{width:100%;min-height:36px;margin:0;accent-color:var(--blue);cursor:pointer}
.photo-crop-actions{position:sticky;bottom:-25px;background:var(--surface);padding:14px 0;margin:0;z-index:2;box-shadow:0 -8px 16px var(--surface)}
.photo-crop-actions .btn{flex:1;min-height:44px}
.photo-crop-editor .form-error:empty{display:none}
@media(max-width:760px){.photo-crop-editor{gap:14px}.photo-crop-frame{max-width:320px}.photo-crop-actions{bottom:-20px}.photo-crop-editor .sub{font-size:13px}}


.web-gate{max-width:460px}.web-gate .brand{margin-bottom:28px}.web-gate h1{font-size:25px}
.web-gate-actions{display:flex;align-items:flex-start;flex-direction:column;gap:16px;margin-top:24px}
.web-gate-actions .text-btn{min-height:32px;font-size:13px}
.registration-toggle{display:flex;align-items:center;gap:14px;min-height:48px;cursor:pointer}
.registration-toggle input{width:22px;height:22px;accent-color:var(--blue);flex-shrink:0}
.registration-toggle b{display:block;font-size:14px;font-weight:600;line-height:1.5}
.registration-toggle small{display:block;font-size:12px;color:var(--muted);line-height:1.6;margin-top:4px}
.web-credentials .form-grid{align-items:end}
@media(max-width:760px){.web-gate{padding:24px}.web-gate .field input{font-size:16px}.web-credentials .btn{width:100%}.registration-toggle{align-items:flex-start}.registration-toggle input{margin-top:4px}}
