:root {
    --gold: #d4ac53;
    --gold-hover: #bc9644;
    --gold-dark: #a07c2d;
    --gold-glow: rgba(212, 172, 83, 0.18);
    --bg: #0f0f0f;
    --bg-2: #161616;
    --panel: #171717;
    --panel-soft: #1f1f1f;
    --text: #f5f5f5;
    --muted: #b0b0b0;
    --dim: #737373;
    --line: #2a2a2a;
    --line-gold: rgba(212, 172, 83, 0.32);
    --danger: #ef6b5a;
    --green: #67c98f;
    --amber: #d4ac53;
    --radius: 12px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
    --font-heading: Georgia, "Times New Roman", serif;
    --font-body: Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: #0f0f0f;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 0%, rgba(212, 172, 83, 0.12), transparent 34%),
        linear-gradient(180deg, #0b0b0b 0%, var(--bg) 44%, #121212 100%);
    font-family: var(--font-body);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px clamp(18px, 4vw, 52px);
    background: rgba(15, 15, 15, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.topbar h1,
.login-card h1,
.section-title h2 {
    margin: 0;
    line-height: 1.05;
    font-family: var(--font-heading);
    font-weight: 500;
}

.topbar h1 {
    font-size: clamp(34px, 4vw, 54px);
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.brand-logo,
.login-logo {
    display: block;
    width: 220px;
    max-width: 70vw;
    height: auto;
    margin-bottom: 14px;
}

.login-logo {
    width: 250px;
    margin-bottom: 20px;
}

.layout {
    width: min(1240px, calc(100% - 32px));
    margin: 30px auto 60px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--gold);
    border-radius: 999px;
    color: #111111;
    background: var(--gold);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 0 22px var(--gold-glow);
}

.button:hover,
button:hover {
    border-color: var(--gold-hover);
    background: var(--gold-hover);
}

.ghost {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 750;
    text-decoration: none;
}

.ghost:hover {
    border-color: var(--line-gold);
    color: var(--gold);
    background: rgba(212, 172, 83, 0.08);
}

.user-pill {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(212, 172, 83, 0.08);
    font-size: 13px;
    font-weight: 800;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stats article,
.panel,
.project-card,
.empty,
.login-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)), var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stats article {
    padding: 18px;
}

.stats span,
.meta dt,
.next-action span {
    display: block;
    color: var(--dim);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stats strong {
    display: block;
    margin-top: 6px;
    color: var(--gold);
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 500;
}

.filters {
    display: flex;
    gap: 8px;
    margin: 0 0 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filters a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    font-weight: 750;
    text-decoration: none;
}

.filters a.active {
    color: #111111;
    border-color: var(--gold);
    background: var(--gold);
}

.filters span {
    opacity: 0.72;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.media-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.recent-media {
    margin: 0 0 20px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)), var(--panel);
    box-shadow: var(--shadow);
}

.recent-media-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.recent-media-list a {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.035);
    text-decoration: none;
}

.recent-media-list strong {
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-media-list span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-card {
    display: flex;
    min-height: 380px;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    border-top: 4px solid var(--line-gold);
}

.status-en-desarrollo {
    border-top-color: #7aa8ff;
}

.status-esperando-cliente,
.status-pausado {
    border-top-color: var(--amber);
}

.status-entregado,
.status-mantenimiento {
    border-top-color: var(--green);
}

.card-head,
.section-title,
.card-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.card-head h2 {
    margin: 8px 0 4px;
    font-family: var(--font-heading);
    font-size: 29px;
    font-weight: 500;
}

.card-head p,
.muted {
    margin: 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    background: rgba(212, 172, 83, 0.1);
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
}

.icon-link {
    color: var(--gold);
    font-weight: 800;
    text-decoration: none;
}

.meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.meta div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.035);
}

.meta dd {
    margin: 5px 0 0;
    color: var(--text);
    font-weight: 750;
}

.next-action {
    padding: 14px;
    border-left: 4px solid var(--gold);
    border-radius: var(--radius);
    background: rgba(212, 172, 83, 0.08);
}

.next-action p,
.notes {
    margin: 5px 0 0;
}

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.links a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(212, 172, 83, 0.08);
    font-weight: 800;
    text-decoration: none;
}

