* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #0f1115;
    color: #e8ecf1;
    font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(180deg, #0f1115 0%, #151922 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: #171b24;
    border: 1px solid #2a3242;
    border-radius: 0;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.brand {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.subtitle {
    color: #9ba7b8;
    margin-bottom: 24px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #b9c2d0;
}

.login-form input {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #344054;
    background: #0e131a;
    color: #eef2f7;
    outline: none;
    border-radius: 0;
    margin-bottom: 16px;
}

.login-form button,
.btn {
    padding: 12px 18px;
    border: 1px solid #4a5568;
    background: #1f2937;
    color: #f9fafb;
    cursor: pointer;
    border-radius: 0;
    transition: 0.15s ease;
}

.login-form button:hover,
.btn:hover {
    background: #253142;
}

.btn.primary {
    background: #dbe2ea;
    color: #111827;
    border-color: #dbe2ea;
}

.btn.primary:hover {
    background: #ffffff;
}

.btn.ghost {
    background: transparent;
    border-color: #5f6b7c;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid #5d2c2c;
    background: #2b1515;
    color: #ffcccc;
}

.layout {
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid #2a3242;
    padding-bottom: 18px;
}

.topbar h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
}

.meta-line {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: #95a1b2;
    font-size: 14px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.panel {
    background: #171b24;
    border: 1px solid #2a3242;
    padding: 18px;
    min-width: 0;
}

.panel.wide {
    grid-column: span 2;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #f1f5f9;
}

.control-group .row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
}

.range-wrap input[type="range"] {
    flex: 1;
    min-width: 240px;
}

.range-wrap input[type="number"] {
    width: 90px;
    padding: 10px;
    border: 1px solid #344054;
    background: #0e131a;
    color: #eef2f7;
    border-radius: 0;
}

.state-box {
    border: 1px solid #303949;
    padding: 16px;
    background: #11161e;
    line-height: 1.9;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.stat-card {
    border: 1px solid #303949;
    padding: 16px;
    background: #11161e;
}

.stat-card .label {
    color: #95a1b2;
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 700;
    word-break: break-word;
}

.chart-box {
    margin-bottom: 26px;
    background: #11161e;
    border: 1px solid #303949;
    padding: 14px;
}

.log-table-wrap {
    overflow-x: auto;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
}

.log-table th,
.log-table td {
    border: 1px solid #2f3746;
    padding: 10px 12px;
    text-align: left;
    font-size: 14px;
}

.log-table th {
    background: #11161e;
    color: #dbe4ef;
}

.log-table td {
    color: #c7d0dc;
}

.notice {
    padding: 12px 14px;
    border: 1px solid #355173;
    background: #132233;
    color: #d7ebff;
    margin-bottom: 14px;
    transition: opacity 0.15s ease;
}

.notice.hidden {
    display: none;
}

.notice.info {
    border-color: #355173;
    background: #132233;
    color: #d7ebff;
}

.notice.success {
    border-color: #2f5a3a;
    background: #15291b;
    color: #d6ffe0;
}

.notice.error {
    border-color: #6b2c2c;
    background: #2b1515;
    color: #ffd7d7;
}

@media (max-width: 980px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .panel.wide {
        grid-column: span 1;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .layout {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
    }
}

.mode-switch {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mode-btn {
    min-width: 110px;
}

.mode-btn.active {
    background: #e5e7eb;
    color: #111827;
    border-color: #e5e7eb;
    font-weight: 700;
}

.mode-btn.inactive {
    background: #1f2937;
    color: #f9fafb;
    border-color: #4a5568;
}

.mode-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

input:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}