* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

nav {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
}

nav a:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-center {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: 2px solid #3498db;
}

.search-btn {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.search-btn:hover {
    background: #2980b9;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.print-toggle {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    display: flex;
    gap: 1rem;
}

.print-toggle label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Print Queue */
.print-queue {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255,255,255,0.15);
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.print-queue:hover {
    background: rgba(255,255,255,0.25);
}

.print-queue-icon {
    font-size: 1.1rem;
}

.print-queue-count {
    background: #e74c3c;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 1.2rem;
    text-align: center;
}

.print-queue-count.completed {
    background: #27ae60;
}

.print-queue-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-width: 250px;
    z-index: 100;
    overflow: hidden;
}

.print-queue.open .print-queue-dropdown {
    display: block;
}

.print-queue-header {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.print-queue-items {
    max-height: 300px;
    overflow-y: auto;
}

.print-queue-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 0.85rem;
}

.print-queue-item:last-child {
    border-bottom: none;
}

.print-queue-item.printing {
    background: #fff9e6;
}

.print-queue-item.completed {
    background: #e8f8e8;
}

.print-item-status {
    font-size: 1rem;
}

.print-item-order {
    font-weight: 600;
    flex: 1;
}

.print-item-waybill {
    color: #7f8c8d;
    font-family: monospace;
    font-size: 0.8rem;
}

.logout-btn {
    background: #e74c3c;
    border-radius: 4px;
}

main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.flash {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

button, .btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
}

button:hover, .btn:hover {
    background: #2980b9;
}

.btn-primary {
    background: #3498db;
}

.btn-success {
    background: #27ae60;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
}

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

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-warning {
    background: #f39c12;
}

.btn-warning:hover {
    background: #e67e22;
}

/* Orders table */
.orders-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.orders-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

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

.orders-table th,
.orders-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.orders-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.orders-table tr:hover {
    background: #f8f9fa;
}

.no-orders {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
}

/* Order detail */
.order-detail-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.order-detail-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.order-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.order-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.order-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.line-items-table th,
.line-items-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.package-config {
    margin-top: 1rem;
}

.package-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.package-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.package-input input {
    width: 100px;
}

.total-weight {
    font-weight: bold;
    margin-top: 1rem;
    padding: 0.5rem;
    background: #e8f4f8;
    border-radius: 4px;
}

.action-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
