/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #333;
}

/* Top Bar */
.topbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 16px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.app-title { font-weight: 700; font-size: 16px; margin-right: 12px; }
.app-subtitle { color: #8899aa; font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.btn-icon {
    background: none; border: none; color: #ccc; font-size: 18px;
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-link { color: #8899aa; text-decoration: none; font-size: 13px; cursor: pointer; background: none; border: none; }
.btn-link:hover { color: #fff; }

/* Main Layout */
.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Panels */
.panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
    background: #fff;
}
.panel-orders { width: 200px; min-width: 180px; }
.panel-vendors { width: 260px; min-width: 220px; }
.panel-detail { flex: 1; }

.panel-header {
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.panel-body { flex: 1; overflow-y: auto; }
.panel-footer {
    padding: 8px 12px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.panel-actions { display: flex; align-items: center; gap: 8px; }
.check-all-label { font-size: 12px; color: #666; cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* Order Items */
.order-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}
.order-item:hover { background: #f5f7fa; }
.order-item.active { background: #e3f2fd; border-left: 3px solid #1976d2; }
.order-no { font-weight: 600; font-size: 13px; }
.order-meta { display: flex; justify-content: space-between; font-size: 11px; color: #888; margin-top: 2px; }
.order-status { margin-top: 4px; }

/* Badges */
.badge { font-size: 10px; padding: 2px 6px; border-radius: 10px; font-weight: 500; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-warn { background: #fff3e0; color: #e65100; }

/* Vendor Items */
.vendor-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.vendor-item:hover { background: #f5f7fa; }
.vendor-item.active { background: #e3f2fd; }
.vendor-check { flex-shrink: 0; }
.vendor-info { flex: 1; min-width: 0; }
.vendor-name { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vendor-meta { font-size: 11px; color: #888; }
.vendor-status { flex-shrink: 0; font-size: 16px; }
.status-sent { color: #2e7d32; }
.status-error { color: #c62828; }
.status-pending { color: #bbb; font-size: 10px; }

/* Detail Section */
.detail-section { margin: 12px; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; }
.detail-section-header {
    padding: 8px 12px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid #e0e0e0;
}

/* Data Table */
.table-wrapper { overflow-x: auto; max-height: 300px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
    background: #1f4e79; color: #fff; padding: 6px 8px;
    text-align: left; font-weight: 500; position: sticky; top: 0;
}
.data-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover { background: #f5f7fa; }
.text-center { text-align: center; }

/* Mail Form */
.mail-form { padding: 12px; }
.mail-row { display: flex; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.mail-row label { width: 55px; flex-shrink: 0; font-weight: 500; font-size: 12px; padding-top: 6px; color: #555; }
.mail-row input[type="text"] {
    flex: 1; padding: 6px 10px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 13px; font-family: inherit;
}
.mail-row input:focus, .mail-row textarea:focus {
    outline: none; border-color: #1976d2; box-shadow: 0 0 0 2px rgba(25,118,210,0.15);
}
.mail-row textarea {
    flex: 1; padding: 6px 10px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 13px; font-family: inherit; resize: vertical;
}
.mail-actions {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee;
}
.mail-sent-info { font-size: 11px; color: #2e7d32; margin-left: auto; }

/* Buttons */
.btn {
    padding: 6px 16px; border: none; border-radius: 4px;
    font-size: 13px; cursor: pointer; font-family: inherit; transition: background 0.2s;
}
.btn-primary { background: #1976d2; color: #fff; }
.btn-primary:hover { background: #1565c0; }
.btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #ccc; }
.btn-secondary:hover { background: #e0e0e0; }
.btn-sm { padding: 4px 10px; font-size: 11px; background: #1976d2; color: #fff; border: none; border-radius: 3px; cursor: pointer; }
.btn-sm:hover { background: #1565c0; }

/* Status Bar */
.statusbar {
    height: 24px; background: #1a1a2e; color: #8899aa;
    padding: 0 12px; font-size: 11px; display: flex; align-items: center; flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal {
    background: #fff; border-radius: 8px; width: 90%; max-width: 900px;
    max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-header {
    padding: 12px 16px; font-weight: 600; border-bottom: 1px solid #e0e0e0;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-body { flex: 1; overflow-y: auto; padding: 16px; }
.btn-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #999; }
.btn-close:hover { color: #333; }

/* Settings Table */
.settings-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.settings-table th { text-align: left; padding: 6px 8px; background: #f8f9fa; border-bottom: 2px solid #e0e0e0; }
.settings-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; }
.input-sm { width: 100%; padding: 4px 6px; border: 1px solid #ddd; border-radius: 3px; font-size: 12px; }
.input-sm:focus { outline: none; border-color: #1976d2; }
