:root {
  --primary: #0072b5;
  --primary-dark: #005b91;
  --secondary: #3ca3d8;
  --ink: #152437;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f8fafc;
  --success: #169c5a;
  --warning: #d99a00;
  --danger: #d94141;
  --shadow-sm: 0 4px 15px rgba(15, 45, 70, .06);
  --shadow-lg: 0 20px 50px rgba(0, 74, 118, .15);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 1000;
  min-height: 92px;
  padding: 14px clamp(18px, 4vw, 52px);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 2px 12px rgba(15, 45, 70, .06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 15px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(0,114,181,.12), rgba(60,163,216,.22));
  color: var(--primary);
}
.brand-mark svg { width: 40px; height: 40px; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { color: var(--primary); font-size: 21px; font-weight: 800; letter-spacing: -.3px; }
.brand-copy small { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.nav-link { color: #475569; text-decoration: none; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; }
.nav-link:hover { color: var(--primary); background: #f1f5f9; }

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 10px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(0,114,181,.2); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 10px 24px rgba(0,114,181,.28); }
.btn-community { background: var(--secondary); color: #fff; box-shadow: 0 8px 18px rgba(60,163,216,.2); }
.btn-community:hover:not(:disabled) { background: var(--primary); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-soft { background: #f1f5f9; color: var(--primary); border: 1px solid var(--line); }
.btn-soft:hover { background: #e7eef5; }
.btn-danger-soft { color: #b42318; background: #fff2f0; border: 1px solid #ffd7d2; }
.btn-danger-soft:hover { background: #ffe4e0; }
.btn-block { width: 100%; }

.login-view {
  min-height: calc(100vh - 92px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  background: linear-gradient(135deg, #0072b5 0%, #3ca3d8 55%, #78c4e9 100%);
}
.login-hero { padding: clamp(70px, 10vw, 140px) clamp(28px, 8vw, 120px); color: #fff; align-self: center; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; opacity: .88; margin-bottom: 13px; }
.eyebrow.dark { color: var(--primary); opacity: 1; }
.login-hero h1 { margin: 0 0 20px; font-size: clamp(38px, 5vw, 68px); line-height: 1.16; letter-spacing: -1.4px; }
.login-hero p { max-width: 680px; margin: 0; font-size: 19px; line-height: 1.9; opacity: .92; }
.login-feature-list { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; }
.login-feature-list span, .hero-tags span { border: 1px solid rgba(255,255,255,.33); background: rgba(255,255,255,.12); padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.login-card {
  width: min(470px, calc(100% - 42px));
  align-self: center;
  justify-self: center;
  background: #fff;
  padding: 38px;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
}
.login-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: #eff8fd; font-size: 28px; margin-bottom: 24px; }
.login-card h2 { margin: 0 0 8px; font-size: 29px; }
.login-card > p { color: var(--muted); line-height: 1.7; margin: 0 0 24px; }

.hero {
  min-height: 375px;
  padding: 64px clamp(22px, 7vw, 110px);
  background: linear-gradient(135deg, #0072b5 0%, #3ca3d8 100%);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, .75fr);
  align-items: center;
  gap: 46px;
  overflow: hidden;
  position: relative;
}
.hero::after { content: ""; position: absolute; width: 430px; height: 430px; border: 80px solid rgba(255,255,255,.08); border-radius: 50%; inset-inline-start: -140px; inset-block-end: -260px; }
.hero-content { position: relative; z-index: 1; }
.hero h1 { margin: 0 0 14px; font-size: clamp(37px, 5vw, 58px); letter-spacing: -1.2px; }
.hero p { margin: 0; font-size: 18px; line-height: 1.8; opacity: .92; max-width: 680px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-visual { position: relative; z-index: 1; display: grid; place-items: center; direction: ltr; }
.hero-phone { width: 260px; min-height: 255px; border: 7px solid rgba(255,255,255,.8); border-radius: 30px; background: #efeae2; padding: 16px 12px; box-shadow: 0 30px 70px rgba(0,61,101,.34); transform: rotate(-2deg); }
.hero-phone-head { height: 46px; margin: -16px -12px 16px; padding: 0 16px; border-radius: 22px 22px 0 0; background: #fff; color: var(--ink); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; }
.hero-phone-head i { width: 23px; height: 23px; border-radius: 50%; background: var(--secondary); }
.mini-bubble { margin-left: 20px; padding: 13px; border-radius: 5px 14px 14px 14px; background: #fff; color: #273244; line-height: 1.65; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.mini-reply { margin: 18px 0 0 auto; width: 70px; padding: 9px 12px; border-radius: 12px 5px 12px 12px; color: #173025; background: #d9fdd3; font-size: 13px; }

.page-container { max-width: 1240px; margin: -44px auto 0; padding: 0 22px 70px; position: relative; z-index: 2; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 54px; }
.stat { min-height: 112px; background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 19px; box-shadow: var(--shadow-sm); display: flex; gap: 15px; align-items: center; transition: transform .25s, box-shadow .25s; }
.stat:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(15,45,70,.1); }
.stat-icon { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 46px; border-radius: 14px; background: #f1f5f9; font-weight: 900; font-size: 20px; }
.stat small { display: block; color: var(--muted); font-weight: 700; margin-bottom: 3px; }
.stat strong { font-size: 29px; line-height: 1; }
.stat-total .stat-icon { background: #eaf5fb; color: var(--primary); }
.stat-pending .stat-icon { background: #fff6d9; color: var(--warning); }
.stat-confirmed .stat-icon { background: #e2f8ec; color: var(--success); }
.stat-declined .stat-icon { background: #eef1f4; color: #5f6d7b; }
.stat-failed .stat-icon { background: #ffebe9; color: var(--danger); }

.section-heading { margin: 0 0 28px; }
.section-heading h2 { margin: 0 0 9px; color: var(--primary); font-size: 31px; }
.section-heading p { margin: 0; color: var(--muted); }

.setup-grid { display: grid; grid-template-columns: .82fr 1.18fr; gap: 24px; align-items: stretch; }
.panel { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 27px; box-shadow: var(--shadow-sm); }
.panel-number { position: absolute; inset-inline-end: 20px; inset-block-start: 20px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--primary); background: #eaf5fb; border-radius: 10px; font-weight: 900; }
.panel-heading { min-height: 64px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-inline-end: 48px; }
.panel-heading h3, .toolbar h3 { margin: 3px 0 0; color: #1e293b; font-size: 22px; }
.panel-kicker { color: var(--secondary); font-size: 11px; font-weight: 900; letter-spacing: .9px; text-transform: uppercase; }
.panel-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: var(--primary); background: #f1f7fb; font-size: 22px; }
.panel-description { color: var(--muted); line-height: 1.7; margin: 9px 0 20px; }

.file-drop { min-height: 154px; border: 2px dashed #c9dbe7; border-radius: 14px; background: #f8fbfd; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.file-drop:hover { border-color: var(--secondary); background: #f1f9fd; }
.file-drop-icon { font-size: 31px; margin-bottom: 10px; }
.file-drop strong { color: var(--primary); }
.file-drop small { color: var(--muted); margin-top: 6px; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.field-label { display: flex; flex-direction: column; gap: 7px; color: #334155; font-size: 13px; font-weight: 800; }
.field-label.compact { max-width: 185px; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 11px 12px; background: #fff; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(60,163,216,.14); }
textarea { resize: vertical; line-height: 1.8; background: #f8fafc; }
.field-note, .hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; }


.version-badge { display: inline-flex; vertical-align: middle; margin-inline-start: 6px; padding: 2px 7px; border-radius: 999px; background: #eaf5fb; color: var(--primary); font-size: 10px; font-weight: 900; }
.template-picker { margin: 0 0 18px; padding: 15px; border: 1px solid #d8e6ef; border-radius: 13px; background: #f8fbfd; }
.template-picker-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; color: #243447; }
.template-picker-heading strong { font-size: 14px; }
.template-picker-heading small { color: var(--muted); font-size: 11px; }
.template-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.template-choice { appearance: none; width: 100%; min-height: 78px; border: 2px solid #d5e1e9; border-radius: 12px; padding: 12px; background: #fff; color: #334155; cursor: pointer; display: flex; align-items: center; gap: 11px; text-align: right; transition: border-color .18s, box-shadow .18s, background .18s, transform .18s; }
.template-choice:hover { border-color: #83c5e7; transform: translateY(-1px); }
.template-choice.active { border-color: var(--secondary); background: #eef8fd; box-shadow: 0 0 0 3px rgba(60,163,216,.13); }
.template-choice-check { width: 25px; height: 25px; flex: 0 0 25px; border: 2px solid #c8d6df; border-radius: 50%; display: grid; place-items: center; color: transparent; font-size: 13px; font-weight: 900; }
.template-choice.active .template-choice-check { border-color: var(--secondary); background: var(--secondary); color: #fff; }
.template-choice-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.template-choice-copy strong { font-size: 13px; color: #243447; }
.template-choice-copy small { direction: ltr; text-align: left; color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; overflow-wrap: anywhere; }

.campaign-panel { scroll-margin-top: 110px; }
.template-meta { margin: 12px 0 18px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.template-meta div { display: flex; align-items: center; gap: 8px; }
.template-meta small { color: var(--muted); font-weight: 700; }
.template-meta code { direction: ltr; color: var(--primary); background: #eaf5fb; padding: 5px 8px; border-radius: 6px; font-weight: 800; }
.status-dot { display: flex; align-items: center; gap: 7px; color: #3d5062; font-size: 12px; font-weight: 800; }
.status-dot i { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px rgba(22,156,90,.12); }
.campaign-content { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: stretch; }
.message-editor { display: flex; flex-direction: column; gap: 13px; }
.event-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px; background: #f8fbfd; border: 1px solid #dbe8f0; border-radius: 12px; }
.event-location { grid-column: 1 / -1; }

.phone-preview { min-width: 0; direction: ltr; }
.phone-shell { height: 100%; min-height: 424px; overflow: hidden; border: 7px solid #233044; border-radius: 28px; background: #efeae2; box-shadow: 0 14px 35px rgba(15,45,70,.18); }
.phone-topbar { height: 62px; padding: 10px 13px; background: #f7f8fa; color: #243043; display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 50%; font-size: 11px; font-weight: 900; }
.phone-topbar div { display: flex; flex-direction: column; }
.phone-topbar strong { font-size: 12px; }
.phone-topbar small { color: #7b8796; font-size: 10px; }
.phone-menu { margin-left: auto; color: #64748b; letter-spacing: 2px; }
.chat-area { min-height: 355px; padding: 17px 12px; background-color: #efeae2; background-image: radial-gradient(rgba(100,86,74,.08) 1px, transparent 1px); background-size: 18px 18px; }
.chat-date { display: block; width: max-content; margin: 0 auto 18px; padding: 5px 10px; color: #526071; background: #fff; border-radius: 8px; font-size: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.chat-bubble { position: relative; max-width: 94%; margin-left: 0; padding: 13px 13px 24px; color: #1f2937; background: #fff; border-radius: 5px 12px 12px 12px; box-shadow: 0 1px 5px rgba(0,0,0,.12); font-size: 12px; line-height: 1.85; direction: rtl; text-align: right; white-space: pre-wrap; }
.chat-bubble::after { content: "10:08 PM"; position: absolute; left: 11px; bottom: 6px; color: #8a96a3; font-size: 8.5px; direction: ltr; }
.preview-caption { display: block; margin-top: 13px; color: #7d736b; text-align: center; font-size: 10px; }
.send-box { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: flex-end; gap: 12px; }
.send-box .btn { flex: 1; }

.feedback { min-height: 20px; margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--primary); }
.feedback.error, .error { color: #b42318; }
.feedback.success { color: var(--success); }

.guests-panel { margin-top: 28px; scroll-margin-top: 110px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar-actions select { width: auto; min-width: 120px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th { color: #526071; background: #f8fafc; font-size: 12px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edf1f5; text-align: right; white-space: nowrap; }
tbody tr:hover { background: #fbfdff; }
.empty-row td { padding: 42px 16px; color: var(--muted); text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #edf1f5; font-size: 12px; font-weight: 800; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.confirmed { color: #12844b; background: #e1f6e9; }
.badge.declined { color: #5f6d7b; background: #eef1f4; }
.badge.pending { color: #b67c00; background: #fff4cc; }
.badge.failed { color: #c23030; background: #fde8e5; }
.row-delete { min-height: 32px; padding: 6px 11px; border-radius: 7px; color: #b42318; background: #fff2f0; border: 1px solid #ffd7d2; }

.site-footer { min-height: 105px; padding: 26px 22px; color: var(--muted); background: #fff; border-top: 1px solid var(--line); text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.site-footer strong { color: var(--primary); }

[hidden] { display: none !important; }

@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .setup-grid { grid-template-columns: 1fr; }
  .campaign-content { grid-template-columns: 1fr 320px; }
}

@media (max-width: 780px) {
  .site-header { min-height: 76px; padding: 10px 15px; }
  .brand-mark { width: 47px; height: 47px; border-radius: 13px; }
  .brand-mark svg { width: 33px; height: 33px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy small, .nav-link { display: none; }
  .login-view { grid-template-columns: 1fr; padding-bottom: 50px; }
  .login-hero { padding: 60px 22px 26px; text-align: center; }
  .login-feature-list { justify-content: center; }
  .login-card { padding: 28px 22px; }
  .hero { grid-template-columns: 1fr; padding: 54px 22px 76px; text-align: center; }
  .hero-tags { justify-content: center; }
  .hero-visual { display: none; }
  .page-container { padding-inline: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { min-height: 96px; padding: 14px; }
  .campaign-content { grid-template-columns: 1fr; }
  .phone-preview { max-width: 340px; width: 100%; margin: auto; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn, .toolbar-actions select { flex: 1; }
}

@media (max-width: 500px) {
  .hero h1 { font-size: 36px; }
  .page-container { margin-top: -36px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:last-child { grid-column: 1 / -1; }
  .stat-icon { width: 39px; height: 39px; flex-basis: 39px; }
  .panel { padding: 21px 16px; }
  .panel-heading { padding-inline-end: 43px; }
  .field-grid, .event-fields, .template-choice-grid { grid-template-columns: 1fr; }
  .event-location { grid-column: auto; }
  .send-box { align-items: stretch; flex-direction: column; }
  .field-label.compact { max-width: none; }
  .header-actions .btn { min-height: 37px; padding: 7px 11px; font-size: 12px; }
}

/* v2.1 clean layout adjustments */
.login-view { grid-template-columns: minmax(320px, 500px); justify-content: center; }
.login-card { width: 100%; }
.header-actions { margin-inline-start: auto; }
@media (max-width: 780px) {
  .login-view { grid-template-columns: 1fr; }
}
