* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* アプリケーションレイアウト */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* サイドバー */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* サイドバーのスクロールバースタイル */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #3498db;
}

.sidebar-link-success {
    background: rgba(76, 175, 80, 0.2);
    border-left-color: #4caf50;
}

.sidebar-link-success:hover {
    background: rgba(76, 175, 80, 0.3);
}

.sidebar-link.active {
    background: rgba(52, 152, 219, 0.3);
    border-left-color: #3498db;
    font-weight: 600;
}

.sidebar-link.active:hover {
    background: rgba(52, 152, 219, 0.4);
}

.sidebar-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-button {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 20px;
}

.sidebar-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.3s;
}

.sidebar-checkbox:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-checkbox input {
    margin: 0;
    cursor: pointer;
}

/* メインコンテンツエリア */
.main-content {
    flex: 1;
    margin-left: 250px;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    white-space: nowrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1001;
        background: #2c3e50;
        color: white;
        border: none;
        padding: 10px;
        border-radius: 5px;
        cursor: pointer;
    }
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: #42a5f5;
    color: white;
}

.btn-primary:hover {
    background: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-success {
    background: #66bb6a;
    color: white;
}

.btn-success:hover {
    background: #43a047;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 30px;
    background: #f5f5f5;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.stat-positive {
    color: #4caf50;
}

.stat-negative {
    color: #f44336;
}

.filter-panel {
    display: flex;
    gap: 10px;
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.search-input, .filter-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    padding-right: 30px;
}

.clear-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.clear-search-btn:hover {
    color: #333;
}

.filter-select {
    min-width: 150px;
}

#showAllColumns {
    margin-left: 10px;
}

.table-controls {
    padding: 10px 30px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.btn-secondary {
    background: #757575;
    color: white;
}

.btn-secondary:hover {
    background: #616161;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    width: 100%;
}

/* カラムが多すぎる場合の調整 */
table {
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

th, td {
    white-space: nowrap;
    min-width: 100px;
}

th:first-child, td:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

thead th:first-child {
    background: #667eea;
    color: white;
}

thead {
    background: #667eea;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    font-weight: 600;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    font-weight: 600;
}

tbody tr:hover {
    background: #f5f5f5;
}

tbody tr:nth-child(even) {
    background: #fafafa;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-in-stock {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-out-of-stock {
    background: #ffebee;
    color: #c62828;
}

.status-low-stock {
    background: #fff3e0;
    color: #e65100;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.pagination {
    padding: 20px 30px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.pagination button {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

.pagination button:hover {
    background: #667eea;
    color: white;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 600px;
    position: relative;
    max-height: 90vh; /* 画面下が見切れないように */
    overflow-y: auto; /* 縦スクロール可能に */
}

.close {
    position: sticky;
    top: 0;
    display: block;
    text-align: right;
    padding: 10px 20px 5px 20px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    z-index: 10;
}

.close:hover {
    color: #333;
}

/* トースト */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 30px;
    background: #333;
    color: white;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 10000;
}

.toast.show {
    display: block;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.btn-detail {
    padding: 4px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-detail:hover {
    background: #764ba2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
