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

:root {
    --bg: #050814;
    --bg-soft: #0b1224;
    --card: #111a30;
    --primary: #4df5c6;
    --primary-dark: #2dbc97;
    --accent: #4a7dff;
    --text: #f8fbff;
    --text-dim: #8ea2c0;
    --border: rgba(255, 255, 255, 0.08);
    --danger: #ff6b81;
    --warning: #f9c86b;
    --success: #63f5a0;
    --gradient: linear-gradient(135deg, #213bff 0%, #6effc3 100%);
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient);
    color: #03111b;
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(53, 142, 255, 0.25);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 1.2rem;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.25);
}

.btn,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    border: 1px solid transparent;
}

.btn.ghost,
.btn-ghost {
    border-color: var(--border);
    background: transparent;
    color: var(--text);
}

.btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.alert {
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(249, 200, 107, 0.08);
    color: var(--warning);
}

/* Auth */
.auth-layout {
    background: radial-gradient(circle at top, #2231ff 0%, #050814 45%);
    padding: 2rem;
    color: var(--text);
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.auth-hero {
    background: var(--card);
    border-radius: 32px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    min-height: 420px;
}

.auth-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(110, 255, 195, 0.2), transparent 55%);
    pointer-events: none;
}

.auth-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    margin: 0 0 1rem;
}

.hero-badge {
    display: inline-flex;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.2rem;
}

.hero-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0;
    display: grid;
    gap: 0.7rem;
}

.hero-list li::before {
    content: '•';
    margin-right: 0.6rem;
    color: var(--primary);
}

