:root {
    --brand: #25978D;
    --brand-dark: #1F7F77;
    --brand-soft: #E8F4F2;
    --ink: #2B2A27;
    --ink-2: #6B6862;
    --ink-3: #9A968E;
    --line: #EBE8E2;
    --bg: #F6F5F2;
    --card: #FFFFFF;
    --danger: #C4534B;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

/* ---------- 通用 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--line);
    background: #FCFBF9;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
}

.btn-danger {
    color: var(--danger);
    border-color: #EFD9D6;
    background: #FDF6F5;
}

.btn-danger:hover {
    background: #FBEDEB;
}

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.input,
.select,
.textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.7;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 151, 141, .12);
}

.label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-2);
    font-size: 13px;
}

.hint {
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 4px;
}

.empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--ink-3);
}

/* ---------- 登录 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #F8F7F4 0%, #F1F5F3 100%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 40px 34px 34px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(43, 42, 39, .06);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    font-size: 18px;
    font-weight: 600;
}

.login-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand);
}

.login-card .label {
    margin-top: 16px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: 24px;
    height: 42px;
    font-size: 15px;
}

.login-error {
    min-height: 20px;
    margin-top: 12px;
    color: var(--danger);
    font-size: 13px;
}

/* ---------- 列表页 ---------- */
.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.topbar-spacer {
    flex: 1;
}

.topbar-user {
    color: var(--ink-2);
    font-size: 13px;
}

.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 24px 60px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.page-head p {
    margin: 2px 0 0;
    color: var(--ink-3);
    font-size: 13px;
}

.page-head .spacer {
    flex: 1;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.table th {
    padding: 13px 16px;
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--ink-3);
    background: #FBFAF8;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #F2F0EC;
    vertical-align: middle;
}

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

.table tr:hover td {
    background: #FCFBF9;
}

.thumb {
    width: 64px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #F1EFEA;
    display: block;
}

.thumb-empty {
    width: 64px;
    height: 40px;
    border-radius: 8px;
    background: #F1EFEA;
    color: var(--ink-3);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-cell {
    font-weight: 500;
}

.meta {
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 20px;
    font-size: 12px;
    background: #F2F0EC;
    color: var(--ink-2);
}

.badge-on {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.badge-off {
    background: #F7EFEE;
    color: #A45A53;
}

.badge-wait {
    background: #FBF2E3;
    color: #9A6A1E;
}

.ops {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar .input {
    width: 220px;
}

/* ---------- 弹层 ---------- */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(35, 33, 30, .38);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 900;
}

.modal-mask.show {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 86vh;
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(30, 28, 25, .18);
}

.modal-head {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}

.modal-head .spacer {
    flex: 1;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--ink-3);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px 22px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 22px 22px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    top: 24px;
    transform: translateX(-50%) translateY(-12px);
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(43, 42, 39, .92);
    color: #fff;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all .22s ease;
    z-index: 1200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.err {
    background: rgba(196, 83, 75, .96);
}

/* ---------- 设计器 ---------- */
.design-body {
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.dz-top {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.dz-top .spacer {
    flex: 1;
}

.dz-title {
    font-weight: 600;
    font-size: 15px;
}

.dz-path {
    color: var(--ink-3);
    font-size: 12px;
    background: #F7F5F1;
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 8px;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dz-wrap {
    display: flex;
    height: calc(100vh - 56px);
}

.dz-left {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--line);
    background: #fff;
    overflow-y: auto;
    padding: 16px 14px;
}

.dz-group-title {
    color: var(--ink-3);
    font-size: 12px;
    margin: 6px 0 10px;
}

.dz-lib {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.dz-lib-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 66px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FCFBF9;
    color: var(--ink-2);
    font-size: 12px;
    cursor: grab;
    user-select: none;
    transition: all .18s ease;
}

.dz-lib-item:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.dz-lib-item:active {
    cursor: grabbing;
}

.dz-center {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 24px;
}

.dz-phone {
    width: 390px;
    flex-shrink: 0;
    border-radius: 34px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 16px 44px rgba(43, 42, 39, .09);
    overflow: hidden;
    position: relative;
}

.dz-phone-head {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    font-size: 12px;
    border-bottom: 1px solid #F4F2EE;
    background: #fff;
}

.dz-canvas {
    min-height: 600px;
    background: #F7F6F3;
}

.dz-comp {
    position: relative;
    background: #fff;
    cursor: pointer;
}

.dz-comp + .dz-comp {
    margin-top: 8px;
}

.dz-comp.sel {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.dz-comp-ops {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
    z-index: 5;
}

.dz-comp:hover .dz-comp-ops,
.dz-comp.sel .dz-comp-ops {
    display: flex;
}

.dz-mini {
    height: 24px;
    min-width: 24px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .96);
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
    line-height: 22px;
}

.dz-mini:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.dz-empty {
    padding: 90px 24px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}

.dz-right {
    width: 320px;
    flex-shrink: 0;
    border-left: 1px solid var(--line);
    background: #fff;
    overflow-y: auto;
    padding: 16px 16px 40px;
}

.dz-prop-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: 14px;
}

.dz-field {
    margin-bottom: 14px;
}

.dz-field > .label {
    margin-bottom: 6px;
}

.dz-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dz-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-size: 13px;
    cursor: pointer;
}

.dz-imgfield {
    border: 1px dashed #DCD8D1;
    border-radius: 10px;
    padding: 8px;
    background: #FCFBF9;
}

.dz-imgbox {
    position: relative;
    height: 100px;
    border-radius: 8px;
    background: #F1EFEA center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    font-size: 12px;
    cursor: pointer;
    overflow: hidden;
}

.dz-imgfield .input {
    margin-top: 8px;
    height: 34px;
    font-size: 12px;
}

.dz-list-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    background: #FCFBF9;
}

.dz-list-item .dz-row {
    margin-bottom: 8px;
}

.dz-list-del {
    color: var(--danger);
    font-size: 12px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
}

.dz-tpl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dz-tpl {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #FCFBF9;
    cursor: pointer;
    transition: all .18s ease;
}

.dz-tpl:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.dz-tpl-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.dz-tpl-meta {
    color: var(--ink-3);
    font-size: 12px;
}

.dz-qr {
    text-align: center;
}

.dz-qr img {
    width: 220px;
    height: 220px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

@media (max-width: 1100px) {
    .dz-left {
        width: 180px;
    }

    .dz-right {
        width: 280px;
    }
}
