:root {
    --canvas: #f4f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --ink: #172033;
    --text-muted: #64748b;
    --placeholder: #94a3b8;
    --border: #dce4ef;
    --border-strong: #cbd5e1;
    --teal: #2563eb;
    --teal-hover: #1d4ed8;
    --teal-soft: #eff6ff;
    --blue-green: #2563eb;
    --aqua-soft: #eaf2ff;
    --success: #16a36a;
    --failure: #dc4c4c;
    --pending: #2563eb;
    --warning: #d97706;
    --track: #e2e8f0;
    --focus: rgba(37, 99, 235, .18);
    --topbar-height: 68px;
    --announcement-height: 38px;
    --sidebar-width: 252px;
    --shadow: 0 8px 26px rgba(15, 23, 42, .06);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
}

.icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.app-shell {
    min-height: 100vh;
}

.announcement-bar {
    position: fixed;
    z-index: 80;
    inset: 0 0 auto;
    height: var(--announcement-height);
    display: flex;
    align-items: center;
    overflow: hidden;
    color: #ffffff;
    background: #172033;
    box-shadow: 0 1px 8px rgba(15, 23, 42, .16);
}

.announcement-track {
    width: max-content;
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: announcement-scroll 22s linear infinite;
    will-change: transform;
}

.announcement-track span,
.announcement-track a {
    min-width: 100vw;
    padding: 0 48px;
    color: inherit;
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
}

.announcement-track a:hover {
    text-decoration: underline;
}

@keyframes announcement-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.topbar {
    position: fixed;
    inset: var(--announcement-height) 0 auto 0;
    z-index: 50;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 1px 10px rgba(15, 23, 42, .04);
    backdrop-filter: blur(12px);
}

.brand {
    width: var(--sidebar-width);
    height: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 16px;
    color: #172033;
    text-decoration: none;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .01em;
    border-right: 1px solid #e2e8f0;
    background: transparent;
    white-space: nowrap;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: #2563eb;
}

.brand-mark svg {
    width: 38px;
    height: 38px;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 18px;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    transition: color 150ms ease-out, background-color 150ms ease-out;
}

.icon-button:hover {
    color: var(--teal);
    background: var(--teal-soft);
}

.secure-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 12px;
}

.secure-chip .icon {
    width: 17px;
    height: 17px;
    color: var(--success);
}

.mobile-menu-button {
    display: none;
    margin-left: 10px;
}

.sidebar {
    position: fixed;
    z-index: 40;
    top: calc(var(--topbar-height) + var(--announcement-height));
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 24px 14px 16px;
    display: flex;
    flex-direction: column;
    background: #111827;
    border-right: 1px solid #1f2937;
}

.sidebar-nav {
    display: grid;
    gap: 9px;
}

.nav-link {
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    transition: color 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out;
}

.sidebar-nav .icon {
    width: 24px;
    height: 24px;
}

.nav-link:hover {
    background: #1f2937;
    color: #ffffff;
}

.nav-link.active {
    color: #ffffff;
    background: rgba(37, 99, 235, .18);
    border-color: transparent;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #60a5fa;
}

.admin-card {
    margin-top: auto;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #374151;
    border-radius: 11px;
    background: #1f2937;
}

.admin-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
}

.admin-avatar .icon {
    width: 24px;
    height: 24px;
}

.admin-card strong,
.admin-card small {
    display: block;
}

.admin-card > span:last-child {
    min-width: 0;
}

.admin-card strong {
    max-width: 156px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8fafc;
}

.admin-card small {
    max-width: 156px;
    overflow: hidden;
    color: #94a3b8;
    font-size: 12px;
    text-overflow: ellipsis;
}

.sidebar-backdrop {
    display: none;
}

.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + var(--announcement-height) + 24px) 24px 30px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(24px, 2.2vw, 30px);
    line-height: 1.3;
    letter-spacing: -.02em;
}

