:root {
    --bg: #0d1117;
    --bg-elevated: #161b22;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #2f81f7;
    --accent-hover: #1f6feb;
    --danger: #f85149;
    --warning: #d29922;
    --success: #3fb950;
    --border: #30363d;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    --radius: 6px;
    --radius-lg: 8px;
}

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

html,
body {
    height: 100%;
    /* Defensa contra overflow-x del viewport por contenido ancho
       (canvas, monospace largos) que descuadra el bottom-nav fixed. */
    overflow-x: hidden;
    max-width: 100%;
}

body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
    margin: 0;
}

ul,
ol {
    padding: 0;
    list-style: none;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-size: 2rem;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    line-height: 1.25;
}

h3 {
    font-size: 1.25rem;
    line-height: 1.3;
}

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

a:hover {
    text-decoration: underline;
}

button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

/* === Componentes === */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
    background: #1c2128;
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
}

.input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
}

.input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}

.alert.alert-danger {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

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

.table th,
.table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

/* === Utilities === */

.stack-xs {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stack-sm {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.stack-md {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.row {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-center {
    text-align: center;
}

/* Desktop breakpoint */
@media (min-width: 768px) {
    body {
        font-size: 1rem;
    }
}
