/* お米ダッシュボード — Transparently デザイン準拠
   トークンは quake.transparently.jp / mytown.transparently.jp / portal.css と共通 */

:root {
  --brand: #f04e4b;
  --brand-dark: #d43c39;
  --ink: #222;
  --ink-soft: #555;
  --ink-faint: #888;
  --line: #e3e3e3;
  --line-soft: #ececec;
  --paper: #ffffff;
  --paper-tint: #faf9f8;
  --paper-deep: #f4f3f2;
  --radius: 6px;
  --maxw: 1160px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper-tint);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", monospace; }

/* ================= ヘッダー ================= */
.site-header {
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}
.brand img { height: 26px; width: auto; display: block; }
.site-catch {
  flex: 1 1 auto;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; }
.contact-link {
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 10px;
  white-space: nowrap;
}
.contact-link:hover { color: var(--brand); border-color: var(--brand); }

/* ================= レイアウト ================= */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px 40px;
}

/* ================= タイル ================= */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.tile-label { font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; }
.tile-value { font-size: 24px; font-weight: 500; line-height: 1.4; }
.tile-value small { font-size: 13px; font-weight: 400; color: var(--ink-soft); }

/* ================= メイン ================= */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.side-col { display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 6px 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
}
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .02em;
}
.list-note { font-size: 12px; color: var(--ink-faint); }
.empty-state { color: var(--ink-faint); text-align: center; padding: 40px 0; margin: 0; }

/* ================= ピルボタン ================= */
.preset-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.preset-pills button {
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.preset-pills button:hover { border-color: var(--brand); color: var(--brand); }
.preset-pills button.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.preset-pills button:disabled {
  opacity: .4; cursor: default;
}
.preset-pills button:disabled:hover { border-color: var(--line); color: var(--ink); }

/* ================= 地図 ================= */
.map-panel { position: relative; display: flex; flex-direction: column; }
.map-panel .panel-head.pad { margin: 14px 16px 0; }
#map { height: 560px; background: var(--paper-deep); }
.map-legend {
  position: absolute; right: 10px; bottom: 10px; z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink-soft);
}
.map-legend .row { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.map-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.08); }
.leaflet-bar, .leaflet-control-layers { border-radius: var(--radius) !important; }
.leaflet-container { font-family: inherit; font-size: 12px; }

/* ================= チャート ================= */
.chart-box { padding: 14px 16px; grid-column: 1 / -1; }
.chart { width: 100%; height: 300px; }
.chart-tall { height: 560px; }

/* 半分幅チャート2枚を横に並べる */
.charts-2col {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.charts-2col .chart-box { grid-column: auto; }

/* ================= 銘柄テーブル ================= */
.list-box { padding: 14px 16px; grid-column: 1 / -1; }
.filter-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
}
#search-input {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  width: 240px;
}
#search-input:focus { outline: none; border-color: var(--brand); }
#sort-select {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
#sort-select:hover { border-color: var(--ink-faint); }
.table-wrap { overflow-x: auto; }
.brand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.brand-table th, .brand-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}
.brand-table th {
  font-size: 12px; font-weight: 500;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--line);
}
.brand-table .num { text-align: right; font-family: "JetBrains Mono", monospace; }
.brand-table td.num { color: var(--ink-soft); }
.brand-table td.r1-strong { color: var(--ink); font-weight: 500; }
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  padding-top: 12px;
}
.pager:empty { display: none; }
.ghost-btn {
  font-family: inherit;
  font-size: 13px; font-weight: 500;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand); }
.ghost-btn:disabled { opacity: .35; cursor: default; }
.ghost-btn:disabled:hover { border-color: var(--line); color: var(--ink); }
.pager-info { font-size: 12px; color: var(--ink-faint); }

/* ================= 年産別サマリー ================= */
.compare-box { padding: 14px 16px; grid-column: 1 / -1; }
.brand-table td.na { color: var(--ink-faint); }
.compare-notes { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.compare-notes p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.9;
}
.compare-notes .note-sub { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

/* ================= お米検索 ================= */
.variety-link { border-bottom: 1px dotted var(--ink-faint); }
.variety-link:hover { color: var(--brand); border-bottom-color: var(--brand); }
.web-search-link {
  display: inline-block;
  font-size: 11px;
  padding: 1px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.web-search-link:hover { border-color: var(--brand); color: var(--brand); }

/* ================= データ更新状況 ================= */
.status-box { padding: 14px 16px; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.status-list li:last-child { border-bottom: none; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.status-dot.ok { background: #3d9e60; }
.status-dot.ng { background: var(--brand); }
.status-dot.wait { background: #d5d5d5; }
.status-name { flex: 1 1 auto; }
.status-time { font-size: 12px; color: var(--ink-faint); font-family: "JetBrains Mono", monospace; }
.status-foot { margin: 10px 0 0; font-size: 11px; color: var(--ink-faint); }

/* ================= ノート ================= */
.note-box { padding: 14px 16px; }
.note-box.wide { grid-column: 1 / -1; }
.note-box p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.9;
}
.note-box .note-sub {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ================= フッター ================= */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 16px 0;
  margin-top: 8px;
}
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 20px;
  font-size: 13px; color: var(--ink-faint);
}
.footer-copy { font-family: "JetBrains Mono", monospace; }

/* ================= レスポンシブ ================= */
@media (max-width: 960px) {
  .site-catch { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .charts-2col { grid-template-columns: 1fr; }
  #search-input { width: 100%; }
  #map { height: 420px; }
  .chart-tall { height: 480px; }
}
