/* AdminTg uses an explicit light palette, including native dialogs on dark-OS devices. */
:root{color-scheme:only light}
dialog{color-scheme:only light;color:#20342b;background:#fff;border:1px solid #d7e2dc;border-radius:16px;box-shadow:0 22px 80px #12291f38;max-height:calc(100dvh - 32px)}
dialog::backdrop{background:#18312755;backdrop-filter:blur(3px)}
dialog>header{background:#f7faf8;color:#20342b;border-bottom:1px solid #dce5df}
dialog input,dialog select,dialog textarea{color-scheme:only light;color:#20342b;background:#fff}
dialog input[type=checkbox]{accent-color:#285e4c;cursor:pointer}
dialog a{color:#24634e;text-decoration:underline;text-underline-offset:2px}
dialog button:focus-visible,dialog input:focus-visible,dialog select:focus-visible,dialog textarea:focus-visible{outline:3px solid #3c917655;outline-offset:2px}
dialog button{min-height:36px}
#cabinet-modal{width:min(660px,calc(100vw - 28px));padding:0;overflow:hidden}
#cabinet-modal[open]{display:flex;flex-direction:column}
#cabinet-modal>header{padding:18px 20px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-shrink:0}
#cabinet-modal>header h2{font-size:18px;margin:0;line-height:1.35}
#cabinet-modal>header button{width:36px;height:36px;padding:0;flex-shrink:0}
#cabinet-body{background:#fff;color:#20342b;padding:20px;overflow:auto;min-height:0;line-height:1.6;overflow-wrap:anywhere}
#cabinet-body p{margin:0 0 14px}
#cabinet-body .profile-card>strong{display:block;margin-bottom:8px;color:#193d2d}
#cabinet-body .studio-notice{background:#f0f6f2;border:1px solid #dce8e0;border-radius:10px;padding:12px;color:#294b3a}
#cabinet-body .studio-hint{color:#586d60;font-size:12px}
#cabinet-body .studio-actions,#cabinet-body .cabinet-key-actions{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
#cabinet-body .cabinet-check{display:flex;align-items:flex-start;gap:10px;margin:16px 0;font-size:13px;line-height:1.6;color:#294236}
#cabinet-body .cabinet-check input{width:17px;height:17px;margin:3px 0 0;flex:none}
#cabinet-body .key-warning{background:#fff5df;color:#76500e;border:1px solid #f2dfb7;border-radius:10px;padding:12px;font-size:12px}
#cabinet-body .cabinet-input,#cabinet-body .cabinet-key{width:100%;box-sizing:border-box;border:1px solid #bbcdc1;border-radius:9px;padding:11px 12px;background:#fff;color:#20342b}
#cabinet-body .cabinet-key{font:13px/1.6 ui-monospace,Consolas,monospace;word-break:break-all}
.cabinet-balance{white-space:nowrap;padding:7px 10px;border:1px solid #cee1d5;border-radius:8px;background:#f4faf6;color:#235340;font-size:12px;font-weight:600}
.tai-demo-pricing{padding:22px;overflow:auto;min-height:0;background:#fff;color:#20342b}
.tai-demo-pricing>p{line-height:1.6;margin:8px 0 18px}
.tai-price-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.tai-price-grid article{padding:14px;border:1px solid #dce5df;border-radius:12px;background:#f7faf8}
.tai-price-grid strong{display:block;font-size:15px;margin-bottom:10px}
.tai-price-grid dl{display:grid;grid-template-columns:1fr auto;gap:5px;font-size:12px;margin:0}
.tai-price-grid dd{margin:0;font-weight:600}
.tai-price-grid small{display:block;margin-top:10px;color:#53695c;line-height:1.5}
@media(max-width:700px){#cabinet-modal{max-height:calc(100dvh - 24px)}#cabinet-body{padding:16px}#cabinet-modal>header{padding:14px 16px}#cabinet-body .studio-actions>button{flex:1 1 160px}.tai-price-grid{grid-template-columns:1fr}.tai-demo-pricing{padding:16px}.cabinet-balance{font-size:11px;padding:5px 7px}}

/* The existing mobile header must not overlap the account strip when the balance is visible. */
@media(max-width:800px){
 body{grid-template-rows:auto 72px minmax(0,1fr) 52px}
 .top{display:grid;grid-template-columns:minmax(0,1fr);padding:8px 12px;gap:7px}
 .top .brand{min-height:30px}.top .brand small{display:none}
 .top-actions{min-width:0;display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;gap:6px;padding:0 0 3px;scrollbar-width:thin;align-items:center}
 .top-actions>*{flex:0 0 auto;white-space:nowrap}
 .top-actions #add{order:-2}.top-actions #cabinet-balance{order:-1}
 .top-actions button{min-height:34px}
}

/* Compact Telegram login after the connection method is chosen. */
.auth-dialog.auth-compact{width:min(480px,calc(100vw - 28px));max-height:calc(100dvh - 28px)}
.auth-dialog.auth-compact>header{padding:14px 18px}
.auth-dialog.auth-compact #modalBody{padding:14px 18px 16px}
.auth-dialog.auth-compact .auth-form{gap:9px}
.auth-dialog.auth-compact .auth-form label{gap:4px}
.auth-dialog.auth-compact .auth-actions{margin-top:4px}
.auth-dialog.auth-compact .qr-box{gap:7px}
.auth-dialog.auth-compact .qr-box img{width:210px;height:210px}
.auth-dialog.auth-compact .auth-qr-loading{min-height:110px}
.auth-dialog.auth-phone-compact{width:min(400px,calc(100vw - 28px))}
.auth-dialog.auth-phone-compact .auth-phone-form{width:min(340px,100%);margin:0 auto}
.auth-dialog.auth-phone-compact #auth-phone{font-size:15px;letter-spacing:.15px}
.auth-switch{border-color:#9fc5b2;background:#eef7f2;color:#22543d;font-weight:600}
.auth-switch:hover:not(:disabled){border-color:#6fa98b;background:#e5f2ea}
.auth-switch-row{width:100%;justify-content:center}
.auth-switch-row .auth-switch{width:min(300px,100%);min-height:42px}
.auth-phone-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
.auth-phone-actions>button{min-width:0;min-height:42px}
@media(max-width:520px){.auth-dialog.auth-compact{width:calc(100vw - 20px)}.auth-dialog.auth-phone-compact .auth-phone-form{width:100%}.auth-dialog.auth-compact #modalBody{padding:12px 14px 14px}.auth-dialog.auth-compact .qr-box img{width:190px;height:190px}}

.auth-delivery{display:flex;flex-direction:column;gap:4px;padding:10px 12px;border:1px solid #d7e2dc;border-radius:10px;background:#f7faf8;color:#294236}
.auth-delivery strong{font-size:13px;color:#244b39}
.auth-delivery span{font-size:12px;line-height:1.45}
.auth-delivery small{font-size:11px;color:#617468}
.auth-delivery.telegram-app{background:#eef6ff;border-color:#cbdff4}
.auth-delivery.telegram-app strong{color:#214f77}
#resend-note{display:block;min-height:16px;color:#65766c}
