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

:root {
    --bg: #fafaf9;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f4;
    --border: #e7e5e4;
    --text: #292524;
    --text-muted: #78716c;
    --accent: #b45309;
    --accent-bg: rgba(180, 83, 9, 0.06);
    --accent-light: #fef3c7;
    --red: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.06);
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.06);
    --blue: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--text); text-decoration: none; }

/* Nav */
.nav {
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.nav-links { display: flex; gap: 1.5rem; font-size: 0.875rem; }
.nav-links a { color: var(--text-muted); transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }

/* Main */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Filters */
.filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.filters select, .filters input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.card:hover { box-shadow: var(--shadow); }
.card.accent { border-color: #d97706; background: var(--accent-bg); }
.card-label { font-size: 0.8rem; color: var(--text-muted); }
.card-value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; color: var(--text); }
.card-value .yen { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }
.card-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Chart containers */
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.chart-box h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

/* Tables */
.table-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg); }
th { padding: 0.75rem 1rem; text-align: left; font-weight: 500; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg-hover); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: 'SF Mono', Monaco, monospace; font-size: 0.8rem; }

/* Forms */
.form-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
input[type="text"], input[type="number"], input[type="password"], select, textarea {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #a8a29e;
    box-shadow: 0 0 0 2px rgba(168,162,158,0.2);
}
textarea { resize: vertical; min-height: 80px; width: 100%; }
.btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--bg-hover); box-shadow: var(--shadow); }
.btn-primary {
    background: var(--text);
    color: var(--bg-card);
    border-color: var(--text);
}
.btn-primary:hover { opacity: 0.9; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

/* Alert badge */
.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--red-bg);
    border: 1px solid rgba(220,38,38,0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--red);
}
.alert-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Status dot */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.on { background: var(--green); }
.status-dot.off { background: #d6d3d1; }

/* Provider tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
}
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--bg-hover); color: var(--text); font-weight: 500; }

/* Section heading */
h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; color: var(--text); }
.subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* Success message */
.msg-success {
    background: var(--green-bg);
    border: 1px solid rgba(22,163,74,0.15);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--green);
}

/* Responsive */
@media (max-width: 768px) {
    .chart-grid { grid-template-columns: 1fr; }
    .cards { grid-template-columns: 1fr 1fr; }
    .nav-inner { flex-direction: column; gap: 0.5rem; }
}
