/* ============== レイアウト ============== */
.tk-page { min-height:100vh; background:#f0f2f5; }

.tk-header {
  display:flex; align-items:center; padding:10px 20px;
  border-bottom:1px solid #dadce0; background:#fff;
  position:sticky; top:0; z-index:100; gap:12px;
}
.tk-logo {
  font-size:26px; font-weight:bold; white-space:nowrap;
  font-family:Arial,sans-serif; flex-shrink:0; text-decoration:none; cursor:pointer;
}
.tk-logo span:nth-child(1){color:#4285F4}
.tk-logo span:nth-child(2){color:#EA4335}
.tk-logo span:nth-child(3){color:#FBBC05}
.tk-logo span:nth-child(4){color:#4285F4}
.tk-logo span:nth-child(5){color:#34A853}
.tk-logo span:nth-child(6){color:#EA4335}
.tk-logo span:nth-child(7){color:#FBBC05}
.tk-header-title { font-size:15px; font-weight:700; color:#202124; }
.tk-header-actions { margin-left:auto; display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }

.rk-share-btn {
  background:none; border:1px solid #dadce0; border-radius:16px;
  padding:4px 12px; font-size:12px; color:#5f6368; cursor:pointer;
  font-family:inherit; white-space:nowrap;
}
.rk-share-btn:hover { background:#f1f3f4; }

.tk-header-link {
  font-size:12px; color:#5f6368; text-decoration:none;
  border:1px solid #dadce0; border-radius:16px; padding:4px 12px;
  background:#fff; font-family:inherit; cursor:pointer;
  white-space:nowrap;
}
.tk-header-link:hover { background:#f1f3f4; }

.tk-body { max-width:1200px; margin:0 auto; padding:16px 16px 40px; }

.tk-modesel { display:flex; gap:8px; margin-bottom:12px; }
.tk-modebtn {
  flex:1; background:#fff; border:2px solid #dadce0; border-radius:12px;
  padding:14px 16px; cursor:pointer; font-family:inherit;
  display:flex; align-items:center; gap:10px;
  transition:all .15s; box-shadow:0 1px 3px rgba(0,0,0,0.06);
}
.tk-modebtn:hover { border-color:#1a73e8; }
.tk-modebtn.active {
  border-color:transparent;
  background:linear-gradient(135deg,#1a73e8,#34a853);
  color:#fff; box-shadow:0 3px 10px rgba(26,115,232,.25);
}
.tk-modebtn .ic { font-size:24px; }
.tk-modebtn .ttl { font-size:14px; font-weight:700; }
.tk-modebtn .sub { font-size:11px; opacity:.85; margin-top:2px; }
.tk-modebtn .txt { text-align:left; line-height:1.3; }

.tk-controls {
  background:#fff; border-radius:10px; padding:12px 14px;
  box-shadow:0 1px 3px rgba(0,0,0,0.06);
  margin-bottom:12px; display:flex; flex-wrap:wrap; gap:14px; align-items:center;
}
.tk-ctrl-group { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.tk-ctrl-group strong { color:#5f6368; font-size:12px; font-weight:700; }
.tk-pbtns { display:flex; gap:4px; flex-wrap:wrap; }
.tk-pbtn {
  background:#f8f9fa; border:1px solid #dadce0; border-radius:16px;
  padding:5px 14px; font-size:12px; color:#3c4043; cursor:pointer;
  font-family:inherit; transition:all .12s;
}
.tk-pbtn:hover { background:#e8f0fe; border-color:#1a73e8; color:#1a73e8; }
.tk-pbtn.active {
  background:linear-gradient(135deg,#1a73e8,#34a853); color:#fff;
  border-color:transparent; font-weight:600;
  box-shadow:0 2px 6px rgba(26,115,232,.25);
}
.tk-date-input {
  border:1px solid #dadce0; border-radius:6px; padding:5px 10px;
  font-size:12px; font-family:inherit; color:#3c4043; background:#fff;
}
.tk-date-input:focus { border-color:#1a73e8; outline:none; }
.tk-reload {
  background:#fff; border:1px solid #dadce0;
  border-radius:16px; padding:5px 14px; font-size:12px;
  color:#1a73e8; cursor:pointer; font-family:inherit; font-weight:600;
}
.tk-reload:hover { background:#e8f0fe; border-color:#1a73e8; }
.tk-reload:disabled { opacity:.5; cursor:not-allowed; }
.tk-cache-info { font-size:11px; color:#70757a; }

.tk-status {
  padding:8px 14px; margin-bottom:12px; border-radius:8px;
  font-size:12px; display:none;
}
.tk-status.show { display:block; }
.tk-status.info { background:#e8f0fe; color:#1a73e8; border-left:3px solid #1a73e8; }
.tk-status.warn { background:#fff3cd; color:#856404; border-left:3px solid #f9ab00; }
.tk-status.err  { background:#fce8e6; color:#c5221f; border-left:3px solid #ea4335; }
.tk-status.ok   { background:#e6f4ea; color:#137333; border-left:3px solid #34a853; }

.tk-metrics {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(100px, 1fr));
  gap:8px; margin-bottom:12px;
}
.tk-metric {
  background:#fff; border-radius:10px; padding:12px 10px;
  text-align:center; box-shadow:0 1px 3px rgba(0,0,0,0.06);
  border-top:3px solid #1a73e8;
}
.tk-metric[data-color="blue"]   { border-top-color:#4285F4; }
.tk-metric[data-color="red"]    { border-top-color:#EA4335; }
.tk-metric[data-color="yellow"] { border-top-color:#FBBC05; }
.tk-metric[data-color="green"]  { border-top-color:#34A853; }
.tk-metric[data-color="purple"] { border-top-color:#9c27b0; }
.tk-metric[data-color="teal"]   { border-top-color:#00897b; }
.tk-metric[data-color="orange"] { border-top-color:#f9ab00; }
.tk-metric[data-color="cyan"]   { border-top-color:#00acc1; }
.tk-metric[data-color="pink"]   { border-top-color:#e91e63; }
.tk-metric[data-color="indigo"] { border-top-color:#3f51b5; }
.tk-metric-icon  { font-size:18px; margin-bottom:2px; }
.tk-metric-val   { font-size:22px; font-weight:700; color:#202124; line-height:1.2; }
.tk-metric-label { font-size:10px; color:#70757a; margin-top:2px; }
.tk-metric-sub   { font-size:10px; color:#9aa0a6; margin-top:1px; }

.tk-card {
  background:#fff; border-radius:10px; padding:14px 16px;
  box-shadow:0 1px 3px rgba(0,0,0,0.06); margin-bottom:12px;
}
.tk-card-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:10px; gap:8px; flex-wrap:wrap;
}
.tk-card-title { font-size:13px; font-weight:700; color:#202124; }
.tk-card-title-sub { font-size:11px; color:#70757a; font-weight:400; margin-left:4px; }
.tk-card-tools { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }

.tk-series { display:inline-flex; flex-wrap:wrap; gap:4px; }
.tk-series button {
  background:#f1f3f4; border:1px solid transparent; border-radius:14px;
  padding:3px 10px; font-size:11px; color:#5f6368; cursor:pointer;
  font-family:inherit; font-weight:600;
  display:inline-flex; align-items:center; gap:4px;
}
.tk-series button .dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.tk-series button.active { color:#fff; }
.tk-series button[data-key="p"].active { background:#4285F4; }
.tk-series button[data-key="t"].active { background:#EA4335; }
.tk-series button[data-key="n"].active { background:#FBBC05; color:#3c4043; }
.tk-series button[data-key="a"].active { background:#34A853; }

.tk-tog {
  display:inline-flex; background:#f1f3f4; border-radius:14px; padding:2px; gap:2px;
}
.tk-tog button {
  background:none; border:none; padding:3px 10px; font-size:11px;
  color:#5f6368; cursor:pointer; border-radius:12px;
  font-family:inherit; font-weight:600;
}
.tk-tog button.active {
  background:#fff; color:#1a73e8; box-shadow:0 1px 3px rgba(0,0,0,.1);
}

.tk-chart-wrap {
  position:relative;
  width:100%;
  height:420px;
  padding:8px 6px 32px;
  box-sizing:border-box;
  overflow:hidden;
}
.tk-chart-wrap.tall { height:480px; padding-bottom:36px; }
.tk-chart-wrap.short { height:300px; padding-bottom:28px; }
.tk-chart-wrap > canvas {
  position:absolute;
  top:8px; left:6px;
  right:6px; bottom:32px;
  width:calc(100% - 12px) !important;
  height:calc(100% - 40px) !important;
}
.tk-chart-wrap.tall > canvas { bottom:36px; height:calc(100% - 44px) !important; }
.tk-chart-wrap.short > canvas { bottom:28px; height:calc(100% - 36px) !important; }

.tk-split { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tk-split .tk-chart-wrap { height:280px; padding-bottom:28px; }
.tk-split .tk-chart-wrap > canvas { bottom:28px; height:calc(100% - 36px) !important; }
@media (max-width:720px) { .tk-split { grid-template-columns:1fr; } }
.tk-split-card {
  border:1px solid #f1f3f4; border-radius:8px; padding:8px 10px;
}
.tk-split-card .ttl {
  font-size:11px; font-weight:700; color:#5f6368;
  margin-bottom:4px; display:flex; align-items:center; gap:6px;
}
.tk-split-card .ttl .dot { width:10px; height:10px; border-radius:50%; display:inline-block; }

.tk-table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.tk-table { width:100%; border-collapse:collapse; font-size:12px; }
.tk-table th, .tk-table td {
  padding:7px 10px; text-align:right; border-bottom:1px solid #f1f3f4; white-space:nowrap;
}
.tk-table th {
  background:#f8f9fa; color:#5f6368; font-weight:600; font-size:11px;
  position:sticky; top:0;
}
.tk-table th:first-child, .tk-table td:first-child { text-align:left; }
.tk-table tbody tr:hover { background:#f8f9fa; }
.tk-table tfoot td {
  font-weight:700; background:#f8f9fa; border-top:2px solid #dadce0;
}

.tk-collapse { padding:0; overflow:hidden; }
.tk-collapse > .tk-collapse-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; cursor:pointer; list-style:none;
  user-select:none; transition:background .12s; gap:8px;
}
.tk-collapse > .tk-collapse-head::-webkit-details-marker { display:none; }
.tk-collapse > .tk-collapse-head:hover { background:#f8f9fa; }
.tk-collapse-arrow { font-size:14px; color:#5f6368; transition:transform .2s; }
.tk-collapse[open] .tk-collapse-arrow { transform:rotate(180deg); }
.tk-collapse-body { padding:0 16px 16px; }

.tk-3d-wrap {
  position:relative; height:520px; width:100%;
  background:#fafbfc; border-radius:8px; padding:8px;
  box-sizing:border-box;
}
.tk-3d-help {
  font-size:11px; color:#70757a; margin-top:6px; text-align:right;
}

.tk-last-updated { font-size:11px; color:#9aa0a6; text-align:right; margin-top:8px; }

/* ============== スマホ対応 ============== */
@media (max-width:768px) {
  .tk-header { padding:8px 10px; gap:6px; flex-wrap:wrap; }
  .tk-logo { font-size:20px; }
  .tk-header-title { font-size:12px; }
  .tk-header-actions { gap:6px; }
  .rk-share-btn, .tk-header-link { padding:3px 9px; font-size:11px; }

  .tk-body { padding:8px 4px 40px; }

  .tk-modesel { gap:6px; margin-bottom:10px; }
  .tk-modebtn { padding:10px 10px; gap:8px; border-radius:10px; }
  .tk-modebtn .ic { font-size:20px; }
  .tk-modebtn .ttl { font-size:13px; }
  .tk-modebtn .sub { font-size:10px; }

  .tk-controls { padding:10px; gap:8px; flex-direction:column; align-items:stretch; }
  .tk-ctrl-group { width:100%; }
  .tk-ctrl-group[style*="margin-left:auto"],
  .tk-ctrl-group[style*="margin-left: auto"] { margin-left:0 !important; justify-content:space-between; }
  .tk-pbtns { flex:1; }
  .tk-pbtn { padding:6px 10px; font-size:12px; flex:1 1 auto; text-align:center; min-width:60px; }
  .tk-date-input { flex:1; min-width:0; }
  #dailyCustomRange { flex-wrap:wrap; width:100%; }
  #dailyCustomRange .tk-date-input { flex:1 1 40%; }

  .tk-metrics { grid-template-columns:repeat(3, 1fr); gap:6px; }
  .tk-metric { padding:10px 8px; }
  .tk-metric-val { font-size:18px; }
  .tk-metric-icon { font-size:16px; }
  .tk-metric-label { font-size:10px; }
  .tk-metric-sub { font-size:9px; }

  .tk-card { padding:10px 6px; border-radius:8px; }
  .tk-card-head { gap:6px; padding:0 4px; margin-bottom:8px; }
  .tk-card-tools { width:100%; gap:6px; }
  .tk-card-title { font-size:12px; }
  .tk-card-title-sub { font-size:10px; display:block; margin-left:0; margin-top:2px; }

  .tk-chart-wrap {
    height:240px;
    padding:4px 0 24px;
  }
  .tk-chart-wrap > canvas {
    top:4px; left:0; right:0; bottom:24px;
    width:100% !important; height:calc(100% - 28px) !important;
  }
  .tk-chart-wrap.tall {
    height:260px;
    padding-bottom:26px;
  }
  .tk-chart-wrap.tall > canvas {
    bottom:26px; height:calc(100% - 30px) !important;
  }
  .tk-split { gap:8px; }
  .tk-split .tk-chart-wrap { height:180px; }
  .tk-split-card { padding:6px 4px; }

  .tk-3d-wrap { height:300px; padding:4px; }

  .tk-table th, .tk-table td { padding:6px 8px; font-size:11px; }
  .tk-collapse > .tk-collapse-head { padding:12px 12px; }
  .tk-collapse-body { padding:0 6px 12px; }
}

@media (max-width:420px) {
  .tk-logo { font-size:18px; }
  .tk-header-title { display:none; }
  .tk-modebtn .sub { display:none; }
  .tk-metric-val { font-size:16px; }
  .tk-metrics { grid-template-columns: repeat(3, 1fr); }
  .tk-body { padding:6px 2px 40px; }
  .tk-card { padding:8px 4px; }

  .tk-chart-wrap { height:220px; padding:2px 0 22px; }
  .tk-chart-wrap > canvas { bottom:22px; height:calc(100% - 24px) !important; }
  .tk-chart-wrap.tall { height:240px; padding-bottom:24px; }
  .tk-chart-wrap.tall > canvas { bottom:24px; height:calc(100% - 26px) !important; }
  .tk-split .tk-chart-wrap { height:170px; }
  .tk-3d-wrap { height:280px; }
}

@media (max-width:900px) and (orientation:landscape) {
  .tk-chart-wrap { height:200px; }
  .tk-chart-wrap.tall { height:220px; }
  .tk-3d-wrap { height:240px; }
}
/* ============== その他ドロップダウン ============== */
.tk-extra-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tk-extra-toggle {
  background: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 11px;
  color: #5f6368;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  white-space: nowrap;
}
.tk-extra-toggle:hover { background: #e8eaed; }
.tk-extra-toggle.has-active {
  background: #1a73e8;
  color: #fff;
}
.tk-extra-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 200;
  min-width: 200px;
  padding: 6px 0;
}
.tk-extra-menu.open { display: block; }
.tk-extra-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 12px;
  color: #3c4043;
  cursor: pointer;
  white-space: nowrap;
  transition: background .1s;
}
.tk-extra-item:hover { background: #f8f9fa; }
.tk-extra-item input[type="checkbox"] {
  accent-color: #1a73e8;
  width: 14px;
  height: 14px;
  margin: 0;
}
.tk-extra-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.tk-extra-lbl { flex: 1; }
