:root {
    --bg: #f6f8fa;
    --panel: #ffffff;
    --border: #d0d7de;
    --text: #1f2328;
    --muted: #6e7781;
    --accent: #2f6feb;
    --accent-hover: #1f5fd1;
    --error: #cf222e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.center-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
}

.card h1 {
    font-size: 20px;
    margin: 0 0 24px;
    text-align: center;
}

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

input:focus { outline: 1px solid var(--accent); }

button {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

button:hover { background: var(--accent-hover); }

.error-msg {
    background: rgba(207, 34, 46, 0.08);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.card-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--muted);
}

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

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

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

.topbar .user-info { font-size: 13px; color: var(--muted); }

.topbar a { color: var(--muted); text-decoration: none; margin-left: 16px; }

.tools-category {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    max-width: 900px;
    margin: 32px auto 0;
    padding: 0 32px;
}

.tools-category:first-of-type { margin-top: 24px; }

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    padding: 16px 32px 32px;
    max-width: 900px;
    margin: 0 auto;
}

.tool-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.15s;
    position: relative;
}

.tool-card:hover { border-color: var(--accent); }

.tool-card-disabled {
    background: var(--bg);
    color: var(--muted);
    border-style: dashed;
    cursor: not-allowed;
    transition: none;
}

.tool-card-disabled .tool-icon { opacity: 0.6; }

.tool-card-disabled:hover { border-color: var(--border); }

.tool-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    object-fit: contain;
}

.tool-icon-fallback {
    font-size: 22px;
}

.tool-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: rgba(110, 119, 129, 0.1);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    line-height: 1.6;
}

/* Admin — Tools */

.admin-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px;
}

.admin-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 32px 0 16px;
}

.admin-create-card {
    max-width: none;
    width: 100%;
    padding: 24px;
}

.admin-create-card h2 {
    font-size: 15px;
    margin: 0 0 20px;
}

.admin-create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 4px 16px;
    align-items: end;
}

.admin-create-form .form-field { margin: 0; }

.admin-create-form label { margin-bottom: 6px; }

.admin-create-form input,
.admin-create-form select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
}

.admin-create-submit {
    width: auto;
    padding: 10px 20px;
    justify-self: start;
    margin-bottom: 16px;
}

.admin-table-wrap {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table tbody tr:not(:last-child) td {
    border-bottom: 1px solid var(--border);
}

.admin-table tbody tr:hover { background: rgba(31, 35, 40, 0.03); }

.admin-table input,
.admin-table select {
    width: 100%;
    min-width: 90px;
    padding: 7px 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    margin: 0;
}

.admin-sort-input { min-width: 60px; width: 5em; }

.admin-actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.admin-delete-form { display: inline; }

.admin-btn-save,
.admin-btn-delete {
    width: auto;
    padding: 7px 14px;
    font-size: 13px;
}

.admin-btn-delete {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
}

.admin-btn-delete:hover { background: rgba(207, 34, 46, 0.08); }

/* App shell — sidebar + main content */

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 20px 0;
}

.sidebar-brand {
    padding: 0 20px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.sidebar-brand-sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-link:hover { background: rgba(47, 111, 235, 0.08); }

.sidebar-link-active,
.sidebar-link-active:hover {
    background: var(--accent);
    color: #ffffff;
}

.sidebar-link-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.sidebar-footer {
    margin-top: 12px;
    padding: 16px 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 1px;
}

.sidebar-footer-link {
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 0;
}

.sidebar-footer-link:hover { color: var(--accent); }

.sidebar-footer-link-active { color: var(--accent); font-weight: 600; }

.main-content {
    flex: 1;
    min-width: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
}

.page-header h1 { font-size: 17px; margin: 0; }

.page-header .page-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 10px 12px;
        gap: 8px;
    }

    .sidebar-brand { display: none; }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
        flex: 1;
        gap: 4px;
    }

    .sidebar-link { padding: 7px 10px; font-size: 13px; }

    .sidebar-link-label { display: none; }

    .sidebar-link-icon { font-size: 18px; }

    .sidebar-footer {
        margin-top: 0;
        padding: 0;
        border-top: none;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .sidebar-user { display: none; }

    .page-header { padding: 16px 20px; }

    .tools-category,
    .tools-grid,
    .admin-content { padding-left: 20px; padding-right: 20px; }
}

/* Placeholder sections ("Proximamente") */

.placeholder-section {
    max-width: 620px;
    margin: 64px auto;
    padding: 56px 40px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-align: center;
}

.placeholder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 34px;
}

.placeholder-section h2 {
    font-size: 22px;
    margin: 0 0 12px;
    color: var(--text);
}

.placeholder-section .tool-badge {
    display: inline-block;
    font-size: 11px;
    padding: 4px 12px;
    margin-bottom: 20px;
}

.placeholder-section p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
    margin: 0;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 480px) {
    .placeholder-section {
        margin: 32px 16px;
        padding: 40px 24px;
    }
}