.todo-list {
    display: grid;
    gap: 8px;
}

.todo {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: start;
    gap: 10px;
}

.todo button {
    width: 22px;
    min-width: 22px;
    min-height: 22px;
    height: 22px;
    margin-top: 1px;
    padding: 0;
    border: 2px solid #666666;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
}

.todo button.done {
    border-color: var(--green);
    background: var(--green);
}

.done-text {
    color: var(--dim);
    text-decoration: line-through;
}

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

.card-actions {
    align-items: center;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.card-actions small {
    color: var(--dim);
}

.danger {
    min-height: 34px;
    padding: 7px 10px;
    color: var(--danger);
    border-color: rgba(239, 107, 90, 0.35);
    background: rgba(239, 107, 90, 0.08);
    box-shadow: none;
}

.danger:hover {
    color: #111111;
    border-color: var(--danger);
    background: var(--danger);
}

.empty {
    grid-column: 1 / -1;
    padding: 34px;
    text-align: center;
}

.panel {
    padding: 24px;
}

.project-form,
.media-upload {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.media-panel {
    border-color: var(--line-gold);
}

.media-row,
.media-card {
    display: grid;
    grid-template-columns: minmax(260px, 1.35fr) minmax(180px, 0.8fr) minmax(170px, 0.8fr) minmax(220px, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)), var(--panel);
    box-shadow: var(--shadow);
}

.media-row-file,
.media-file-head {
    display: grid;
    grid-template-columns: 48px 1fr;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}

.media-file-icon {
    display: inline-grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--line-gold);
    border-radius: 12px;
    color: #111111;
    background: var(--gold);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 0 18px var(--gold-glow);
}

.media-row-title,
.media-file-head > span {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.media-row-title a,
.media-file-head strong {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 850;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-row-title span,
.media-file-head small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-row-tags,
.media-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.media-row-tags span,
.media-tags span {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 4px 9px;
    border: 1px solid var(--line-gold);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(212, 172, 83, 0.08);
    font-size: 12px;
    font-weight: 800;
}

.media-row-details,
.media-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.media-row-details span,
.media-meta div,
.media-meta dd {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-body {
    display: contents;
}

.media-meta {
    grid-template-columns: 1fr;
    margin: 0;
}

.media-meta dt {
    display: none;
}

.media-meta dd {
    margin: 0;
    color: var(--muted);
}

.empty h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 500;
}

.media-url {
    min-width: 0;
    min-height: 34px;
    color: var(--muted);
    font-size: 12px;
}

.media-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.media-card .card-actions {
    margin: 0;
    padding: 0;
    border: 0;
    align-items: center;
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    background: #101010;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--gold-glow);
    border-color: var(--gold);
}

.wide,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.alert {
    padding: 12px 14px;
    border: 1px solid rgba(239, 107, 90, 0.35);
    border-radius: var(--radius);
    color: #ffc4bc;
    background: rgba(239, 107, 90, 0.08);
    font-weight: 750;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(460px, 100%);
    padding: 30px;
}

.login-card h1 {
    font-size: 44px;
}

.stack {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.hint {
    margin: 18px 0 0;
    color: var(--dim);
    font-size: 13px;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    color: var(--gold);
    background: rgba(212, 172, 83, 0.08);
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats,
    .project-grid,
    .project-form,
    .media-upload,
    .recent-media-list {
        grid-template-columns: 1fr;
    }

    .media-row {
        grid-template-columns: 1fr;
    }

    .media-card {
        grid-template-columns: 1fr;
    }

    .media-actions {
        justify-content: flex-start;
    }

    .meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .layout {
        width: min(100% - 20px, 1220px);
        margin-top: 16px;
    }

    .topbar {
        padding: 18px 14px;
    }

    .topbar nav,
    .topbar nav a {
        width: 100%;
    }

    .topbar nav a {
        justify-content: center;
    }

    .project-card,
    .panel,
    .login-card {
        padding: 16px;
    }

    .card-head,
    .section-title,
    .card-actions {
        flex-direction: column;
    }

    .brand-logo,
    .login-logo {
        width: 190px;
    }
}
