* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", "Meiryo", sans-serif; font-size: 14px; color: #333; background: #f5f5f5; }
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

nav { background: #2c3e50; padding: 0; }
nav ul { list-style: none; display: flex; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
nav li a { display: block; color: #ecf0f1; padding: 12px 18px; font-size: 14px; }
nav li a:hover, nav li a.active { background: #1a252f; text-decoration: none; }

h1 { font-size: 20px; margin-bottom: 16px; border-bottom: 2px solid #2c3e50; padding-bottom: 6px; }
h2 { font-size: 16px; margin: 16px 0 8px; }

table { width: 100%; border-collapse: collapse; background: #fff; margin-bottom: 20px; }
th, td { border: 1px solid #ddd; padding: 6px 10px; text-align: right; white-space: nowrap; }
th { background: #2c3e50; color: #fff; font-weight: normal; position: relative; }
th[data-sort] { cursor: pointer; padding-right: 20px; user-select: none; }
th[data-sort]:hover { background: #3d566e; }
th[data-sort]::after { content: '⇅'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 11px; opacity: 0.4; }
th[data-sort].sort-asc::after { content: '▲'; opacity: 1; font-size: 10px; }
th[data-sort].sort-desc::after { content: '▼'; opacity: 1; font-size: 10px; }
td:first-child, th:first-child { text-align: left; }
tr:nth-child(even) { background: #f9f9f9; }
tr:hover { background: #eef5ff; }

.buy { color: #c0392b; font-weight: bold; }
.sell { color: #2980b9; font-weight: bold; }
.positive { color: #27ae60; }
.negative { color: #c0392b; }

form.filter { margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
form.filter label { font-weight: bold; }
form.filter input, form.filter select { padding: 4px 8px; border: 1px solid #ccc; border-radius: 3px; }
form.filter button { padding: 5px 16px; background: #2c3e50; color: #fff; border: none; border-radius: 3px; cursor: pointer; }

.upload-area { background: #fff; border: 2px dashed #bbb; padding: 30px; text-align: center; margin-bottom: 16px; border-radius: 6px; }
.upload-area input[type=file] { margin: 10px 0; }
.upload-area button { padding: 8px 24px; background: #27ae60; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 15px; }

.msg { padding: 10px 14px; margin-bottom: 12px; border-radius: 4px; }
.msg.success { background: #d5f5e3; color: #1e7e34; }
.msg.error { background: #fadbd8; color: #922b21; }
.msg.info { background: #d6eaf8; color: #1a5276; }

.summary { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.summary .card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 14px 20px; min-width: 140px; }
.summary .card .label { font-size: 12px; color: #888; }
.summary .card .value { font-size: 22px; font-weight: bold; margin-top: 4px; }
.rule-o-card { border-color: #27ae60; }
.rule-x-card { border-color: #e74c3c; }

/* ルールボタン */
.rule-cell { text-align: center; white-space: nowrap; }
.rule-btn { padding: 2px 8px; border: 1px solid #ccc; border-radius: 3px; cursor: pointer; background: #f5f5f5; font-size: 13px; margin: 0 1px; }
.rule-btn:hover { background: #e0e0e0; }
.rule-btn.active-o { background: #27ae60; color: #fff; border-color: #1e8449; }
.rule-btn.active-x { background: #c0392b; color: #fff; border-color: #922b21; }

/* メモセル */
.memo-cell { text-align: left; min-width: 200px; white-space: normal; }
.memo-input { width: 100%; padding: 3px 6px; border: 1px solid #ccc; border-radius: 3px; font-size: 12px; resize: vertical; font-family: inherit; box-sizing: border-box; }
.memo-save-btn { margin-top: 3px; padding: 2px 10px; background: #2c3e50; color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: 12px; }
.memo-save-btn:hover { background: #3d566e; }

/* ロットサイズ乖離 */
.lot-ok    { color: #27ae60; font-weight: bold; }  /* 適正（±20%以内） */
.lot-over  { color: #c0392b; font-weight: bold; }  /* 多すぎ（リスク超過） */
.lot-under { color: #2980b9; }                     /* 少なめ（控えめ） */

/* 設定ページ */
.settings-table { border: none; background: none; margin-bottom: 0; }
.settings-table th, .settings-table td { border: none; background: none; padding: 8px 12px 8px 0; text-align: left; }
.settings-table th { color: #555; font-weight: bold; white-space: nowrap; }
.settings-input { padding: 5px 8px; border: 1px solid #ccc; border-radius: 3px; width: 160px; }
.settings-hint { font-size: 12px; color: #888; margin-left: 8px; }
