:root {
    --bg: #0f172a;
    --panel: rgba(15, 23, 42, 0.92);
    --panel-2: rgba(30, 41, 59, 0.72);
    --line: rgba(148, 163, 184, 0.22);
    --text: #f8fafc;
    --soft: #cbd5e1;
    --muted: #94a3b8;
    --blue: #407aec;
    --blue-2: #2563eb;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --orange: #fb6b31;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 10%, rgba(64, 122, 236, .32), transparent 32%),
        radial-gradient(circle at 82% 0%, rgba(251, 107, 49, .18), transparent 28%),
        linear-gradient(135deg, #08111f, #101827 48%, #111827);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 22px 42px;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(15, 23, 42, .82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    margin-bottom: 20px;
}

.header-greeting h2,
.auth-card h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    letter-spacing: -0.04em;
    font-weight: 900;
}

.user-role,
.auth-subtitle {
    display: block;
    color: var(--soft);
    margin-top: 4px;
    font-size: .92rem;
}

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

.header-btn,
.submit-button,
.action-button,
.filter-button,
.log-filter,
.page-link {
    border: 0;
    outline: 0;
    border-radius: 999px;
    padding: 11px 16px;
    color: var(--text);
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .12);
    font-weight: 800;
    font-size: .86rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.header-btn:hover,
.submit-button:hover,
.action-button:hover,
.filter-button:hover,
.log-filter:hover,
.page-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .14);
}

.header-btn.logout,
.action-button.delete { background: rgba(239, 68, 68, .18); border-color: rgba(239, 68, 68, .36); color: #fecaca; }
.header-btn.primary,
.submit-button,
.action-button.primary { background: linear-gradient(135deg, var(--blue), var(--blue-2)); border-color: rgba(96, 165, 250, .48); color: #fff; }
.action-button.edit { background: rgba(245, 158, 11, .15); border-color: rgba(245, 158, 11, .32); color: #fde68a; }
.action-button.copy { background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .32); color: #a7f3d0; }

.content-wrapper-full { display: grid; gap: 20px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px;
}

.stat-card,
.list-card,
.panel-card {
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, .78);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.stat-card {
    padding: 18px;
}

.stat-card span {
    color: var(--soft);
    font-size: .84rem;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    margin-top: 6px;
    letter-spacing: -0.04em;
}

.list-card { padding: 20px; overflow: hidden; }

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.list-header h3 { margin: 0; font-size: 1.22rem; letter-spacing: -0.03em; }

.tab-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 2px 0 0;
}

.tab-btn {
    border: 1px solid var(--line);
    background: rgba(15, 23, 42, .62);
    color: var(--soft);
    padding: 12px 18px;
    border-radius: 999px;
    font-weight: 900;
    cursor: pointer;
}

.tab-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(64, 122, 236, .95), rgba(37, 99, 235, .95));
    border-color: rgba(96, 165, 250, .42);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.filter-section,
.tool-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-button.active,
.log-filter.active { background: rgba(64, 122, 236, .92); color: white; border-color: rgba(96, 165, 250, .52); }

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .24);
    background: rgba(15, 23, 42, .74);
    color: var(--text);
    border-radius: 14px;
    padding: 12px 13px;
    font-family: inherit;
    font-size: .94rem;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(96, 165, 250, .86);
    box-shadow: 0 0 0 4px rgba(64, 122, 236, .14);
}

input::placeholder,
textarea::placeholder { color: rgba(203, 213, 225, .62); }

label {
    display: block;
    margin-bottom: 7px;
    color: var(--soft);
    font-size: .83rem;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
}

.form-group.full-width { grid-column: 1 / -1; }

.divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 20px 0;
}

.registro-panel,
.import-panel {
    display: none;
    border: 1px solid var(--line);
    background: rgba(30, 41, 59, .45);
    border-radius: 22px;
    padding: 18px;
    margin-bottom: 20px;
}

.registro-panel.open,
.import-panel.open { display: block; }

.table-wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--line); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    background: rgba(15, 23, 42, .54);
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    vertical-align: top;
}

.data-table th {
    color: var(--soft);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgba(30, 41, 59, .72);
}