.page-header p {
    margin: 5px 0 0;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 0;
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 16px;
}

.card-body {
    padding: 17px 18px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card {
    min-height: 136px;
    padding: 18px;
    background: linear-gradient(145deg, #ffffff, #f6f9ff);
}

.metric-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    color: var(--text-muted);
    font-weight: 600;
}

.metric-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--teal);
    background: var(--teal-soft);
}

.metric-card[data-tone="blue"] .metric-icon {
    color: var(--pending);
    background: #edf5fb;
}

.metric-card[data-tone="success"] .metric-icon {
    color: var(--success);
    background: #eaf7f1;
}

.metric-card[data-tone="failure"] .metric-icon {
    color: var(--failure);
    background: #fff0ee;
}

.metric-value {
    margin-top: 12px;
    font-size: 29px;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.metric-hint {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    gap: 16px;
}

.stack {
    display: grid;
    gap: 13px;
}

.field {
    display: grid;
    gap: 7px;
}

.field label,
.field-label {
    color: #334155;
    font-weight: 700;
}

.field-help {
    color: var(--text-muted);
    font-size: 12px;
}

.input,
.textarea,
.select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}

.input,
.select {
    min-height: 43px;
    padding: 9px 12px;
}

.textarea {
    min-height: 120px;
    padding: 11px 12px;
    resize: vertical;
}

.code-editor {
    min-height: 240px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
}

.saved-template-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.bulk-template-import {
    padding: 16px;
    margin-bottom: 16px;
    border: 1px dashed #b9c7d9;
    border-radius: 12px;
    background: #f8fafc;
}

.bulk-template-import-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.bulk-template-import-heading small,
.bulk-template-import-grid > span {
    color: var(--muted);
}

.bulk-template-import-grid {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.bulk-template-import .textarea {
    min-height: 150px;
}

.bulk-template-file-button {
    cursor: pointer;
}

.saved-template-tools small {
    grid-column: 1 / -1;
    min-height: 18px;
    color: var(--muted);
}

.variant-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 640px) {
    .saved-template-tools { grid-template-columns: 1fr 1fr; }
    .saved-template-tools .select { grid-column: 1 / -1; }
    .bulk-template-import-grid { grid-template-columns: 1fr; }
}

.input:hover,
.textarea:hover,
.select:hover {
    border-color: #94a3b8;
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--focus);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--placeholder);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 9px;
}

.input-with-unit .input {
    min-width: 0;
}

.input-with-unit span {
    color: var(--text-muted);
    white-space: nowrap;
}

.drop-zone {
    position: relative;
    min-height: 118px;
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    text-align: center;
    background: #fff;
    transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--teal);
    background: #eff6ff;
}

.drop-zone input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 7px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--teal);
    background: var(--teal-soft);
}

.drop-zone-content strong,
.drop-zone-content small {
    display: block;
}

.drop-zone-content small {
    margin-top: 3px;
    color: var(--text-muted);
}

.file-name {
    margin-top: 7px;
    color: var(--blue-green);
    font-size: 12px;
    font-weight: 600;
}

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, .22);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    color: #f7f9f8;
    background: #a8b3c5;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.button-secondary {
    color: var(--teal);
    border-color: #93b4f5;
    background: #fff;
}

.button-secondary:hover {
    background: var(--teal-soft);
    box-shadow: none;
}

.button-danger {
    color: var(--failure);
    border-color: #efb8b2;
    background: #fff;
}

.button-danger:hover {
    background: #fff3f1;
    box-shadow: none;
}

.button-warning {
    color: var(--warning);
    border-color: #e7c894;
    background: #fff;
}

.button-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

.button-wide {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
}

.button .icon {
    width: 18px;
    height: 18px;
}

