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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #000000;
    color: #ffffff;
    min-height: 100vh;
}

.header {
    background: #0a0a0a;
    border-bottom: 1px solid #1a2a1a;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #22c55e;
    letter-spacing: -0.02em;
}

.header-left p {
    color: #6b7280;
    font-size: 0.82rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.3rem;
    font-weight: 500;
    color: #22c55e;
    letter-spacing: 0.05em;
    background: #0f0f0f;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    border: 1px solid #1a3a1a;
}

.badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    background: #0f0f0f;
    color: #9ca3af;
    border: 1px solid #1f2f1f;
    transition: border-color 0.2s;
}

.badge:hover {
    border-color: #22c55e;
}

.badge strong {
    color: #22c55e;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #0a0a0a;
    border: 1px solid #1a2a1a;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.stat-card .val {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

.stat-card .lbl {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

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

.card {
    background: #0a0a0a;
    border: 1px solid #1a2a1a;
    border-radius: 12px;
    padding: 1.25rem;
}

.card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1a2a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-left: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #d1d5db;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-val {
    margin-left: auto;
    font-weight: 600;
    color: #ffffff;
}

.bar-wrap {
    margin-top: 0.5rem;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.bar-label {
    width: 70px;
    font-size: 0.78rem;
    color: #9ca3af;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: #0f0f0f;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
    min-width: 2px;
}

.bar-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    width: 30px;
    text-align: right;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

th {
    text-align: left;
    padding: 0.55rem 0.75rem;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #050505;
    border-bottom: 1px solid #1a2a1a;
    white-space: nowrap;
}

td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #0f0f0f;
    vertical-align: middle;
}

tr:hover td {
    background: #0f1a0f;
}

tr:last-child td {
    border-bottom: none;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tag-green {
    background: #0a2a0a;
    color: #4ade80;
}

.tag-white {
    background: #1a1a1a;
    color: #ffffff;
}

.tag-black {
    background: #000000;
    color: #9ca3af;
    border: 1px solid #1f2f1f;
}

.hash {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #22c55e;
}

.hash-link {
    color: #22c55e;
    text-decoration: none;
}

.hash-link:hover {
    text-decoration: underline;
}

.msg {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #d1d5db;
}

.date-col {
    white-space: nowrap;
    color: #6b7280;
    font-size: 0.78rem;
}

.timeline {
    position: relative;
    padding: 0.5rem 0 0.5rem 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #1a3a1a;
}

.tl-item {
    position: relative;
    margin-bottom: 1rem;
}

.tl-item:last-child {
    margin-bottom: 0;
}

.tl-dot {
    position: absolute;
    left: -1.25rem;
    top: 0.25rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #000000;
}

.tl-date {
    font-size: 0.72rem;
    color: #6b7280;
    font-family: 'JetBrains Mono', monospace;
}

.tl-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    margin-top: 0.1rem;
}

.tl-desc {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 0.15rem;
}

.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
    background: #0a0a0a;
    border: 1px solid #1f2f1f;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    color: #ffffff;
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border 0.2s;
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #22c55e;
}

.filter-bar input {
    flex: 1;
    min-width: 180px;
}

.filter-bar select {
    min-width: 130px;
}

.loading {
    text-align: center;
    padding: 5rem 2rem;
    color: #6b7280;
}

.loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #1a2a1a;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    background: #0a0a0a;
    border: 1px solid #2a1a1a;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.error h2 {
    color: #f87171;
    font-size: 1.1rem;
}

.error p {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.error button {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: #22c55e;
    border: none;
    border-radius: 6px;
    color: #000000;
    font-weight: 700;
    cursor: pointer;
}

.error button:hover {
    background: #16a34a;
}

.footer {
    text-align: center;
    padding: 1.5rem;
    color: #374151;
    font-size: 0.78rem;
    border-top: 1px solid #0f0f0f;
    margin-top: 2rem;
}

.footer a {
    color: #22c55e;
    text-decoration: none;
}

.settings-btn {
    background: none;
    border: 1px solid #1f2f1f;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
    font-size: 1.1rem;
    transition: border-color 0.2s, color 0.2s;
}

.settings-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #0a0a0a;
    border: 1px solid #1a2a1a;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 440px;
}

.modal h2 {
    font-size: 1rem;
    color: #ffffff;
    margin-bottom: 0.25rem;
}

.modal p {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.modal label {
    display: block;
    font-size: 0.78rem;
    color: #9ca3af;
    margin-bottom: 0.35rem;
}

.modal input[type="text"],
.modal input[type="password"] {
    width: 100%;
    background: #0f0f0f;
    border: 1px solid #1f2f1f;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    color: #ffffff;
    font-size: 0.82rem;
    font-family: monospace;
    outline: none;
    transition: border 0.2s;
}

.modal input:focus {
    border-color: #22c55e;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-actions button {
    flex: 1;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-save {
    background: #22c55e;
    color: #000000;
}

.btn-save:hover {
    background: #16a34a;
}

.btn-cancel {
    background: #1a1a1a;
    color: #9ca3af;
    border: 1px solid #1f2f1f;
}

.btn-cancel:hover {
    background: #2a2a2a;
}

.modal .saved {
    color: #22c55e;
    font-size: 0.82rem;
    text-align: center;
    margin-top: 0.5rem;
    display: none;
}

.token-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: #6b7280;
    cursor: default;
}

.token-status.active {
    color: #22c55e;
}