* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

header .header-title {
    flex: 1;
}

header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 25px;
}

header .user-info span {
    font-size: 14px;
}

header .user-info span::before {
    content: '👤 ';
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-admin {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 15px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

header .subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.6;
}

main {
    padding: 30px;
}

section {
    margin-bottom: 30px;
}

section h2 {
    font-size: 1.3em;
    color: #1e3c72;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e6ed;
    display: flex;
    align-items: center;
}

section h2::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    margin-right: 10px;
    border-radius: 2px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: #fff;
}

.form-group .hint {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e6ed;
    padding-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #f0f2f5;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: #e0e6ed;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-card {
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.item-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.item-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fb;
    cursor: pointer;
}

.item-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #667eea;
}

.item-header label {
    font-weight: 600;
    color: #333;
    cursor: pointer;
    flex: 1;
}

.item-body {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #e0e6ed;
}

.action-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e6ed;
}

.btn-primary,
.btn-secondary {
    padding: 14px 40px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: #f0f2f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e6ed;
}

.result-section {
    background: linear-gradient(135deg, #f8f9fb 0%, #fff 100%);
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #e0e6ed;
}

.result-header {
    margin-bottom: 25px;
}

.result-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.result-info p {
    margin: 5px 0;
    color: #555;
}

.result-info strong {
    color: #333;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-table th,
.result-table td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e6ed;
}

.result-table th {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95em;
}

.result-table tbody tr:hover {
    background: #f8f9fb;
}

.result-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.result-table tbody tr:nth-child(even):hover {
    background: #f0f2f5;
}

.result-table tfoot tr {
    background: #f8f9fb;
}

.result-table tfoot td {
    font-weight: 600;
    color: #333;
}

.result-table .subtotal td {
    border-top: 2px solid #e0e6ed;
}

.result-table .tax-row td {
    color: #e67e22;
}

.result-table .total-row td {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 1.1em;
    border-top: 3px solid #5a6fd6;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed;
}

footer {
    background: #1e3c72;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
}

@media print {
    body {
        background: #fff;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
    }

    .action-section,
    .result-actions,
    .tabs,
    .item-body,
    footer {
        display: none !important;
    }

    .result-section {
        display: block !important;
        border: none;
        padding: 0;
    }

    .result-table {
        box-shadow: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.6em;
    }

    main {
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        text-align: center;
    }

    .action-section {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .result-table {
        font-size: 0.85em;
    }

    .result-table th,
    .result-table td {
        padding: 10px 8px;
    }
}
