* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }
.hidden { display: none !important; }
.error { color: #ef4444; font-size: 0.85rem; margin-top: 0.5rem; }
.subtitle { color: #94a3b8; font-size: 0.9rem; }

/* Login */
.login-card { max-width: 400px; margin: 15vh auto; padding: 2rem; background: #1e293b; border-radius: 12px; border: 1px solid #334155; }
.login-card h1 { text-align: center; margin-bottom: 0.25rem; color: #38bdf8; }
.login-card .subtitle { text-align: center; margin-bottom: 1.5rem; }
.login-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-card input { padding: 0.75rem; border: 1px solid #475569; border-radius: 8px; background: #0f172a; color: #e2e8f0; font-size: 1rem; }
.login-card button { padding: 0.75rem; border: none; border-radius: 8px; background: #38bdf8; color: #0f172a; font-size: 1rem; font-weight: 600; cursor: pointer; }
.login-card button:hover { background: #7dd3fc; }

/* Nav */
nav { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.5rem; background: #1e293b; border-bottom: 1px solid #334155; }
nav h2 { color: #38bdf8; font-size: 1.2rem; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 0.75rem; }

/* Buttons */
button { cursor: pointer; }
.btn-sm { padding: 0.4rem 0.8rem; border: 1px solid #475569; border-radius: 6px; background: #1e293b; color: #e2e8f0; font-size: 0.8rem; }
.btn-sm:hover { background: #334155; }
.btn-primary { background: #38bdf8 !important; color: #0f172a !important; border-color: #38bdf8 !important; font-weight: 600; }
.btn-primary:hover { background: #7dd3fc !important; }
.btn-success { border-color: #22c55e !important; color: #22c55e !important; }
.btn-danger { border-color: #ef4444 !important; color: #ef4444 !important; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }
.header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* Cards */
.card { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
.card h4 { margin-bottom: 0.75rem; color: #38bdf8; }

/* Server Grid */
.servers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.server-card { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.25rem; cursor: pointer; transition: border-color 0.2s; }
.server-card:hover { border-color: #38bdf8; }
.server-card .server-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.server-card h4 { color: #f1f5f9; margin: 0; }
.server-card .status { font-size: 0.8rem; padding: 0.2rem 0.6rem; border-radius: 20px; }
.status-running { background: #166534; color: #86efac; }
.status-stopped { background: #7f1d1d; color: #fca5a5; }
.status-unknown { background: #475569; color: #94a3b8; }
.server-card .server-info { font-size: 0.85rem; color: #94a3b8; }
.server-card .server-info span { display: inline-block; margin-right: 1rem; }
.badge-external { background: #854d0e; color: #fde68a; font-size: 0.7rem; padding: 0.15rem 0.5rem; border-radius: 10px; margin-left: 0.5rem; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }
.info-row { display: flex; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid #334155; font-size: 0.9rem; }
.info-row .label { color: #94a3b8; }

/* Trunk */
.trunk-item { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #334155; font-size: 0.85rem; }
.trunk-item .trunk-info { flex: 1; }
.trunk-item .trunk-actions { display: flex; gap: 0.5rem; }

/* Logs */
.logs-box { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 1rem; font-size: 0.75rem; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; color: #94a3b8; }

/* Erlang */
.erlang-card { margin-top: 1rem; }
.erlang-form { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.erlang-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: #94a3b8; }
.erlang-form input { padding: 0.5rem; border: 1px solid #475569; border-radius: 6px; background: #0f172a; color: #e2e8f0; width: 140px; }
.erlang-result { padding: 0.75rem 1rem; background: #164e63; border-radius: 8px; color: #67e8f9; font-weight: 600; font-size: 1.1rem; min-width: 200px; text-align: center; }
.erlang-preview { padding: 0.5rem; background: #164e63; border-radius: 6px; color: #67e8f9; font-size: 0.85rem; margin-top: 0.25rem; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 100; }
.modal-content { background: #1e293b; border: 1px solid #475569; border-radius: 12px; padding: 2rem; width: 90%; max-width: 480px; }
.modal-content h3 { margin-bottom: 1rem; color: #38bdf8; }
.modal-content form { display: flex; flex-direction: column; gap: 0.75rem; }
.modal-content label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: #94a3b8; }
.modal-content input, .modal-content textarea { padding: 0.6rem; border: 1px solid #475569; border-radius: 6px; background: #0f172a; color: #e2e8f0; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.modal-actions button { flex: 1; padding: 0.6rem; border: 1px solid #475569; border-radius: 6px; font-size: 0.9rem; }