.auth-card {
    background: rgba(5, 8, 20, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px;
    padding: 2rem;
    backdrop-filter: blur(14px);
}

.auth-card__header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.auth-card__header p {
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1.5rem;
}

.auth-form label {
    font-size: 0.95rem;
    color: var(--text-dim);
}

.auth-form input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    color: var(--text);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-alert {
    border: 1px solid rgba(255, 107, 129, 0.5);
    background: rgba(255, 107, 129, 0.08);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: 16px;
}

.auth-footer {
    margin-top: 2rem;
    color: var(--text-dim);
    text-align: center;
}

/* Dashboard */
.dashboard-layout {
    background: radial-gradient(circle at top, rgba(74, 125, 255, 0.4), transparent 45%), var(--bg);
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.dash-sidebar {
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    gap: 2rem;
}

.brand {
    font-family: var(--font-display);
    font-size: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand small {
    color: var(--text-dim);
}

.dash-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dash-sidebar nav a {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    color: var(--text-dim);
}

.dash-sidebar nav a.active,
.dash-sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.dash-main {
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-header h1 {
    margin: 0.2rem 0 0;
}

.header-actions {
    display: flex;
    gap: 0.8rem;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.insight-card {
    background: rgba(17, 26, 48, 0.9);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 1.4rem;
}

.insight-label {
    color: var(--text-dim);
    margin: 0;
}

.insight-card h2 {
    margin: 0.3rem 0;
    font-size: 2.2rem;
}

/* Resumen de tickets cerrados (mes actual + diario) */
.closed-summary {
    background: transparent;
}

.closed-summary-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.section-subtitle {
    margin: 0.2rem 0 0;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.week-badge {
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.week-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.week-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.85rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.week-chip:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.week-chip.is-active {
    background: var(--gradient);
    color: #03111b;
    border-color: transparent;
}

.closed-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: flex-start;
}

.closed-week-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.week-switcher {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
}

.week-switcher label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    color: var(--text-dim);
    gap: 0.2rem;
}

.week-switcher select {
    min-width: 140px;
    background: rgba(8, 16, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: var(--text);
    padding: 0.45rem 0.6rem;
}

.closed-weeks h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.closed-week-card {
    background: rgba(6, 11, 26, 0.85);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.closed-week-card table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.closed-week-card th,
.closed-week-card td {
    padding: 0.45rem 0.35rem;
    text-align: left;
}

.closed-week-card thead tr {
    color: var(--text-dim);
}

.closed-week-card tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.closed-daily {
    background: rgba(6, 11, 26, 0.9);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 1.4rem 1.6rem;
}

.closed-daily h2 {
    margin: 0 0 0.4rem;
}

.closed-daily-subtitle {
    margin: 0 0 0.8rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.closed-daily table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.closed-daily th,
.closed-daily td {
    padding: 0.4rem 0.3rem;
    text-align: left;
}

.closed-daily thead tr {
    color: var(--text-dim);
}

.closed-daily tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.ticket-workspace {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
}

.ticket-list-panel,
.ticket-detail {
    background: rgba(6, 11, 26, 0.85);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 1.5rem;
    min-height: 540px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header input,
.panel-header select,
.ticket-form select,
.ticket-form textarea,
.ticket-form input,
.agent-form input,
.agent-form select,
.new-ticket-form input,
.new-ticket-form textarea {
    width: 100%;
    background: rgba(8, 16, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    color: var(--text);
}

.panel-header select,
.ticket-form select,
.agent-form select,
.new-ticket-form select {
    color: var(--text);
    background-color: rgba(8, 16, 40, 0.95);
}

.panel-header select option,
.ticket-form select option,
.agent-form select option,
.new-ticket-form select option {
    background-color: #050814;
    color: var(--text);
}

.new-ticket-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.new-ticket-form label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.panel-header input:focus,
.panel-header select:focus,
.ticket-form select:focus,
.ticket-form textarea:focus,
.agent-form input:focus,
.agent-form select:focus {
    outline: none;
    border-color: var(--primary);
}

.ticket-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ticket-pagination {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.ticket-pagination button {
    min-width: 2rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}

.ticket-pagination button:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--text);
}

.ticket-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.ticket-pagination .page-active {
    border-color: var(--primary);
    color: var(--text);
}

.ticket-row {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    transition: border 0.2s ease, transform 0.2s ease;
}

.ticket-row:hover,
.ticket-row.active {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.ticket-title {
    font-weight: 600;
    margin: 0 0 0.2rem;
}

.ticket-meta {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.ticket-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge {
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: capitalize;
}

.priority-high,
.priority-urgent,
.priority-critical {
    border-color: rgba(255, 107, 129, 0.5);
    color: var(--danger);
}

.priority-low {
    border-color: rgba(99, 245, 160, 0.4);
    color: var(--success);
}

.status-closed {
    border-color: rgba(99, 245, 160, 0.35);
    color: var(--success);
}

.status-pending {
    border-color: rgba(249, 200, 107, 0.45);
    color: var(--warning);
}

.ticket-detail__content header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.ticket-detail__content h2 {
    margin: 0.2rem 0 0.4rem;
}

.detail-label {
    margin: 1.2rem 0 0.3rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.ticket-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.photo-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.2rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(8, 16, 40, 0.9);
    color: var(--text);
    cursor: pointer;
    max-width: 160px;
}

.photo-upload span {
    font-size: 0.95rem;
}

.photo-upload input[type="file"] {
    display: none;
}

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

.placeholder {
    color: var(--text-dim);
}

.agent-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.agent-card,
.agent-list-card {
    background: rgba(6, 11, 26, 0.85);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 1.5rem;
}

.agent-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.agent-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.7rem;
}

.agent-row:last-child {
    border-bottom: none;
}

.empty-state {
    text-align: center;
    color: var(--text-dim);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.9rem 1.4rem;
    border-radius: 999px;
    background: rgba(6, 11, 26, 0.95);
    border: 1px solid var(--border);
    color: var(--text);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--success {
    border-color: rgba(99, 245, 160, 0.5);
    color: var(--success);
}

.toast--error {
    border-color: rgba(255, 107, 129, 0.5);
    color: var(--danger);
}

.toast--info {
    border-color: rgba(74, 125, 255, 0.5);
    color: var(--accent);
}

.closed-tickets {
    margin-top: 1rem;
    background: rgba(6, 11, 26, 0.85);
    border-radius: 28px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.closed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.closed-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.closed-export label {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.closed-export input[type="date"] {
    background: rgba(8, 16, 40, 0.9);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.3rem 0.6rem;
    color: var(--text);
}

.closed-subtitle {
    margin: 0.2rem 0 0;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.closed-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 260px;
    overflow-y: auto;
}

.closed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.8rem 1rem;
}

.closed-pagination {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.4rem;
}

.page-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-dim);
}

.page-dot.active {
    background: var(--gradient);
    border-color: transparent;
    color: #03111b;
}

/* Evidencias de tickets */
.detail-evidence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: flex-start;
}

.detail-evidence-empty,
.detail-evidence-loading,
.detail-evidence-error {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.evidence-thumb {
    display: inline-flex;
    width: 80px;
    height: 80px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(8, 16, 40, 0.9);
}

.evidence-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 1024px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .dash-sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .ticket-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .auth-layout,
    .dash-main {
        padding: 1.2rem;
    }

    .dash-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-header {
        flex-direction: column;
    }
}