.alert {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.alert button {
    border: 0;
    color: inherit;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.alert-success {
    color: #227759;
    border-color: #a8d8c4;
    background: #effaf5;
}

.alert-error {
    color: #aa433a;
    border-color: #efbbb5;
    background: #fff4f2;
}

.alert-warning {
    color: #8d601d;
    border-color: #ead0a6;
    background: #fff9ee;
}

.error-list {
    margin: 0 0 15px;
    padding: 12px 15px 12px 34px;
    border: 1px solid #efbbb5;
    border-radius: 10px;
    color: #a13f37;
    background: #fff4f2;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #e7ecea;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--text-muted);
    background: #fbfcfa;
    font-size: 12px;
    font-weight: 700;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table td strong,
.data-table td small {
    display: block;
}

.data-table td small {
    margin-top: 2px;
    color: var(--text-muted);
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    color: var(--pending);
    background: #edf5fb;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-running {
    color: var(--teal);
    background: var(--teal-soft);
}

.status-success {
    color: var(--success);
    background: #eaf7f1;
}

.status-failure {
    color: var(--failure);
    background: #fff0ee;
}

.status-paused {
    color: var(--warning);
    background: #fff6e8;
}

.empty-state {
    padding: 48px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .empty-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: var(--teal);
    background: var(--teal-soft);
}

.empty-state .empty-icon .icon {
    width: 28px;
    height: 28px;
}

.empty-state h3 {
    margin: 0 0 5px;
    color: var(--ink);
}

.empty-state p {
    margin: 0 0 16px;
}

.compose-layout {
    display: grid;
    grid-template-columns: minmax(460px, 1.18fr) minmax(360px, .82fr);
    gap: 14px;
    align-items: start;
}

.compose-main,
.compose-side {
    display: grid;
    gap: 12px;
}

.compose-card {
    padding: 16px 18px;
}

.compose-card h2 {
    margin: 0 0 12px;
    font-size: 15px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-heading h2 {
    margin-bottom: 2px;
}

.section-heading small {
    color: var(--text-muted);
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.mode-option,
.account-choice {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfa;
    cursor: pointer;
    transition: border-color 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.mode-option:has(input:checked),
.account-choice:has(input:checked) {
    border-color: #60a5fa;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .09);
}

.mode-option input,
.account-choice input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    flex: 0 0 auto;
    accent-color: var(--teal);
}

.mode-option strong,
.mode-option small,
.account-choice strong,
.account-choice small {
    display: block;
}

.mode-option small,
.account-choice small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.account-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.account-choice {
    padding: 11px 12px;
}

.account-choice span {
    min-width: 0;
}

.account-choice small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.variant-list {
    display: grid;
    gap: 12px;
}

.variant-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fbfcfa;
}

.variant-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 11px;
}

.variant-heading strong {
    color: var(--teal-hover);
}

.variant-fields {
    display: grid;
    grid-template-columns: minmax(150px, .38fr) minmax(240px, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.summary-mode {
    min-height: 44px;
    display: grid !important;
    place-items: center;
    font-size: 14px !important;
    line-height: 1.35 !important;
}

.split-upload {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    align-items: stretch;
}

.or-divider {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 12px;
}

.recipient-assignment-panel {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
}

.recipient-assignment-panel[hidden] {
    display: none;
}

.recipient-assignment-heading,
.recipient-batch-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.recipient-assignment-heading strong,
.recipient-assignment-heading small {
    display: block;
}

.recipient-assignment-heading small,
.recipient-assignment-heading > span {
    color: var(--text-muted);
    font-size: 11px;
}

.recipient-batch-tools {
    justify-content: flex-start;
    margin-top: 12px;
}

.recipient-batch-tools .select {
    width: min(260px, 100%);
}

.recipient-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.recipient-assignment-list {
    max-height: 420px;
    margin-top: 12px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #ffffff;
}

.recipient-assignment-row {
    display: grid;
    grid-template-columns: 20px minmax(180px, 1fr) minmax(160px, 240px);
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
}

.recipient-assignment-row:last-child {
    border-bottom: 0;
}

.recipient-assignment-email {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recipient-assignment-row .select {
    min-height: 38px;
    padding-block: 6px;
}

.empty-assignment {
    padding: 24px;
    color: var(--text-muted);
    text-align: center;
}

.interval-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.interval-box {
    padding: 15px;
}

.interval-box .clock-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
}

.clock-icon {
    width: 37px;
    height: 37px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--teal);
    background: var(--teal-soft);
}

.clock-icon .icon {
    width: 19px;
    height: 19px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.summary-card {
    min-height: 132px;
    padding: 13px 8px;
    border: 1px solid var(--border);
    border-radius: 11px;
    text-align: center;
    background: linear-gradient(145deg, #fff, rgba(231, 244, 241, .45));
}

.summary-card span,
.summary-card small {
    display: block;
}

.summary-card > span:first-child {
    min-height: 40px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.summary-card small {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 11px;
}

.consent-box {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-muted);
    background: #fbfcfa;
    font-size: 12px;
}

.consent-box input {
    width: 17px;
    height: 17px;
    margin-top: 1px;
    accent-color: var(--teal);
}

.inline-image-editor {
    display: grid;
    gap: 9px;
    margin-top: 12px;
}

.inline-image-item {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}

.inline-image-item > img {
    width: 84px;
    height: 64px;
    display: block;
    border-radius: 7px;
    object-fit: cover;
    background: #ffffff;
}

.inline-image-fields {
    min-width: 0;
    display: grid;
    grid-template-columns: 130px minmax(180px, 1fr);
    gap: 7px;
}

.inline-image-fields strong {
    grid-column: 1 / -1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-image-fields .input,
.inline-image-fields .select {
    min-height: 36px;
    font-size: 11px;
}

.inline-image-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gmail-preview-card {
    overflow: hidden;
    padding: 0;
}

.gmail-preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
}

.gmail-preview-heading h2 {
    margin: 0;
    font-size: 15px;
}

.gmail-preview-heading small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
}

.preview-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.preview-variant-select {
    width: 130px;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 12px;
}

.preview-device-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.preview-device-switch button {
    min-height: 28px;
    padding: 4px 8px;
    border: 0;
    border-radius: 6px;
    color: var(--text-muted);
    background: transparent;
    font-size: 10px;
    cursor: pointer;
}

.preview-device-switch button.active {
    color: #ffffff;
    background: var(--teal);
}

.gmail-window {
    padding: 12px;
    background: #f1f3f4;
}

.gmail-window.is-mobile .gmail-message {
    width: min(100%, 360px);
    margin-inline: auto;
}

.gmail-message {
    padding: 18px;
    border: 1px solid #dadce0;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(60, 64, 67, .08);
}

.gmail-message h3 {
    margin: 0 0 15px;
    color: #202124;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.gmail-sender-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    margin-bottom: 17px;
}

.gmail-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    background: #1a73e8;
    font-size: 15px;
    font-weight: 700;
}

.gmail-sender strong,
.gmail-sender small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-sender strong {
    color: #202124;
    font-size: 13px;
}

.gmail-sender small,
.gmail-sender-row time {
    color: #5f6368;
    font-size: 10px;
}

.gmail-body-preview {
    width: 100%;
    min-height: 310px;
    border: 0;
    background: #ffffff;
}

.gmail-email-canvas {
    width: 100%;
    max-width: 600px;
    margin-inline: auto;
}

.gmail-inline-image-list:empty {
    display: none;
}

.gmail-body-preview + .gmail-inline-image-list:not(:empty) {
    margin-top: 18px;
}

.gmail-inline-image-preview {
    margin-bottom: 18px;
    text-align: center;
}

.gmail-inline-image-preview img {
    width: 100%;
    max-width: 600px;
    height: auto;
    display: block;
    margin-inline: auto;
}

.gmail-attachment-preview {
    margin-top: 12px;
    padding: 10px;
    overflow: hidden;
    border: 1px solid #dadce0;
    border-radius: 7px;
    color: #3c4043;
    background: #f8f9fa;
    font-size: 11px;
}

.admin-recipient-page {
    min-height: 100vh;
    background: #f4f7fb;
}

.admin-recipient-shell {
    width: min(1480px, calc(100% - 40px));
    margin: 0 auto;
    padding: 38px 0 64px;
}

.admin-recipient-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.admin-recipient-header h1 {
    margin: 5px 0 4px;
}

.admin-recipient-header p {
    margin: 0;
    color: var(--text-muted);
}

.eyebrow {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.admin-stats article {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow);
}

.admin-stats small,
.admin-stats strong {
    display: block;
}

.admin-stats small {
    color: var(--text-muted);
}

.admin-stats strong {
    margin-top: 6px;
    font-size: 28px;
}

.admin-filter-card {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 18px;
}

.admin-filter-form {
    display: flex;
    align-items: flex-end;
    flex: 1;
    gap: 12px;
}

.admin-filter-form label:not(.admin-check) {
    min-width: 170px;
    flex: 1;
}

.admin-filter-form label span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.admin-check {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    white-space: nowrap;
}

.admin-export-actions {
    display: flex;
    gap: 8px;
}

.gmail-attachment-preview img {
    width: auto;
    max-width: min(100%, 320px);
    max-height: 200px;
    display: block;
    margin: 0 auto 9px;
    object-fit: contain;
    border-radius: 5px;
    background: #ffffff;
}

.gmail-attachment-preview img[hidden] {
    display: none;
}

.gmail-attachment-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.gmail-attachment-meta span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-card {
    padding: 17px;
}

.progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.progress-heading h2 {
    margin: 0;
    font-size: 16px;
}

.progress-percent {
    color: var(--teal);
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.progress-track {
    height: 10px;
    margin: 15px 0;
    overflow: hidden;
    border-radius: 999px;
    background: var(--track);
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
    transition: width 320ms cubic-bezier(.22, 1, .36, 1);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 15px;
}

.progress-stat {
    padding: 0 10px;
    border-right: 1px solid #e5eae8;
    text-align: center;
}

.progress-stat:first-child {
    padding-left: 0;
}

.progress-stat:last-child {
    padding-right: 0;
    border-right: 0;
}

.progress-stat span,
.progress-stat strong {
    display: block;
}

.progress-stat span {
    color: var(--text-muted);
    font-size: 11px;
}

.progress-stat strong {
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

.progress-stat.success strong {
    color: var(--success);
}

.progress-stat.failure strong {
    color: var(--failure);
}

.progress-stat.pending strong {
    color: var(--pending);
}

.activity-list {
    max-height: 228px;
    overflow: auto;
    border-top: 1px solid #e7ecea;
}

.activity-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) 92px 74px;
    gap: 10px;
    align-items: center;
    min-height: 39px;
    padding: 7px 2px;
    border-bottom: 1px solid #edf0ef;
    font-size: 12px;
    animation: activity-in 180ms ease-out;
}

.activity-row .email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-main {
    min-width: 0;
}

.activity-main small {
    display: block;
    overflow: hidden;
    margin-top: 1px;
    color: var(--text-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-row .result {
    font-weight: 700;
}

.activity-row .result.sent {
    color: var(--success);
}

.activity-row .result.failed {
    color: var(--failure);
}

.activity-row time {
    color: var(--text-muted);
    text-align: right;
}

.job-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.job-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.meta-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfcfa;
}

.meta-item span,
.meta-item strong {
    display: block;
}

.meta-item span {
    color: var(--text-muted);
    font-size: 11px;
}

.meta-item strong {
    margin-top: 2px;
}

.login-page,
.setup-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(37, 99, 235, .14), transparent 35%),
        radial-gradient(circle at 85% 85%, rgba(30, 58, 95, .12), transparent 32%),
        var(--canvas);
}

.login-page {
    padding-top: calc(24px + var(--announcement-height));
}

.auth-card {
    width: min(100%, 450px);
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .13);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    color: #1d4ed8;
    font-size: 20px;
    font-weight: 800;
}

.auth-brand .brand-mark {
    width: 43px;
    height: 43px;
}

.auth-card h1 {
    margin: 0;
    text-align: center;
    font-size: 24px;
}

.auth-card > p {
    margin: 7px 0 21px;
    color: var(--text-muted);
    text-align: center;
}

.requirement-list {
    display: grid;
    gap: 7px;
    margin: 14px 0 20px;
}

.requirement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfa;
}

.requirement.ok strong {
    color: var(--success);
}

.requirement.bad strong {
    color: var(--failure);
}

.login-footnote {
    margin-top: 15px;
    color: var(--text-muted);
    text-align: center;
    font-size: 11px;
}

.license-login-card {
    width: min(620px, calc(100vw - 28px));
}

.license-key-input {
    min-height: 150px;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
}

@keyframes activity-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1180px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compose-layout,
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .recipient-assignment-heading,
    .recipient-batch-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .recipient-assignment-row {
        grid-template-columns: 20px minmax(0, 1fr);
    }

    .recipient-assignment-row .select {
        grid-column: 1 / -1;
    }

    .admin-recipient-shell {
        width: min(100% - 24px, 1480px);
        padding-top: 20px;
    }

    .admin-recipient-header,
    .admin-filter-card,
    .admin-filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-export-actions .button {
        flex: 1;
    }

    :root {
        --topbar-height: 58px;
    }

    .brand {
        width: auto;
        border-right: 0;
        gap: 8px;
        padding: 0 12px;
        font-size: 16px;
    }

    .brand-mark,
    .brand-mark svg {
        width: 34px;
        height: 34px;
    }

    .mobile-menu-button {
        display: inline-grid;
    }

    .secure-chip {
        display: none;
    }

    .sidebar {
        z-index: 60;
        width: min(82vw, 280px);
        transform: translateX(-105%);
        transition: transform 180ms ease-out;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 55;
        inset: calc(var(--topbar-height) + var(--announcement-height)) 0 0 0;
        background: rgba(15, 23, 42, .55);
    }

    .sidebar-backdrop.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: calc(var(--topbar-height) + var(--announcement-height) + 18px) 14px 24px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions,
    .page-actions .button {
        width: 100%;
    }

    .dashboard-grid,
    .field-row,
    .interval-card,
    .job-meta,
    .mode-grid,
    .account-choice-grid {
        grid-template-columns: 1fr;
    }

    .variant-fields {
        grid-template-columns: 1fr;
    }

    .inline-image-item {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .inline-image-item > img {
        width: 64px;
        height: 54px;
    }

    .inline-image-fields {
        grid-template-columns: 1fr;
    }

    .inline-image-fields strong {
        grid-column: auto;
    }

    .inline-image-actions {
        grid-column: 1 / -1;
        flex-direction: row;
    }

    .inline-image-actions .button {
        flex: 1;
    }

    .gmail-preview-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .preview-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .preview-variant-select,
    .preview-device-switch {
        width: 100%;
    }

    .preview-device-switch button {
        flex: 1;
    }

    .gmail-body-preview {
        min-height: 240px;
    }

    .split-upload {
        grid-template-columns: 1fr;
    }

    .or-divider {
        justify-content: center;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table th:nth-child(3),
    .data-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 460px) {
    .brand span:last-child {
        font-size: 15px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .activity-row {
        grid-template-columns: 1fr 72px;
    }

    .activity-row time {
        display: none;
    }

    .auth-card {
        padding: 24px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .08s !important;
        transition-duration: .08s !important;
    }

    .announcement-track {
        width: 100%;
        justify-content: center;
        transform: none !important;
        animation: none !important;
    }

    .announcement-track > :nth-child(2) {
        display: none;
    }
}
