* {
    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;
}

/* ===== Password Gate ===== */

.password-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0088cc 0%, #005fa3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.password-card {
    background: white;
    border-radius: 20px;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.password-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.password-card h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 24px;
    font-weight: 600;
}

.password-card input {
    text-align: center;
    font-size: 18px;
    letter-spacing: 2px;
}

.password-error {
    color: #c62828;
    font-size: 13px;
    min-height: 20px;
    margin-top: 8px;
}

/* ===== Layout ===== */

.container {
    max-width: 100%;
    padding: 16px;
}

.header {
    background: #0088cc;
    color: white;
    padding: 20px;
    text-align: center;
    margin: -16px -16px 20px -16px;
    position: relative;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.settings-btn {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.clear-btn {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

/* ===== Tabs ===== */

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    flex: 1;
    min-width: 80px;
    padding: 12px 8px;
    background: white;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab.active {
    background: #0088cc;
    color: white;
}

.tab.has-badge {
    position: relative;
}

.tab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f44336;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== Forms ===== */

.form-section, .list-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0088cc;
    background: white;
}

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

/* ===== Payment Toggle ===== */

.payment-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.payment-btn {
    flex: 1;
    min-width: 70px;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
}

.payment-btn.selected {
    border-color: #4caf50;
    background: #e8f5e9;
    color: #2e7d32;
}

.payment-btn.selected.unpaid {
    border-color: #f44336;
    background: #ffebee;
    color: #c62828;
}

.payment-btn.selected.later {
    border-color: #ff9800;
    background: #fff3e0;
    color: #e65100;
}

/* ===== Buttons ===== */

.submit-btn {
    width: 100%;
    padding: 16px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.1s;
}

.submit-btn.secondary {
    background: #4caf50;
    margin-top: 12px;
}

.submit-btn.danger {
    background: #f44336;
    margin-top: 8px;
}

.submit-btn:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.submit-btn:active {
    transform: scale(0.98);
}

/* ===== Date Sections ===== */

.date-section {
    margin-bottom: 24px;
}

.date-header {
    background: #e3f2fd;
    color: #1976d2;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-header.today {
    background: #e8f5e9;
    color: #2e7d32;
}

.date-header.past {
    background: #ffebee;
    color: #c62828;
}

/* ===== Order Cards ===== */

.order-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #ccc;
    position: relative;
}

.order-card.status-new { border-left-color: #9c27b0; }
.order-card.status-packed { border-left-color: #ff9800; }
.order-card.status-issued { border-left-color: #0088cc; }
.order-card.status-returned { border-left-color: #4caf50; }

.order-card.invoice-unpaid {
    background: #fff8e1;
    border-left-color: #ff9800;
}

.order-card.invoice-paid {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.order-card.payment-unpaid {
    background: #ffebee;
    border-left-color: #f44336;
}

.order-card.payment-paid {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.order-number {
    font-weight: 700;
    color: #333;
    font-size: 15px;
}

.order-details {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ===== Status Badges ===== */

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.new { background: #f3e5f5; color: #7b1fa2; }
.status-badge.packed { background: #fff3e0; color: #e65100; }
.status-badge.issued { background: #e3f2fd; color: #1976d2; }
.status-badge.returned { background: #e8f5e9; color: #2e7d32; }

.payment-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.payment-status-badge.paid { background: #e8f5e9; color: #2e7d32; }
.payment-status-badge.unpaid { background: #ffebee; color: #c62828; }
.payment-status-badge.later { background: #fff3e0; color: #e65100; }
.payment-status-badge.pending { background: #fff3e0; color: #e65100; }

.invoice-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.invoice-status.pending { background: #fff3e0; color: #e65100; }
.invoice-status.paid { background: #e8f5e9; color: #2e7d32; }

/* ===== Tags ===== */

.bag-tag {
    display: inline-block;
    background: #0088cc;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.bag-tag.empty {
    background: #e0e0e0;
    color: #999;
}

.days-tag {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.issued-tag {
    display: inline-block;
    background: #4caf50;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.invoice-tag {
    display: inline-block;
    background: #9c27b0;
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.price-tag {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}

.days-info {
    display: inline-flex;
    align-items: center;
    background: #fff3e0;
    color: #e65100;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 8px;
}

/* ===== Workflow Actions ===== */

.workflow-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.workflow-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.workflow-btn.pack { background: #ff9800; color: white; }
.workflow-btn.issue { background: #0088cc; color: white; }
.workflow-btn.return { background: #4caf50; color: white; }
.workflow-btn.invoice { background: #ff9800; color: white; }
.workflow-btn.delete { background: #f44336; color: white; }
.workflow-btn.payment-paid { background: #4caf50; color: white; }
.workflow-btn.payment-unpaid { background: #f44336; color: white; }
.workflow-btn:disabled { background: #e0e0e0; color: #999; cursor: not-allowed; }

/* ===== Filters ===== */

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}

.filter-btn.active {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.quick-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.quick-btn.active {
    border-color: #0088cc;
    color: #0088cc;
    background: #e3f2fd;
}

/* ===== Stats ===== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stats-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.stat-card.stat-ok {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.stat-card.stat-ok .stat-value {
    color: #2e7d32;
}

.stat-card.stat-warning {
    background: #fff3e0;
    border: 2px solid #ff9800;
    animation: pulse-warning 2s ease-in-out infinite;
}

.stat-card.stat-warning .stat-value {
    color: #e65100;
}

.stat-card.stat-danger {
    background: #ffebee;
    border: 2px solid #f44336;
    animation: pulse-danger 1.5s ease-in-out infinite;
}

.stat-card.stat-danger .stat-value {
    color: #c62828;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2); }
    50% { box-shadow: 0 2px 16px rgba(255, 152, 0, 0.4); }
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 2px 8px rgba(244, 67, 54, 0.2); }
    50% { box-shadow: 0 2px 16px rgba(244, 67, 54, 0.5); }
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0088cc;
}

.stat-value.warning { color: #ff9800; }
.stat-value.danger { color: #f44336; }

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.stat-label span {
    font-weight: 600;
    color: #999;
}

/* ===== Price Calculator ===== */

.price-calc {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 20px;
}

.price-header {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.price-value {
    font-size: 32px;
    font-weight: 700;
}

.price-details {
    margin-top: 12px;
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.6;
}

/* ===== Modal ===== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #333;
}

.modal-subheader {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.close-modal {
    width: 100%;
    padding: 16px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    cursor: pointer;
}

/* ===== Empty State ===== */

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== Bag Input ===== */

.bag-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bag-input-group input {
    flex: 1;
}

.bag-check {
    padding: 12px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.occupied-warning {
    color: #f44336;
    font-size: 12px;
    margin-top: 4px;
}

/* ===== Availability ===== */

.availability-warning {
    background: #ffebee;
    border: 2px solid #ef5350;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    color: #c62828;
    font-weight: 600;
    display: none;
}

.availability-warning.show {
    display: block;
}

.availability-info {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    color: #2e7d32;
    font-weight: 600;
}

/* ===== Clients ===== */

.client-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #0088cc;
    position: relative;
}

.client-header {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
    padding-right: 80px;
}

.client-contact {
    font-size: 13px;
    color: #666;
}

.client-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
}

.client-btn {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
}

.client-btn.delete { color: #f44336; border-color: #ffcdd2; }
.client-btn.delete:hover { background: #ffebee; }
.client-btn.edit { color: #0088cc; border-color: #b3e5fc; }

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.add-client-btn {
    width: 100%;
    padding: 16px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
}

.client-notice {
    background: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #e65100;
    display: none;
}

.client-notice.show {
    display: block;
}

.responsible-note {
    background: #f3e5f5;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: #6a1b9a;
}

.location-note {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    font-size: 13px;
    color: #1565c0;
}

.location-note strong {
    color: #0d47a1;
}

/* ===== Edit Order Form ===== */

.edit-order-form {
    background: #fff8e1;
    border: 2px solid #ffcc80;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.edit-form-title {
    font-weight: 700;
    font-size: 15px;
    color: #e65100;
    margin-bottom: 12px;
}

.edit-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ===== Delete Confirm ===== */

.delete-confirm {
    background: #ffebee;
    border: 2px solid #ef5350;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.delete-confirm-text {
    color: #c62828;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ===== Calendar ===== */

.calendar-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.calendar-btn {
    padding: 12px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.calendar-btn.active {
    border-color: #0088cc;
    color: #0088cc;
    background: #e3f2fd;
}

.date-picker {
    flex: 1;
    min-width: 140px;
}

.day-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.day-stat {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.day-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #0088cc;
}

.day-stat-label {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

/* ===== Search ===== */

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: white;
}

.search-box input:focus {
    outline: none;
    border-color: #0088cc;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.search-stats {
    font-size: 13px;
    color: #666;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 8px;
}

.highlight {
    background: #ffeb3b;
    padding: 0 2px;
    border-radius: 2px;
}

/* ===== Export ===== */

.export-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.export-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    background: white;
    border: 2px solid #0088cc;
    border-radius: 12px;
    color: #0088cc;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.export-btn:hover {
    background: #e3f2fd;
}

.backup-info {
    background: #e8f5e9;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #2e7d32;
}

.backup-info strong {
    color: #1b5e20;
}

.import-area {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 12px;
    font-size: 13px;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 12px;
}

.import-area:focus {
    outline: none;
    border-color: #0088cc;
    border-style: solid;
}
