/* =====================================================
   Taller Motos — Panel de administración
   Paleta: grafito (estructura) + ámbar (acento de taller)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --grafito-900: #14171A;
    --grafito-800: #1E2226;
    --grafito-700: #2A2F34;
    --acero-500: #5B646C;
    --acero-300: #9AA3AA;
    --papel-100: #EEF0F2;
    --papel-000: #F8F9FA;
    --ambar-500: #F2A93B;
    --ambar-600: #DD9424;
    --ambar-100: #FCEBCB;
    --rojo-alerta: #D9503F;
    --verde-ok: #4C8B5F;
    --borde: #DDE1E4;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius: 10px;
    --shadow-card: 0 1px 2px rgba(20, 23, 26, 0.06), 0 1px 12px rgba(20, 23, 26, 0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--papel-100);
    color: var(--grafito-900);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout general ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: var(--grafito-900);
    color: var(--papel-000);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 16px 20px;
    border-bottom: 1px solid var(--grafito-700);
    margin-bottom: 20px;
    overflow: hidden;
}

.sidebar-logo {
    width: 140px;
    max-width: 100%;
    height: auto;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--acero-300);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: var(--grafito-800); color: var(--papel-000); }

.nav-item.active {
    background: var(--grafito-800);
    color: var(--papel-000);
    border-left-color: var(--ambar-500);
}

.nav-item .nav-icon { width: 18px; text-align: center; opacity: 0.9; }

.nav-section-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--acero-500);
    padding: 18px 20px 6px;
}

/* ---------- Main content ---------- */
.main {
    padding: 28px 36px 60px;
    max-width: 1180px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 14px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.page-header p {
    margin: 0;
    color: var(--acero-500);
    font-size: 13.5px;
}

/* ---------- Buttons ---------- */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13.5px;
    border-radius: 8px;
    padding: 10px 16px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--ambar-500); color: var(--grafito-900); }
.btn-primary:hover { filter: brightness(1.05); }

.btn-ghost { background: transparent; color: var(--grafito-900); border: 1px solid var(--borde); }
.btn-ghost:hover { background: var(--papel-000); }

.btn-danger-ghost { background: transparent; color: var(--rojo-alerta); border: 1px solid #F2D3CD; }
.btn-danger-ghost:hover { background: #FBEDEA; }

.btn-sm { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Search bar ---------- */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--borde);
    background: var(--papel-000);
    font-family: var(--font-body);
    font-size: 13.5px;
    color: var(--grafito-900);
}
.search-input:focus { outline: 2px solid var(--ambar-500); outline-offset: 1px; }

/* ---------- Card / Table ---------- */
.card {
    background: var(--papel-000);
    border: 1px solid var(--borde);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

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

thead th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--acero-500);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--borde);
    background: var(--papel-100);
}

tbody td {
    padding: 13px 16px;
    font-size: 13.8px;
    border-bottom: 1px solid var(--borde);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FCFBF9; cursor: pointer; }

.cell-strong { font-weight: 600; }
.cell-muted { color: var(--acero-500); font-size: 12.8px; }
.cell-mono { font-family: var(--font-mono); font-size: 12.6px; color: var(--grafito-800); }

.badge {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--ambar-100);
    color: var(--ambar-600);
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--acero-500);
}
.empty-state .empty-icon { font-size: 30px; margin-bottom: 10px; opacity: 0.6; }

/* ---------- Ficha (detail panel) ---------- */
.ficha-tag {
    background: var(--grafito-900);
    color: var(--papel-000);
    border-radius: var(--radius);
    padding: 22px 26px;
    position: relative;
    margin-bottom: 20px;
    overflow: hidden;
}
.ficha-tag::after {
    content: '';
    position: absolute;
    top: -18px;
    right: 28px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--papel-100);
}
.ficha-tag-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ambar-500);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.ficha-tag h2 {
    font-family: var(--font-display);
    font-size: 21px;
    margin: 0 0 4px;
}
.ficha-tag .ficha-sub { color: var(--acero-300); font-size: 13px; }

.ficha-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.ficha-field label {
    display: block;
    font-size: 10.8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--acero-300);
    margin-bottom: 4px;
}
.ficha-field .value {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--papel-000);
}

.section-title {
    font-family: var(--font-display);
    font-size: 15.5px;
    font-weight: 600;
    margin: 26px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 23, 26, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-box {
    background: var(--papel-000);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px;
}
.modal-box h3 {
    font-family: var(--font-display);
    font-size: 18px;
    margin: 0 0 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--grafito-800);
}
.form-field input,
.form-field textarea {
    width: 100%;
    padding: 9px 12px;
    border-radius: 7px;
    border: 1px solid var(--borde);
    font-family: var(--font-body);
    font-size: 13.5px;
    color: var(--grafito-900);
    background: var(--papel-000);
}
.form-field input:focus,
.form-field textarea:focus { outline: 2px solid var(--ambar-500); outline-offset: 1px; }
.form-field textarea { resize: vertical; min-height: 60px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--grafito-900);
    color: var(--papel-000);
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-card);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.2s ease;
}
.toast.error { background: var(--rojo-alerta); }
.toast .toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ambar-500); }
.toast.error .toast-dot { background: var(--papel-000); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Home ---------- */
.home-view {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.home-logo {
    width: min(680px, 85%);
    height: auto;
    display: block;
}

@media (max-width: 760px) {
    .home-view { min-height: calc(100vh - 120px); padding: 12px; }
    .home-logo { width: min(420px, 92%); }
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.link-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--acero-500);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 14px;
}
.link-back:hover { color: var(--grafito-900); }

@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; overflow-x: auto; overflow-y: visible; padding: 12px; position: static; height: auto; }
    .sidebar-brand { display: none; }
    .main { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
}
