* {
    box-sizing: border-box;
}

body {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    margin: 0;
    color: #222;
}

.container {
    max-width: 1320px;
    margin: 30px auto;
    padding: 0 16px;
}

.container.small {
    max-width: 650px;
}

h1 {
    margin: 0;
}

h2 {
    margin-top: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-links a {
    padding: 10px 14px;
    background: #eeeeee;
    color: #111;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
}

.card {
    background: white;
    padding: 22px;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}

.center {
    text-align: center;
}

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

input, select {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    min-width: 150px;
    font-size: 15px;
}

button, .button-link {
    display: inline-block;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    background: #111;
    color: white;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}

.button-link.light {
    background: #eeeeee;
    color: #111;
}

button:hover, .button-link:hover {
    opacity: 0.85;
}

.big-btn {
    width: 100%;
    margin-top: 15px;
    padding: 16px;
    font-size: 18px;
    background: #0a7c2f;
}

.btn-warning {
    background: #d98200;
}

.btn-success {
    background: #0a7c2f;
}

.btn-danger {
    background: #c62828;
}

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

th, td {
    border-bottom: 1px solid #eee;
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

.row-inactive {
    background: #fafafa;
    color: #777;
}

.inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form.compact input {
    width: 110px;
    min-width: 90px;
}

.stock-form {
    display: grid;
    grid-template-columns: 120px 90px 210px 70px;
    gap: 8px;
    align-items: center;
}

.stock-form input, .stock-form select {
    min-width: 0;
}

.tag {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
}

.unused {
    background: #fff2cc;
    color: #8a5a00;
}

.used {
    background: #d8f5dc;
    color: #176b2c;
}

.active {
    background: #d8f5dc;
    color: #176b2c;
}

.inactive {
    background: #eeeeee;
    color: #555;
}

.warning {
    background: #ffe8c2;
    color: #9a5500;
}

.plus {
    color: #176b2c;
}

.minus {
    color: #c62828;
}

.qr {
    width: 260px;
    height: 260px;
    margin: 18px auto;
    display: block;
}

.tips {
    color: #666;
    line-height: 1.6;
}

.flash {
    background: #e8f1ff;
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.success {
    background: #d8f5dc;
    color: #176b2c;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.error {
    background: #ffe1e1;
    color: #9b1c1c;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.empty {
    color: #777;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: white;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
}

.stat-title {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-num {
    font-size: 26px;
    font-weight: bold;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

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

@media (max-width: 1000px) {
    .form-row, .inline-form, .stock-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    input, select, button, .button-link {
        width: 100%;
    }

    table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

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

    .nav-links {
        flex-direction: column;
    }

    .nav-links a {
        text-align: center;
    }
}


.share-box {
    margin: 20px 0;
    padding: 16px;
    background: #f7f7f7;
    border-radius: 14px;
}

.copy-input {
    width: 100%;
    margin: 8px 0 12px;
    background: #f7f7f7;
}

.ticket-body {
    background: linear-gradient(180deg, #f0f3f8 0%, #ffffff 100%);
}

.ticket-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 18px;
}

.ticket-card {
    background: white;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.10);
    margin-top: 20px;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 18px;
}

.ticket-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.ticket-header h1 {
    font-size: 26px;
    line-height: 1.25;
}

.ticket-status {
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: bold;
    white-space: nowrap;
}

.unused-status {
    background: #fff2cc;
    color: #8a5a00;
}

.used-status {
    background: #d8f5dc;
    color: #176b2c;
}

.ticket-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.ticket-info div {
    background: #f7f7f7;
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
}

.ticket-info span {
    color: #777;
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
}

.ticket-info b {
    font-size: 17px;
}

.ticket-qr-box {
    text-align: center;
    padding: 18px;
    border-radius: 18px;
    background: #fafafa;
}

.ticket-qr {
    width: 260px;
    height: 260px;
    max-width: 100%;
}

.used-big {
    font-size: 38px;
    font-weight: bold;
    color: #176b2c;
    padding: 60px 0 30px;
}

.ticket-detail {
    margin-top: 18px;
    color: #333;
    line-height: 1.6;
}

.ticket-notice {
    margin-top: 18px;
    padding: 14px;
    background: #fff8e8;
    color: #6b4b00;
    border-radius: 14px;
    line-height: 1.5;
}

@media (max-width: 520px) {
    .ticket-info {
        grid-template-columns: 1fr;
    }

    .ticket-header {
        flex-direction: column;
    }
}


.voucher-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wide-input {
    min-width: 280px;
    flex: 1;
}

.muted {
    color: #777;
    font-size: 13px;
}

.customer-box {
    margin: 18px 0;
    padding: 14px;
    background: #f7f7f7;
    border-radius: 14px;
    text-align: left;
}

.customer-box h2 {
    margin-bottom: 10px;
}

.ticket-customer {
    margin: 18px 0;
    padding: 14px;
    border-radius: 14px;
    background: #f7f7f7;
    line-height: 1.5;
}


/* 第八版：数据备份导出 */
.actions .button-link {
    margin-bottom: 8px;
}


/* 第九版：多账号与权限 */
.user-badge {
    padding: 10px 14px;
    background: #e8f1ff;
    color: #174ea6;
    border-radius: 10px;
    white-space: nowrap;
}

.role-tip {
    background: #fff8e8;
    color: #6b4b00;
}

.user-form {
    display: grid;
    grid-template-columns: 110px 110px 130px 64px;
    gap: 8px;
}

.button-disabled {
    background: #dddddd;
    color: #777;
    cursor: not-allowed;
}
