/* ============ TwitterScale — components ============ */

/* ---- pills / badges ---- */
.ts-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 100px; font-weight: 600; white-space: nowrap; line-height: 1; }
.ts-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ts-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 7px; padding: 3px 8px; font-weight: 600; line-height: 1.5; white-space: nowrap; }

/* ---- buttons ---- */
.ts-btn { display: inline-flex; align-items: center; gap: 7px; border-radius: var(--r-sm); font-weight: 600; white-space: nowrap; transition: background .14s, box-shadow .14s, border-color .14s, transform .05s; border: 1px solid transparent; }
.ts-btn:active { transform: translateY(.5px); }
.ts-btn:disabled { opacity: .45; pointer-events: none; }
.ts-btn-md { height: 40px; padding: 0 16px; font-size: 13.5px; }
.ts-btn-sm { height: 33px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.ts-btn-lg { height: 46px; padding: 0 20px; font-size: 14.5px; border-radius: 11px; }

.ts-btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.18); }
.ts-btn-primary:hover { background: var(--accent-strong); }
.ts-btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.ts-btn-secondary:hover { background: var(--surface-hover); border-color: #C4CAD3; }
.ts-btn-ghost { background: transparent; color: var(--text-2); }
.ts-btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.ts-btn-ghost.is-active { background: var(--accent-weak); color: var(--accent-text); }
.ts-btn-danger { background: var(--danger-bg); color: var(--danger); }
.ts-btn-danger:hover { background: #FBDCE3; }
.ts-btn-success { background: var(--active); color: #fff; box-shadow: 0 1px 2px rgba(22,134,75,.3); }
.ts-btn-success:hover { background: #137040; }

.ts-iconbtn { position: relative; width: 40px; height: 40px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); transition: background .14s, color .14s; }
.ts-iconbtn:hover { background: var(--surface-hover); color: var(--text); }
.ts-iconbtn.is-active { background: var(--accent-weak); color: var(--accent-text); }
.ts-iconbtn-badge { position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--danger-dot); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--surface); }

/* ---- cards ---- */
.ts-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.ts-card-head { display: flex; align-items: center; gap: 11px; padding: 18px var(--pad); border-bottom: 1px solid var(--border); }
.ts-card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }

/* ============ shell ============ */
.ts-app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100%; }

.ts-sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 16px; gap: 4px; }
.ts-brand { display: flex; align-items: center; gap: 11px; padding: 8px 8px 18px; }
.ts-logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(145deg, #2563EB, #1D4ED8); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(37,99,235,.4), inset 0 1px 0 rgba(255,255,255,.25); }
.ts-brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.02em; }
.ts-brand-sub { font-size: 10.5px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; }

.ts-nav-label { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 16px 10px 6px; }
.ts-nav-item { display: flex; align-items: center; gap: 13px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 550; font-size: 14px; cursor: pointer; transition: background .13s, color .13s; position: relative; }
.ts-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.ts-nav-item.is-active { background: var(--accent-weak); color: var(--accent-text); font-weight: 650; }
.ts-nav-item.is-active::before { content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ts-nav-count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-hover); padding: 1px 7px; border-radius: 20px; }
.ts-nav-item.is-active .ts-nav-count { background: var(--accent-weak-2); color: var(--accent-text); }
.ts-nav-count.alert { background: var(--danger-bg); color: var(--danger); }

/* primary "create" nav item */
.ts-nav-create { background: var(--accent); color: #fff; font-weight: 650; margin: 4px 0; box-shadow: 0 1px 2px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.18); }
.ts-nav-create:hover { background: var(--accent-strong); color: #fff; }
.ts-nav-create.is-active::before { display: none; }

/* main */
.ts-main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.ts-topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.ts-content { flex: 1; overflow-y: auto; }
.ts-page { padding: 24px; max-width: 1480px; margin: 0 auto; }
.ts-page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.ts-page-title { font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.ts-page-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* search */
.ts-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); min-width: 220px; transition: border-color .14s, background .14s; }
.ts-search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-weak); }
.ts-search input { border: none; outline: none; background: none; flex: 1; font-size: 13px; color: var(--text); min-width: 0; }
.ts-kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-3); box-shadow: 0 1px 0 var(--border-strong); }

/* model selector */
.ts-modelsel { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 10px 0 7px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; transition: background .14s, border-color .14s; white-space: nowrap; }
.ts-modelsel:hover { background: var(--surface-hover); }

/* ---- kpi ---- */
.ts-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.ts-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px 16px; box-shadow: var(--shadow-xs); }
.ts-kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); font-weight: 550; }
.ts-kpi-val { font-size: 27px; font-weight: 700; letter-spacing: -.03em; margin-top: 7px; line-height: 1; }
.ts-kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 11.5px; }

