:root {
    --bg: #0a0a0b;
    --surface: #131316;
    --surface-hover: #1a1a1f;
    --border: #26262b;
    --text: #e8e8ea;
    --muted: #8a8a92;
    --accent: #7c5cff;
    --accent-hover: #8f73ff;
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --radius: 8px;
    --radius-card: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-feature-settings: "cv11", "ss01";
    font-size: 14px;
    line-height: 1.5;
}

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

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.wordmark {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.wordmark span { color: var(--accent); }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--muted);
    font-size: 13px;
}
.header-right .user { color: var(--text); }
.header-right form { display: inline; margin: 0; }
.header-right button.link {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.header-right button.link:hover { color: var(--text); }

.center-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 32px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.card h1 {
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin: 0 0 24px;
}

.field { margin-bottom: 16px; }
.field label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font: inherit;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.3);
}
textarea {
    min-height: 90px;
    resize: vertical;
    font-family: inherit;
}

button, .button {
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: var(--radius);
    padding: 10px 16px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms ease, opacity 150ms ease;
}
button:hover, .button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.scan-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.scan-form input { flex: 1; }

.section { margin-top: 28px; }
.section h2 {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 12px;
}

.status-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    display: none;
}
.status-panel.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
}
.pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}
.pill[data-state="done"] .dot { background: var(--success); animation: none; }
.pill[data-state="error"] .dot { background: var(--error); animation: none; }
.pill[data-state="queued"] .dot { background: var(--warning); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.elapsed {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}
th {
    color: var(--muted);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
tbody tr + tr td { border-top: 1px solid var(--border); }
tbody tr:hover { background: var(--surface-hover); }
.port { font-variant-numeric: tabular-nums; font-weight: 500; }
.extra {
    color: var(--muted);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.results-empty {
    color: var(--muted);
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
}

.history-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    align-items: center;
    font-size: 13px;
}
.history-row:first-child { border-top: 0; }
.history-row:hover { background: var(--surface-hover); }
.history-row .meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}
.history-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}
.history-status.done { color: var(--success); }
.history-status.error { color: var(--error); }
.history-status.running,
.history-status.nmap,
.history-status.queued { color: var(--warning); }

.error {
    color: var(--error);
    font-size: 13px;
    margin-top: 8px;
}

.feedback-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 200ms ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
#toast.show { opacity: 1; }
