/* ================================================================
   BTC GROUP Dashboard
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #f2f4f7;
    --surface:    #ffffff;
    --border:     #e5e7eb;
    --text:       #111827;
    --text2:      #4b5563;
    --text3:      #9ca3af;
    --primary:    #4f46e5;
    --primary-l:  #eef2ff;
    --green:      #059669;
    --green-l:    #ecfdf5;
    --green-dot:  #10b981;
    --red:        #dc2626;
    --red-l:      #fef2f2;
    --yellow:     #d97706;
    --yellow-l:   #fffbeb;
    --radius:     14px;
    --radius-sm:  10px;
    --shadow:     0 1px 3px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.03);
    --font:       'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Header ────────────────────────────────── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.header-inner {
    max-width: 1100px; margin: 0 auto;
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 18px;
}
.header-title { font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.header-title span { color: var(--primary); }
.header-sub { font-size: 11px; color: var(--text3); font-weight: 400; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-clock {
    font-size: 12px; color: var(--text2);
    font-variant-numeric: tabular-nums;
}

/* ── Main ──────────────────────────────────── */
.main {
    max-width: 1100px; margin: 0 auto;
    padding: 24px 24px 80px;
}

/* ── Summary Row ───────────────────────────── */
.summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.summary-value {
    font-size: 32px; font-weight: 800;
    line-height: 1.1; margin-bottom: 4px;
}
.summary-value-sm { font-size: 16px; font-weight: 600; }
.summary-label { font-size: 11px; color: var(--text3); font-weight: 500; }
.summary-running .summary-value { color: var(--green); }
.summary-error .summary-value { color: var(--red); }

/* ── Category ──────────────────────────────── */
.category {
    margin-bottom: 24px;
}
.category-title {
    font-size: 13px; font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
    padding-left: 2px;
    display: flex; align-items: center; gap: 8px;
}
.category-title::before {
    content: '';
    width: 3px; height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

/* ── Tool Card ─────────────────────────────── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none; color: inherit;
    display: flex; gap: 16px; align-items: flex-start;
    transition: all .2s ease;
    box-shadow: var(--shadow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(79,70,229,.1);
    border-color: #c7d2fe;
}
.tool-card::after {
    content: '→';
    position: absolute;
    right: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text3);
    font-size: 16px;
    transition: .2s;
}
.tool-card:hover::after { color: var(--primary); transform: translateY(-50%) translateX(3px); }

.tool-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}

.tool-body { flex: 1; min-width: 0; padding-right: 24px; }
.tool-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.tool-desc { font-size: 12px; color: var(--text2); margin-bottom: 8px; }

/* ステータスバッジ */
.tool-status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px;
}
.status-running {
    background: var(--green-l); color: var(--green);
}
.status-running::before {
    content: ''; width: 6px; height: 6px;
    background: var(--green-dot); border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}
.status-error {
    background: var(--red-l); color: var(--red);
}
.status-error::before {
    content: ''; width: 6px; height: 6px;
    background: var(--red); border-radius: 50%;
    display: inline-block;
}
.status-stopped {
    background: var(--yellow-l); color: var(--yellow);
}
.status-stopped::before {
    content: ''; width: 6px; height: 6px;
    background: var(--yellow); border-radius: 50%;
    display: inline-block;
}

.tool-summary {
    font-size: 11px; color: var(--text3);
    margin-top: 4px;
}

/* ── Loading ───────────────────────────────── */
.loading {
    text-align: center; padding: 60px 0;
    color: var(--text3); font-size: 13px;
}
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 12px;
}

/* ── Footer ────────────────────────────────── */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: var(--text3);
}
.footer-sep { margin: 0 8px; }

/* ── Animations ────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.category { animation: fadeIn .4s ease both; }
.category:nth-child(2) { animation-delay: .05s; }
.category:nth-child(3) { animation-delay: .1s; }
.category:nth-child(4) { animation-delay: .15s; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
    .main { padding: 16px 12px 60px; }
    .summary-row { grid-template-columns: repeat(2, 1fr); }
    .tools-grid { grid-template-columns: 1fr; }
    .header-inner { padding: 12px 16px; }
}
@media (max-width: 480px) {
    .summary-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .summary-card { padding: 14px 12px; }
    .summary-value { font-size: 24px; }
}
