/* Admin workspace: shared spacing and readable tables in both themes. */
.admin-shell{grid-template-columns:232px minmax(0,1fr)}
.admin-shell .sidebar{padding:28px 16px;gap:26px;max-height:100dvh;overflow:hidden}
.admin-shell .sidebar nav{gap:5px;min-height:0;overflow-y:auto;scrollbar-width:thin;flex:1;align-content:start}
.admin-shell .sidebar>.brand,.admin-shell .sidebar-foot{flex-shrink:0}
.admin-shell .navlink{padding:11px 12px;line-height:1.45}
.admin-shell .navlink svg{flex:0 0 18px}
.admin-shell .sidebar-foot{padding:20px 8px 0}
.admin-shell .sidebar-foot>.flex:not(.account){display:grid;grid-template-columns:1fr 42px;gap:10px}
.admin-shell .sidebar-foot .account>div:last-child{flex:1;min-width:0;overflow-wrap:anywhere}
.admin-shell .sidebar-foot .language-picker{max-width:none;min-width:0;width:100%}
.admin-shell #logout{grid-column:1/-1}
.admin-shell .topbar{height:72px;padding:0 30px}
.admin-shell .content{padding:30px;max-width:1680px}
.admin-shell .page-head{align-items:center;gap:24px;margin-bottom:24px;flex-wrap:wrap}
.admin-shell .page-head>div{min-width:0}
.admin-shell h1{font-size:30px;letter-spacing:-.035em;line-height:1.3}
.admin-shell h2,.admin-dialog h2{font-size:20px;letter-spacing:-.025em;line-height:1.4}
:is(.admin-shell,.admin-dialog) h3{font-size:16px;letter-spacing:-.02em;line-height:1.4}
:is(.admin-shell,.admin-dialog) :is(.panel,.stat){padding:22px;border-radius:12px}
:is(.admin-shell,.admin-dialog) .panel>h2{margin-bottom:18px}
:is(.admin-shell,.admin-dialog) .stack>h3{margin:0}
.admin-shell .content>.panel+.panel,.admin-shell .content>.grid2+.panel,.admin-shell .content>.form-grid+.panel{margin-top:24px}
.admin-shell .panel.order-item{padding:22px;margin-top:24px}
.admin-shell .grid2,.admin-shell .form-grid{gap:22px;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}
.admin-shell .grid2{align-items:stretch}
:is(.admin-shell,.admin-dialog) .stack{gap:18px;min-width:0}
:is(.admin-shell,.admin-dialog) .stack>*{min-width:0}
:is(.admin-shell,.admin-dialog) :is(button,.button){line-height:1.4;min-height:42px}
:is(.admin-shell,.admin-dialog) :is(button,.button) svg{flex-shrink:0}
:is(.admin-shell,.admin-dialog) :is(input,select){height:44px;min-height:44px;padding:10px 12px;line-height:1.4;font-size:14px}
:is(.admin-shell,.admin-dialog) input[type=checkbox]{height:20px;min-height:20px;width:20px}
:is(.admin-shell,.admin-dialog) label{font-size:13px;gap:8px;min-width:0;line-height:1.45}
.admin-shell .toolbar{gap:14px;align-items:end;flex-wrap:wrap;margin-bottom:20px}
.admin-shell .toolbar>input{flex:1 1 240px;min-width:160px;width:auto}
.admin-shell .toolbar>select{flex:0 1 230px;width:auto}
.admin-shell .toolbar>.tag{align-self:center}
.admin-shell .toolbar label{min-width:180px}
.admin-shell .period{gap:8px;flex-wrap:wrap}
.admin-shell .period input{width:148px;max-width:148px}
.admin-shell .stats{gap:16px;margin-bottom:24px}
.admin-shell .stat{display:flex;flex-direction:column;min-width:0}
.admin-shell .stat .value{font-size:clamp(24px,2.2vw,32px);letter-spacing:-1px;line-height:1.3;margin:14px 0 8px;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.admin-shell .stat>.tiny:last-child{margin-top:auto}
.admin-shell .bar-row{grid-template-columns:minmax(100px,145px) minmax(0,1fr) 45px;margin:17px 0;line-height:1.5}
.admin-shell .bar-row>.mono{text-align:right}
:is(.admin-shell,.admin-dialog) .table-scroll{max-width:100%;min-width:0;border:1px solid var(--line);border-radius:10px;overflow:auto}
:is(.admin-shell,.admin-dialog) .panel>.table-scroll+.table-scroll{margin-top:16px}
:is(.admin-shell,.admin-dialog) table{font-size:13px;line-height:1.55;font-variant-numeric:tabular-nums}
:is(.admin-shell,.admin-dialog) th{padding:12px 14px;background:var(--raised);font-size:12px;font-weight:600;line-height:1.4;vertical-align:middle}
:is(.admin-shell,.admin-dialog) td{padding:14px;vertical-align:top}
:is(.admin-shell,.admin-dialog) tbody tr:hover{background:color-mix(in srgb,var(--tint) 35%,transparent)}
:is(.admin-shell,.admin-dialog) td :is(button,.button){min-height:32px;padding:6px 10px;font-size:12px;white-space:nowrap}
:is(.admin-shell,.admin-dialog) .tag{font-family:inherit;font-size:11px;font-weight:600;line-height:1.4;padding:5px 8px}
:is(.admin-shell,.admin-dialog) .table-empty{padding:28px;text-align:center}
.admin-shell .panel.stack>button{justify-self:start}
.admin-shell #prices-form{max-width:1060px}
.admin-shell #prices-form td{vertical-align:middle}
.admin-shell #prices-form input{max-width:180px}
.admin-shell #invite-form>button{grid-column:1/-1;justify-self:start}
.admin-shell #import-queue .table-scroll{margin:0}
.admin-shell #import-queue td{min-width:110px}
.admin-shell #import-queue td:first-child{min-width:240px}
.admin-shell #import-queue td input{margin-top:10px}
.admin-shell #bulk-dropzone{padding:22px;gap:14px}
.admin-shell #bulk-files{height:auto;min-height:48px}
.admin-shell #bulk-cost{max-width:240px}
.admin-shell #apply-bulk-cost{align-self:end}
.admin-shell #inventory-table table{min-width:940px}
.admin-shell #inventory-table td:first-child{min-width:220px}
.admin-shell #inventory-table td:nth-child(2){min-width:130px}
.admin-shell #inventory-table td:last-child{min-width:215px}
.admin-shell #inventory-table .actions{gap:7px}
.admin-shell .order-head h2{margin:0 0 8px;flex-wrap:wrap;gap:10px}
.admin-shell .order-head>.flex{flex-shrink:0;flex-wrap:wrap}
.admin-shell .order-head{align-items:flex-start}
.admin-shell .order-details{gap:20px}
.admin-shell .audit-detail{max-width:680px;min-width:240px;line-height:1.6;word-break:break-word}
.admin-shell .client-analytics-filters{padding:20px;gap:14px;grid-template-columns:120px minmax(160px,1.2fr) 130px minmax(160px,1.2fr) auto}
.admin-shell .client-analytics-stats{gap:16px}
.admin-shell .client-funnel{gap:14px}
.admin-shell .client-funnel>div{padding:12px;background:var(--bg);border:1px solid var(--line);border-radius:9px;justify-content:space-between}
.admin-shell .client-funnel>div .tiny{min-height:38px}
.admin-shell #ca-results .panel h2{margin:0}
.admin-shell #ca-results .grid2 h2{margin-bottom:18px}
.admin-shell #ca-results table{min-width:620px}
.admin-shell #ca-results .grid2 table{min-width:0}
.admin-shell #ca-results .grid2 th{white-space:normal}
.admin-shell #ca-results table td{line-height:1.55}
.admin-shell #ca-results .form-note{max-width:1050px}

/* User list keeps identity, Telegram and recent activity in separate columns. */
.admin-users-toolbar{display:flex;align-items:end;justify-content:space-between;gap:18px;margin-bottom:20px}
.admin-users-toolbar label{width:min(100%,540px)}
.admin-users-toolbar>span{padding-bottom:12px;white-space:nowrap}
#user-table table{min-width:920px;table-layout:fixed}
#user-table th:nth-child(1){width:160px}#user-table th:nth-child(2){width:160px}
#user-table th:nth-child(3){width:134px}#user-table th:nth-child(4){width:145px}
#user-table th:nth-child(5){width:165px}#user-table th:nth-child(6){width:132px}
#user-table :is(th,td){padding:14px 12px}
#user-table td{overflow-wrap:anywhere}
#user-table .user-id{display:flex;align-items:center;gap:7px;min-height:25px;font-weight:600}
#user-table .telegram-badge{width:22px;height:22px}
#user-table .user-key{font-size:11px;line-height:1.6;max-width:100%;letter-spacing:-.1px}
#user-table .telegram-identity{margin:0;gap:4px;font-size:13px;line-height:1.45;max-width:100%}
#user-table .telegram-identity>.tiny{font-size:11px}
.admin-account-cell,.admin-cell-stack{display:grid;gap:7px;min-width:0}
.admin-user-finance{margin:0;display:grid;gap:5px;font-size:12px}
.admin-user-finance>div{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.admin-user-finance dt{color:var(--muted);font-weight:400}
.admin-user-finance dd{margin:0;font-weight:600;white-space:nowrap;font-variant-numeric:tabular-nums}
.admin-order-count{margin-top:6px;text-align:right;font-size:11px}
.admin-user-access{display:grid;justify-items:start;gap:10px}
#user-table td:nth-child(3){overflow-wrap:normal}

/* Admin dialogs use the same sections and keep the close control in reach. */
.admin-dialog{width:min(900px,calc(100vw - 32px));max-height:calc(100dvh - 40px);padding:24px;scrollbar-gutter:stable}
.admin-dialog>.dialog-head{position:sticky;top:-24px;z-index:5;margin:-24px -24px 24px;padding:18px 24px;background:var(--surface);border-bottom:1px solid var(--line);gap:18px}
.admin-dialog>.dialog-head h2{min-width:0;overflow-wrap:anywhere}
.admin-dialog>.dialog-head button{flex:0 0 38px;min-height:38px;width:38px}
.admin-dialog .notice{overflow-wrap:anywhere;line-height:1.6}
.admin-dialog .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.user-dialog{width:min(1160px,calc(100vw - 32px))}
.user-overview{display:grid;grid-template-columns:minmax(220px,1.2fr) minmax(160px,1fr) auto;gap:24px;align-items:start;padding:20px;background:var(--tint);border:1px solid var(--line);border-radius:12px}
.user-overview .telegram-identity{margin:0;max-width:100%}
.user-overview .user-key{max-width:none;font-size:14px}
.user-overview-balance{display:grid;gap:5px;text-align:right;min-width:110px}
.user-management-grid{display:grid;grid-template-columns:minmax(0,1.8fr) minmax(290px,1fr);gap:20px;align-items:start}
.user-management-side{align-content:start}
.user-management-side form button{width:100%}
.user-management-side .notice{padding:14px}
.user-access-actions{border-top:1px solid var(--line);padding-top:18px}
.user-history-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.user-history-grid>section:first-child{grid-column:1/-1}
.user-history-grid td:last-child{white-space:nowrap}
.user-dialog .copy-journal{border:1px solid var(--line);padding:22px}
.user-dialog .copy-summary>div{padding:12px}
.user-dialog .copy-summary strong{font-size:24px}
.user-dialog .copy-log{border:1px solid var(--line);border-radius:9px}
.user-dialog .copy-log .table-scroll{border:0;border-radius:0;max-width:none;overflow:visible}
.user-dialog .copy-log td{min-width:95px}
.user-dialog .copy-log td:first-child{min-width:160px}
.user-dialog .copy-filter{max-width:none}
.user-dialog .user-journal-filters{gap:12px}
.user-dialog .user-journal-events{max-height:440px;scrollbar-gutter:stable}
.user-dialog .user-journal-event{padding:14px;gap:7px;font-size:13px}
.user-dialog .user-journal-event .tiny{font-size:12px}
.user-dialog .user-journal-event strong{font-size:13px}
.user-dialog .user-journal-event button{min-height:26px;padding:2px 7px}
.user-dialog [data-journal-summary]{line-height:1.7}
.user-dialog [data-journal-visit]{flex-wrap:wrap}
.user-dialog [data-journal-more]{justify-self:start}
@media(max-width:850px){.admin-shell .sidebar nav{flex:none;overflow-y:hidden}}

@media(min-width:1800px){#user-table table{table-layout:auto}}
@media(max-width:1250px){.admin-shell{grid-template-columns:210px minmax(0,1fr)}.admin-shell .content{padding:24px}.admin-shell .topbar{padding:0 24px}.admin-shell .client-analytics-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-shell .client-analytics-filters>button{justify-self:start}}
@media(max-width:1050px){.user-management-grid{grid-template-columns:1fr}.user-management-side{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.user-overview{gap:18px}.admin-shell .client-funnel{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:850px){.admin-shell{display:block}.admin-shell .sidebar{max-height:none;height:auto;overflow:visible;gap:18px;padding:18px}.admin-shell .sidebar nav{display:flex;overflow-x:auto;padding-bottom:4px}.admin-shell .sidebar-foot{position:static;padding:14px 0 0;border-top:1px solid var(--line);margin:0}.admin-shell .sidebar-foot .account{display:none}.admin-shell .sidebar-foot>.flex:not(.account){display:flex;flex-wrap:nowrap}.admin-shell .sidebar-foot .language-picker{width:130px}.admin-shell .sidebar-foot .theme-btn{display:inline-flex}.admin-shell #logout{margin-left:auto}.admin-shell .topbar{height:58px}.admin-shell .grid2,.admin-shell .form-grid{grid-template-columns:1fr}.admin-shell .page-head{gap:18px}.admin-shell .period{width:100%}.admin-shell .client-analytics-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.user-overview{grid-template-columns:1fr auto}.user-overview>div:nth-child(2){grid-column:1;grid-row:2}.user-overview-balance{grid-column:2;grid-row:1/3}.user-overview>div:nth-child(2):empty{display:none}}
@media(max-width:620px){.admin-shell .content{padding:22px 14px}.admin-shell .topbar{padding:0 16px}.admin-shell h1{font-size:26px}.admin-shell :is(.panel,.stat){padding:18px}.admin-shell .panel.order-item{padding:18px}.admin-shell .toolbar>*{max-width:100%}.admin-shell .toolbar>select,.admin-shell .toolbar>input{flex:1 1 100%;width:100%}.admin-shell .period{display:grid;grid-template-columns:1fr 12px 1fr}.admin-shell .period input{width:100%;max-width:none;min-width:0}.admin-shell .period button{grid-column:1/-1}.admin-shell .stats,.admin-shell .client-analytics-stats{gap:12px}.admin-shell .client-analytics-filters{grid-template-columns:1fr}.admin-shell .client-funnel{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-users-toolbar{display:grid;gap:10px}.admin-users-toolbar>span{padding:0}.admin-dialog{padding:16px;width:calc(100vw - 20px);max-height:calc(100dvh - 20px)}.admin-dialog>.dialog-head{top:-16px;margin:-16px -16px 18px;padding:16px}.admin-dialog :is(.panel,.copy-journal){padding:16px}.admin-dialog .form-grid,.user-history-grid,.user-management-side{grid-template-columns:1fr}.user-overview{padding:16px;grid-template-columns:1fr}.user-overview-balance{grid-column:auto;grid-row:auto;text-align:left;border-top:1px solid var(--line);padding-top:12px}.user-history-grid>section:first-child{grid-column:auto}.user-management-grid,.user-history-grid{gap:18px}.user-dialog .copy-summary{gap:6px}.user-dialog .copy-summary>div{padding:10px 8px}.user-dialog .copy-summary span{font-size:11px}.user-dialog .user-journal-events{max-height:380px}.user-dialog .user-journal-filters{grid-template-columns:1fr}.user-dialog .user-journal-event{padding:12px}}
