:root {
  color-scheme: light;
  --ink: #17213c;
  --muted: #6e778b;
  --paper: #ffffff;
  --canvas: #f2f4f8;
  --line: #dfe3eb;
  --accent: #ff6b3d;
  --accent-dark: #e65227;
  --blue: #3157d5;
  --success: #14805e;
  --danger: #c63d46;
  --shadow: 0 22px 60px rgba(23, 33, 60, .1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(49, 87, 213, .12), transparent 28rem),
    radial-gradient(circle at 100% 26%, rgba(255, 107, 61, .12), transparent 30rem),
    var(--canvas);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { width: calc(100% - 32px); max-width: 860px; margin: 0 auto; padding: 38px 0 72px; }
.brand { display: flex; align-items: center; gap: 15px; margin: 0 0 28px; }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px;
  color: #fff; font: 800 23px/1 Georgia, serif;
  background: linear-gradient(145deg, var(--ink), var(--blue)); box-shadow: 0 12px 28px rgba(49, 87, 213, .24);
}
.brand h1 { margin: 1px 0 0; font-size: 23px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.card { background: rgba(255, 255, 255, .94); border: 1px solid rgba(223, 227, 235, .9); border-radius: 24px; box-shadow: var(--shadow); }
.login-card { max-width: 520px; margin: 9vh auto 0; padding: 38px; }
.step { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
h2 { margin: 12px 0 7px; font-size: clamp(22px, 4vw, 29px); letter-spacing: -.035em; }
.muted { color: var(--muted); line-height: 1.65; margin: 0; overflow-wrap: anywhere; }
form label, .content-panel > label { display: block; margin: 27px 0 9px; font-size: 13px; font-weight: 750; }
input[type="text"], input[type="tel"], #mobile, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; outline: none; color: var(--ink); background: #fbfcfe;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#mobile { padding: 16px 17px; font-size: 18px; letter-spacing: .08em; }
textarea { padding: 16px; resize: vertical; min-height: 180px; line-height: 1.65; }
input:focus, textarea:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(49, 87, 213, .1); }
.primary, .ghost {
  border: 0; border-radius: 13px; padding: 13px 18px; font-weight: 750; transition: transform .15s, opacity .15s, background .15s;
}
.primary { color: #fff; background: var(--ink); box-shadow: 0 10px 22px rgba(23, 33, 60, .18); }
.primary:hover { background: #263253; transform: translateY(-1px); }
.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.login-card .primary { width: 100%; margin-top: 17px; padding: 15px; }
.ghost { color: var(--ink); background: #eef1f6; }
.workspace { display: grid; gap: 18px; }
.account-bar { display: flex; align-items: center; gap: 24px; padding: 19px 22px; }
.account-bar strong { display: block; margin-top: 3px; }
.account-stats { display: flex; gap: 9px; margin-left: auto; }
.account-stats span { padding: 9px 12px; border-radius: 11px; background: #f2f4f8; color: var(--muted); font-size: 12px; }
.account-stats b { color: var(--ink); font-size: 16px; }
.composer { padding: clamp(23px, 5vw, 38px); }
.section-head { display: flex; justify-content: space-between; gap: 20px; }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 5px; margin-top: 27px; border-radius: 15px; background: #eef1f6; }
.segment { border: 0; border-radius: 11px; padding: 12px; color: var(--muted); background: transparent; font-weight: 750; }
.segment.active { color: var(--ink); background: #fff; box-shadow: 0 5px 15px rgba(23, 33, 60, .08); }
.counter { margin-top: 8px; color: var(--muted); text-align: right; font-size: 12px; }
.file-drop {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; min-height: 230px;
  margin: 27px 0 0 !important; border: 1.5px dashed #aeb7ca; border-radius: 18px; background: #f8f9fc; cursor: pointer;
}
.file-drop:hover { border-color: var(--blue); background: #f4f6ff; }
.upload-icon { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 13px; border-radius: 50%; color: #fff; background: var(--blue); font-size: 25px; }
.file-drop small { color: var(--muted); margin-top: 7px; }
.media-preview { margin-top: 17px; overflow: hidden; border-radius: 16px; background: #111827; }
.media-preview img, .media-preview video { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.upload-state { margin-top: 12px; color: var(--blue); font-size: 13px; font-weight: 700; }
.group-exclusions { margin-top: 29px; padding-top: 24px; border-top: 1px solid var(--line); }
.group-exclusion-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.group-exclusion-head h3 { margin: 0 0 6px; font-size: 17px; }
.group-head-actions { display: flex; align-items: center; gap: 8px; }
.exclude-badge { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; color: #9d3e22; background: #fff0eb; font-size: 12px; }
.group-tools { display: flex; align-items: center; gap: 10px; margin-top: 17px; }
.group-search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; margin: 0 !important; padding: 0 13px;
  border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #fbfcfe;
}
.group-search:focus-within { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(49, 87, 213, .1); }
.group-search input { min-width: 0; padding: 12px 0; border: 0; outline: 0; background: transparent; box-shadow: none; }
.group-actions { display: flex; gap: 8px; }
.mini-button { border: 0; border-radius: 10px; padding: 10px 12px; color: var(--blue); background: #eef2ff; font-size: 12px; font-weight: 750; }
.mini-button:hover { background: #e3e9ff; }
.refresh-button { color: var(--success); background: #eaf7f2; }
.refresh-button:hover { background: #dcf1e9; }
.group-list { display: grid; gap: 7px; max-height: 330px; margin-top: 13px; padding-right: 4px; overflow-y: auto; }
.group-option {
  display: flex; align-items: center; gap: 12px; margin: 0 !important; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
}
.group-option:hover { border-color: #b9c5e9; background: #fafbff; }
.group-option.is-excluded { border-color: #ffc5b4; background: #fff7f4; }
.group-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.group-option-text { min-width: 0; }
.group-option-name, .group-option-id { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-option-name { color: var(--ink); font-size: 13px; }
.group-option-id { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.group-empty { margin: 16px 0 0; padding: 20px; border-radius: 12px; color: var(--muted); background: #f8f9fc; text-align: center; font-size: 13px; }
.target-summary { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.send-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 29px; padding-top: 21px; border-top: 1px solid var(--line); }
.send-summary span { display: block; color: var(--muted); font-size: 12px; }
.send-summary strong { display: block; margin-top: 3px; font-size: 15px; }
.send-button { min-width: 180px; background: var(--accent); }
.send-button:hover { background: var(--accent-dark); }
.progress-card { padding: 27px; }
.progress-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.progress-top h2 { margin-top: 7px; font-size: 21px; }
.progress-ratio { font-variant-numeric: tabular-nums; }
.progress-track { height: 10px; margin-top: 21px; overflow: hidden; border-radius: 10px; background: #e8ebf1; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width .35s ease; }
.progress-meta { display: flex; gap: 25px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.progress-meta b { color: var(--ink); }
.lock-note { margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; color: #765d18; background: #fff7d9; font-size: 12px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 27px; z-index: 20; max-width: calc(100% - 30px); padding: 12px 17px; border-radius: 12px; color: #fff; background: var(--ink); opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog { width: min(440px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 23px; color: var(--ink); box-shadow: 0 35px 100px rgba(12, 20, 45, .32); }
dialog::backdrop { background: rgba(13, 19, 36, .57); backdrop-filter: blur(4px); }
.dialog-card { padding: 30px; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto; border-radius: 50%; color: #fff; background: var(--accent); font-size: 25px; font-weight: 900; }
.dialog-card p { color: var(--muted); line-height: 1.7; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 23px; }
.is-locked .segments, .is-locked .content-panel, .is-locked .group-exclusions, .is-locked .send-summary { opacity: .48; pointer-events: none; user-select: none; }

@media (max-width: 640px) {
  .shell { width: calc(100% - 22px); padding-top: 24px; }
  .login-card { margin-top: 5vh; padding: 27px 22px; }
  .account-bar { align-items: flex-start; flex-wrap: wrap; }
  .account-stats { order: 3; width: 100%; margin-left: 0; }
  .account-stats span { flex: 1; text-align: center; }
  .account-bar .ghost { margin-left: auto; }
  .send-summary { align-items: stretch; flex-direction: column; }
  .send-button { width: 100%; }
  .group-exclusion-head, .group-tools { align-items: stretch; flex-direction: column; }
  .group-head-actions { justify-content: space-between; }
  .group-actions { display: grid; grid-template-columns: 1fr 1fr; }
}
