/* ==========================================================================
   GlobalDebrid v16 — user app (/app)
   ========================================================================== */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.app-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.app-header .brand { font-size: var(--fs-md); }
.user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); }
.user-chip .avatar { width: 30px; height: 30px; font-size: 11px; }
.user-chip .who { display: none; line-height: 1.15; }
.user-chip .who b { display: block; font-size: var(--fs-sm); }
.user-chip .who span { font-size: 11px; color: var(--text-3); }
@media (min-width: 640px) { .user-chip .who { display: block; } }
.app-main { flex: 1; padding: 24px 0 64px; }
@media (min-width: 900px) { .app-main { padding: 32px 0 80px; } }
.app-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .app-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; } }
.app-side { display: grid; gap: 16px; }
@media (min-width: 1000px) { .app-side { position: sticky; top: 88px; } }

/* Quota card */
.quota { display: flex; align-items: center; gap: 18px; }
.quota .ring { width: 92px; height: 92px; }
.quota-meta { min-width: 0; }
.quota-meta .big { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.quota-meta .big small { font-size: var(--fs-md); color: var(--text-3); font-weight: 600; }
.quota-meta p { font-size: var(--fs-xs); margin-top: 6px; }
.plan-card { display: flex; align-items: center; gap: 12px; }
.plan-card .stat-icon { width: 40px; height: 40px; }
.plan-card b { display: block; }
.plan-card span { font-size: var(--fs-xs); color: var(--text-3); }

/* Generator */
.gen-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gen-form .input-row .input { min-height: 48px; font-size: var(--fs-md); }
.gen-form .input-row .btn { min-height: 48px; padding: 0 20px; }
@media (max-width: 640px) { .gen-form .input-row { flex-direction: column; align-items: stretch; } .gen-form .input-row .btn { width: 100%; } }
.result-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.result-card.ok { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.result-card.err { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.result-card .r-title { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.result-card .r-title .stat-icon { width: 32px; height: 32px; flex: 0 0 auto; }
.result-card .r-title .fname { min-width: 0; overflow-wrap: anywhere; }
.result-card .r-title .src { font-size: var(--fs-xs); color: var(--text-3); font-weight: 400; }
.result-card .r-link { display: flex; gap: 8px; align-items: center; }
.result-card .r-link .input { font-family: var(--mono); font-size: var(--fs-xs); min-height: 38px; }
.result-card .r-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .result-card .r-actions .btn { flex: 1; } }
.result-list { display: grid; gap: 10px; }
.batch-summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.drop { display: block; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--text-3); font-size: var(--fs-sm); transition: all var(--t-fast); cursor: pointer; background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.drop .icon { margin: 0 auto 8px; width: 26px; height: 26px; }
.drop b { color: var(--text); }

/* Torrents */
.torrent { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.torrent .t-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.torrent .t-name { font-weight: 600; font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.torrent .t-meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.torrent .progress { height: 6px; }

/* History */
.hist { display: grid; gap: 8px; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.hist-item .stat-icon { width: 34px; height: 34px; flex: 0 0 auto; }
.hist-item .h-body { min-width: 0; flex: 1; }
.hist-item .h-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .h-meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.hist-item .h-actions { display: flex; gap: 4px; flex: 0 0 auto; }

/* Pending */
.pending-hero { text-align: center; padding: 40px 20px; }
.pending-hero .stat-icon { width: 64px; height: 64px; border-radius: var(--r-lg); margin: 0 auto 18px; }
.pending-hero .stat-icon .icon { width: 30px; height: 30px; }
.pending-hero h2 { font-size: var(--fs-xl); margin-bottom: 8px; }
.pending-hero p { max-width: 460px; margin: 0 auto; }

/* Tips */
.tips { display: grid; gap: 10px; }
.tip { display: flex; gap: 10px; font-size: var(--fs-xs); color: var(--text-2); line-height: 1.5; }
.tip .icon { color: var(--primary); flex: 0 0 auto; margin-top: 1px; width: 15px; height: 15px; }
.tip code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* Mobile bottom tabs */
@media (max-width: 640px) {
    .tabs.app-tabs { position: sticky; top: 64px; z-index: 30; background: var(--bg); margin: 0 -20px 16px; padding: 0 20px; }
    .tab { padding: 12px 12px; }
}