/* ---- table ---- */
.ts-table { width: 100%; border-collapse: collapse; }
.ts-table thead th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 9px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.ts-table tbody td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.ts-table tbody tr { transition: background .1s; cursor: pointer; }
.ts-table tbody tr:hover { background: var(--surface-2); }
.ts-table tbody tr:last-child td { border-bottom: none; }
.ts-handle { font-weight: 600; color: var(--text); }

/* ---- generator format cards ---- */
.ts-fmt { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 16px; cursor: pointer; transition: border-color .16s, box-shadow .16s, transform .12s; display: flex; flex-direction: column; position: relative; }
.ts-fmt:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ts-fmt.is-sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak), var(--shadow-md); }
.ts-fmt-tweet { font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }

/* tweet preview (X-like) */
.ts-tweet { display: flex; gap: 11px; }
.ts-tweet-body { flex: 1; min-width: 0; }
.ts-tweet-head { display: flex; align-items: center; gap: 5px; font-size: 13.5px; }
.ts-poll-opt { border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-top: 7px; position: relative; overflow: hidden; font-weight: 500; }
.ts-poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-weak); z-index: 0; }
.ts-tweet-actions { display: flex; justify-content: space-between; max-width: 320px; margin-top: 12px; color: var(--text-3); }
.ts-tweet-action { display: flex; align-items: center; gap: 5px; font-size: 12px; }

/* ---- queue card ---- */
.ts-queue-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 14px; box-shadow: var(--shadow-xs); transition: border-color .14s, box-shadow .14s; }
.ts-queue-card.is-focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak), var(--shadow-sm); }

/* ---- calendar ---- */
.ts-cal { display: grid; grid-template-columns: 52px repeat(7, 1fr); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.ts-cal-hcell { padding: 9px 10px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface-2); }
.ts-cal-daycol { border-left: 1px solid var(--border); min-height: 100px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.ts-cal-tcell { border-left: 1px solid var(--border); border-top: 1px solid var(--border); padding: 6px; min-height: 64px; position: relative; }
.ts-cal-time { font-size: 10.5px; color: var(--text-3); text-align: right; padding: 8px 8px 0 0; border-top: 1px solid var(--border); }
.ts-cal-post { border-radius: 7px; padding: 6px 8px; font-size: 11.5px; line-height: 1.35; cursor: pointer; border: 1px solid; transition: transform .1s, box-shadow .12s; }
.ts-cal-post:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* ---- warmup ---- */
.ts-wm-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 15px; transition: border-color .14s, box-shadow .14s; }
.ts-wm-day.is-current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.ts-wm-day.is-done { background: var(--surface-2); }
.ts-check { width: 19px; height: 19px; border-radius: 6px; border: 1.6px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .13s, border-color .13s; cursor: pointer; color: #fff; }
.ts-check.on { background: var(--active-dot); border-color: var(--active-dot); }
.ts-check.cur { border-color: var(--accent); }

/* ---- segmented ---- */
.ts-seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px; gap: 2px; }
.ts-seg-item { padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.ts-seg-item.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---- photo grid ---- */
.ts-photo { aspect-ratio: 3/4; border-radius: 10px; position: relative; overflow: hidden; background: var(--surface-hover); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .14s, box-shadow .14s; }
.ts-photo:hover { transform: scale(1.015); box-shadow: var(--shadow-md); }
.ts-photo-tag { position: absolute; left: 7px; bottom: 7px; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 5px; background: rgba(14,17,22,.62); color: #fff; backdrop-filter: blur(4px); }
.ts-photo-pick { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.ts-photo:hover .ts-photo-pick { opacity: 1; }

/* ---- toast ---- */
.ts-toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ts-toast { display: flex; align-items: center; gap: 10px; background: #0E1116; color: #fff; padding: 11px 15px; border-radius: 10px; font-size: 13px; font-weight: 550; box-shadow: var(--shadow-lg); animation: pop .22s ease; }
.ts-toast .ts-toast-ico { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* ---- modal ---- */
.ts-overlay { position: fixed; inset: 0; background: rgba(14,17,22,.42); backdrop-filter: blur(2px); z-index: 150; display: flex; align-items: center; justify-content: center; animation: fadeUp .18s ease; padding: 24px; }
.ts-modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; animation: pop .22s ease; }

/* alert row */
.ts-alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px solid; transition: background .12s; cursor: pointer; }
.ts-alert:hover { filter: brightness(.99); }
.ts-alert-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* wizard */
.wz-q { font-size: 13.5px; font-weight: 650; color: var(--text); letter-spacing: -.01em; }

/* misc */
.ts-divider { height: 1px; background: var(--border); }
.ts-vdivider { width: 1px; align-self: stretch; background: var(--border); }
.ts-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 100px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text-2); }