.data-table tr:hover td { background: rgba(255, 255, 255, .025); }

.domain-link { font-weight: 900; text-decoration: none; color: #e0f2fe; }
.domain-link:hover { text-decoration: underline; }

.subtext { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: 900;
    font-size: .76rem;
    color: #fff;
    white-space: nowrap;
}
.badge.ok { background: rgba(16, 185, 129, .86); }
.badge.warning { background: rgba(245, 158, 11, .94); }
.badge.danger { background: rgba(239, 68, 68, .9); }
.badge.muted { background: rgba(148, 163, 184, .28); color: var(--soft); }
.badge.provider { background: rgba(64, 122, 236, .82); }
.badge.orange { background: linear-gradient(135deg, #fb6b31, #ef4444); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline; }

.empty-state {
    text-align: center;
    color: var(--soft);
    padding: 34px 14px;
    border: 1px dashed var(--line);
    border-radius: 20px;
}
.empty-state span { display: block; font-size: 2rem; margin-bottom: 8px; }

.mensaje {
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    font-weight: 800;
}
.mensaje.success { background: rgba(16, 185, 129, .15); color: #a7f3d0; border-color: rgba(16, 185, 129, .30); }
.mensaje.error { background: rgba(239, 68, 68, .16); color: #fecaca; border-color: rgba(239, 68, 68, .32); }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.page-link { min-width: 38px; padding: 9px 12px; }
.page-link.active { background: var(--blue); color: white; }

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.provider-mini {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    background: rgba(30, 41, 59, .44);
}
.provider-mini span { color: var(--soft); font-size: .8rem; font-weight: 700; }
.provider-mini strong { display: block; margin-top: 3px; font-size: 1.3rem; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 35px 16px;
    background: rgba(2, 6, 23, .76);
    z-index: 50;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal-card {
    width: min(920px, 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #0f172a;
    box-shadow: var(--shadow);
    padding: 20px;
}
.modal-title-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.modal-title-row h3 { margin: 0; }
.close-modal { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.08); color: white; border: 1px solid var(--line); cursor: pointer; }

.auth-page { display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-shell { width: min(460px, 100%); }
.auth-card {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(15, 23, 42, .86);
    box-shadow: var(--shadow);
    padding: 28px;
    backdrop-filter: blur(18px);
}
.brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue), var(--orange));
    font-weight: 900;
    margin-bottom: 18px;
}
.auth-form { display: grid; gap: 12px; margin-top: 20px; }
.auth-form .submit-button { width: 100%; margin-top: 4px; }

.secret-box {
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, .36);
    background: rgba(245, 158, 11, .12);
    border-radius: 16px;
    color: #fde68a;
    word-break: break-word;
    margin-top: 8px;
}

@media (max-width: 980px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .main-header { align-items: flex-start; }
}

@media (max-width: 640px) {
    .main-container { padding: 18px 12px 30px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .list-card { padding: 14px; }
    .main-header { border-radius: 18px; }
    .header-actions, .search-form, .filter-section { width: 100%; }
    .header-btn, .submit-button, .filter-button, .log-filter { width: 100%; }
}


/* V4 filters and domain status refinements */
.filter-toolbar {
    align-items: flex-start;
}
.compact-search {
    flex: 1 1 320px;
}
.quick-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.quick-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, .24);
    background: rgba(15, 23, 42, .72);
    color: var(--soft);
    text-decoration: none;
    font-weight: 900;
    font-size: .84rem;
    white-space: nowrap;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.quick-filter:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, .58);
    background: rgba(30, 41, 59, .92);
}
.quick-filter.active {
    background: rgba(64, 122, 236, .92);
    color: white;
    border-color: rgba(96, 165, 250, .58);
}
.th-link {
    color: var(--soft);
    text-decoration: none;
    font-weight: 900;
}
.th-link:hover {
    color: #e0f2fe;
    text-decoration: underline;
}
.package-label {
    font-weight: 900;
    color: #e0f2fe;
}
.badge.package-expired {
    display: inline-flex;
    margin-top: 6px;
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: #fff;
}

@media (max-width: 760px) {
    .quick-filter-buttons { justify-content: flex-start; }
}
