:root {
    --primary: #1f6feb;
    --primary-dark: #174ea6;
    --success: #1f9d55;
    --danger: #d93025;
    --warning: #b45309;
    --bg: #f2f5f9;
    --card: #ffffff;
    --text: #1a1a1a;
    --muted: #6b7280;
    --border: #d7dde5;
    --radius: 14px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 18px;
}

body {
    margin: 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: 18px;
    line-height: 1.55;
}

h1, h2, h3, p, dl, dd, dt {
    margin: 0;
}

a {
    color: var(--primary);
}

.h5-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 40, 90, 0.18);
}

.h5-header h1 {
    flex: 1;
    text-align: center;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 1px;
}

.h5-back,
.h5-logout {
    min-width: 58px;
    min-height: 48px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 17px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.h5-back-placeholder {
    display: inline-block;
    min-width: 58px;
    min-height: 48px;
}

.h5-main {
    max-width: 680px;
    margin: 0 auto;
    padding: 14px 14px 40px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(20, 40, 70, 0.07);
}

.card-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 12px;
}

.field {
    margin-bottom: 16px;
}

.field > label {
    display: block;
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

select,
input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea {
    width: 100%;
    min-height: 56px;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 20px;
    font-family: inherit;
    outline: none;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

input[type="time"],
input[type="date"] {
    min-height: 58px;
}

.input-with-unit {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.input-with-unit input {
    flex: 1;
}

.input-with-unit span {
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
    border-radius: 12px;
    background: #e8f0fe;
    color: var(--primary-dark);
    font-size: 19px;
    font-weight: 700;
}

.hint {
    margin-top: 6px;
    font-size: 16px;
    color: var(--muted);
}

.hint.warn {
    color: var(--warning);
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s;
}

.btn:active {
    opacity: 0.75;
}

.btn[disabled] {
    opacity: 0.45;
    pointer-events: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #e8f0fe;
    color: var(--primary-dark);
}

.btn-plain {
    background: #f1f3f6;
    color: #374151;
}

.btn-danger {
    background: #fdecea;
    color: var(--danger);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-block {
    display: flex;
    width: 100%;
    margin-top: 10px;
}

.btn-submit {
    min-height: 64px;
    font-size: 22px;
    letter-spacing: 2px;
}

.steps {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 14px;
}

.step {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #9aa3af;
}

.step span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0 auto 4px;
    border-radius: 50%;
    background: #e5e9ef;
    color: #6b7280;
    font-size: 17px;
    font-weight: 700;
}

.step.active {
    color: var(--primary);
    font-weight: 700;
}

.step.active span {
    background: var(--primary);
    color: #fff;
}

.step.done span {
    background: #d1fae5;
    color: var(--success);
}

.hidden {
    display: none !important;
}

.step-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.step-actions .btn {
    flex: 1;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f7f9fc;
    border: 1px solid #e6ebf2;
}

.item-row .item-main {
    flex: 1;
    min-width: 0;
}

.item-row .item-title {
    font-size: 18px;
    font-weight: 700;
    word-break: break-all;
}

.item-row .item-sub {
    font-size: 16px;
    color: var(--muted);
    margin-top: 2px;
}

.item-row .item-amount {
    font-size: 19px;
    font-weight: 700;
    color: var(--primary-dark);
    white-space: nowrap;
}

.icon-btn {
    min-width: 48px;
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: #fdecea;
    color: var(--danger);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
}

.empty {
    padding: 14px 0;
    text-align: center;
    color: var(--muted);
    font-size: 17px;
}

.totals {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #e8f0fe;
    color: var(--primary-dark);
    font-size: 18px;
}

.totals strong {
    font-size: 21px;
}

.review dl {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 8px 10px;
    font-size: 18px;
}

.review dt {
    color: var(--muted);
}

.review dd {
    font-weight: 600;
    word-break: break-all;
}

.success-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
}

.success-box {
    width: 100%;
    max-width: 420px;
    padding: 26px 20px;
    border-radius: 18px;
    background: #fff;
    text-align: center;
}

.success-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #d1fae5;
    color: var(--success);
    font-size: 40px;
    font-weight: 700;
}

.success-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.success-sub {
    font-size: 18px;
    color: var(--muted);
    margin-bottom: 14px;
}

.success-warning {
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: #fff7ed;
    color: var(--warning);
    font-size: 17px;
    text-align: left;
}

.wo-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    z-index: 200;
    max-width: 88vw;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 18px;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.22s ease;
}

.wo-toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

.wo-toast[data-type="error"] {
    background: rgba(185, 28, 28, 0.96);
}

.wo-toast[data-type="success"] {
    background: rgba(21, 128, 61, 0.96);
}

.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #1f6feb, #174ea6);
    color: #fff;
}

.user-bar .user-name {
    font-size: 22px;
    font-weight: 700;
}

.user-bar .user-role {
    font-size: 16px;
    opacity: 0.9;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip {
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 15px;
}

.menu-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(20, 40, 70, 0.07);
}

.menu-card.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: #e8f0fe;
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 800;
}

.menu-content {
    flex: 1;
}

.menu-title {
    font-size: 21px;
    font-weight: 700;
}

.menu-desc {
    font-size: 16px;
    color: var(--muted);
}

.menu-arrow {
    font-size: 28px;
    color: #9aa3af;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #e8f0fe, #f2f5f9 45%, #eef7f1);
}

.login-wrap {
    width: 100%;
    max-width: 420px;
    padding: 26px 20px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(20, 40, 70, 0.1);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 12px;
    border-radius: 20px;
    background: var(--primary);
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}

.login-wrap h1 {
    margin-bottom: 4px;
    text-align: center;
    font-size: 24px;
}

.login-tip {
    margin: 12px 0 18px;
    text-align: center;
    font-size: 16px;
    color: var(--muted);
}

.order-card {
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 1px 4px rgba(20, 40, 70, 0.07);
}

.order-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.order-no {
    font-size: 18px;
    font-weight: 700;
}

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.badge.submitted {
    background: #d1fae5;
    color: #065f46;
}

.badge.draft {
    background: #fff7ed;
    color: #b45309;
}

.order-meta {
    margin-top: 6px;
    font-size: 17px;
    color: var(--muted);
}

.order-lines {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    font-size: 17px;
}

.order-lines div {
    padding: 2px 0;
}

.order-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.order-actions .btn {
    flex: 1;
    min-height: 48px;
    font-size: 17px;
}

.preset-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 4px;
    border-bottom: 1px solid #eef1f5;
    cursor: pointer;
}

.preset-row:last-child {
    border-bottom: 0;
}

.preset-row input[type="checkbox"] {
    width: 28px;
    height: 28px;
    accent-color: var(--primary);
}

.preset-info {
    flex: 1;
}

.preset-name {
    font-size: 18px;
    font-weight: 600;
}

.preset-price {
    font-size: 16px;
    color: var(--muted);
}

.notice {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: #e8f0fe;
    color: var(--primary-dark);
    font-size: 17px;
}

.notice.warn {
    background: #fff7ed;
    color: var(--warning);
}

.preset-row .preset-qty {
    width: 104px;
    min-height: 50px;
    padding: 6px 8px;
    font-size: 20px;
    text-align: center;
}

.time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.time-grid .field {
    margin-bottom: 8px;
}

@media (max-width: 380px) {
    .preset-row .preset-qty {
        width: 86px;
    }
}

@media (min-width: 600px) {
    html {
        font-size: 19px;
    }
}
