:root {
  --navy: #0f2747;
  --navy-2: #173a63;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --border: #e2e8f0;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(15, 39, 71, .06);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.boot { padding: 3rem; color: var(--muted); }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-brand { background: linear-gradient(145deg, #0f2747, #174b83); color: white; padding: clamp(2rem, 7vw, 6rem); display: flex; flex-direction: column; justify-content: center; }
.login-brand h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: 1.02; margin: 1rem 0; letter-spacing: -.04em; }
.login-brand p { color: #cbdcec; font-size: 1.05rem; max-width: 32rem; line-height: 1.7; }
.brand-mark { display: inline-flex; align-items: center; gap: .65rem; font-weight: 800; letter-spacing: -.02em; }
.brand-dot { width: 34px; height: 34px; border-radius: 11px; background: var(--blue); display: inline-grid; place-items: center; color: white; font-size: 1.15rem; }
.login-panel { display: grid; place-items: center; padding: 2rem; background: white; }
.login-card { width: min(100%, 420px); }
.login-card h2 { font-size: 1.8rem; margin: 0 0 .5rem; }
.login-card > p { color: var(--muted); margin-bottom: 2rem; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 3.2rem; }
.password-toggle { position: absolute; right: .45rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: .5rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: var(--navy); color: white; padding: 1.4rem 1rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand-mark { padding: .4rem .65rem 1.6rem; }
.nav { display: grid; gap: .35rem; }
.nav button { border: 0; background: transparent; color: #b8c9dc; text-align: left; padding: .78rem .85rem; border-radius: 10px; display: flex; gap: .7rem; align-items: center; }
.nav button:hover, .nav button.active { background: rgba(255,255,255,.1); color: white; }
.nav button.active { box-shadow: inset 3px 0 #60a5fa; }
.nav-icon { width: 1.2rem; text-align: center; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 1rem .65rem .2rem; }
.sidebar-user strong { display: block; font-size: .9rem; }
.sidebar-user small { color: #9fb4ca; text-transform: capitalize; }
.logout { margin-top: .8rem; width: 100%; border: 1px solid rgba(255,255,255,.16); color: white; background: transparent; padding: .55rem; border-radius: 9px; }
.main { min-width: 0; }
.topbar { height: 74px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 3vw, 2.2rem); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(12px); }
.topbar h1 { font-size: 1.25rem; margin: 0; letter-spacing: -.02em; }
.topbar small { color: var(--muted); }
.view { padding: clamp(1rem, 3vw, 2.2rem); max-width: 1500px; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; min-width: 0; }
.card h2, .card h3 { margin: 0 0 1rem; letter-spacing: -.02em; }
.card h2 { font-size: 1.05rem; }
.card h3 { font-size: .98rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; background: #eff6ff; right: -20px; top: -20px; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; margin-top: .4rem; }
.field { display: grid; gap: .4rem; margin-bottom: .9rem; }
.field label { font-size: .8rem; font-weight: 700; color: #475569; }
.field input, .field textarea, .field select, .inline-input { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: .72rem .8rem; background: white; color: var(--text); outline: none; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.field textarea { resize: vertical; min-height: 110px; }
.field-help { color: var(--muted); font-size: .75rem; display: flex; justify-content: space-between; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; margin: .5rem 0 1rem; }
.check input { width: 18px; height: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 150px; gap: .8rem; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn { border: 1px solid transparent; border-radius: 10px; padding: .68rem 1rem; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: white; border-color: #cbd5e1; color: #334155; }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-success { background: var(--green); color: white; }
.btn-sm { padding: .42rem .65rem; font-size: .76rem; border-radius: 8px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { text-align: left; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: .7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: .8rem .7rem; border-bottom: 1px solid #edf2f7; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.tweet-text { min-width: 240px; max-width: 520px; white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .24rem .55rem; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.status-line { display: flex; align-items: center; gap: .6rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.status-dot.on { background: #10b981; box-shadow: 0 0 0 5px #d1fae5; }
.notice { padding: .9rem 1rem; border-radius: 10px; background: #eff6ff; color: #1e40af; font-size: .84rem; line-height: 1.55; border: 1px solid #dbeafe; }
.notice-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; border: 1px dashed #cbd5e1; border-radius: 10px; }
.step-builder { background: #f8fafc; padding: 1rem; border-radius: 12px; border: 1px solid var(--border); }
.step-grid { display: grid; grid-template-columns: 1fr 100px 120px auto; gap: .6rem; align-items: end; }
.step-list { display: grid; gap: .55rem; margin: 1rem 0; }
.step-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: .7rem; padding: .7rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; }
.step-number { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: white; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.sequence-card { margin-bottom: .8rem; }
.sequence-meta { color: var(--muted); font-size: .82rem; margin: .3rem 0 .8rem; }
.log-message { min-width: 280px; }
.toast { position: fixed; z-index: 50; right: 1.2rem; bottom: 1.2rem; background: var(--navy); color: white; border-radius: 11px; padding: .8rem 1rem; box-shadow: 0 12px 35px rgba(0,0,0,.2); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; max-width: min(420px, calc(100vw - 2rem)); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #991b1b; }
.loading { color: var(--muted); padding: 2rem; }
.filter-bar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar .field { margin: 0; min-width: 170px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-grid { grid-template-columns: 1fr 90px 110px; }
  .step-grid .btn { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 210px; padding: 2rem; }
  .login-brand h1 { font-size: 2.2rem; }
  .login-brand p { display: none; }
  .login-panel { padding: 2rem 1.3rem; }
  .app-shell { display: block; }
  .sidebar { height: auto; position: static; padding: .8rem; }
  .sidebar .brand-mark { padding: .2rem .4rem .8rem; }
  .nav { display: flex; overflow-x: auto; gap: .4rem; padding-bottom: .2rem; }
  .nav button { white-space: nowrap; padding: .55rem .7rem; }
  .nav button.active { box-shadow: none; }
  .sidebar-user { display: none; }
  .topbar { height: 60px; }
  .topbar small { display: none; }
  .view { padding: .85rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .card { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .step-grid { grid-template-columns: 1fr 1fr; }
  .step-grid .field:first-child { grid-column: 1 / -1; }
  .step-grid .btn { grid-column: 1 / -1; }
  .data-table th { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-bottom: 1px solid var(--border); padding: .6rem 0; }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { border: 0; padding: .35rem .2rem; }
  .tweet-text, .log-message { min-width: 0; }
  .mobile-logout { display: inline-flex !important; }
}
@media (min-width: 761px) { .mobile-logout { display: none !important; } }
